How to… Terminal
Introduction
The Terminal (also called Shell, Console, PowerShell, or Command Line) is a text-based interface to your computer. Back in time, when there were no fancy graphical user interfaces (UIs), you had to use the terminal to interact with your computer. Nowadays, we often use the mouse. Nevertheless, the terminal offers some significant advantages and is indispensable in many fields.
Setup
For those who use an Apple device or have Linux installed: Congratulations! All of the following commands will run directly in your standard terminal.
If you are using a Windows device: No problem. Just install the WSL (Windows Subsystem for Linux) extension. This allows you to run Linux commands natively on Windows.
Commands
We use the terminal by employing commands. You simply type a command and press \(\text{Enter}\). There are many built-in commands, but you only need to know a few to get started.
Getting an Overview
When you arrive at a folder, you may want to know what’s inside. Use ls (List) to list the contents of the folder:
lsParameters and Options
Sometimes, you can add a parameter or option to the command to get a special output. For instance, ls does not show hidden files by default. Running ls -a (all) lists all files in a folder, including the hidden ones:
ls -aNote: Any file can be made hidden by adding a period (
.) to the beginning of the file name:.hidden_notes.txt.
Most Used Commands
Here is a quick list of the most frequently used commands:
pwd: Print Working Directory (Shows the current directory).ls: List (Lists all files in a directory).cd: Change Directory (Changes the current directory).touch: Creates a new, empty file.mv: Move (Moves a file or renames it).rm: Remove (Deletes a file or directory).
Do I Really Need All This?
The short answer: Yes. There will be a time when you need to use the Terminal. Example: You have to use a Server for a study project. Servers often lack a graphical User Interface (UI) where you can click around with your mouse. The Terminal is often the only tool you can use to work on a server, manage files, and execute programs.
Check out the Linux Cheat Sheet by Mathis et al.