Chelistico

It's a tech blog!

Exploring the Basics of Linux Terminal Commands

By Marcelo Vieyra, November 25th 2023 | 2 mins, 320 words

The command line interface (CLI) in Linux provides a powerful and efficient way to interact with your system. While the graphical user interface (GUI) is user-friendly, mastering some basic terminal commands can enhance your control and understanding of Linux. In this article, we'll explore a few fundamental commands to get you started.

Navigating the File System

pwd - Print Working Directory

Use this command to display the current working directory. It's a handy way to confirm your location in the file system.

pwd

ls - List

List the contents of the current directory.

ls

Add options for more details:

  • -l for a long listing format.
  • -a to show hidden files.
ls -l
ls -a
ls -la  # Combine options

cd - Change Directory

Move to another directory. Use cd followed by the directory name.

cd directory_name

For example, to go up one level:

cd ..

Manipulating Files and Directories

cp - Copy

Copy files or directories.

cp source_file destination
cp -r source_directory destination  # Use -r for directories

mv - Move

Move or rename files and directories.

mv source destination

rm - Remove

Delete files or directories.

rm file_name
rm -r directory_name  # Use -r for directories

Note: Be cautious with the rm command, as it permanently deletes files.

Working with Text Files

cat - Concatenate and Display

View the content of a text file.

cat filename

nano - Text Editor

Edit text files using the nano editor.

nano filename

Press Ctrl + X to exit, and it will prompt you to save changes.

System Information

uname - System Information

Display system information.

uname -a

df - Disk Free

Check disk space usage.

df -h

Managing Processes

ps - Process Status

Display information about running processes.

ps aux

kill - Terminate a Process

Stop a running process.

kill process_id

These are just a few basic Linux terminal commands to get you started. As you become more comfortable with the command line, you can explore additional commands and their options to streamline your workflow. The terminal is a powerful tool that provides efficiency and flexibility in managing your Linux system.