Home Top Ad

Shell commands - Linux Shell Scripting Tutorial - A Beginner's handbook

Share:



style="display:block"
data-ad-client="ca-pub-3789102779598541"
data-ad-slot="4927543765"
data-ad-format="auto"
data-full-width-responsive="true">






← The bash shellHomeThe role of shells in the Linux environment →


The bash shell comes with two types of commands:



  • Internal commands (builtins) - part of the shell itself, i.e. built into the shell.

  • External commands - separate binaries stored in /sbin, /usr/sbin, /usr/bin, /bin, or /usr/local/bin directories.


Bash and Command Types


The bash shell understands the following types of commands:



  • Aliases such as ll

  • Keywords such as if

  • Functions (user defined functions such as genpasswd)

  • Built in such as pwd

  • Files such as /bin/date


The type command can be used to find out a command type.


type command


The type command can be used to find out if a command is built in or an external binary file.


Find out if ls is built in or an external command


Type the following command at a shell prompt:


Sample Output:


ls is /bin/ls

To find out if history command is built in or an external command, enter:


sample Output:


history is a shell built in

However, some commands are supplied as both internal and external commands. For example:



type -a true
type -a echo


sample Outputs:


echo is a shell built in
echo is /bin/echo

List of command bash keywords and built in commands


← The bash shellHomeThe role of shells in the Linux environment →








style="display:block"
data-ad-client="ca-pub-3789102779598541"
data-ad-slot="4927543765"
data-ad-format="auto"
data-full-width-responsive="true">