LilyYucarp

the lav kit

Introduction to the terminal

Terminal is a crucial part for the (GNU/)Linux system. Even the graphical environment is technically running on a terminal. Although the terminal is very crucial, many people don't bother learning it as it's seen as a screen that people enter cheat codes and get something in return. In reality, the terminal is just a place where people write commands in order to execute them. Although these commands might be hard to remember when starting, they will become a tool that will make your life easier. Let's have a quick look to the terminal.

yourname@computer:~/$
					

When you open the terminal, you will encounter with a prompt like this. The first part will be the username that you are running as. The second part is the name of your computer, which is called hostname. The thing after the colon is your location, in this case the current session is in the users home directory. After all of that, there is a dollar sign, which shows that the shell is working and is ready to take commands. Although the look of this prompt might look different from system to system, the main structure is the same.

Important commands

So, it's that part of this section. There will be a lot of commands to remember. However, trying to just memorizing them is inefficient. It's important to understand commands in order to fully remember them. Let's take a look at the structure of commands first:

command -(options) (filename1/argument1) (filename2/argument2) ...
					

This is the main structure of a command. Many commands take arguments in order to change their way of working. For example, the ls command takes the l argument in order to show a more detailed list of files and directories. Many commands also take more arguments, which allow them to work on more things. All of the arguments are optional, yet some commands might need an argument in order to work. Also options usually take the "-" character, so please don't forget to put them.

File navigation commands

Command Meaning
ls (directory) Show the contents of the directory mentioned. If no argument is provided, it will show the contents of the current directory. (list)
pwd Show the current directory. (present working directory)
cd (directory) Change directory to the mentioned directory. If no argument is provided, it will change the current directory into the home directory. (change directory)

Important knowledge:

If you want to specify the parent directory, you can use .. as an alias for the parent directory. If you want to specify the current directory, you can use . for an alias for current directory. In Linux, file locations are seperated by / instead of \. This distinction might be hard to get used to but it will cause no harm if you use the wrong character.

Other commands

Command Meaning
file (file) Show the type of the file. (file)
echo (message) Print the written message back. (echo)
whoami Check which user you are running as.

These commands might seem intimidating at first, but getting used to them is easy, especially when you have understood the meaning of the commands.

Terminal shortcuts

When using a program that's text-based, shortcuts become an important feature to deal with text. The terminal also features it, and it will make some tasks easier. Remember that these aren't all of the shortcuts that are used in the terminal.

Command Meaning
Ctrl+A Go to the first character in the prompt.
Ctrl+E Go to the last character in the prompt.
Ctrl+L Clean the terminal screen.
Ctrl+H An alternative to the backspace key.
Ctrl+O Execute the command.
Ctrl+C Terminate the program running.
Ctrl+P or the up arrow key Show the previous command.
Ctrl+N or the down arrow key Show the next command if there is.
Tab Autocomplete. When there are multiple choices it will print them.

These are the main shortcuts that you can use in your daily tasks. Memorizing them might seem hard, so it's better to learn with practicing.

Before: Logging in and logging out Next: Package managers