Download Free Designs Free Websites Templates
Home / General / Ubuntu Commands

Ubuntu Commands

I recently was asked by a new Ubuntu user (also involved in web, graphic design, etc.), what some of the more common day to day commands I use are.

Many of these commands can increase productivity, etc. by making things (for me at least), easier to do. My system desktop has a transparent terminal integrated into it. This makes it easy for me to run commands as I never have to open a terminal – my desktop in effect, is the terminal.

These are useful commands! Ones that will actually help you do something! Other more common commands (chmod, chown, ls, cd, etc.) can be found elsewhere on the Internet. I tried to stay away from such basic commands, unless they were really useful (like rebooting).

Hopefully, the following will help out some of my readers. If you’ve some good commands, feel free to comment!

1) To find out the processes running that use the most memory. When things are running slower than I want, and am looking for which processes I can kill:

ps aux | sort -nrk 4 | head

2) To see the version of the installed package, when I’m considering an application upgrade:

apt-cache policy xxxxxx (where xxxxxx is the name of the package).

3) To mount an ISO image, so that I don’t have to burn it if I don’t want the ISO after review:

mount /xxx/image-file.iso /mnt/cdrom -o loop (where xxx is the path).

4) Find out where that newly installed package went. This happens to me a lot… I just installed it, where did it go?

whereis xxxxxx (where xxxxxx is the package name).

5) Ever reinstalled an app to find the old configuration still working? This will purge the config files of Ubuntu packages:

sudo aptitude purge `dpkg –get-selections | grep deinstall | awk ‘{print $1}’`

6) Go back and look at the commands I ran, when I’m to lazy:


7) Remove a .deb package (obviously not installed via aptitude), this way I was not afraid to download and use .deb files if the package was not available within Ubuntu or launchpad repositories:

sudo dpkg -r xxxxxx (where xxxxxx is the name of the package).

8) Create an image (.iso) of a CD or DVD – For me this is the easiest:

mkisofs -r -o xxxxxx.iso /cdrom/ (where xxxxxx is the name for the file).

9) Make a backup of a file before editing (such as sources.list). I learned the hard way, ALWAYS backup a file (that’s a .bak file for me) before making changes to it:

sudo cp /xxxxxx/sources.list /xxxxxx/sources.list.bak

10) Add (append) entry to sources.list – For me it’s a simple easy way to do this than clicking my way through the GUI:

sudo echo “xxxxxx” >> /etc/apt/sources.list (where xxxxxx is the address you want to add).

11) Erase a re-writable CD (CDRW), for me at least, musch faster than using a GUI:

cdrecord -v dev=/dev/cdrom blank=fast

12) Reboot a system or server, when I’m installing or making changes via SSH, that require a reboot:

sudo shutdown -r now

13) Get a fast text list (called “installed-packages”) of what’s installed on my system:

dpkg –get-selections > installed-packages

14) Simple way to kill a process, I’m too often lazy to find the process ID:

killall xxxxxx (where xxxxxx is the name of the process)

15) Quickly remove downloaded package manager updates, when no longer needed:

sudo aptitude autoclean

16) Easily add a downloaded key to the repository sources (for aptitude/apt-get):

sudo apt-key add xxxxxx.gpg (where xxxxxx is the name of the key file).

17) Force CD to eject the disk:

sudo umount /media/cdrom0/ -l

18) Security… leave the terminal open, but remove sudo passwords so there are no “issues”:

sudo -k

19) Sometimes I need to change a bit of text in several files. Instead of opening each one to edit, I do this instead:

grep -lr -e ‘xxxxxx’ * | xargs sed -i ‘s/xxxxxx/yyyyyy/g’

Note: xxxxxx is the word you want to change (replace) and yyyyyy is the new word you want used.

20) Fast way to convert .ps (postscript – print to file format) to PDF:

ps2pdf xxxxxx.pdf (where xxxxxx is the name of the file).

Don’t have the command ps2pdf? sudo aptitude install ghostscript or apt:ghostscript

As usual, I hope some of these help someone – Let me know! Don’t forget to add your comments below.

About Amit Raj

Check Also—“Ringing Bell” is a scam or what?

A viral message floats in social site that “Beware the scam- Ringing bell company doing ...