0% found this document useful (0 votes)
24 views4 pages

Git Commands

The document provides a comprehensive list of command-line commands for file and directory operations, process management, system information, and networking, along with brief explanations and usage examples. It covers essential commands such as 'ls', 'cd', 'mkdir', 'chmod', 'ps', 'df', 'ssh', and more. Additionally, it includes bonus commands for searching errors in logs and managing old log files.

Uploaded by

lojogin348
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
24 views4 pages

Git Commands

The document provides a comprehensive list of command-line commands for file and directory operations, process management, system information, and networking, along with brief explanations and usage examples. It covers essential commands such as 'ls', 'cd', 'mkdir', 'chmod', 'ps', 'df', 'ssh', and more. Additionally, it includes bonus commands for searching errors in logs and managing old log files.

Uploaded by

lojogin348
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 4
Here's a complete list of the commands with one-line explanations and examples of how to use them: File & Directory Operations 1. 1s - List files/directories. © 1s -1 (detailed list) © 1s -a (show hidden files) 2. pwd ~ Print current directory path. ° pwd — /home/user 3. ed - Change directory. © cd Documents (enter “Documents”) ° cd .. (go back one level) 4. mkdir - Create a new directory. ° mkdir new_folder 5. touch ~ Create an empty file. ® touch file.txt 6. ep - Copy files/directories. © cp file.txt backup/ (copy to “backup” folder) © cp -r dirt/ dir2/ (copy directory recursively) 7. mv - Move/rename files/directories. © my old.txt new.txt (rename) © mv file.txt ~/Downloads/ (move to Downloads) 8. rm - Remove files/directories. © rm file.txt (delete file) ° rm -r folder/ (delete folder recursively) 10. 11. 12. 13. 14. eat — Display file content. less head tail grep find cat file.txt - View file page by page. less long_file.log (press q to quit) ~ Show first 10 lines of a file. head -n 5 file.txt (show first 5 lines) ~ Show last 10 lines of a file. tail -f log.txt (live updates for logs) ~ Search text in files. grep “error” log.txt (find “error” in file) ~ Search for files/directories. find /home -name "*.txt" (find all txt files) Permissions & Ownership 15. chmod - Change file permissions. chnod 755 script.sh (give execute permission) 16. chown - Change file owner. chown user:group file.txt Process Management 17. ps ~ List running processes. ps aux (detailed list) 18. top / htop - Monitor system processes. © top (live system stats, press q to quit) 19. kill - Terminate a process. © kill -9 1234 (force kill PID 1234) System & Disk Info 20. df - Check disk space usage. © df -h (human-readable format) 21. du - Check file/directory size. © du -sh folder/ (summary of folder size) Compression & Archives 22. tar - Archive/extract files. © tar -czvf archive.tar.gz folder/ (create . tar.gz) © tar -xzvf archive. tar.gz (extract tar.gz) 23. zip / unzip - Compress/extract ZIP files. © zip archive.zip file.txt © unzip archive.zip Networking 24. ssh - Connect to a remote server. © ssh [email protected] 25. sep ~ Securely copy files over SSH. © scp file.txt user@remote:/path/ 26. wget / curl - Download files from the web. © wget https: //example.com/file.zip © curl -0 https://example.com/file.zip 27. ping - Test network connectivity. © ping google.com 28. ifconfig / ip - Check network interfaces. ° ifconfig (older Linux) © ip a (newer Linux) Miscellaneous 29. history - View command history. © history | grep “ssh” (find past SSH commands) 30, man - View command manual. e man 1s (help for 1s command) Bonus: Coml 1g Commands + Search & count errors in logs: grep “error” /var/log/syslog | wo -1 + Find and delete old logs: find /var/log -name "*.log" -mtime +30 -delete Let me know if you'd like more advanced examples! x”

You might also like