Salta al contenuto principale

The 10 Bash commands to rule the world

In a time when shellshock make cry many Linux administrators, I want to remember what bash can do for us, I've collected some of the bash commands that characterize the most advanced functionalities of Bourne Again SHell.

$ sudo !!

Recall the last command with the power of superuser

$ echo "<command>" | at 12pm

Start the command at midnight, need atd daemon

$ ctrl-r

Reverse-i-search search reversed every digit in the command history

$ ssh user@host cat /path/to/remotefile | diff /path/to/localfile -

Check the differences over the remote file and the local one

$ ctrl-l

Clear the screen, it's the same as type clear

$ ssh -t reachable_host ssh unreachable_host

Make an ssh connection with a host in the middle

$ less +F logfile

Call less in follow mode, act like tail -f  appending the new content at end of file

# nc -v -l 80 < file.ext

Host the file.ext over HTTP port, need superuser privileges

$ disown -a && exit

Detach all the background process and exit from shell

$ echo "!!" > foo.sh

Write the last command in the foo.sh file with the shell's output redirection

You can find more usefully commands at Commandlinefu

Aggiungi un commento