Page Body


The Command Prompt

The command line prompt is represented by the sharp (#) or dollar sign ($) symbol. A command with a # means that you must run it as the root user. A command with a $ or no symbol for the prompt means that you can run the command as a non-root user.

To help distinguish between commands and command output, multi-line code block commands will contain a symbol for the command line prompt, when necessary. To distinguish between command line commands and internal program commands (e.g., a command used within a program like vim), a symbol will be used for the command line prompt, as well.

When copying commands, do not include the command line prompt symbol.


Code samples may contain words with the phrase ex_ in them. These words are placeholders for command options, subcommands, and arguments. You will need to replace these words with the actual values that you would like to use as options, subcommands, and arguments for the command in question.

A command argument placeholder followed by ellipses (...) indicate that it is repeatable.

Running Bash Scripts

If you see a Bash script on this site that you want to utilize, copy the script content and save it to a text file on your system. Saving scripts to a Scripts directory in your user's home directory is a common practice, but you should choose what works best for you. To view your user's home directory, run the following command:

echo "${HOME}"

${HOME} is a shell variable that will expand to your user's home directory before the command executes.

The script filename can be arbitrary, but it is probably best to select something that reflects the script's purpose and is easy to remember. Give the script filename a .bash extension.

To ensure that you can easily run the script by entering its filename at the command prompt, you will need to make the script file executable. You can do this with the chmod command. For example, if the script is called example.bash and is stored in a Scripts directory within your home directory, you can make the script executable by running:

chmod 700 "${HOME}/Scripts/example.bash"

Also, you will need to make sure that the location of your Scripts directory is a part of your shell's PATH variable. You can see the current value of your shell's PATH the same way that you viewed your system's home directory, e.g., echo "${PATH}".

${PATH} is a variable that contains the colon-delimited list of directories that your shell uses to search for programs and scripts.

Often, the PATH variable is defined via the .profile (or .bash_profile) file in your user's home directory. You can add your Scripts directory to PATH by appending a line that redefines the PATH variable to the .profile (or .bash_profile) file. For example:

$ {
  echo -e '\n# Set PATH variable with custom locations'
  echo 'export PATH="${PATH}:${HOME}/Scripts"'
} >> "${HOME}/.profile"

Finally, reload the .profile file into your shell's current configuration with the source command:

source "${HOME}/.profile"

Now, you should be able to run the script above at the command line by entering example.bash, regardless of where you are in your system's file system hierarchy.


There are many posts on this site that cover the foundations of the command line interface (CLI). If you are just getting started on your GNU/Linux journey, the content here may help.