Command Line Basics
There are several different shells on Linux, these are just a few:
- Bourne-again shell (Bash)
- C shell (csh or tcsh, the enhanced csh)
- Korn shell (ksh)
- Z shell (zsh)
With the most common one being Bash.
When using an interactive shell, the user inputs commands at a so-called prompt. For each Linux distro, the default prompt may look a little different, but it usually follows this structure:
Default
username@hostname current_directory shell_type
where:
- username is the name of the user that runs the shell.
- hostname is the name of the host on which the shell runs. You can change it or show the current host name with
hostname
. - current_directory is the directory that the shell is currently in. A ~ means that the shell is in the current user's home directory.
- shell type
- $ indicates the shell is run by a regular user.
- # indicates the shell is run by the superuser root.
Here are some examples of the default prompt on different distros:
$ Regular user Ubuntu or Debian GNU/Linux
carol@mycomputer: ~$
# Super user Ubuntu or Debian GNU/Linux
root@mycomputer: ~#
$ Regular user Red Hat or CentOS
[carol@mycomputer ~] $
# Super user Red Hat or CentOS
[root@mycomputer ~] #