Linux is widely used for web servers, cloud infrastructure, development environments, DevOps, databases, and enterprise applications. One of the most important skills for working with Linux is understanding how to use the command line.
The Linux terminal allows developers and system administrators to perform tasks quickly without relying on a graphical interface. From navigating directories and creating files to managing permissions and monitoring processes, Linux commands provide direct control over the operating system.
This guide introduces some of the most useful and simple Linux commands that beginners should know.
What Is a Linux Command?
A Linux command is an instruction entered into the terminal to tell the operating system to perform a specific action.
For example, you can use commands to:
Navigate through directories
Create and delete files
Copy and move files
Search for information
Change permissions
Install software
Monitor system resources
Manage processes
Work with remote servers
Linux commands are generally short and can be combined with options and arguments to perform more specific operations.
1. pwd – Print Working Directory
The pwd command shows the directory you are currently working in.
pwd
For example, it may return:
/home/user/projects
This is useful when you are working across multiple directories and want to confirm your current location.
2. ls – List Files and Directories
The ls command displays files and directories in the current location.
ls
You can use options to get additional information.
ls -l
This displays information such as:
File permissions
Owner
Group
File size
Modification date
File name
To include hidden files:
ls -la
3. cd – Change Directory
The cd command is used to move from one directory to another.
cd /home/user
To move into a directory within the current location:
cd projects
To move one level up:
cd ..
To return to your home directory:
cd ~
Directory navigation is one of the first Linux skills beginners should learn.
4. mkdir – Create a Directory
The mkdir command creates a new directory.
mkdir projects
You can also create nested directories using:
mkdir -p projects/webapp/src
This is useful when setting up application folders or organizing files.
5. touch – Create a File
The touch command can create a new empty file.
touch example.txt
It can also update the timestamp of an existing file.
Developers commonly use touch when quickly creating configuration, source-code, or documentation files.
6. cat – Display File Content
The cat command displays the contents of a file.
cat example.txt
It can be useful for quickly viewing small configuration or text files.
For large files, commands such as less are generally more convenient.
7. cp – Copy Files and Directories
The cp command copies files.
cp source.txt destination.txt
To copy a directory and its contents:
cp -r project backup
Copying files is useful when creating backups or duplicating configuration and project resources.
8. mv – Move or Rename Files
The mv command is used to move files or directories.
mv example.txt documents/
It can also rename a file:
mv oldname.txt newname.txt
This makes mv an important command for both file organization and renaming.
9. rm – Remove Files
The rm command removes files.
rm example.txt
To remove a directory and its contents:
rm -r project
Be careful when using rm, especially with recursive options, because deleted files may not be recoverable through a normal recycle bin.
10. clear – Clear the Terminal
The clear command removes previously displayed content from the terminal screen.
clear
It does not delete files or change system data. It simply makes the terminal easier to read.
11. whoami – Identify the Current User
The whoami command displays the username of the currently logged-in user.
whoami
This is particularly useful when working on remote servers or when switching between user accounts.
12. sudo – Run Commands With Elevated Privileges
sudo allows an authorized user to execute a command with elevated privileges.
For example:
sudo apt update
It is commonly used for administrative tasks such as installing software, modifying protected files, and managing system configurations.
Because commands executed with elevated privileges can make significant system changes, sudo should be used carefully.
13. man – Read Command Documentation
The man command displays the manual page for a Linux command.
For example:
man ls
This can show available options, syntax, and descriptions.
When you are unsure how a command works, checking its manual is one of the most useful Linux habits to develop.
14. find – Search for Files
The find command searches for files and directories based on specified conditions.
For example:
find /home/user -name "example.txt"
You can search by:
File name
File type
File size
Modification time
Permissions
Ownership
This makes find particularly useful when working with large projects or servers.
15. grep – Search Text
The grep command searches for text patterns inside files or command output.
For example:
grep "error" application.log
It can be very useful when troubleshooting application logs.
A developer or system administrator can use grep to quickly locate warnings, errors, IP addresses, configuration values, or other information.
16. chmod – Change File Permissions
Linux uses permissions to control who can read, write, or execute files.
The chmod command changes these permissions.
For example:
chmod 755 script.sh
Permissions should be configured carefully, particularly on production servers.
Avoid giving files or directories broader permissions than necessary.
17. chown – Change File Ownership
The chown command changes the owner or group associated with a file.
For example:
sudo chown user:user example.txt
This is useful when application files have been created by one user but need to be accessed by another authorized user or service.
18. ps – View Running Processes
The ps command displays information about running processes.
For example:
ps aux
This can help identify applications and processes currently running on the system.
When troubleshooting a server, process information can help determine whether a particular service or application is running.
19. top – Monitor System Processes
The top command provides a real-time view of running processes and resource usage.
top
It can help you monitor:
CPU usage
Memory usage
Running processes
Process IDs
System load
This makes it useful for basic server monitoring and troubleshooting.
20. df – Check Disk Usage
The df command shows available and used disk space.
df -h
The -h option makes the output easier to read.
Monitoring disk space is important because a server can experience application or database problems when available storage becomes critically low.
21. du – Check Directory Size
The du command shows how much disk space files and directories are using.
For example:
du -sh /var/log
This can help identify directories consuming significant amounts of storage.
22. free – Check Memory Usage
The free command displays information about system memory.
free -h
It provides information about memory usage and availability, which can be useful when investigating application performance problems.
23. ping – Test Network Connectivity
The ping command can be used to test basic network connectivity with another host.
ping example.com
It sends network requests and reports whether responses are received.
Developers and administrators often use it as an initial troubleshooting step when investigating connectivity issues.
24. curl – Make HTTP Requests
The curl command is widely used to communicate with URLs and APIs.
For example:
curl https://example.com
It is particularly useful for:
Testing APIs
Checking HTTP responses
Downloading resources
Troubleshooting web services
Testing endpoints
For developers working with REST APIs, curl is an especially useful command-line tool.
25. wget – Download Files
The wget command can download files from the internet.
For example:
wget https://example.com/file.zip
It can be useful when installing software or downloading resources directly on a remote Linux server.
26. apt – Manage Packages on Debian-Based Systems
On Debian and Ubuntu-based systems, apt is commonly used to manage software packages.
For example:
sudo apt update
To install a package:
sudo apt install nginx
To remove a package:
sudo apt remove nginx
The exact package-management commands depend on the Linux distribution you are using.
27. history – View Previous Commands
The history command displays commands previously entered in the terminal.
history
This can be useful when:
Repeating previous commands
Troubleshooting
Reviewing administrative work
Finding a command you used earlier
You can also use keyboard shortcuts such as the Up Arrow to navigate through previously entered commands.
28. echo – Display Text
The echo command displays text or variable values.
echo "Hello Linux"
It is also frequently used in shell scripts.
For example:
echo $PATH
This displays the current value of the PATH environment variable.
29. export – Set Environment Variables
The export command can make environment variables available to processes started from the current shell.
For example:
export APP_ENV=production
Environment variables are commonly used to configure applications without hardcoding environment-specific values into source code.
30. exit – Close the Terminal Session
The exit command ends the current shell session.
exit
When connected to a remote Linux server through SSH, it can also close the current remote shell session.
Linux Commands for Developers
Developers working with Linux servers should become comfortable with commands for:
File management
Directory navigation
Permissions
Process management
Package installation
Network testing
Log analysis
Disk monitoring
Memory monitoring
Environment configuration
These skills can make everyday development and server administration considerably faster.
Linux Commands for Server Administration
Linux commands become particularly valuable when managing cloud and production servers.
Administrators commonly use the terminal to:
Inspect server resources
Restart services
Review logs
Manage users
Configure permissions
Install packages
Test network connectivity
Monitor disk usage
Troubleshoot application issues
For production systems, commands should be executed carefully and preferably within established operational and change-management procedures.
Linux Commands and Shell Scripts
One of the biggest advantages of Linux commands is that they can be combined into shell scripts.
For example, repetitive tasks can be automated using Bash scripts.
A script can:
Check disk space.
Search logs for errors.
Create a backup.
Compress files.
Move files to another location.
Send a notification.
This turns individual Linux commands into repeatable automation workflows.
Best Practices When Using Linux Commands
Understand Before Executing
Do not run a command on a production server unless you understand what it does.
Be Careful With sudo
Commands executed with elevated privileges can make system-wide changes.
Be Especially Careful With rm
Always verify the target path before deleting files recursively.
Use Documentation
When unsure about syntax or options, use:
man command
or the command's official documentation.
Test on Non-Production Systems
Where possible, test potentially disruptive commands in a development or staging environment before using them in production.
Use Scripts for Repetitive Tasks
If the same sequence of commands is repeatedly executed, consider automating it with a properly tested shell script.
Why Linux Command-Line Skills Matter
Linux remains an important platform for modern application hosting, cloud infrastructure, DevOps, containers, and backend systems.
Although graphical administration tools are available, command-line skills provide:
Faster server management
Better troubleshooting capabilities
Automation opportunities
Remote administration
Greater control over system resources
Easier integration with DevOps workflows
Learning a small set of common commands can therefore provide a strong foundation for developers and system administrators.
Conclusion
Linux commands provide a simple but powerful way to interact with the operating system. Beginners can start with basic commands such as pwd, ls, cd, mkdir, touch, cp, mv, and rm, and gradually learn commands for permissions, processes, networking, system monitoring, and automation.
You do not need to memorize every Linux command. The most important skill is understanding the common commands, knowing where to find documentation, and using them safely.
As your Linux experience grows, these commands can become an essential part of development, server administration, cloud management, and DevOps workflows.