Ubuntu useful commands

Ubuntu advanced home user’s useful commands

All the wonderfully useful commands in Ubuntu/Linux I need every year and then and therefore fail to remember …

Show shell history


Find authorative nameserver of domain

>set querytype=soa

Limit bandwidth to n kBits/s (requires sudo apt-get install wondershaper)

sudo wondershaper eth0 2000 500

Batch resize images (requires sudo apt-get install imagemagick)

Resize all images to 640xn while preserving aspect ratio
mogrify -resize 640 *.jpg

Force images to exactly that size, disregarding aspect ratio
mogrify -resize 640×480! *.jpg

Resize image to x percent of previous size
mogrify -resize 20% *.jpg

Rip CD/DVD iso image

cat /dev/scd0 > /media/CACHE/yourLegalBackupCopy.iso

Import dump into local mysql database

/mysql -u username -p -h localhost databaseName < /home/you/Desktop/myDatabaseDump.sql

Clone Virtualbox image

VBoxManage clonevdi sourceImage.vdi targetImage.vdi

Find process with name

ps ax | grep processName

Launch application with menu attached to application window (especially useful for gimp)


Shut down at specific time

sudo shutdown -h 22:30

Install debian package on Ubuntu

sudo alien -i package.deb

Batch convert flv to mp3 (requires sudo apt-get install ffmpeg libavcodec-extra-53)

(copy this into a shell script and “chmod u+x scriptname” it in order to be able to execute it)
for f in *.flv
ffmpeg -i “$f” -acodec libmp3lame -ab 128k “${f%.flv}.mp3”
(you can also use the newer avconv -i input.flv output.mp3 for conversion)

Convert image series to video (requires sudo apt-get install ffmpeg)

ffmpeg -f image2 -i result%04d.jpg video.avi

This takes all images named like result0001.jpg, must be in a continuous range
use -sameq parameter if you want to preserve the original quality
Set the desired bitrate (here 1 mbit/s) -vb 1M

Extract images from pdf (requires sudo apt-get install poppler-utils)

pdfimages mypdf.pdf imagePrefix

(and in order to convert the resulting ppm files to jpeg, requires sudo apt-get install imagemagick)
convert *.ppm result.jpg

Convert images to pdf (requires sudo apt-get install imagemagick)

convert *.jpg foo.pdf

Download high-quality flv version of ORF TVThek Video (requires sudo apt-get install rtmpdump)

rtmpdump -r “rtmp://apasfw.apa.at/cms-worldwide/” -a “cms-worldwide/” -y “mp4:2012-10-28_1635_sd_02_ERLEBNIS-OESTERREICH_Wer-was-wird–wird-W__4836103__o__0000294809__s4836105___ch_ORF2HiRes_16362424P_16592421P_Q4A.mp4” -v -o Beitrag.mp4

The url to the video can be retrieved from the respective video’s page source (needs to be url-decoded to be used like this)

Leave a Reply

Your email address will not be published. Required fields are marked *

Please solve this little equation for verifying that you\'re human *