[Lecture 3] Ubuntu terminal operation and shell commands

Ubuntu terminal operation and shell commands

1. Ubuntu terminal operation

Open a terminal for command line operations.
Right-click on the Ubuntu desktop to open the terminal compiler.
insert image description here

2. Shell command

1. Directory information viewing command ls
ls -a displays all files and folders, including hidden files, such as those starting with ( . )
insert image description here

2. Directory switching command cd
3. Current path display command pwd
4. System information viewing command uname

5. Clear the screen command clear

Clean up the commands entered above. In fact, the commands have not been deleted, but the above commands have been moved to the top.

6. Display file content command cat
7. Switch user identity command sudo
insert image description here

8. File copy command cp

Copy ac to bc.
insert image description here

9. Switch user command su
10. Move file command mv

Another meaning of this command is renaming.
The following one renames the file.
insert image description here
This is to rename the folder.
insert image description here
The following is to move the ac file to the test1 folder.
insert image description here

11. Create folder command mkdir

12. Create file command touch

Create an ac file.
insert image description here

13. The delete command rm
generally takes -rf directly when deleting.
insert image description here

14. Directory deletion command rmdir
This command can not only delete folders but also delete files.

  • List item

When creating a directory, remember to use ls to check whether the directory you created is successful, and you must develop such a programming habit.
insert image description here

15. Display the network configuration information command ifconfig
insert image description here
Use ifconfig to open and close the network card: when you enter ifconfig, some prompt command characters will appear
insert image description here
after it .-h
insert image description here

16. Reboot command reboot
17. Shutdown command poweroff
18. System help command man
19. Synchronously write data to disk command sync

It is often used in embedded systems, which is to store the data to be stored in a buffer, and then automatically write the data to the disk every 10ms.

20.
The most commonly used find file command find is find -name to find the directory where the file name is located.
insert image description here

21. The search content command grep
command grep -nr
grep -nir can be combined accordingly.
insert image description here

22. Folder size view command du
insert image description here

23. Disk space check command df
insert image description here

24. Use gedit to open a certain file.
The command gedit is equivalent to the txt text input box under windows.
insert image description here

25. The current system process view command ps
This command is equivalent to a task manager under windows.
As shown below: insert image description here
The following is an example of the PS command:
insert image description here

26. View the real-time running status of the process with the command top

View the real-time running status of the CPU.insert image description here

27. The file type view command file
view is the file type of the file you want.
insert image description here

切记: Do not switch to root, this will delete the entire system.

insert image description here

Guess you like

Origin blog.csdn.net/qq_54974383/article/details/129994360