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:
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
I already know most of them but I especially find this interesting:
ReplyDelete"8. Make an audible alarm when an IP address goes online:"
Thanks!
Awesome!
ReplyDeleteYou 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.
ReplyDeleteI think on number 4, there should be a space between "-o" and "loop" like so:
ReplyDeletemount /path/to/file.iso /mnt/cdrom –o loop
and:
ReplyDeletepgrep procname
tail -f filename [filename]
No need to write "for noobs" because it's labeled "for dummy" just before the comment section.
ReplyDeleteThere used to be a cli command to list the history or buffer of the commands previously typed. What is that?
ReplyDeletehistory
ReplyDeletehistory.
ReplyDeleteI tried the sudo !! command but I keep getting an error. It says user !! isn't found. Any ideas?
ReplyDeletefree -m is also handy
ReplyDeleteAnother unknown but useful CLI tool is 'apropos'.
ReplyDeleteAn 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:
ReplyDeleteusing 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.
ReplyDeleteUse pkill
This last comment was far more useful than the article. Although #2 doesn't work.
ReplyDeleteHow about making it easier for people to use the apps instead of making them create a file to save the commands in!
ReplyDeleteI 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
ReplyDeleteAnonymous 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"
ReplyDeletePlease...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.
ReplyDeletecd 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.
ReplyDeleteGreat post thank you!
ReplyDeleteFor 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 :)
ReplyDeleteThe ffmpeg command is particulaly interesting. THanks man!!!
ReplyDeleteone of my favorites is the watch command
ReplyDeleteAlways be careful of the sudo command. It can bring doom and gloom.
ReplyDeleteHi 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.
In the tip 5 you can add -f oss -i /dev/dsp1 to capture desktop with audio.
ReplyDeleteLike 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.
what's the command for viewing the history of safari even if you erase it or do private browsing?
ReplyDeleteUh, 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.
ReplyDeleteThis is total junk.
ReplyDelete