Pear Code
Colorized tail

tailcolor() {
    tail -f -n5000 $1 | perl -pe "s/$2/\e[1;31;43m$&\e[0m/g"
}

Display available memory on Linux / Ubuntu

cat /proc/meminfo

Compare Directories using Diff in Linux

Use this command:

diff -qr --exclude=.svn dir1 dir2|sort

-q = print result only where files are different

-r = recursive

—exclude = use it if something has to be excluded

How to create *.tar.gz and *.tar.bz2 files

tar.gz:

$ tar -zcvf archive_name.tar.gz directory_to_compress

tar.bz2:

$ tar -jcvf archive_name.tar.bz2 directory_to_compress
How to exclude dir in grep

Add parameter —exclude-dir to the grep command:

grep -R --exclude-dir=example_dir "something" *
Tab completion in Python shell

1. Create .pythonrc in your HOME directory

2. Add these lines to the previously created file:

import rlcompleter, readline
readline.parse_and_bind("tab: complete")

3. Export PYTHONSTARTUP variable in .bashrc file:

export PYTHONSTARTUP="$HOME/.pythonrc"
How to remove all .pyc files from a project

Command:

find . -name '*.pyc' -delete
SSH Tunneling

Just use this command:

ssh -f -L local_port:remote_host:remote_port user@remote_host -N
How to run screen as daemon?

Use this command:

$ screen -dmS screen_name command
How to replace text in many files?

perl -pi -w -e 's/source_text/destination_text/g;' *.php