Linux Tips And Tricks


Here, you will find several tips and tricks I have leaned over the last couple of years using Linux. These tips and tricks will make your life as a Linux user/sysadmin hopefully a bit easier. I hope that both experienced as well as novice Linux users and administrators will find these tips useful.

If you have tips you would like to contribute please send me an email or give me some feedback so that I can add them on this page. I will be calling everything Linux on this page even though Linux is only the kernel and the main programs and utilities are GNU. So the more accurate name would be a GNU/Linux operating system.

In the link section there are a couple of links to Linux distributions. So if you are new to Linux why not start by downloading it for free today?

Linux filesystem

The first thing you notice when using Linux or any other Unix based operating systems is the differences in partition and folder names. In Windows you have C:\ which is the first partition. In this partition is the Windows operating system and Programs Files installed. If you have more partitions these could be D:\, E:\ etc.. Also there are other drive letters: like A:\ for the first floppy drive or G: or some other letter for your dvd/cdrom player.

In Linux this is totally different. For example /dev/sda is my first sata harddrive. If I would add another harddrive it would be named /dev/sdb, yet another would be called /dev/sdc. etc.. etc.. The /dev/ is the folder in which all devices are stored. If I would add a new parition on my new Linux drive it would be called /dev/sda1, second partition /dev/sda2 etc.

There are several folders/directories, which can be on one partition or different partitions.

The screenshot above is one I made of Baobap. Its a program which maps your harddrive and gives you information about usage. As you see my /home folder uses the most space. The disk2 is a second harddrive with one partition which I mounted on /disk2. The /usr (see below) is where most programs are installed is only 2,6 G. I have alot of programs installed like openoffice, gimp (a bit like photoshop), games, video players, audio players. So Linux and the programs on Linux do not use up a lot of space. The last time I installed another operating system I needed about the same just for the operating system. Personally I like this because I get to keep a lot of space for other stuff like Music or Videos.Lets look at some common directories/partitions:


The slash is called root and every other subdirectory expands from it. You can mount any directory on this root directory from almost any place. If you work with NFS (Network FileSystem), you can mount a directory from another machine on top of your filesystem. You won’t even notice that you are working on another system. Or you can mount extra storage from another drive. A good analogy would be that / is the base of a tree and the branches are other partitions, network locations or external drives mounted on root.


This is where all the users data is stored on Linux. If you have a user on the system called hank, his home directory would be /home/hank/
Inside the home dir of hank there will be details stored about hanks system settings (for example his bash settings/gnome settings etc..) But also documents from Hank and the music he loves.


In this folder system configuration files are stored. The different programs/daemons (daemons are services running on Linux – example an ftp server) have either an separate directory with files or a file where settings are stored. Also user passwords/group information is stored here. If you decide to backup your Linux system this directory should be among it.


Storage directory for logs, emails, database data and other data stored by default like crontabs.ex.. /var/log – storage of all logs, /var/mail etc..


Contains system binaries. The essential programs used by administrators to maintain their computer, like hardware configuration programs and maintenance. Examples would be mount, fdisk, mkfs.


The bin directory contains useful programs for both common user as system adminstrator to work with the system. examples are grep,mkdir,chown,chmod,rmdir and rm. It also contains all the shells like bash. Both the /bin and /sbin directory are essential to the system.


In this directory there are several sub directories like /usr/bin and /usr/sbin. In these subdirectories applications are installed, like firefox or openoffice.


Here are all the shared libraries stored. These libraries are needed for essential system stuff – like system32 or system on Windows.


This directory contains temporary data. Many programs want to create data to store temporarily. This information can be cleared out on reboot or shutdown. So do not store information here! 😉


This contains all you kernels and grub or lilo information. The kernel is basically the program which communicates with your system hardware and other programs.


Contains all devices on your PC. The interesting thing about all Unix and thus also Linux systems is that everything is a file.

Some commands about storage

Checking diskspace
df -h – checks diskspace.

View information about harddrive partitions
sudo fdisk -l shows all harddrives installed and their partitions.
You can also use cfdisk instead of fdisk which is more user friendlier

A great gui tool to manage your disks/external disk in Ubuntu and other Linux distros is redhat’s diskutility called “palimpsest”. Its easy to check your harddrives performance, smart data (this is information about your harddrive health) or format a new drive, add or edit partitions. Some time ago I had to format an external drive to fat32 for my brother. After trying to format it under Windows 7 which apparently would take ages, I cancelled this operation rebooted to Ubuntu and formatted it with Palimpsest in a couple of minutes. In Ubuntu this program will warn you when your harddrive is about to fail.

