Linux Shell Commands Introduction

The Linux shell commands are ways or instructions through which you can instruct your system to do some action.

Commands are executed in the command line.

Sample syntax of :

# command [option] [argument]  

Linux some commands which do not have any option or do not accept any argument such as ‘clear’ and ‘pwd’ command.


‘clear’ command clears out all the previous commands and outputs from terminal display.


‘pwd’ command stands for ‘print working directory’.

That is doesn’t accept any option or argument and displays the detail of current working directory.

Types of Commands

External or built-in commands

The Linux Built-in commands are internal commands that are built-in the shell.

Linux Built-in commands are called from the shell and executed directly within the shell itself. So you can list all built-in commands with the help of ‘help’ and ‘compgen -b’ command.

Now we can some example of built-in commands are ‘pwd’, ‘help’, ‘type’, ‘set’, ‘unset’, etc.

External commands are other than built-in commands.

Those commands are programs, which have their own binary and located in the filesystem. The Linux commands that your system offer and are totally shell independent.

Mostly these commands reside in /bin, /sbin, /usr/sbin.

type command

Linux type command tell us whether a command is given to the shell is a built-in or external command.

Sample syntax of :

# type <command>  

Like example of :

type pwd  
type cd  
type man  
type cat  
type file  

See your terminal after run the command, commands like ‘pwd’ and ‘cd’ are built-in commands while commands ‘man’, ‘cat’, and ‘file’ are external commands.

‘type’ command also tells whether a command is aliased or not.

Like example of :

# type ls  

See your terminal after run the command, ‘type’ command shows that ‘ls’ is an aliased command.

type -a

Linux type -a option tells about all type of command whether it is built-in, external, or aliased. Some commands are both external and built-in commands.

The built-in command will always takes priority until and unless path of external command is mentioned.

Sample syntax of :

# type -a <command>  

Like example of :

# type -a echo  

See your terminal after run the command, ‘echo’ command is internal as well as external. It is use external ‘echo’ command, path “/bin/echo” is mentioned.


‘which’ command locates the path of a command.

Sample syntax of :

# which <command1> <command2> <command3>....  

Like example of :

#which ls pwd rmdir mkdir cp cd file man  

See your terminal after run the command, except ‘cd’ command, all other commands are external commands because bash has displayed their external path.

Leave a Reply