Here is a list of basic Linux terminal commands that are essential for new users:
1. ls - List files and directories in the current directory.
- Example: `ls`
2. cd - Change directory.
- Example: `cd /path/to/directory`
3. pwd - Print the current working directory.
- Example: `pwd`
4. mkdir - Create a new directory.
- Example: `mkdir new_directory`
5. rmdir - Remove an empty directory.
- Example: `rmdir empty_directory`
6. touch - Create an empty file or update the timestamp of an existing file.
- Example: `touch filename.txt`
7. rm - Remove files or directories.
- To remove a file: `rm filename.txt`
- To remove a directory and its contents (use with caution): `rm -r directory_name`
8. cp - Copy files or directories.
- Example: `cp file.txt /path/to/destination`
9. mv - Move or rename files or directories.
- To move: `mv file.txt /path/to/destination`
- To rename: `mv oldname.txt newname.txt`
10. cat - Display the contents of a file.
- Example: `cat filename.txt`
11. less or more - View a file one page at a time.
- Example: `less filename.txt`
12. head - Display the beginning of a file.
- Example: `head filename.txt`
13. tail - Display the end of a file.
- Example: `tail filename.txt`
14. nano or vim - Text editors for creating and editing files in the terminal.
- Example (nano): `nano filename.txt`
15. grep - Search for text within files.
- Example: `grep "search_term" filename.txt`
16. chmod - Change file permissions.
- Example: `chmod 644 filename.txt` (sets read and write permissions for the owner, and read-only for others)
17. chown - Change file ownership.
- Example: `chown user:group filename.txt`
18. ps - List running processes.
- Example: `ps aux`
19. kill - Terminate processes by their process ID (PID).
- Example: `kill PID`
20. sudo - Execute a command as the superuser or with elevated privileges.
- Example: `sudo command`
21. df - Display disk space usage.
- Example: `df -h`
22. du - Display file and directory space usage.
- Example: `du -sh directory`
23. tar - Create or extract compressed archive files.
- Example (create): `tar -cvzf archive.tar.gz /path/to/directory`
- Example (extract): `tar -xvzf archive.tar.gz`
24. wget or curl - Download files from the internet.
- Example (wget): `wget https://example.com/file.zip`
- Example (curl): `curl -O https://example.com/file.zip`
25. history - View a list of recently executed commands.
- Example: `history`
These commands should help you get started with basic Linux terminal operations. Remember to exercise caution, especially when working with commands like `rm` and `sudo`, as they can have significant consequences if used incorrectly.
No comments:
Post a Comment