Linux Essential Commands
### File and Directory Management
1. `ls` - Lists files and directories in the current directory. Example: `ls -la`
2. `cd` - Changes the current directory. Example: `cd /var/log`
3. `pwd` - Prints the current directory path.
4. `mkdir` - Creates a new directory. Example: `mkdir myfolder`
5. `rmdir` - Deletes an empty directory. Example: `rmdir myfolder`
6. `cp` - Copies files or directories. Example: `cp file1.txt file2.txt`
7. `mv` - Moves or renames files or directories. Example: `mv oldname.txt newname.txt`
8. `rm` - Deletes files or directories. Example: `rm -r folder/`
9. `find` - Searches for files and directories. Example: `find / -name "file.txt"`
### File Viewing and Editing
10. `cat` - Displays file content. Example: `cat file.txt`
11. `less` - Views file content one page at a time. Example: `less file.txt`
12. `nano` or `vim` - Opens text editors to modify files. Example: `nano file.txt`
13. `head` / `tail` - Displays the beginning (`head`) or end (`tail`) of a file. Example: `tail -n 10 log.txt`
14. `touch` - Creates an empty file. Example: `touch newfile.txt`
### User and Permission Management
15. `whoami` - Shows the current user.
16. `id` - Displays user ID (UID) and group ID (GID). Example: `id username`
17. `chmod` - Changes file permissions. Example: `chmod 755 file.txt`
18. `chown` - Changes file ownership. Example: `chown user:group file.txt`
19. `sudo` - Executes a command as another user, typically the superuser. Example: `sudo apt
update`
20. `passwd` - Changes the user password. Example: `passwd username`
### System Monitoring and Process Management
21. `top` - Displays running processes and system usage.
22. `ps` - Shows current processes. Example: `ps aux | grep process_name`
23. `kill` - Terminates a process. Example: `kill 1234` (where 1234 is the process ID).
24. `df` - Displays disk usage. Example: `df -h`
25. `du` - Displays directory or file size. Example: `du -sh folder/`
26. `free` - Shows memory usage. Example: `free -m`
27. `uptime` - Displays system uptime.
### Networking Commands
28. `ping` - Tests network connectivity. Example: `ping google.com`
29. `ifconfig` or `ip` - Displays or configures network interfaces. Example: `ifconfig`
30. `netstat` - Displays network connections. Example: `netstat -tuln`
31. `curl` / `wget` - Fetches files from the web. Example: `curl http://example.com`
32. `traceroute` - Traces the route packets take to a destination. Example: `traceroute google.com`
33. `nslookup` - Queries DNS for domain information. Example: `nslookup example.com`
### Archiving and Compression
34. `tar` - Archives files. Example: `tar -cvf archive.tar folder/`
35. `gzip` / `gunzip` - Compresses or decompresses files. Example: `gzip file.txt`
36. `zip` / `unzip` - Creates or extracts zip files. Example: `unzip archive.zip`
### Package Management (for Ubuntu/Debian)
37. `apt` - Manages packages. Example: `sudo apt update && sudo apt install package-name`
38. `dpkg` - Installs or removes .deb packages. Example: `sudo dpkg -i package.deb`
### Other Useful Commands
39. `history` - Displays command history.
40. `alias` - Creates command shortcuts. Example: `alias ll='ls -la'`
41. `echo` - Prints a message or variable. Example: `echo "Hello, World!"`
42. `man` - Displays manual pages for commands. Example: `man ls`
43. `clear` - Clears the terminal screen.