Linux Commands Every Developer Should Know
Learn the most useful Linux commands for developers, from navigating files and managing processes to searching logs, checking resources, and working with permissions.

Tools used: Linux, Linux Terminal, SSH, VS Code
Prerequisites: Basic computer knowledge and access to a Linux terminal or Linux-based environment.
Linux Commands Every Developer Should Know
If you work in software development, cloud, DevOps, backend engineering, or cybersecurity, you will eventually interact with a terminal.
You might use it to:
- Start an application
- Install packages
- Inspect files
- Check server resources
- Read logs
- Connect to remote servers
- Manage processes
- Test network connectivity
- Work with Git
- Troubleshoot production problems
You do not need to memorize hundreds of commands.
A small set of commands covers a surprisingly large part of everyday development work.
1. Start With the Terminal
A Linux terminal allows you to interact with the operating system using commands.
For example:
pwdThis shows your current directory.
Then:
lsshows the files and directories in the current location.
A typical workflow looks like:
Open Terminal
↓
Check Location
↓
List Files
↓
Navigate
↓
Work With Files
↓
Run Application2. pwd — Where Am I?
Use pwd to print your current working directory.
pwdExample:
/home/developer/projectsThis is especially useful when working with multiple directories.
3. ls — List Files
The basic command is:
lsUseful variations:
ls -lShows detailed information.
ls -aShows hidden files.
ls -lahShows detailed information in a human-readable format, including hidden files.
You will use ls constantly.
4. cd — Move Between Directories
Use cd to change directories.
cd projectsMove to the parent directory:
cd ..Go to your home directory:
cd ~Go to the root directory:
cd /A simple navigation pattern:
/home
↓
/home/developer
↓
/home/developer/projects
↓
/home/developer/projects/my-app5. mkdir — Create a Directory
Create a directory:
mkdir my-projectCreate nested directories:
mkdir -p projects/web/frontendThe -p option creates missing parent directories when needed.
6. touch — Create a File
Create an empty file:
touch app.jsMultiple files:
touch index.html style.css script.jsThis is useful when creating project files directly from the terminal.
7. cp — Copy Files
Copy a file:
cp app.js backup.jsCopy a directory recursively:
cp -r project project-backupBe careful when copying files because an existing destination can potentially be overwritten.
8. mv — Move or Rename
Move a file:
mv app.js src/app.jsRename a file:
mv old-name.js new-name.jsMove a directory:
mv project ~/projects/The same command is commonly used for both moving and renaming.
9. rm — Remove Files
Remove a file:
rm old-file.txtRemove an empty directory:
rmdir old-directoryRemoving directories recursively requires extra care:
rm -r old-projectAvoid using destructive commands unless you are certain about what they target.
Before deleting, check:
pwd
ls10. cat — Read a File
Display a file:
cat package.jsonThis is convenient for small files.
For large files, commands such as less are usually more practical.
11. less — Read Large Files
Open a file:
less application.logYou can scroll through the file without loading the entire file into a terminal view at once.
Useful keys include:
Space → Next page
b → Previous page
/ → Search
q → Quit12. head — See the Beginning
Show the first lines:
head application.logShow the first 20 lines:
head -n 20 application.logUseful when you only need to inspect the beginning of a large file.
13. tail — See the End
Show the last lines:
tail application.logShow the last 50 lines:
tail -n 50 application.logFor live application logs:
tail -f application.logThis keeps displaying new lines as they are added.
14. Searching With grep
grep is one of the most useful commands for developers.
Search for an error:
grep "ERROR" application.logSearch recursively:
grep -R "TODO" src/Ignore case:
grep -i "error" application.logShow line numbers:
grep -n "ERROR" application.logThis becomes extremely useful when debugging applications.
15. Combining Commands
Linux becomes powerful when commands are combined.
For example:
cat application.log | grep "ERROR"Or:
ps aux | grep nodeThe | symbol passes the output of one command to another command.
Conceptually:
Command A
↓
Output
↓
Command B
↓
Filtered Result16. find — Find Files
Search for JavaScript files:
find . -name "*.js"Find files with a specific name:
find . -name "package.json"Find directories:
find . -type d -name "node_modules"This is useful in large projects.
17. which — Find a Command
Check where an executable is located:
which nodeExample:
/usr/bin/nodeYou can also check:
which pythonThis can help when multiple installations exist.
18. whoami — Current User
Run:
whoamiThis shows the currently authenticated user.
It is useful when working with permissions and remote servers.
19. id — User Information
Run:
idIt can show information such as:
- User ID
- Group ID
- Groups
For example:
uid=1000(developer)
gid=1000(developer)20. File Permissions
Linux files have permissions controlling who can:
- Read
- Write
- Execute
A listing might look like:
-rwxr-xr--The permissions are associated with:
Owner
Group
OthersUnderstanding permissions is essential when deploying applications.
21. chmod — Change Permissions
For example:
chmod +x deploy.shThis adds execute permission to the script for the applicable permission set.
You may also encounter numeric permissions:
chmod 755 deploy.shA common interpretation is:
Owner → read + write + execute
Group → read + execute
Others → read + executeUse permissions appropriate to the actual security requirement rather than blindly applying 777.
22. Why chmod 777 Is Usually a Bad Idea
You may see beginners using:
chmod 777 fileThis grants broad read, write, and execute permissions.
That can create unnecessary security risk.
Prefer the minimum permissions required by the application.
A good rule is:
Give only the permissions that are actually needed.23. chown — Change Ownership
Ownership can be changed with:
sudo chown developer:developer app.logThis changes the owner and group.
Ownership problems can cause errors such as:
Permission deniedAlways understand the target path before changing ownership.
24. sudo — Run With Elevated Privileges
Some administrative operations require elevated privileges.
For example:
sudo apt updatesudo should be used carefully.
Do not automatically prefix every command with sudo.
First understand why elevated privileges are required.
25. Installing Packages
On Debian-based distributions, package management commonly uses apt.
For example:
sudo apt updateThen:
sudo apt install gitRemove a package:
sudo apt remove gitOther Linux distributions use different package managers.
26. ps — View Processes
To view running processes:
psA more detailed view:
ps auxThis can help identify running applications and processes.
For example:
ps aux | grep node27. top — Monitor Processes
Run:
topIt provides a live view of system activity.
You can observe things such as:
- CPU usage
- Memory usage
- Running processes
Many Linux systems also provide htop as an alternative when installed.
28. kill — Stop a Process
First find the process ID:
ps aux | grep nodeThen, when appropriate:
kill PIDFor example:
kill 12345A normal termination request should generally be preferred before using stronger signals.
29. free — Check Memory
Run:
free -hThe -h option makes values easier to read.
Example:
Mem: 15Gi
Swap: 2GiThis is useful when investigating memory-related problems.
30. df — Check Disk Space
Run:
df -hThis shows filesystem usage.
A nearly full disk can cause unexpected application failures.
For example:
Filesystem
↓
Used
↓
Available
↓
Capacity31. du — Find Large Directories
Check the current directory:
du -sh .Check subdirectories:
du -sh *This is useful when a server is running out of disk space.
For example, you might discover:
logs/ 12G
uploads/ 8G
cache/ 4G32. uname — System Information
Run:
uname -aThis can provide information about the kernel and system.
For a simpler operating-system check, depending on the distribution:
cat /etc/os-release33. hostname
Display the machine hostname:
hostnameThis is useful when working with multiple servers.
For example:
web-server-0134. date
Display the current system date and time:
dateTime-related issues can be important when troubleshooting:
- Logs
- Authentication
- Scheduled jobs
- Certificates
- Distributed systems
35. Environment Variables
Display an environment variable:
echo $PATHAnother example:
echo $HOMEList environment variables:
envEnvironment variables are frequently used for application configuration.
36. export
Set an environment variable for the current shell environment:
export APP_ENV=developmentThen:
echo $APP_ENVreturns:
developmentThe exact persistence behavior depends on where and how the variable is configured.
37. history
View previously executed commands:
historyYou can search your shell history using your terminal's interactive history search or commands such as:
history | grep dockerThis is useful when you remember doing something but not the exact command.
38. clear
Clear the terminal screen:
clearIt does not delete command history.
It simply makes the current terminal view easier to read.
39. Command History With the Up Arrow
You do not always need to type commands again.
Press:
↑to access previous commands.
This is one of the simplest terminal productivity tricks.
40. man — Read Documentation
Linux provides manual pages for many commands.
For example:
man grepOr:
man chmodYou can search within a manual page using:
/and exit with:
qLearning to read command documentation is more valuable than memorizing every option.
41. command --help
Many commands also provide built-in help.
For example:
docker --helpor:
grep --helpThis is often the fastest way to check available options.
42. Networking With ip
Modern Linux systems commonly provide the ip command.
View network interfaces:
ip addrView routing information:
ip routeThese commands can help diagnose networking problems.
43. ping — Test Connectivity
For example:
ping example.comThis can help determine whether a host responds to ICMP echo requests.
However, a failed ping does not automatically mean that an application is unreachable because networks can block ICMP.
44. curl — Test HTTP APIs
curl is extremely useful for developers.
For example:
curl https://example.comTest an API:
curl https://api.example.com/healthSend a GET request with headers:
curl -H "Accept: application/json" https://api.example.com/usersSend JSON:
curl \
-X POST \
-H "Content-Type: application/json" \
-d '{"name":"Alex"}' \
https://api.example.com/usersAlways be careful not to expose credentials in shell history or shared command output.
45. ss — Check Network Connections
Run:
ss -tulpnThis can help identify listening network sockets and associated processes on systems where the required information is available.
It is useful when you need to answer:
Which service is listening on this port?46. ssh — Connect to a Remote Server
SSH is commonly used to connect securely to remote Linux systems.
For example:
ssh user@server.example.comYou may authenticate using a password or, preferably in many server environments, an SSH key.
The basic workflow is:
Your Computer
↓
SSH
↓
Remote Server
↓
Terminal47. SSH Keys
Generate an SSH key pair using an appropriate algorithm, for example:
ssh-keygen -t ed25519This creates a private key and a public key.
Conceptually:
Private Key → Keep Secret
Public Key → Share With ServerNever share your private SSH key.
48. scp — Copy Files Over SSH
Copy a local file to a remote server:
scp app.zip user@server:/home/user/Copy a remote file to your computer:
scp user@server:/home/user/app.log .For larger or repeated transfers, tools such as rsync can often be more efficient.
49. rsync — Synchronize Files
A common example:
rsync -av ./project/ user@server:/home/user/project/rsync can efficiently synchronize files between locations.
It is widely used in deployment and backup workflows.
50. tar — Create Archives
Create a tar archive:
tar -cf project.tar project/Create a compressed gzip archive:
tar -czf project.tar.gz project/Extract:
tar -xzf project.tar.gzThis is common when working with application packages and server backups.
51. zip and unzip
Create a ZIP archive:
zip -r project.zip project/Extract:
unzip project.zipZIP is commonly used when exchanging files across different operating systems.
52. wc — Count Lines
For example:
wc -l application.logThis counts lines.
You can combine it with other commands:
grep "ERROR" application.log | wc -lThis can tell you approximately how many matching error lines exist.
53. sort
Sort text:
sort users.txtReverse order:
sort -r users.txtSort by numeric value:
sort -n numbers.txt54. uniq
Remove adjacent duplicate lines:
sort users.txt | uniqCount occurrences:
sort users.txt | uniq -cThis is useful when analyzing repeated log values.
55. cut
Extract fields from structured text.
For example:
cut -d: -f1 /etc/passwdThis uses : as the delimiter and extracts the first field.
56. awk
awk is useful for processing structured text.
For example:
awk '{print $1}' access.logIt can become extremely powerful for log analysis and command-line data processing.
You do not need to master awk immediately.
Start with simple use cases.
57. sed
sed can process and transform text.
For example:
sed 's/old/new/g' file.txtThis replaces occurrences of old with new in the displayed output.
Be careful when using options that modify files directly.
58. Pipes and Redirection
These are fundamental Linux concepts.
Pipe
command1 | command2Redirect Output
command > output.txtAppend Output
command >> output.txtRedirect Errors
command 2> errors.txtRedirect Output and Errors
One common approach is:
command > output.txt 2>&1These operators let you connect commands and capture results.
59. Background Processes
You can start a command in the background:
npm run dev &Check running jobs:
jobsBring a job back to the foreground:
fgFor long-running server processes, dedicated service managers or process supervisors are usually more appropriate.
60. Process Signals
Linux processes can receive signals.
A common signal is:
SIGTERMwhich requests graceful termination.
Another is:
SIGKILLwhich forcefully terminates a process.
Use forceful termination carefully because the process may not have an opportunity to clean up.
61. Reading Application Logs
Suppose your application writes:
application.logStart with:
tail -n 100 application.logSearch errors:
grep -i "error" application.logFollow new entries:
tail -f application.logA practical debugging flow is:
Check Service
↓
Check Logs
↓
Find Error
↓
Identify Component
↓
Investigate
↓
Fix
↓
Verify62. System Logs
Many Linux systems use systemd.
You can inspect service logs with:
journalctlFor a particular service:
journalctl -u nginxFollow logs:
journalctl -u nginx -fThe exact services available depend on the machine.
63. Managing Services With systemctl
Check a service:
systemctl status nginxStart:
sudo systemctl start nginxStop:
sudo systemctl stop nginxRestart:
sudo systemctl restart nginxEnable at boot:
sudo systemctl enable nginxBe careful when restarting production services.
64. Checking a Port
Suppose your application should run on port 3000.
You can inspect listening sockets:
ss -ltnpThen look for the relevant port.
For example:
LISTEN ... :3000This helps determine whether something is listening.
65. Troubleshooting a Web Application
Suppose your website returns an error.
A practical investigation could be:
Website Error
↓
Check Application Status
↓
Check Port
↓
Check Logs
↓
Check Disk
↓
Check Memory
↓
Check Network
↓
Check DependenciesUseful commands may include:
systemctl status app
ss -ltnp
df -h
free -h
tail -n 100 application.log66. Checking Environment Problems
An application may work locally but fail on a server.
Check:
echo $PATHCheck environment variables:
envCheck runtime versions:
node --version
python --version
java --versionDifferent runtime versions can cause unexpected behavior.
67. Linux and Git
Git is frequently used through the Linux command line.
A typical workflow:
git status
git add .
git commit -m "Update application"
git pushYou can combine Linux commands with Git workflows to manage development projects efficiently.
68. Linux and Docker
Docker also relies heavily on command-line workflows.
Common commands include:
docker ps
docker images
docker logs container-name
docker exec -it container-name shLinux terminal knowledge makes Docker easier to learn.
69. Linux and Cloud Servers
Cloud virtual machines frequently run Linux.
A common workflow is:
Cloud VM
↓
SSH
↓
Linux Terminal
↓
Install Dependencies
↓
Deploy Application
↓
Monitor LogsThat is why Linux remains an important skill for cloud and DevOps engineers.
70. A Developer's Daily Linux Workflow
You might start your day with:
pwd
ls
cd project
git statusRun your application:
npm run devInspect processes:
ps aux | grep nodeCheck a service:
systemctl status nginxRead logs:
tail -f application.logTest an API:
curl http://localhost:3000/healthThese simple commands cover many everyday tasks.
71. The Most Important Commands to Memorize
If you are a beginner, start with these:
pwd
ls
cd
mkdir
touch
cp
mv
rm
cat
less
head
tail
grep
find
chmod
chown
sudo
ps
kill
top
free
df
du
curl
ssh
scp
tar
systemctl
journalctlYou do not need to memorize every option.
Learn what each command is designed to accomplish.
72. A Better Way to Learn Linux
Do not study commands only as a list.
Practice them by solving small problems.
Task 1
Find your current directory.
pwdTask 2
List hidden files.
ls -laTask 3
Find all JavaScript files.
find . -name "*.js"Task 4
Find errors in a log.
grep -i "error" application.logTask 5
Check disk usage.
df -hTask 6
Test an API.
curl http://localhost:3000/healthThis approach creates practical memory.
73. Linux Command Mental Model
Instead of memorizing hundreds of commands, organize them by purpose:
Once commands are grouped by purpose, they become much easier to remember.
74. Common Beginner Mistakes
Running Commands Without Understanding Them
Do not blindly copy commands from the internet.
Using sudo Everywhere
Use elevated privileges only when required.
Using Dangerous rm Commands
Always verify the path before deleting.
Using chmod 777
Give only the permissions that are actually required.
Ignoring Logs
Logs often contain the first useful clue during troubleshooting.
Memorizing Instead of Practicing
Use commands repeatedly on real projects.
75. Linux Command Cheat Sheet
| Task | Command |
|---|---|
| Current directory | pwd |
| List files | ls |
| Detailed listing | ls -l |
| Hidden files | ls -a |
| Change directory | cd |
| Create directory | mkdir |
| Create file | touch |
| Copy | cp |
| Move / rename | mv |
| Remove file | rm |
| Read file | cat |
| Read large file | less |
| Beginning of file | head |
| End of file | tail |
| Search text | grep |
| Find files | find |
| Current user | whoami |
| Permissions | chmod |
| Ownership | chown |
| Processes | ps |
| Monitor processes | top |
| Stop process | kill |
| Memory | free |
| Disk space | df |
| Directory size | du |
| HTTP request | curl |
| Network sockets | ss |
| Remote login | ssh |
| Copy over SSH | scp |
| Archive | tar |
| Service status | systemctl |
| Service logs | journalctl |
76. Final Takeaway
Linux is not about memorizing hundreds of terminal commands.
It is about understanding how to interact with a system.
Start with:
Files
↓
Processes
↓
Permissions
↓
Networking
↓
Logs
↓
Services
↓
Remote ServersOnce you become comfortable with these areas, many development and DevOps tasks become much easier.
The most useful commands to practice first are:
pwd
ls
cd
mkdir
cp
mv
rm
cat
less
grep
find
ps
top
df
du
curl
ssh
chmod
systemctl
journalctlPractice them while working on real projects.
When an application fails, use the terminal to investigate.
When a server is slow, use system commands to inspect it.
When an API is not responding, use networking tools.
When a deployment fails, inspect the service and logs.
That is how Linux becomes a practical developer skill rather than just a list of commands.







Comments (0)
Be the first to share your thoughts.