How to check your disks health from the commandline
Install the package smartmontools.
smartctl -t short -d ata /dev/sda short selftest for drive /dev/sda (will finish in 5 minutes)
If you change short into long it will do a more extensive disk check.

smartctl -l selftest /dev/sda -d ata show results of test
smartctl -a dev/sda show extensive results of harddrive
With smartmontools you can also run it as a daemon/service to report about your harddrive health (it will send an email when your harddrive is about to fail). This is something I have installed on my servers.

The dash h means in human format – M for megabytes, G gigabytes etc… If you do not use the dash h , it wil display the numbers in bytes which is not very legible.

Another command for finding out disk usage of directories is du. Try du -sh /home/myusername to find out how much space “myusername” is using. If you are currently standing in /home/myusername. You can test this by using the command pwd . You can also use the following command to show the size of your home dir du -sh .

Finding those big files that take lots of space.
find . -size +10M -ls shows all files below current directory which use more than 10 Megabytes of space.

mkfs.ext3 /dev/sda1 create ext3 filesystem on /dev/sda1 (first partition on sata disk 1)
With Linux you can create different filesystems. ext3, ext4 are the most commonly used for Linux. You can also format drives in fat32, riserfs, udf (Unix filesystem) and lots more. I will only talk about ext3 and ext4 from here because they are used the most.
ext4 is the latest filesystem in the ext filesystem line. For new desktop installs I usually choose ext4 as my default filesystem. When I started with Linux the default filesystem was ext2. ext3 and ext4 are journalled filesystems unlike ext2. So if your system crashes and there are filesystem issues it will try to get its information back from these journals.

Linux permissions

When you see the contents of a directory using the command line it looks kinda weird. Whats up with all the r’s,w”s and x es.

drwxr-xr-x 2 user user 4096 Jun 9 13:17 new2
-rw-r–r– 1 user user 0 Jun 9 13:17 one
-rw-r–r– 1 user user 0 Jun 9 13:17 two

The first character is the type in case of “new2” its a directory. SO “d” is a directory, – is a file, “l” a link to another file or directory.
The next three characters are the user permissions. In case of the directory the user “user” has full rights, “r” stands for read, “w” for writing and “x” for execute.
The second permissions are for the group. And its in the same order, read – write – execute permissions.
The third permissions are for other. Other means the other users which are not matched by the first two permissions. So if user hank is not in the group “user” he only has read permissions on both files and can enter the folder new2.
The numeric value after the permissions are sizes. Since I created empty files it will only show 0.
If a file is changed to execute you can run it like a program.

Changing ownership and permissions
Changing ownership of a file is done with two commands chown username file CHange OWNer or if you only want to change group permissions chgrp groupname file CHange GRouP.

Changing permissions is done with the chmod command.
Changing permissions can be done in two destinctive ways.
1. by using letters
If you want to change the ownership of the file one and add write permissions to both the group and other user.
chmod go+w one
If you want to remove from the other user all rights chmod o-rw one
2. by using numbers.
How does this work – 0 no rights, 1 execute rights, 2 writing rights, 4 read rights.
So if you would give a user read and execute rights it would add up to 3, read and execute is 5, read and write adds up to 6. Which leaves 7 which is read,write and execute rights.
So if you would execute the following command chmod 755 one It would give user full rights to one, the group and other user will have read and execute rights to the file one.

Recursive changes in permissions or ownership

chown -R user:user * Change ownership to the user called “user” and the group called “user” to all files and directories at the current location and above.
If the user and the group are the same you can also use this command by leaving out the group after the colon
chown -R user: *
chown -R :user * change all folders, files here and below to the group user

chmod -R 755 * Change permissions to 755 for all files and folders at the current location and above.
If you do not have permissions become root first or use sudo or su.

sudo and su examples
sudo and su are used to execute commands or become the root user. With su its also possible to become another user on your system.

su -c chown user:group file using su to change ownership of a file
sudo chown user:group file same example but now with sudo
sudo -i change to root user with sudo command

changing user with su
If you type su you will become the root user. Type su – to load all the root users settings with su you will become root with your settings (.bash etc…)

su – username login as username

Gnome and compiz

Window managers, GUI the cool stuff…

When I first started with Linux it was very confusing because it did not have one Window manager like in Windows but several.

What is X Windows or Xorg?
X windows or Xorg is a graphical server. You could run X without a Window manager like Gnome or KDE but it would be pretty limited in functionality compared to Gnome or KDE. As a server it is possible to remotely connect to a X Windows server and run programs.

