The Linux command line is a powerful and efficient way to interact with your system. This reference guide covers 20 essential commands that provide a solid foundation for navigating and performing basic tasks in Linux.

Basic Navigation

ls - List Files and Directories

Show the contents of the current directory.

ls

cd - Change Directory

Move to a different directory.

cd /path/to/directory

pwd - Print Working Directory

Display the current directory path.

pwd

File Operations

cp - Copy Files

Copy files from one location to another.

cp source destination

mv - Move or Rename Files

Move files or rename them.

mv oldname newname

rm - Remove/Delete Files

Delete files. Be cautious; this action is irreversible.

rm filename

Directory Management

mkdir - Make Directory

Create a new directory.

mkdir directoryname

rmdir - Remove Directory

Delete an empty directory.

rmdir directoryname

Viewing and Editing Files

cat - Concatenate and Display File Content

Display the entire content of a file.

cat filename

nano - Text Editor

Open a simple text editor for creating or editing files.

nano filename

System Information

man - Manual Pages

Access the manual pages for a command to learn more about its usage.

man command_name

ps - Process Status

Display information about running processes.

ps

kill - Terminate a Process

Terminate a running process using its process ID (PID).

kill PID

df - Disk Free

Display information about disk space usage.

df -h

du - Disk Usage

Show the disk usage of files and directories.

du -h

File Permissions and Security

chmod - Change File Permissions

Modify the permissions of a file or directory.

chmod permissions filename

sudo - Superuser

Execute a command with administrative privileges.

sudo command

Utilities

history - Command History

View a list of recently executed commands.

history

grep - Search Text

Search for a specific pattern in a file.

grep pattern filename

exit - Exit the Terminal

Close the terminal session.

exit

Important: Use caution with commands like rm and sudo, as they can have significant consequences if used incorrectly.