Terminal Explained

How you interact with Linux on the command line

On a Linux system, the terminal refers to a command-line interface that allows you to interact with the operating system by typing commands. It's a powerful tool for managing and controlling your server, especially when it doesn't have a graphical user interface (GUI).

The terminal provides a text-based environment where you can execute various commands to perform tasks such as managing files and directories, installing software, configuring system settings, and much more. It's like having direct control over your server's operations through typed instructions.

Here are some basic commands and examples to help you get started with the terminal on a Linux server:

Navigating the file system

  • pwd: Display the current working directory.
  • ls: List files and directories.
  • cd: Change directory.
  • mkdir: Create a new directory.
  • rm: Remove files and directories.

Example: To navigate to the "Documents" directory and list its contents, you can type:

cd Documents

Managing files

  • touch: Create an empty file.
  • cp: Copy files and directories.
  • mv: Move or rename files and directories.
  • cat: Display the contents of a file.

Example: To create a new file called "my_file.txt" and display its contents, you can type:

touch my_file.txt
cat my_file.txt

Working with text files

  • nano: A simple text editor for editing files.
  • vi or vim: More advanced text editors with additional features.

Example: To edit the my_file.txt using Nano, you can type:

nano my_file.txt

Managing processes

  • ps: List running processes.
  • kill: Terminate a process.

Example: To list all running processes and terminate a specific process, you can type:

ps aux
kill <process_id>

Managing users and permissions

  • sudo: Run a command with administrative privileges.
  • useradd: Create a new user.
  • passwd: Change user's password.
  • chmod: Change file permissions.

Example: To create a new user called john and change its password, you can type:

sudo useradd john
sudo passwd john

These are just a few examples of the commands you can use in the terminal. Linux provides a vast array of commands and options to perform different tasks. You can explore and learn more about them as you become more comfortable with the terminal.

Remember, the terminal requires precise command syntax, so be cautious while executing commands and ensure you understand their purpose before running them.