What is a Window manager?

A window manager is basically the graphical system run on top of Linux. A bit like in the past you run dos and then started Windows (Windows 2000 and before). But unlike Windows you can run different graphical systems. The most commonly used systems are KDE and Gnome. KDE has a bit more similar look and feel like Windows (my opinion) while Gnome looks a bit more like a Mac.

Why are there different Window managers and not one like Windows?

It is all about choice a good analogy would be why are there different cars on the road and not one brand. Some people like their Window manager to be small and simple and use not a lot of resources (ex. Blackbox, Fluxbox etc..), others want more features. Also with an old PC you can still run a Window manager. Linux is not a one size fits all operating system like Windows. It runs on high end server equipment but also on routers and hardware with limited resources.

If you have an old computer you will still be able to run Linux. There are even complete Linux systems which you can put on your usb stick and run directly from it!


Below is a picture which I made running Compiz on Gnome. Its the expo function which shows all the open workspaces. I have 5 running. In the first I always put a terminal, second the browser, third evolution mail client, fourth nautilus (similar like windows explorer but for Gnome).

The filter function or expose like used by Mac. When I press F12 or flick the mouse pointer to the right hand corner it will show all the open programs side by side. By clicking on it i will go to that program in that specific workspace.

Also check out the youtube videos I posted on the bottom to see Compiz in action.

There are a lot more features within Compiz.

Shell Usage

Most beginning Linux users will feel daunted by the shell/commandline. I advise beginning users to learn a bit about the commandline, because later on you will recognize its power to quickly manage your Linux machine or manage multiple machines with ease. If you have used Dos before you will learn that doing stuff on the commandline under Linux or any other Unix related Operating System (FreeBSD/Solaris) is much much more powerful than you were used to under Dos. Also if you want to try out other operating systems (Solaris, HP-UX, FreeBSD, OpenBSD) later you will find out alot of similarities and it will speed up your knowledge of them.

Every command you enter at the shell gets logged. When entering the command “history” it wil show you the past command’s you have used. In front of each command is a number. For example: 1 cd /home. If you type “!1” or instead of 1 the number you choose the shell will repeat the command you issued before.
Another neat trick is that if you type “!cd” it will append the last command which included cd. Example “cd /home/user”.

Cycling through previous issued commands.
This is a huge time saver! Instead of entering the same commands over and over again the bash shell lets you repeat commands previously entered.
Start by pressing “Ctrl” + “r” and enter the part of the command, for example “cd”. Now the last command containing “cd” will appear!

If you press “Alt”and “.” it will cycle through the last part of the command. Another way of doing this is using the “!$” but then it will only use the last part and will not let you cycle through the commands you have allready entered. Give it a try by doing a “ls /home/username” and then either “cd !$” or “cd Alt+.”. If you type `cd -` you will go back to you last position. Ex. /home/me to cd /usr, cd – will let you go back to /home/me!
Another way to repeat previous commands is by using the up or downkey next to the control key. Or you can use Ctrl-n or Ctrl-p.

Repeat last command !!. Example say you want to install vim in ubuntu. apt-get install vim this will fail because you do not have root permissions sudo !! will install it. The double exclamation marks are transformed in the previous command!

Another way of switching between two locations is by using the “pushd” command.
By entering pushd you will return to the previous directory. Just enter cd /etc and then enter “pushd”. You will jump right back from where you came. I never use pushd anymore since I think “cd -” does the same thing and is faster to type.

If you use !* instead of !$ it will complete everything after say “vi bla bla2%u2033, so everything after vi. Removing characters from a command. For example you have mistyped the command rm blaa instead of rm bla. Press “^a” and it will come back with “rm bla”.

Basic commands

cat file show file contents
more file show file content one page at a time space or enter moves on to next page and with q you exit the pager
less file show file content. But you can scroll up or down (pgup/pgdown and arrow up/down). Use zless to peek into packed files. Like file.gz
head file show first couple of lines of the top of the file
tail file same as head but now for the last part.
Using tail with logs. tail is a great command to show whats going on. Example tail -f messages wil show you all the new entries written to messages log. With ctrl-c you can end the command.

cp file /home/user/ copies file to /home/user
mv file /home/user/ move a file to /home/user directory
Move can also be used to rename a file or directory. Example: mv file file2 renames file to file2.
diff file1 file2 show differences between file1 and file2
diff -q dir1 dir2 show differences between the content of dir1 and dir2 use -qr to do this recursive across sub directories.
env show user environment variables (in windows its “set”)
source ~/.bashrc reread changes you made to the .bashrc file.
For instance I have this in my .bashrc file. I’ve made a directory in my home folder called bin with small shell scripts/perl scripts. If you add this to your .bashrc it will allow you to execute these scripts.
export PATH


