Operations 5 min read

Common Linux Commands with Usage Examples

This guide presents a concise reference of essential Linux command‑line tools, including cd, ls, touch, mkdir, cp, mv, rm, chmod, chown, ps, top, tar, grep, sed, find, ssh, scp, ping, netstat, and ifconfig, each illustrated with a practical example.

php中文网 Courses
php中文网 Courses
php中文网 Courses
Common Linux Commands with Usage Examples

1. cd: Change the current working directory. cd /var/www/html

2. ls: List files and directories in the specified path. ls /var/www/html

3. touch: Create an empty file. touch test.php

4. mkdir: Create a new directory. mkdir images

5. cp: Copy a file or directory. cp index.php /var/www/html

6. mv: Move (or rename) a file or directory. mv index.php /var/www/html

7. rm: Delete a file or directory. rm index.php

8. chmod: Change file or directory permissions. chmod 755 index.php

9. chown: Change file or directory ownership. chown www-data:www-data index.php

10. ps: Display information about active processes. ps aux

11. top: Real‑time view of system processes and resource usage. top

12. tar: Archive and compress files or directories. tar -czvf backup.tar.gz /var/www/html

13. grep: Search for matching strings within files. grep "hello" test.txt

14. sed: Perform text substitution, deletion, or insertion. sed 's/hello/world/g' test.txt

15. find: Locate files or directories based on criteria. find /var/www/html -name "*.php"

16. ssh: Connect to a remote server via SSH. ssh [email protected]

17. scp: Securely copy files between local and remote hosts. scp local_file remote_user@remote_host:/remote/dir

18. ping: Test network connectivity to a host. ping google.com

19. netstat: Show current network connections, listening ports, and routing tables. netstat -an

20. ifconfig: Display network interface configuration details. ifconfig eth0

LinuxshellCommand LineSystem Administrationbasics
php中文网 Courses
Written by

php中文网 Courses

php中文网's platform for the latest courses and technical articles, helping PHP learners advance quickly.

0 followers
Reader feedback

How this landed with the community

login 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.