Linux Common Commands (Beginners)

 

1. The command to display the date: date


 

2. The command to display the calendar: cal

3. Simple and easy to use calculator: bc

How can 10/100 become 0? This is because bc is preset to output only integers. If you want to output the lower digits of the decimal point, you must execute scale=number, and that number is the number of decimal points, for example:

4. Several important hotkeys [Tab], [ctrl]-c, [ctrl]-d 

[Tab] button---with the function of "command completion" but not "file completion"

[Ctrl]-c key---make the current program "stop"

[Ctrl]-d key---usually means: "Keyboard input end (End Of File, EOF or End OfInput)"; in addition, it can also be used to replace exit

5、man

quit with q,

man -f man

6. Data is written to disk synchronously: sync

Enter sync, the data that has not been updated in the memory will be written to the hard disk; therefore, this command is very important before the system is shut down or restarted! Better to do it several times!

7. The usual shutdown command: shutdown

In addition, it should be noted that the time parameter must be added to the command, otherwise the shutdown will automatically jump to run-level 1 (that is, the login situation of single-person maintenance), which will be troublesome! Here are some examples of time parameters:

Reboot, shutdown: reboot, halt, poweroff

8. Switch execution level: init

There are seven execution levels in Linux:

--run level 0 : shutdown

--run level 3 : plain text mode

--run level 5 : include graphics interface mode

--run level 6 : restart

 

Use the init command to switch between modes:

If you want to shutdown, in addition to the above shutdown -h now and poweroff, you can also use the following command to shutdown:  

9. Change the group the file belongs to: chgrp

10. Change the file owner: chown

He can also directly modify the name of the group

11. Change the permissions of the file: chmod

There are two ways to set permissions. You can use numbers or symbols to change permissions.

--Number type to change file permissions:

 

--symbol type change file permissions:

12. View version information, etc.

13. Change directory: cd

14. Display the current directory: pwd

15. Create a new directory: mkdir

 

It is not recommended to use the -p option, because if you make a typo, the directory name will become messy

 

16. Delete the "empty" directory: rmdir

17. Display of files and directories: ls

18. Copy a file or directory: cp

19. Remove a file or directory: rm

20. Move files and directories, or rename: mv

21. Obtain the file name and directory name of the path: basename, dirname

22. Display the file content from the first line: cat

23. Display from the last line: tac (it can be seen that tac is the reverse of cat)

24. When displaying, output the line number along the way: nl

25. Display file content page by page: more

26. Similar to more, but better than more, he can page forward: less

27. Only look at the first few lines: head

28. Only look at the last few lines: tail

29. Read the file content in binary placement: od

30. Modify the file time or create a new file: touch

31. File default permission: umask

32. Configuration file file hidden attribute: chattr

33. Show file hidden attributes: lsattr

34. Observe the file type: file

35. Find [Executive Block]: which

36. Find a specific file: whereis

37. Find a specific file: locate

38. Find a specific file: find

39. Compressing files and reading compressed files: gzip, zcat

40. Compressing files and reading compressed files: bzip2, bzcat

41. Compressing files and reading compressed files: tar

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=324085058&siteId=291194637