Learning Linux Commands
If you are a complete newbie to Linux, or if you “know enough to be dangerous,” then here are some pointers that may help.
One of the great things about Linux is that, even though the operating system is extensible through the addition of arbitrary commands, there are standards for documenting such commands. Because of these standards, not only is it easy to find out what a command does and how it works, but it’s easy to find out that these commands exist in the first place, even if you don’t know their names.
(Updated 21-May-2007: Added notes about using the type command instead of the which command.)
Commands About Commands:
- man — Display the manual for a command
- whatis — Display a summary of a command (rather than the entire manual)
- apropos — Display a list of commands that pertain to (are apropos to) a keyword
- whereis — Display information about the location of a command: the executable, the source code (if any), and the man pages.
- which — Display which version of a command will execute (for when there are two, or more, commands with the same name installed on the system). See also the type command.
- type — Display how a name would be interpreted if used as a command. In other words, what type of resource is it? (Actually does a more thorough job of distinguishing between multiple resources with the same name than the “which” command.)
MAN — In previous tips, we mentioned the MAN command. MAN stands for manual. It is the main resource for displaying the documentation (a.k.a. “man pages”) for any particular command. For example, to find out how the LS command works, you would enter
man ls
The man command brings up the first page of the manual, and then waits for navigation keystrokes. The most commonly used navigation controls are PageUp, PageDown, Home, End and the letter q (quit). Of course, man has its own man pages.
man man
WHATIS — The whatis command is actually an alias for using the man command with the -f switch (and -f is shorthand for –whatis). So, all of the following are equivalent.
whatis ls man -f ls man --whatis ls
APROPOS — The man pages for any given command usually includes a section of relevant keywords. The apropos command searches through all of the keywords listed in all of the man pages, and reports on any hits.
The apropos command is actually an alias for using the man command with the -k switch (and -k is shorthand for –apropos). So, all of the following are equivalent. (I find that it’s easier to remember “man -k” (where K stands for keyword), than it is to remember the word “apropos”.)
apropos ls man -k ls man --apropos ls
WHEREIS — The whereis command is immensely helpful for working with extended commands, i.e. commands that were not part of the original distribution (”distro”). The whereis command can tell you if, indeed, the command is installed on your system, and if so, where (so that you know how to invoke it). It shows you the location of any command executable, source code, and/or man pages that match the name given. Note: If you only care about searching for the command executables, then add “-b” to tell it to only search for binaries.

WHICH and TYPE — On the occasion that there happens to be two different versions of a command (that is, two different command executables with the same name), the which command tells you which version will actually be executed if you were to enter the command name alone (without specifying its exact location). For example, my installation of CygWin (a Linux emulator for Microsoft Windows), has two different “grep” commands installed.
Even better is the “type” command. Whereas the which command only looks for binary executables of the specified name, the type command considers that the specified name might also be a command alias or a function that would take precedence. Using type without any options returns a detailed answer (i.e. for the question, “what type of resource is this?”)
$ type grep grep is /usr/bin/grep $ type type type is a shell builtin
Using type with an option of -t returns a terse answer, one of these five words: alias, keyword, function, builtin, or file.
$ type -t grep file $ type -t type builtin
(The -t option is useful for checking a resource type within a shell script.)
Note: “man type” displays a combined man page for all bash builtin commands, listed alphabetically. So, use PageDown (or End and PageUp) to get to the description of the type command.
As an aside, I was about to mention what the grep command does. Instead, I think I’ll leave finding that out as an exercise to the reader.
Related articles:
- Use Linux Commands and Shell Scripts directly in Windows
- Quick Tip: Searching for Files in Linux (or Windows)
Read more: Linux
Trackbacks & Pings
Comments
-
You should never use which, it does not know about how things actually resolve (e.g., shell aliases and functions). Try “type”.
-
Thanks for the additional tip. The which command has never steered me wrong, but now that you mention it, I see how it could. I’ll update this article shortly.
-
the article is also missing the “info” command. Really useful if you want to get far in depth with commands.
-
locate much better than whereis
-
I updated this article, adding notes about the type command. (Thanks, again, Anon.)
-
hi
Pls send the reqd details.
Regards,
Shailendra. -
Nice list, cat is a pretty good one as well, does a lot of things other than concatenate as well.
Cheers
-
enjoy
-
I have the study material of Linux OS .I have study for linux for that How to handle this Os With command.plz Send me this material/tutorials.on my mail….ur faithfully nilesh ganage.
-
Hi, How would I find the Path MTU in a Linux machine?What is the command to change the Path MTU. Please Mail me on.
-
can u plz send the material of linux which can be easily understandable.
-
i studied linux material but not understand cleary pls send me material with example commands
-
good matteral

CLI Fun: Get help at the Linux command line (beyond man) » D-L Technology BLOG on 18 May 2007 at 3:21 am
[…] Handy! —Gina Trapani Learning Linux Commands [CodeJacked] […]
Learning Linux Commands » Two Bits on 18 May 2007 at 6:11 pm
[…] Here is a nice set of linux commands to find / learn linux commands. … […]
error is the mother of all inventions on 21 May 2007 at 4:27 am
[…] useful link >> No Comments so far Leave a comment RSS feed for comments on this post. TrackBack URI Leave a comment Line and paragraph breaks automatic, e-mail address never displayed, HTMLallowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> […]
Basic Linux Commands » It’s Not the Network! on 04 Jun 2007 at 6:27 am
[…] This week the Slashdot Poll is about least favorite cliches, and one of the missing poll options that we aren’t supposed to complain about is “This is the year of Linux desktop.” Even if it isn’t, there are certainly more reasons to start experimenting with Linux than ever, and there are more new people to Linux than there ever have been. While there are lots of resources out there for learning some of the basics and getting started, sometimes you just need a reminder while actually doing stuff about what is what. Codejacked has written yet another great article that lists a few commands that can help remind you. This is an article about commands that give you information about commands, and it is an excellent resource for newbies and experienced users alike. Learning Linux Commands [Codejacked] Bookmark to: […]
Mujeres TIC » Blog Archive » Aprendiendo sobre Comandos en Linux on 07 Jun 2007 at 2:21 am
[…] Así que me he decidido a traducir este pequeño manual, que he leído en Codejacked. […]
Cool Websites and Tips (makeuseof extra #67) » MakeUseOf.com on 29 Jun 2007 at 6:17 pm
[…] Learning Linux Commands [codejacked.com] […]
Munich Unix » Learning Linux Commands on 07 Nov 2007 at 8:04 am
[…] read more | digg story […]