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


23 comments:
I already know most of them but I especially find this interesting:
"8. Make an audible alarm when an IP address goes online:"
Thanks!
Awesome!
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.
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
and:
pgrep procname
tail -f filename [filename]
No need to write "for noobs" because it's labeled "for dummy" just before the comment section.
There used to be a cli command to list the history or buffer of the commands previously typed. What is that?
history
history.
I tried the sudo !! command but I keep getting an error. It says user !! isn't found. Any ideas?
free -m is also handy
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.
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
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
This last comment was far more useful than the article. Although #2 doesn't work.
How about making it easier for people to use the apps instead of making them create a file to save the commands in!
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
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.
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...
Is killall really that unknown? Apart from that, this was insightful in most aspects.
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.
I was searching for that UUID for a long time. Now I can fix my fstab easily :)
The ffmpeg command is particulaly interesting. THanks man!!!
Comments