Task

command

Example of use

Autocomplete a file or directory name

<tab>

$ tar zxvf box<tab>

produces

$ tar zxvf boxee-0.9.10.5534-sources.tar.bz2

Change to the home directory

cd ~

 

Unpack a tarball

tar zxfv

tar zxfv ivtv-0.4.4.tar.gz

Change directories

cd

cd /tmp goes to the temp directory

cd .. goes one level up

Check your internet address

ifconfig

(windows equivalent is ipconfig)

Run something as root – ubuntu (terminal)

sudo

sudo chmod a+rwx /dev/video0 (to make my webcam available to all users)

Run something as root – ubuntu (gui)

<alt>+<F2>

gksudo

gksudo nautilus (to run an instance of the file manager with root privileges)

Get root privileges in the terminal (i.e. superuser)

su

Watch the prompt change from $ to #

Copy a file

cp

cp /tmp/*.mpg /home/ian/videos

Move a file

mv

mv /media/disk1/*.jpg /home/ian/pictures/beachparty

Rename a file

mv

mv tuner.ko tuner.ko.old

Delete a file

rm

rm tickets.pdf

Create a directory

mkdir or md

mkdir test or md test

Delete a directory

rm -r

rm -r test

Compile something from source

./configure

make

make install

sudo make && make install (make install prob needs root privileges)

See the manual page for a given command

man

man ifconfig (press q to quit when done)

Run more than one command at a time

&&

cd ~ && wget http://dl.boxee.tv/boxee-0.9.10.5534-sources.tar.bz2 && tar jxf boxee-0.9.10.5534-sources.tar.bz2 changes to the home directory, downloads a file, extracts the compressed archive

List the contents of a directory

ls or dir

ls | more (if there is more than one page of terminal output)

Download a file from the net

wget

wget http://dl.boxee.tv/boxee-0.9.10.5534-sources.tar.bz2 or

wget -i files.txt (downloads all the files in a list)

Show full path name of command

which

which wget produces /usr/bin/wget which is where the command file is located

Get the bash terminal to stop doing something

<ctrl>+<c>

 

IP address of a website

host

host swiftandbored.com returns swiftandbored.com has address 64.29.145.9

Registration data of a website

whois

whois swiftandbored.com returns the whois info of that website

Find windows machines

smbtree

See also findsmb

Find the windows (netbios) name associated with ip address

nmblookup

nmblookup -A 1.2.3.4

List shares on windows machine or samba server

smbclient

smbclient -L windows_box

Mount a windows share

mount

mount -t smbfs -o fmask=666,guest //windows_box/share /mnt/share

Send popup to windows machine

echo 'message' | smbclient -M windows_box

(off by default in XP sp2)

Display a calendar

cal -3

 

Display a calendar for a particular month year

cal 9 1972

 

Show free space on mounted filesystems

df  -h

 

Show disks partitions sizes and types

fdisk -l

sudo fdisk -l (must be run as root)

Kernel name

uname -r

 

Kernel name and architechture

uname -a

 

End a process

kill

(get the process ID from the top command)

Free RAM

free -m

 

Install a package from the command line

apt-get

aptitude

yum

sudo apt-get install firefox (distros with debian package management only, e.g. ubuntu)

Test a connection to an IP address

ping

 

Show the IP route of a connection

traceroute

(windows equiv is tracert)

List processes and system info

top

 

Batch convert photos from large file sizes to smaller ones

convert

convert *.JPG -resize 1440x960 sm%03d.jpg (imagemagik package)

See the last 10 kernel messages

dmesg | tail

 

List connected usb devices

lsusb

 

Install VMWare

 

sudo aptitude install build-essential linux-kernel-headers linux-kernel-devel

 

gksudo bash ./VMware-Workstation-6.5.0-118166.i386.bundle

Search for a package

 

sudo apt-cache search keyword

Rename upper case filenames to lower case

rename 'y/A-Z/a-z/' *

 

Change file extention from upper case to lower case

rename -v 's/\.JPG$/\.jpg/' *.JPG