in

10 Unknown but Useful Linux Terminal Commands

- - 29 comments
Before, I have posted here a few basic Linux terminal commands that I think are essential for newbies to know. I've also shared some deadly ones that should be avoided at all costs. This time, I'm going to show you several terminal commands that are perhaps unfamiliar to many new-to-Linux users but could be really handy when used properly.

Here’s a list of 10 rather unknown yet useful Linux terminal commands:

1. Kill a running application by its name:

killall [app_name]

2. Display disk space usage:

df –h

3. Locate the installation directories of a program:

whereis [app]

4. Mount an .iso file:

mount /path/to/file.iso /mnt/cdrom –oloop

5. Record or capture a video of your desktop:

ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq /tmp/out.mpg

6. Find out the Universally Unique Identifier (UUID) of your partitions:

ls /dev/disk/by-uuid/ -alh

7. Show the top ten running processes (sorted by memory usage):

ps aux | sort -nrk 4 | head

8. Make an audible alarm when an IP address goes online:

ping -i 60 -a IP_address

9. Run the last command as root:

sudo !!

10. Make a whole directory tree with one command:

mkdir -p tmp/a/b/c

29 comments

  1. I already know most of them but I especially find this interesting:

    "8. Make an audible alarm when an IP address goes online:"

    Thanks!

    ReplyDelete
  2. AnonymousMay 31, 2009

    You should add "For Noobs" in your title so guys like me don't waste time reading stuff like this just so that guys like you can get paid to write crap.

    ReplyDelete
  3. I think on number 4, there should be a space between "-o" and "loop" like so:

    mount /path/to/file.iso /mnt/cdrom –o loop

    ReplyDelete
  4. and:
    pgrep procname
    tail -f filename [filename]

    ReplyDelete
  5. AnonymousMay 31, 2009

    No need to write "for noobs" because it's labeled "for dummy" just before the comment section.

    ReplyDelete
  6. AnonymousMay 31, 2009

    There used to be a cli command to list the history or buffer of the commands previously typed. What is that?

    ReplyDelete
  7. AnonymousMay 31, 2009

    history.

    ReplyDelete
  8. AnonymousMay 31, 2009

    I tried the sudo !! command but I keep getting an error. It says user !! isn't found. Any ideas?

    ReplyDelete
  9. AnonymousJune 01, 2009

    Another unknown but useful CLI tool is 'apropos'.
    An example would be:

    apropos who

    Really useful when you know what command you need but forgot its name.

    ReplyDelete
  10. AnonymousJune 01, 2009

    Know most of them. some of my favourite shell tricks below:

    using ranges {..} in wildcards

    e.g 1. rm {A-Z}*
    e.g 2. mkdir {A-Z}/{1..9}

    e.g 3. mkdir 2009-05-{1..31}

    e.g 4. pkill fox

    e.g 5. whoami

    e.g 6. uname -a

    e.g.7. cd -


    e.g 1: deletes all letters starting with capital letter

    e.g 2: will create directories of A/1, A/2 ...Z/9

    e.g 3: mkdir will create directories 2009-05-1 ... 2009-05-31

    e.g 4. pkill [substring] will kill all process that contain [substring]

    e.g 5. self explanetory

    e.g 6 gives OS info
    You should have put Noob or beginner IN THE TITLE.

    e.g 7. switches to last working directory

    ReplyDelete
  11. Don't use killall! Use pkill. If you go to some other *nix OS's [say Solaris], killall doesn't take an argument. It just kills EVERYTHING! So don't get in the habit of using killall.

    Use pkill

    ReplyDelete
  12. This last comment was far more useful than the article. Although #2 doesn't work.

    ReplyDelete
  13. AnonymousJune 01, 2009

    How about making it easier for people to use the apps instead of making them create a file to save the commands in!

    ReplyDelete
  14. I prefer pkill over killall... it is shorter to type and it will kill any aplication that matches the regular expresion you type.. you only need to type "pkill firef" to kill firefox

    ReplyDelete
  15. Anonymous said: "You should add "For Noobs" in your title so guys like me don't waste time reading stuff like this just so that guys like you can get paid to write crap"




    Please...your hubris is only outdone by the likelihood you haven't bathed in a week.

    To the author--thanks. A couple of these will be useful.

    ReplyDelete
  16. Nice list, although some "cd" tricks are worth mentioning.

    cd by itself takes the current user back to their home folder,
    while cd - returns to the previous folder, when the last cd command was issued, while 2 dashes goes back twice, 3 dashes goes back three times, etc...

    ReplyDelete
  17. AnonymousJune 01, 2009

    Is killall really that unknown? Apart from that, this was insightful in most aspects.

    ReplyDelete
  18. Great post thank you!
    For what I can remember I found references to killall only once for the past few years so I suppose it is sort of unknown.

    ReplyDelete
  19. I was searching for that UUID for a long time. Now I can fix my fstab easily :)

    ReplyDelete
  20. The ffmpeg command is particulaly interesting. THanks man!!!

    ReplyDelete
  21. one of my favorites is the watch command

    ReplyDelete
  22. Always be careful of the sudo command. It can bring doom and gloom.

    Hi Jun!

    Sudo please change my link in your blogroll to http://www.dannybuntu.com

    I am no longer a bum!

    At long last I came out of my rock and started to learn how to make money online as a freelance writer

    Sa wakas.

    P.S. I put you in my G-old friends hehehe.

    ReplyDelete
  23. In the tip 5 you can add -f oss -i /dev/dsp1 to capture desktop with audio.
    Like this:
    ffmpeg -f oss -i /dev/dsp1 -f x11grab -s wxga -r 25 -i :0.0 -sameq /tmp/out.mpg

    if dsp1 don't capture audio use dsp0.

    ReplyDelete
  24. what's the command for viewing the history of safari even if you erase it or do private browsing?

    ReplyDelete
  25. Uh, exactly who doesn't know these? These are basic Linux commands. I vote also to add on "for noobs" to be tacked on there, as that's the only people who don't know these.

    ReplyDelete
  26. This is total junk.

    ReplyDelete