You can link to a file or directory
ln -s target linkname ex. ln -s /home/me/test test2 makes a link to /home/me/test and its called test2.
-s is symbolic link – removing the link doesn’t remove the origibal file – without -s is hardlink – removing the link will also remove the original file!! Be careful.
ln -sd targetdir linkdirname – make symbolic link to directory

Output redirection

ls > file – pipe output of command ls to file
ls >> file – append output to existing file
ls 2> file – only pipe errors to file of command ls
ls 2>&1 file – output stdout and stderror to file or “ls &> file” or ls > /dev/null 2>&1 – output stderr & stdout to bitbucket.
mail [email protected] < file – mail command takes input from file and sends it to receiver
wc < file > other_file -> wordcount takes input from file and pipes output to other_file
output can also be piped to screen for example a different console/terminal. try this “cal > /dev/pts/2” this will output a calender in the terminal no. 2. (ssh host “cal > /dev/pts/1” – paste calender on remote machine).
reset – lets you clear the terminal (for ex. when its garbled).

Usage of su and sudo
To change to root you can use the “su” command. You become the user root. BEWARE: root has unlimited access to the system. Certain commands can destroy your system, like rm -rf /

The sudo command is more to get temporary root privileges with certain commands.

sudo command run command as root – ex. sudo apt-get update

sudo -i opens a root shell
sudo passwd -l root disable root passwd (lock)
sudo passwd -u root unlock root passwd (if passwd was set before locking)
sudo passwd root enable root passwd
sudo -sopens a new shell and allows you to work like root without having to use sudo for each command.

dd if=/dev/hda of=bla.iso make an iso file from your dvd or cd
dd if=/dev/zero of=10MB bs=1024 count=10240 make 10MB file.
kill -HUP pid restart process with processid or kill -HUP `cat /var/run/`
export GREP_OPTIONS=’–color=auto’ shows match in red color
ls /home/{user1,user2} show content of both user1 and user2 homefir

script filename – lets you record commands till you press Ctrl-D or type exit.

Usefull commands

find . -type f | xargs tar -zcf files.tar.gz
Find all files in current and subdirectories and compress them all in archive. The xargs argument takes input from the find command and passes all the files through the tar command.

find . ! -perm 775 -exec chmod 775 {} \;
find . ! -perm 775 | xargs chmod 775 *

change all directories and files who do not have read,write, execute permission for user and gruop – other users have read and execute permissions.

find . -maxdepth 1 -type d -ls find all dirs in current dir. Change maxdepth number to the depth you want to go. An example of a command I used to change all permissions in the current dir. find . -maxdepth 1 -type d -exec chmod 711 {} \;

grep -i “fail\|warn\|error” messages
Find all messages which contain fail,warn,error in the messages file. I usually use the “*” to search all the logs for possible errors. Also you could use the zgrep command to search through packed archives.

mv `grep -l “linux” *` dir/
move all the files containing the word linux to folder dir. The quotes are backticks not single quotes and cause the command to be executed.

cp file{,.new} copy file to
mv file{.new,} move to file (ex. in case you want to restore your old settings)
mkdir dir{1,2,3} create dir1, dir2, dir3
mv /path/to/file.{txt,xml} rename file at path to file.xml

Use curly braces to execute the commands and then direct output to the file like:
} > file

Another use for curly braces is for loops. If you want to increment a number to ten try this:

for i in {1..10};
echo $i

Another way to increment a number is by using the command seq. Same example in a script:

for i in $(seq 1 10);
echo $i

Try to combine these scripts with tedious tasks like things you want to do ten times or more and make shell scripts.

Handy program is qpdf to decrypt pdf files like this:

qpdf –password=password –decrypt secure.pdf decrypted.pdf

Edit the command line with cut and paste: ctrl-k for cut, and ctrl-y for paste.

Sometimes you want to split a file into smaller files. This can be done under Linux with the split command.
split -l 1000 file.txt subfile split a file into subfiles with 1000 lines each
The result will be files like subfileaa, subfileab etc.. If you want all these files to have a .txt extension (if you want to open them in Windows for example) you can run this following script.

for i in `ls subfile*`
mv $i{,.txt}

