A nice chunk of useful tips for unix:
Bash
- In bash, 
ctrl-rsearches your command history as you type. - Input from the commandline as if it were a file by replacing 
command < file.inwithcommand <<< "some input text": ^is a sed-like operator to replace chars from last command:
ls docs; ^docs^web^is equal tols web.
The second argument can be empty.!!:nselects the nth argument of the last command, and!$the last arg:ls file1 file2 file3; cat !!:1-2shows all files and cats only 1 and 2.nohup ./long_script &to leave stuff in background even if you logout.cd -to change to the previous directory you were working on.Ctrl-x Ctrl-eopens an editor to work with long or complex command lines.- Add 
set editing-mode viin your ~/.inputrc to use the vi keybindings for bash and all readline-enabled applications (python, mysql, etc). 
Pseudo aliases for commonly used long commands
function lt() { ls -ltrsa "$@" | tail; }function psgrep() { ps axuf | grep -v grep | grep "$@" -i --color=auto; }function fname() { find . -iname "*$@*"; }
Tools
htopinstead oftop.rangeris a nice console file manager for vi fans.- Use 
apt-fileto see which package provides that file you`re missing. dictis a commandline dictionary.trash-clisends files to the trash instead of deleting them forever.sort | uniqto check for duplicate lines.echo start_backup.sh | at midnightstarts a command at the specified time.- Pipe any command over 
column -tto nicely align the columns. diff --side-by-side fileA.txt fileB.txt | pagerto see a nice diff.- learn to use 
pushdto save time navigating folders. - run jobs in parallel easily: 
ls \*.png | parallel -j4 convert {} {.}.jpg. 
Networking
python -m SimpleHTTPServer 8080shares all the files in the current folder over HTTP, port 8080.ssh -R 12345:localhost:22 server.com "sleep 1000; exit"forwards server.com's port 12345 to your local ssh port, even if you machine is not externally visible on the net. Now you canssh localhost -p 12345from server.com and you will log into your machine.sleepavoids getting kicked out from server.com for inactivity.socat TCP4-LISTEN:1234,fork TCP4:192.168.1.1:22forwards your port 1234 to another machine`s port 22. Very useful for quick NAT redirection.lsof -imonitors network connections in real time.iftopshows bandwith usage per connection.nethogsshows the bandwith usage per process.- Pipe a compressed file over ssh to avoid creating large temporary .tgz files:
tar cz folder/ | ssh server "tar xz"or even better, usersync. - ssmtp can use a Gmail account as SMTP and send emails from the command line:
echo "Hello, User!" | mail user@domain.com
Configure your /etc/ssmtp/ssmtp.conf: 
root=<email>
mailhub=smtp.gmail.com:587
rewriteDomain=
hostname=smtp.gmail.com:587
UseSTARTTLS=YES
UseTLS=YES
AuthUser=<email>
AuthPass=<password>
AuthMethod=LOGIN
FromLineOverride=YES
-~-
(CC) by-nc, Carles Fenollosa carles.fenollosa@bsc.es
Retrieved from http://mmb.pcb.ub.es/~carlesfe/unix/tricks.txt
Last modified: lun 11 mar 2013 05:13:37 CET
Taken from http://mmb.pcb.ub.es/~carlesfe/unix/tricks.txt