source : http://www.commandlinefu.com

Get the IP address

gives u each configured IP in a seperate line.

ip -f inet a | awk '/inet / { print $2 }'
127.0.0.1/8
46.105.96.60/24
 ip -f inet a

Show crontabs for all users

added echo “### Crontabs for $user ####"; to make clear whose crontab is listed.

   for user in $(getent passwd|cut -f1 -d:); do echo "### Crontabs for $user ####"; crontab -u $user -l; done

Download song from youtube for import into itunes (m4a format)

Last argument is the youtube link.

Requires ffmpeg

 ~/sbin/youtube-dl -t --extract-audio --audio-format=m4a http://www.youtube.com watch?v=DxL8X9mT90k

Find biggest 10 files in current and subdirectories and sort by file size

find . -type f -print0 | xargs -0 du -h | sort -hr | head -10

Copies files from a directory to another, overwriting only existing files with same name

 cp -rf srcdir/* destdir

ou

 yes | cp -r srcdir/* destdir
 

Download Youtube video with wget!

    
    wget http://www.youtube.com/watch?v=dQw4w9WgXcQ -qO- | sed -n "/fmt_url_map/{s/[\'\"\|]/\n/g;p}" | sed -n '/^fmt_url_map/,/videoplayback/p' | sed -e :a -e '$q;N;5,$D;ba' | tr -d '\n' | sed -e 's/\(.*\),\(.\)\{1,3\}/\1/' | wget -i - -O surprise.flv

youtube-dl -t –extract-audio –audio-format mp3 YOUTUBEURLHERE 2011-11-15 20:11:20 User: menachem Tags: youtube mp3 21 Up Down Convert Youtube videos to MP3

youtube-dl has this functionality built in. If you're running an older version of youtube-dl, you can update it using youtube-dl -U (although if you have an older version, it probably doesn't download youtube videos anyway.)

youtube-dl –help will show you other options that may come in useful.

Server load and process monitoring

In certain cases you mighy need to monitor the server load caused by certain process. For example HTTP, while stress testing apache using ab (apache benchmark) you may want to monitor the server status,load, # of spawned HTTP processes, # of established connections, # of connections in close wait state, apache memory footprint etc.

 watch -n1 "uptime && ps auxw|grep http|grep -v grep | grep -v watch|wc -l &&        netstat -ntup|grep :80 |grep ESTABLISHED|wc -l && netstat -ntup|grep :80|grep WAIT|wc -l && free -mo && ps -ylC httpd --sort:rss|tail -3|awk '{print \$8}'"

See size of partitions

See size of partitions as human readable

See size of partitions as human readable and get extra informations about hdd and partitions

parted /dev/sda print
fdisk -l /dev/sda

Find out the installation time of a linux system (when installed in a ext2/3/4 file system)
tune2fs -l $(df -P / | awk 'NR==2 {print $1}') | sed -n 's/^.*created: *p'
Get your external IP and Network Info curl ifconfig.me/all

cat urls.txt | wget -i- -T 10 -t 3 –waitretry 1 cat urls.txt | xargs -n1 curl -O –max-time 10 –retry 3 –retry-delay 1 download a list of urls