[Linux] common Linux commands

Source: Internet
Author: User

Many common commands in Linux must be mastered. Here we will share some common basic commands that I learned when I started Linux, and hope to help you.


This is what I sorted out from laruence's book. I hope it will not involve copyright issues.

1. Date command

2. calendar display command: Cal


3. Easy to use calculator: BC


Why does 10/100 change to 0? This is because BC outputs only Integers by default. If you want to output the number of digits under the decimal point, you must execute scale = number, which is the number of decimal places, for example:



4. Key keys: [Tab], [CTRL]-C, and [CTRL]-d

[Tab] press the key to enable "command completion" instead of "file completion ".


[CTRL]-C: press the button to stop the current program 』


[CTRL]-D keys --- usually represent the end of the keyboard input (end of file, EOF end ofinput). In addition, it can also be used to replace exit


5. Man

Exit Q,

Man-F Man



6. synchronize data to disk: sync

Enter sync, and data that has not been updated in the memory will be written to the hard disk. Therefore, this role makes it important before the system is shut down and restarted! It is best to execute multiple times!



7. Conventional shutdown command: Shutdown


In addition, you must note that the time parameter must be included in the Command; otherwise, shutdown will automatically jump to run-Level 1 (that is, the login situation maintained by a single user), which will hurt your mind! Below are examples of several time parameters:



Restart, shut down: 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: graphic interface mode


-- Run level 6: restart


 

Use the init command to switch the modes:


If you want to shut down the instance, you can use the following command to shut down the instance in addition to the shutdown-H now and poweroff commands:



9. Change the group to which the file belongs: chgrp


10. Change the file owner: chown

He can also modify the group name directly by clicking "modify ".



11. Change file permissions: chmod

You can use numbers or symbols to set permissions.


-- Permission for changing the number type:



 

-- Change the File Permission of the symbol type:



12. View version information.


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 frequently, because you are worried that if you typed the wrong word, the directory name will become messy.

 

16. Delete the "null" Directory: rmdir


17. display of files and directories: ls


18. Copy an archive or directory: CP


19. Remove an archive or directory: Rm


20. Move files and directories or rename them: MV


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


22. The first line displays the file content: Cat


23. Display Tac from the last line (we can see that TAC is a cat write backwards)


24. When displayed, the downstream output line number is NL.


25. display file content on one page and one page: More


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


27. Just look at the first few rows: Head


28. Just look at the last few lines: tail


29. Read File Content in binary format: OD


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


31. File preset permissions: umask


32. configuration file hidden attribute: chattr


33. Hide the file property: lsattr


34. Observed file type: File


35. Find the [execution block]: Which


36. Search for specific files: whereis


37. Search for specific files: locate


38. Find a specific file


39. compressing and reading compressed files: gzip and zcat


40. compressed files and read compressed files: Bzip2, bzcat


41. compressed files and compressed files read: Tar


 

 

Well, I am exhausted and finally finished it. I hope it will help you.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.