Setting defaults via the commandline
This is done with the command update-alternatives
To update all the settings use the following command:
sudo update-alternatives –all
sudo update-alternatives –config –editor change all the editor settings for example if you want to change the default editor to vi

Burning dvds via the commandline
You can use wodim to burn dvds via the commandline

wodim –devices show available devices
wodim dev=/dev/sg2 -sao -eject speed=8 /absolute/path/to/filename.iso Burn iso with wodim

what is my current runlevel?
runlevel in ubuntu/debian
who -r all distros

Screen is a command that allows you to detach your current
screen -list show all running screen processes

Filesystem checking and handling

mounting and checking file systems

The “mount” command shows you which devices are mounted in Linux. Example:
/dev/sda1 on /boot type ext3 (rw)
The first partition on the first SATA harddrive is mounted on the directory boot. The filesystem is ext3 and it is readable and writable.

If you want to unmount a device which is currently in use you can find out about the processes which are using this device by issuing a “lsof /mountpoint”. You can also issue the command lsof -n | grep “mountpoint” to achieve the same result. If a disk refuses to be umounted issue the command umount -l “mountpoint”.

mount -o loop iso /mountpoint – mounts the iso at mountpoint (you can check its content)

set noatime,nodiratime in fstab inclreases filesystem performance.
vi /etc/fstab and add these two values after default option.
mount -o remount / to remount filesystem.
The atime,nodiratime keeps a record each time the file or dir was accessed – in most cases this is not necessary.

Filesystem checks

How to check an encrypted external disk?
First make sure its not mounted – check with mount or look in nautilus if the drive is mounted. Never check a mounted filesystem!

sudo cryptsetup luksOpen /dev/sdb1 foo
Now it will ask you for your passphrase you gave it when you made the encrypted volume. The foo part has no real meaning. It will create a device named foo. Now for the checking.
sudo fsck /dev/mapper/foo

removing foo from /dev/mapper/
sudo cryptsetup remove foo


Computer networking is a task Linux was born to do. Linux has its roots as a server operating system, and is used a lot for various networking services like:

  • Nameservers (e.g. converting ip addresses into domainnames and back)
  • Mailservers (Receiving and sending mail)
  • Webservers (Apache is the biggest webserver application in the world and runs on Linux – also on other Operating Systems)
  • LDAP (Directory services)
  • Routing/Firewall systems
  • Fileserver functionality to both Windows (Samba) and Unix based systems (NFS)
  • Proxy server
  • FTP server

So even if you run a certain desktop version of Linux you will be able to install various network services on your PC.

Useful commands
ethtool -i eth0 show network interfect information (also to change settings)
ifconfig show all network interfaces plus ipaddresses etc..
route -n show all routes.
route add default gw add a route to the gateway
ping ping ipadress to test the connection
traceroute ipaddress trace the route of packets

Setting networkcard speed
ethtool -s eth0 speed 10|100|1000
ethtool eth0 shows you the capabilities of the card.
netstat -tulpn show open listening ports
netstat -tup show which processes own which network connections
another way to show open ports is lsof | grep LISTEN as root or place sudo before command

whois – get domain registration info
whois ipaddress get ipadress ripe information
dig dns check
dig -x ipadress reverse dns check
host What is the ipaddress of On Ubuntu if you do a host it will also show you the mailserver records for this domain if any. If you do host ipadress it will return the corresponding full domainname.
mtr -r -c 25 mtr combines the functionality of the traceroute and ping programs in a single network diagnostic tool

wget download file from domain with wget. wget is a great tool. It can be used to download complete websites.
w3m use w3m, lynx or links as a text only browser from the commandline.


dhclient3 -1 eth0 renew ip adrress on eth0 (change eth0 into whatever your interface is)
dhclient -r eth0 release ip adress
ifdown eth0 bring interface eth0 down
ifup eth0 bring interface eth0 up – if it is configured as dhcp interface it will automatically restart dhcp settings.

Daemons on Linux

Services running on Linux

Daemons has nothing to do with “demons” or devils but with services/server applications running on Linux. A good example would be a fileserver or a mailserver application. In this chapter I will tell you something about the basic services running on Linux.

Cron and Atd

Both the cron the atd are daemons for executing commands/programs at certain intervals. The atd daemon is used for single events while the cron daemon is used for repeated events (like updating the locate database). Cron is really useful to automate certain tasks. For example mailserver statistics to be send at a certain time to administrator, clean up tasks etc…

Usage cron.
crontab -e edit the cronfile from the current user
crontab -l list the cronfile.

There are 5 fields for time and one field for the command that has to run. All fields are seperated by a space.

