Linux cli snippets

Just some Linux Cli / Bash snippets i’d like to remember.

Turn monitor off (until mouse move of keyboard press)

$ xset dpms force off

SSH auto-login

Create SSH directory on user folder (if doesn’t exists yet):

a@A:~> ssh b@B mkdir -p .ssh
b@B's password:

Append a’s new public key to b@B:.ssh/authorized_keys and enter b’s password one last time:

a@A:~> cat ~/.ssh/ | ssh b@B 'cat >> ~/.ssh/authorized_keys'
b@B's password:

From now on you can log into B as b from A as a without password:

a@A:~> ssh b@B

Depending on your version of SSH you might also have to do the following changes:

  1. Put the public key in .ssh/authorized_keys2
  2. Change the permissions of .ssh to 700
  3. Change the permissions of .ssh/authorized_keys2 to 640

Taken from here

Formatting USB Pen Drive

Find out the device:

$ mount

Umount the device:

$ umount /dev/sdb1

Format the device:

$ mkfs.vfat /dev/sdb1

Burning ISO to USB drive

dd bs=4M if=path-to-your.iso of=/dev/sdb

Sync folders

rsync -azrP /**/**/**/dir user@addr:/**/parentfolder

Will sync local dir folder inside parentfolder in a remote location.

Fix NTFS issues in partitions

sudo ntfsfix /dev/sdb1

That’s it for now! :)

comments powered by Disqus