Essential Linux Command Cheat Sheet: 20+ Must‑Know Commands for System Operations
This concise guide lists essential Linux commands for file searching, process monitoring, permission handling, compression, and system information, providing clear examples and brief explanations to help users perform common administrative tasks efficiently.
1. Find a file
find / -name filename.txt– Search for filename.txt under the root directory.
2. Check if a program is running
ps -ef | grep tomcat– List all processes related to Tomcat.
3. Terminate a process
kill -9 19979– Force‑kill the process with PID 19979.
4. List files including hidden ones
ls -al5. Show current working directory
pwd6. Copy a directory recursively
cp -r sourceFolder targetFolder7. Create a directory
mkdir newfolder8. Remove an empty directory
rmdir deleteEmptyFolder9. Delete files or directories recursively
rm -rf deleteFile10. Move or rename files
mv /temp/movefile /targetFolder– Move a file; mv oldNameFile newNameFile – Rename a file.
11. Switch user
su -username12. Change file permissions
chmod 777 file.java– Set read, write, and execute permissions for everyone.
13. Compress files
tar -czf test.tar.gz /test1 /test214. List contents of a tar.gz archive
tar -tzf test.tar.gz15. Extract a tar.gz archive
tar -xvzf test.tar.gz16. View the first 10 lines of a file
head -n 10 example.txt17. View the last 10 lines of a file
tail -n 10 example.txt18. Follow a log file
tail -f example.log– Continuously display new log entries.
19. Launch the Vi editor
vi20. Show current system time
date– Displays day, month, date, time, timezone, and year.
21. Format date output
date +"%Y-%m-%d"– Prints the date as YYYY-MM-DD.
22. Extract a zip file
unzip -oq archive.zip23. Count threads of a process
ps -Lf portNumber | wc -lSigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Programmer DD
A tinkering programmer and author of "Spring Cloud Microservices in Action"
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