1. Minute (00 – 59)
2. Hour (00 – 23)
3. Day of the month (01 – 31)
4. Month (01 – 12)
5. Day of the week. (0 – 6) (0 is sunday, or 7)
6. the command or script that needs to be run. (ex /home/me/

Minute Hour Day of the month Month Day of the week command
00 04 01 * * this will run every first of the month at 4 in the morning

Usage at
atq view all current commands in queue
at “time” start new command ex. at 14:00 (start new at 14:00)
after entering such an command you will be taken to a new shell which allows you to enter an command. You end the shell with Ctrl-D. This will make at execute your command at such a time. If you write your own shell scripts you can also let at read them by entering the following command for example: at 14:00 < myshellscript

Linux Flickr Photos

Some screenshots of the installation of Ubuntu 11.04, compiz desktop and other Linux desktop pictures.


Everything about packagemanagement

Most Linux distributions use some sort of package management system to help you install new programs or uninstall programs. With an internet connection updating your Linux distribution is really easy just like with Windows updates, and it will also update all programs that you installed during the installation.

Contrary to most claims that the installation of programs under Linux is hard, its actually really easy with the current package managers to install new software or manage existing software.

With Windows software you have to visit websites for each program installed to see if there are updates or if you are lucky it will notify you with a special program running (Windows update/Logitec/Adobe etc..). This is easier in Linux. For example both Fedora and Ubuntu will notify you for each package installed that there are updates. With a few clicks your whole system will be updated to the latest version!

Explanation of the differences in package systems.

There are three major systems:
rpm based – ex. RedHat/SuSE/Fedora/OpenSuse/Mandrake and others.
deb based – ex. Debian/Ubuntu and others.
source based – Gentoo/Slackware package management

Are you new to Linux? I would recommend by starting out with either Fedora or Ubuntu. These two distributions use the two most commonly used package systems and also have the biggest communities.

Scared of messing up your Windows or Mac system? If you do not have a second pc lying around a great way to test Linux is by using a virtual machine. You can download Virtualbox or Vmware for free and create your own virtual machine or download a virtual machine. A virtual machine is a “virtual pc” and installs the operating system and programs into a file on your PC. You can set the amount of memory/cpu cores and videocard memory your virtual pc will take. If you mess up your system it is easy to get started again without messing up your Windows system or Mac.

Or you could install it on a spare machine or spare harddrive so that you can test it and you do not need to worry about your Windows installation. Learn the differences and similarities between package management.

Graphical installation of programs

Updating with the update manager in Ubuntu under Gnome 2:
Go to system > administration and select update manager. If there are updates you will usually see an icon in the top right corner mentioning updates. See screenshot of update manager with updates. Click on the thumbnail to view the full size image.

As you can see its only one button you have to click to update the whole system!

Installing new programs with Synaptic.
Screenshot of synaptic. Click on thumbnail to view full size image.

Another great way to install new programs is the add/remove application under Applications.

In the latest Ubuntu you can also use software center. This makes installing software so easy that a “one handed monkey” could install new software on your machine. 🙂 Search or browse for software and press the install button.

Shell installation of programs.

RPM based systems
rpm -qa gives you a complete list of all the installed packages.
rpm -Uvh packagename upgrades an package. The v part in the command means that the output should be verbose.

yum package management
yum is the commandline package management for fedora and other rpm based systems.
yum update – update all packages in one command

DEB based systems
dpkg –get-selections give you a complete list with all installed (and uninstalled) packages.

# dump packages to list and reinstall from list
dpkg –get-selections > installed_packages.txt

To re-install the packages from the list
dpkg –set-selections < installed_packages.txt
apt-get dselect-upgrade

apt-get install packagename installs packagename
apt-get update updates package database
apt-get upgrade upgrades all installed packages
apt-get clean cleans deb’s which were downloaded

Update every package from the commandline in one line in Ubuntu/Debian with sudo:
sudo apt-get update && sudo apt-get upgrade && sudo apt-get clean

TIP: add the following line to your .bashrc file in your home dir.
alias upgrade=’sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get clean’

Now you can update all your packages just by giving the ‘ upgrade’ command (without quotes).

apt-file search /usr/bin/vi searches for file in package even if it uninstalled
dpkg -S /usr/bin/file searches for file in packages on local system
dpkg -l list all packages installed/uninstalled on system

Removing packages when you are getting errors.
dpkg –purge –force-all package_name
dpkg –remove –force-all package_name

apt-cache search packagename search for package in repositories.

Cleaning up your debian based systeem
I use both deborphan and debfoster to clean up the system of unwanted packages. The deborphan package searches for orphaned packages – packages with no dependencies on others. Like old libraries. Always check that you are sure that you want to remove these packages. Debfoster also looks for packages which can be removed but it makes a run through all the packages and asks you if you would like to remove these.

You can combine commands to orphaned packages.
sudo apt-get remove –purge $(deborpan)

Installing packages not available in the repositories
Sometimes you will want to install a program which is not available in the repositories. How can you find it? If you use Ubuntu there are PPA repositories. These are kind of special repositories where developers can develop software for Ubuntu which is not included or maybe even newer packages. So if you use Ubuntu and you would want to install a program try to look for a PPA repository. For Fedora and OpenSuSE there are also other repositories available for extra software.

I would advise against installing from source (especially for beginners). Why? Unless its an small program to install it can be a real pain to install from source. Complex software like for example Gnome has dependencies on lots of different other software. This means you will have to compile several software programs to get Gnome to work properly. Then there is the problem with uninstalling from source or if you want to do an update. Its not easy to uninstall software if the files are scattered across your Linux system. Package management takes care of all these problems (installing/removing/upgrading) without leaving traces on your system.


Solutions for problems encountered

If you run into trouble try one of these fixes below.

If Gnome or another window manager freezes you can use the following keys combo to terminate the window manager and return to the login screen Ctrl+Alt+backspace. Another way to kill the X session is by using Alt-PrintScreen-K.
You can also drop to the shell by using the following combo’s Ctrl+Alt+F1 – or any F key till F6). If you use Ctrl-Alt-F7 you will return to your active X session.
You can also use the Alt+left or right arrow keys to switch between consoles. If you have ssh running on the machine you could also try to remotely login onto the machine and then kill the X session or other processes.

