Learning the Terminal
The Terminal and Terminal Emulators
A Terminal is an interface that allows a user to input data and may write output to the screen. A Terminal Emulator is a window that emulates what a Terminal does, the default Terminal in the Plasma desktop is Konsole, but other Terminal emulators may be installed. See List of Terminal Emulators for more details.
Shell
A shell is the piece of software that's in charge of interpreting commands written in a Terminal and perform actions based on the input it read. Shells can also be used to execute shell scripts. The default shell may be replaced by user choice.
Getting started with commands
After opening the Terminal Emulator of choice, the user is greeted by the shell prompt which may display some information like the username or the current location where the shell was executed, it may also show if the shell is being used in "user mode" $ or in "root mode" # this is important because some commands require the shell to be in root mode, to enter root mode one must insert the command su and login with the root account.
It is ill advised to use the shell in "root mode" most of the times, however one can temporarily gain root privileges using the sudo command[1].
Hash and Dollar signs
It is important to note #
and $
when reading commands. This wiki, and other guides on the internet, use these symbols as a convention.
Dollar sign
The dollar sign ($
) represents commands that should be run as a regular user, not in "root mode".
$ cd Documents
Hash sign
The hash symbol (#
) represents commands that should be run as root, in "root mode". Often you can just add sudo
to the front of these commands.
# pacman -Syu
You can run the command above as:
$ sudo pacman -Syu
Basic shell commands
$ echo hello
It prints hello to the screen.
$ ls
list it shows all the visible files and folders in the current directory.
$ cd
change directory allows you to navigate trough valid folders relative to the current directory.
$ pwd
print working directory prints the absolute path (from the root folder) to the current directory.
$ cat filename
It prints all the contents of filename into the console.
$ touch filename
It creates a file called filename.
$ mkdir folder
It creates a folder called folder.
$ cp /path/to/file /path/to/destination
It copies a file located in /path/to/file into /path/to/destination, it can also copy folders. Note that if /path/to/destination is not a folder, the copied file will be named destination.
$ mv /path/to/file /path/to/destination
It moves /path/to/file into /path/to/destination, it can also move folders and if the destination already exists it will be overwritten, so use this command with care.
It would be impossible to fit all possible commands into this guide. Instead, the man command can be used to find more information about a command.
$ man command
If command is installed on a system, running man command will often open a manual describing how to use command