Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the commonly used linux instructions

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the commonly used linux instructions which have a certain reference value, friends can refer to the need. I hope you will have a lot of success after reading this article. Let's take a look at it together.

Linux in many common commands must be mastered, here I will learn linux entry time to learn some common basic commands to share with you, I hope to help you.

1. Command to display date: date

2. Command to display calendar: cal

3. Simple and easy to use calculator: bc

How does 10/100 become 0? This is because bc outputs integers by default. If you want to output decimal places, you must execute scale=number, and that number is the decimal place. For example:

4, important several hotkeys [Tab],[ctrl]-c, [ctrl]-d

[Tab]Key---has the function of "command completion" instead of "file completion"

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

[Ctrl]-d key---usually means "End Of File, EOF, End Of Input"; it can also be used instead of exit.

5、man

Exit with q,

man -f man

6. Synchronous data writing to disk: sync

Enter sync, and the data that has not yet been updated in memory will be written to the hard disk; therefore, this command is important before the system shuts down and restarts! Better do it a few times!

7. Conventional shutdown command: shutdown

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

reboot, halt,poweroff

8. Switch execution level: init

Linux has seven execution levels:

--run level 0 : shutdown

--run level 3 : plain text mode

--run level 5 : contains graphical interface mode

--run level 6 : Restart

Use the init command to switch modes:

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

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

Change File Owner: chown

He can also modify the name of the group directly at will

11. Change file permissions: chmod

There are two ways to set permissions, and permissions can be changed using numbers or symbols.

--Number Type Change File Permission:

--Symbol Type Change File Permission:

12. View version information, etc.

13. Change directory: cd

14. Display the current directory: pwd

15. Create a new directory: mkdir

The-p option is not recommended because you are worried that if you type incorrectly, the directory name will become confusing.

16. Delete the empty directory: rmdir

17. Display of files and directories: ls

Copy files or directories: cp

Remove files or directories: RM

20. Move files and directories, or rename them: mv

21, get the path file name and directory name: basename, dirname

22. Show file contents starting from the first line: cat

23, starting from the last line: tac (you can see that tac is cat written backwards)

24, when displayed, by the way output line number: nl

25, page by page display file content: more

Similar to more, but better than more, he can turn the page forward: less

Just look at the first few lines: head

28. Look only at the last few lines: tail

29. Read file contents in binary placement: od

30. Modify file time or create new file: touch

File default permissions: umask

32. Configuration file hidden attribute: chattr

33. Show file hidden attribute: lsattr

34. Observation file type: file

35. Search for: which

Search for specific files: whereis

Find a specific file: locate

38. Search for specific files: find

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

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

41. Compressed files and reading compressed files: tar

PS: IP.GZIP.TAR What's the difference? Which compression is greater?

tar is packaging, not compression, just a bunch of files into a file GZIP used in HTTP protocol is a technology used to improve the performance of WEB applications, web content compressed and then transmitted. Zip, needless to say, the mainstream compression format. zip The latest compression algorithm is still very good, it is recommended to use zip format, universal platform. tar has no compression, compression rate 100%, mainly forever packaging, zip compression rate depends on the file type, jpg has no compression rate, but bmp is very high gzip is generally higher than zip zipzip -r myfile.zip./* Compress all files and folders in the current directory into myfile.zip file,-r means recursively compress all files in the subdirectory.unzipunzip -o -d /home/sunny myfile.zip Unzip myfile.zip file to/home/sunny/-o: overwrite files without prompting;-d:-d /home/sunny Indicates unzip files to/home/sunny directory Zip command: # zip test.zip test.txt It will compress test.txt file to test.zip course, you can also specify the directory of the compressed package, such as/root/test.zip# unzip test.zip It will extract files to the current directory by default, if you want to extract to the specified directory, You can add the-d option # unzip test.zip -d /root/Thank you for reading this article carefully. I hope that Xiaobian will share what common linux instructions are helpful to everyone. At the same time, I hope that everyone will support you more. Pay attention to the industry information channel. If you encounter problems, find detailed solutions waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report