Linux can be rebooted using the Ctrl-Alt-Del keys. You can disable this setting if you want to. If you have a really complete freeze of your system and the last combo doesn’t help you can try to use the following key combo:

When Linux freezes and Crtl-Alt-Del doesn’t work do the following:
While holding down Alt-PrintScreen press: REISUB. (how to memorise: Raising Elephants Is Utterly Boring – or busier spelled backwards).
This works everytime! Use this instead of a hard reset (using the reset button on your pc). I always try to avoid using the reset button, because if the harddrive is writing data it could cause filesystem corruption.

lightdm not starting after upgrade. I’ve changed the value in /etc/X11/default-display-manager from “lightdm” into “/usr/sbin/lightdm” to get it up and running again.

No calendar entries in Evolution after a restore. The reason why this is happening is that evolution calendar process was already running during the restore. Quit evolution and reboot or quit evolution and run the following command evolution –force-shutdown. This will shutdown all running evolution processes.


Unity is the new Windows manager for Ubuntu. Below are some sweet shortcuts to use with Unity!

Open Dash
To start a program just type a part of its name and you can start it by clicking on the icon. You can also see the last edited files, programs used last.

How to move icons on the launcher? Click on the icon and hold the left mouse button for two seconds to drag and drop the icon.

Launch Expose in Unity (show all opened applications)
WindowsKey + w

Show all workspaces
WindowsKey + s

Open trash folder
WindowsKey + t

Open the application number on the launcher (hold windowskey to see the number).
WindowsKey + number

Minimises all windows in this workspace.
WindowsKey + d

Run commands via dash
WindowsKey + r

Resize application window between maximized and normal size.

Ctrl-Alt-Numpad 7 – Place window in top left corner of screen.
Ctrl-Alt-Numpad 8 – Place window in top half of screen.
Ctrl-Alt-Numpad 9 – Place window in top right corner of screen.
Ctrl-Alt-Numpad 4 – Place window on the left side of the screen.
Ctrl-Alt-Numpad 5 – Center/Maximize the window in the middle of the screen.
Ctrl-Alt-Numpad 6 – Place window on the right side of the screen.
Ctrl-Alt-Numpad 1 – Place window in the bottom left corner of the screen.
Ctrl-Alt-Numpad 2 – Place window in the bottom half of the screen.
Ctrl-Alt-Numpad 3 – Place window in the bottom right corner of the screen.
Ctrl-Alt-Numpad 0 – Maximize window.

Moving applications to another workspace:
ctrl-alt-shift + arrow up/down/left/right to move application to workspace up/down/ to the left or the right.

You can download a wallpaper with all these shortcuts here:
ubuntu shortcuts

