Linux Commands

There are so many great little utilities in Linux. I made this page to help me remember my favorites.

Start a webserver from any directory

  • python -m SimpleHTTPServer 8000

Wake up to music

  • echo "banshee --play" | at 7:00am

Random integer between 0 and X

  • echo $(($RANDOM%X)) #X < 32768

Resize an image [requires ImageMagick]

  • convert original.jpg -resize 50% resized.jpg
  • convert original.jpg -size 320x150 resized.jpg

IP Address Lookups

  • dig www.google.com
  • dig @4.2.2.1 www.google.com

Sleep Timer

  • echo 'gnome-power-cmd suspend' | at now + 10 minutes

Text to Speech

  • echo $@ | text2wave | aplay

Convert a .flv movie to .mp3 [requires ffmpeg and lame]

  • ffmpeg -i "flv_filename" -acodec pcm_s16le -ac 2 -ab 192k -vn -y "output.wav"; lame --preset cd "output.wav" "$output.mp3"; rm "output.wav"

Show processes sorted by I/O usage [requires iotop]

  • iotop

Uncompress (tar, 7z, zip, rar, etc) [requires unp]

  • unp archive.tar
  • unp *.zip

Bandwidth log [requires vnstat]

  • vnstat -d #daily usage
  • vnstat -m #monthly usage