Tag Archive: Command (computing)



We can classify all of the Linux/Unix commands into two types- Internal And External. Internal commands are the shell built-in commands while external commands are  files present in the $PATH. (Remember we treat everything in the Linux as a file). Commands like pwd, cd ,echo comes under the category of the  internal commands while ls,cp etc comes in the other category. To check whether the command is internal  or external we will use the typeutility (type itself is internal one). Just type the name of the command after the utility and it will return you something like this -

Using Type Utility

If you got a message like “cd is a shell builtin” after the execution of the command  it is an internal command. If you got something else it comes under the category of external commands (like cp in this case).

How Execution  Takes Place : For the external commands, execution is possible  only if the command file is present in the locations mentioned in the $PATH. Otherwise it will give you an error.If the command file is available  , but the path to that file is not included in the PATH variable, it will show you an error. Internal commands don’t need files for their execution. Set of internal commands is stored in shell by default. Sometimes a command with the same name exist in both the categories. Example – echo (external one lies in the /bin/echo) . In this case shell will give preference to the  internal echo first, then comes the turn of the external ones.  So if you use the echo utility internal will get executed. External echo rarely gets executed (You can execute it in the shell  by creating a subshell though).

Pages : Follow ankurtwi on Twitter      


I am reading this book – “Unix concepts and applications” written by the great author “Sumitabha Das”. This book is very good to start from the basics. If you wanna buy it , you can purchase it from Buy Unix Concepts And Applications from Flipkart.com .

It is very difficult to remember each shell command, even experts get confused with them sometimes. There’s an inbuilt documentation called as Man pages in Unix/Linux which practically provides the documentation of every command. You just have to type “man command” (without Quotes). What man command does,it searches for the documentation of the given command and  display it on the shell through the pager program. Man documentation has been divided into several sections. As of present it is divided into 9 sections each having a collection of specific category. Sections are-

1. Executable programs or shell commands

2. System Calls

3. Library Calls

4. Special Files (Usually Found in /dev)

5.File Formats and Coventations

6. Games

7. Miscellaneous

8. System Admin Commands

9. Kernel Routines

Most of the commands are available in the section 1. When you call the man documentation such as   “man wc”  man will look for the documentation of the wc command in the sections starting from section number 1. As soon as it finds it, it will stop looking further and  will display the documentation of the wc from the section 1.  There are many commands which are available in the multiple sections of the man documentation. For example passwd command is available in both section 1 and section 4. To locate the documetation section wise you should type the section number as an argument. Ex- “man 4 passwd” . This will display the man page of passwd form the section 4 not from the section 1.

Pages : Follow ankurtwi on Twitter      

Follow

Get every new post delivered to your Inbox.

Join 70 other followers

%d bloggers like this: