Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Jun 182010
 

Simple file encryption with OpenSSL

Answer:

You have a single file (input.txt), and you want to encrypt it with a password, it is easy with OpenSSL.

# openssl aes-128-cbc -salt -in input.txt-out input.aes

Enter the password twice.

When you want to decrypt it, use the command.

# openssl aes-128-cbc -d -salt -in input.aes -out output.txt

Jun 172010
 

Case conversion of string in Linux

Answer:

To convert a string to upper case letter, you can use the following command.

# echo 'Test' | tr '[:lower:]' '[:upper:]'

On the other hand, if you want to convert from upper case to lower case, you can use

#echo 'Test' | tr '[:upper:]' '[:lower:]'

Jun 152010
 

Specify a port with the scp command

Answer:

If you want to use scp to copy file to remote machine, but that ssh server is listening at port other than 22, you can use the following command syntax.

# scp -P 6000 test.txt john@remoteserver:/home/john/

Please notes it is -P, not -p.

Jun 142010
 

Create ISO image from CD-ROM in Linux

Answer:

1. Put the CD in your CDROM

2. umount the CD if it was mounted automatically (assume the current mount point is at /mnt/cdrom, you can type the mount command to check if your are not sure)

# umount /mnt/cdrom

3. Create the ISO image

# dd if=/dev/cdrom of=/tmp/cd.iso