Want to reset unity back to default settings? Because you messed with compiz settings or other settings.
Alt-F2 to run commands then type: unity –reset

With: unity –reset-icons you can reset the launcher icons in the launch bar to default settings.

If you get two nautilus icons instead of one if you open nautilus.
gksu gedit /usr/share/applications/nautilus-home.desktop
Add a hash infront of the following line OnlyShowIn=GNOME;Unity;
Save and logout and login.

Great programs under Linux

Try out these wonderful programs under Linux

  • Audacious – if you are used to Winamp under Windows you will love Audacious. It has a similar layout and loads of features which you can add with plugins.
  • VLC – videolan player is also available under Linux. It plays everything and just rocks.
  • Transmission – bittorrent client. Small, fast and beautiful.
  • Gringotts – still keeping your passwords in different places and in text files? Store it safe and encrypted in Gringotts. Choose the encryption method and a password then just place all your passwords within this file. With a password you can unlock this file.
  • K3B – Burn cds/dvs etc.. under Linux. Burning cds couldn’ t get any easier with K3B. K3B has the best features of any burning program I have found under Linux. If you want something simple and no frills you can also try out Brasero or Gnomebaker under Gnome.
  • The Gimp – bring out the artist in yourself. The Gimp is a great program to edit pictures or do other graphical things. An alternative to Photoshop.
  • Evolution – Outlook like mail program. It has a calendar, contacts, taks etc.
  • Inkscape – vector graphics program.
  • – like the Windows version. Open and edit Word documents, Excell, Powerpoint, Access databases.
  • Firefox – just like under Windows you can use Firefox to surf the web.
  • Pidgin – a messenger. Communicate with msn/yahoo/google messengers.
  • Emesene – communicate with MSN users.
  • OpenShot Video editor – Edit those funny movie clips with openshot. It’s really easy to use and you can save the files as different formats (also made for youtube and other movies sites).

Getting Help

1. The man pages. The man command is an abbreviation for “manual”. If you enter “man command” at the commandline it will give you more information about the command and possible switches. For example: “man ls”

2. Help switch a more short version of the man page.
Or you can type either `–help`or `-h` behind the command to learn more about their operators.

3. Finding related info. Related command’s can be found by typing “apropos command”.

4. The internet – the biggest library in the world! Just use your favorite search engine and type in the issue you are experiencing.
There are also newsgroups with Linux information and about certain software (Linux or deamons like the Apache webserver).

5. Irc. Enter a channel and ask your question for example #debian, #fedora, #ubuntu . Be polite because sometimes you won’t get an answer straightaway.

6. Books – eventhough you can find almost everything on the internet its nice to have some books about Linux. I can really recommend “Running Linux” from O’reilly. It covers a lot to get you started and get to know Linux basics. This was the first book I bought on Linux.

7. Forums – if you are an Ubuntu user join the and start asking questions or answer them. If you use fedora join See the link list for links to these Linux forums.

Linux is all about contribution. Beginning Linux users will find a huge community dedicated on improving Linux and helping Linux users. Why don’t you join a forum and make Linux better. Start by joining a forum or usergroup. Report bugs you find or wishes you have to improve programs.

Starter Tip List

Tips for starting and other Linux users

  • Install Linux in a virtual machine to try it out! Lots of people are afraid of messing up their system and their settings. With a virtual machine you install a operating system in a file on your current system (Windows, Mac etc..). The O.S. thinks its installed on a proper PC system while the software just emulates the hardware. This way you can run Linux within Windows to try it out. If you crash and burn you can start over again without risking your current system.
  • Vmware also offers premade virtual machines – just download one and start ubuntu, fedora or any other Linux distribution. Another nice thing about virtual machines is that they can make a snapshot. So before you want to mess around make a snapshot, Now all changes are stored in the new snapshot if you totally mess up something, you can return to the state before the snapshot.
  • Join the forum of your Linux Distribution of choice. Each distribution has an own forum and other resources to help you out. You can also join a local user group in your area.Linux and open source software is all about collaboration and sharing. Even if you are not technically inclined there are allways things you can take part in. For instance helping out with bugs by mentioning them or helping out with translations etc..
  • Missing certain software under Linux? With Wine you can install Windows software under Linux. Check the wine database on how well your program runs under Linux. http://appdb.winehq.orgAnother option is to run Windows inside Linux in a Virtual Machine. Have you checked for “alternatives” for your program under Linux?
    You can also write to the programs maker or company and ask if they will port it to Linux.
Linux Tips And Tricks
Rate this post


Please enter your comment!
Please enter your name here