Mounting a remote filesystem with ssh
Although running the scp or ssh command is very convenient, mounting the remote servers filesystem on the local system has solved many problems for me.
Here is how this can be done. To mount the remote filesystem to a local Linux workstation, you need to install the sshfs. To install, you can choose to use the package manager of your distro or you can compile and install manually. More details can be found at http://fuse.sourceforge.net/sshfs.html
After the installation is complete, you can run the following command on your Linux workstation:
sshfs username@hostname:/ /
That’s it, so enjoy! (Of course, you should have the required permissions.)
Low-level HDD formatting
You often have a hard disk drive that needs to be formatted such that all data in it gets destroyed. Here is a command that can erase all data from your HDD.
#dd if=/dev/zero of=/dev/hda bs=1M
This will format your primary HDD (hda) to a low level using dd. This will fill the entire disk with a sequence of zeros. In case you want to mix zeros and ones to fill the HDD, you can use the following command:
#dd if=/dev/urandom of=/dev/hda bs=1M
Note: Please be very careful while using dd as the wrong use of this command can erase all your valuable data.
Encrypt an image using the command line
First, get a PNG image file and run the following command:
$echo p4ssw0rd|convert vizay.png -encipher - hidden.png
…where p4ssw0rd is our secret key for encryption and hidden.png is the encrypted image.
Now, to confirm the encryption, check whether or not the image can be seen as earlier by running the following command:
This should display the scrambled image and not the actual one if everything is fine.
Now, let’s decrypt the image by running the following command:
$echo p4ssw0rd|convert hidden.png -decipher - new.png
Here new.png is our decrypted image.
Running the command below will display the original image:
The new.png will be same as the original image, vizay.png