Operations 4 min read

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.

Programmer DD
Programmer DD
Programmer DD
Essential Linux Command Cheat Sheet: 20+ Must‑Know Commands for System Operations

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 -al

5. Show current working directory

pwd

6. Copy a directory recursively

cp -r sourceFolder targetFolder

7. Create a directory

mkdir newfolder

8. Remove an empty directory

rmdir deleteEmptyFolder

9. Delete files or directories recursively

rm -rf deleteFile

10. Move or rename files

mv /temp/movefile /targetFolder

– Move a file; mv oldNameFile newNameFile – Rename a file.

11. Switch user

su -username

12. Change file permissions

chmod 777 file.java

– Set read, write, and execute permissions for everyone.

13. Compress files

tar -czf test.tar.gz /test1 /test2

14. List contents of a tar.gz archive

tar -tzf test.tar.gz

15. Extract a tar.gz archive

tar -xvzf test.tar.gz

16. View the first 10 lines of a file

head -n 10 example.txt

17. View the last 10 lines of a file

tail -n 10 example.txt

18. Follow a log file

tail -f example.log

– Continuously display new log entries.

19. Launch the Vi editor

vi

20. 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.zip

23. Count threads of a process

ps -Lf portNumber | wc -l
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Shellcommand-lineSystem Administration
Programmer DD
Written by

Programmer DD

A tinkering programmer and author of "Spring Cloud Microservices in Action"

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.