20 Useful, Common Linux (Ubuntu) Commands for New Users

June 20, 2009 | By: UbuntuLinuxHelp | 7 Comments
Posted in How to...

1 Star2 Stars3 Stars4 Stars5 Stars (36 votes, average: 4.83 out of 5)
Loading ... Loading ...

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:

history

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.ps 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.

If you like this post, why not share it?
  • StumbleUpon
  • del.icio.us
  • Digg
  • Google Bookmarks
  • Reddit
  • Mixx
  • Yahoo! Bookmarks
  • blogmarks
  • Twitter

Related posts:

  1. Friday Fun – Useful Linux Terminal Commands for New Users.
  2. Quick Fix for the ‘Size Mismatch’ When Updating Ubuntu Linux
  3. Using Ubuntu as an Electronic Document Management System
  4. How to Install VMware in Ubuntu Linux
  5. Update Gimp in Ubuntu Hardy 8.04 – The Fast Way


Comments

7 Comments so far

  1. BigWhale BigWhale on June 20, 2009 4:51 pm

    I’d add three more:

    21) Finding (case insensitive) files or directories:

    find /relative/path -iname "filename"

    22) Checking which executable file you’re actually running:

    which filename

    23) Deleting all filenames (and only files, not directories) with the same name anywhere on your drives (careful with this one)

    find /realtive/path -type f -name "filename" -exec rm {} \;

    :)

    Read more from BigWhale

    Encoding videos with FFMPEG and H.264

    Prelude to encoding

    Encoding videos can be a real pain. While ffmpeg is an excellent utility for converting videos between various formats it is also a pain to use. If you put H.264 codec on top of t[...]

  2. Steven Steven on June 20, 2009 8:55 pm

    alias ll='ls -l'
    #(might want to stick that in your ~/.bashrc file)

    pwd
    #to find out where you are

    whoami
    #useful if you’re on a server and switch users a lot

    #and of course…..
    man
    #never again will you have to face RTFM ;)

    Read more from Steven

    Install Drush on a Server You Don’t Have Admin Rights To

    I’ve been working with quite a few Drupal sites in the past couple years and recently one of my favorite tools to use has become drush. For those of you who aren’t aware of it, drush is a command line[...]

  3. 20 comandos imprescindibles 20 comandos imprescindibles on June 22, 2009 5:43 am

    [...] Vía [...]

  4. Jady L. Jady L. on June 23, 2009 7:23 am

    ffmpeg -i input.flv -f mp3 -vn -acodec copy ouput.mp3

    sudo sysctl vm.swappiness=0
    sudo swapoff -a

  5. HowtoMatrix HowtoMatrix on June 24, 2009 1:35 pm

    [...] Read more at Ubuntu Linux Help [...]

  6. Sephi Sephi on June 28, 2009 6:15 pm

    10) A shorter way :
    sudo cp /xxxxxx/sources.list{,.bak}

    12) A shorter way :
    sudo halt

    17) An easier way which doesn’t require root privileges (don’t know if it works if the drive is busy) :
    eject

  7. HowtoMatrix HowtoMatrix on September 28, 2009 10:27 pm

    [...] 20 Useful, Common Linux (Ubuntu) Commands for New Users Posted by suvi under Linux, Tricks, Ubuntu New tutorial added to HowtoMatrix database. 20 Useful, Common Linux (Ubuntu) Commands for New Users 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 [...] Link to the original site [...]

Name (required)

Email (required)

Website

Speak your mind