What is a command? Linux command tutorial with examples

What is a Command?

The simplest answer to the question, “What is a command?”, is that a command is a software program that when executed on the command line, performs an action on the computer.

You may also like: Introduction to Linux Operating System

When you consider a command using this definition, you are really considering what happens when you execute a command. When you type in a command, a process is run by the operating system that can read input, manipulate data and produce output. From this perspective, a command runs a process on the operating system. Which then causes the computer to perform a job.

Different sources of commands

However, there is another way of looking at what a command is: look at its source. The source is where the command “comes from” and there are several different sources of commands within the shell of your CLI:

  • Commands built-in to the shell itself: A good example is the cd command as it is part of the bash shell. When a user types the cd command, the bash shell is already executing and knows how to interpret that command, requiring no additional programs to be started.
  • Commands that are stored in files that are searched by the shell: If you type a ls command, then the shell searches through the directories that are listed in the PATH variable to try to find a file named ls that it can execute. These commands can also be executed by typing the complete path to the command.
  • Aliases: An alias can override a built-in command, function, or a command that is found in a file. Aliases can be useful for creating new commands built from existing functions and commands.
  • Functions: Functions can also be built using existing commands to either create new commands, override commands built-in to the shell or commands stored in files. Aliases and functions are normally loaded from the initialization files when the shell first starts, discussed later in this section.


Hamza Arif
Follow us

Hamza Arif

Hey, i hamza arif student of telecommunication from BZU, i am good in Networking, Telecommunication and Web Development working on different projects and try my best to teach them to all of you.
Hamza Arif
Follow us

2 thoughts to “What is a command? Linux command tutorial with examples

Leave a comment

Your email address will not be published. Required fields are marked *