


A complete list of commonly used Linux commands
Many common commands in Linux must be mastered. Here I will share with you some common basic commands that I learned when I was getting started with Linux. I hope it can help you.
1. Instruction to display date: date
2. Instruction to display calendar: cal
3. Simple and easy calculation Device: bc
How can 10/100 become 0? This is because bc only outputs integers by default. If you want to output the number of decimal points, you must execute scale=number. That number is the number of decimal points, for example:
4. Several important hotkeys [ Tab], [ctrl]-c, [ctrl]-d
[Tab] button---has the function of "command completion" and "file completion"
[Ctrl] -c key---let the current program "stop"
[Ctrl]-d key---usually means: "End Of File, EOF or End OfInput" ; In addition, it can also be used to replace exit
5, man
to exit with q,
man -f man
6, and data synchronization writing Enter the disk: sync
Enter sync, the data that has not been updated in the memory will be written to the hard disk; therefore, this command is important before the system is shut down or restarted. ! Better to do it a few times!
7. Commonly used 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, single-person maintenance Login status), this is nerve-wracking! Here are some examples of time parameters:
Restart, shutdown: reboot, halt,poweroff
8. Switch execution level: init
Linux has seven execution levels. :
--run level 0: Shutdown
--run level 3:Pure text mode
--run level 5:Contains graphical interface mode
--run level 6: Restart
Use the init command to switch between modes:
If you want to shut down, in addition to the above shutdown -h now In addition to poweroff, you can also use the following command to shut down:
9. Change the group to which the file belongs: 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, which can be used respectively. Use numbers or symbols to change permissions.
--Change file permissions for numeric type:
--Change file permissions for symbol type:
12. View version information, etc.
13. Change directory: cd
14. Display the current directory: pwd
15. Create a new directory: mkdir
is not recommended for common use -p option, because you are worried that 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 files or directories: cp
19, remove files or directories: rm
20, move files and directories, Or rename: mv
21. Get the file name and directory name of the path: basename, dirname
22. Display the file content starting from the first line: cat
23. Display starting from the last line: tac (it can be seen that tac is cat written backwards)
24. When displaying, output the line number: nl
25, page by page Display file content: more
26. Similar to more, but better than more, it can turn pages forward: less
27. Only read the first few lines: head
28. Read only the last few lines: tail
29. Read the file content in binary format: od
30. Modify the file time or create a new file: touch
31. File default permissions: umask
32. Configuration file hidden attributes: chattr
33. Display file hidden attributes: lsattr
34. Observe files Type: file
35. Search for [Execution Block]: which
36. Search for a specific file: whereis
37. Search for a specific file: locate
38. Search for specific files: find
39. Compress files and read compressed files: gzip, zcat
40. Compress files and read compressed files: bzip2, bzcat
41. What is the difference between compressing files and reading compressed files: tar
ps:IP.GZIP.TAR? How deep is the compression?
tar是打包,不是压缩,只是把一堆文件打成一个文件而已GZIP用在HTTP协议上是一种用来改进WEB应用程序性能的技术,将网页内容压缩后再传输。 zip就不用说了,主流的压缩格式。 zip最新的压缩算法还是很好的,建议还是用zip格式化,全平台通用。
tar没有怎样压缩,压缩率100%,主要是永远打包, zip压缩率看文件类型,jpg就没怎么压缩率,但bmp很高 gzip一般比zip高
zip zip -r myfile.zip ./* 将当前目录下的所有文件和文件夹全部压缩成myfile.zip文件,-r表示递归压缩子目录下所有文件. unzip unzip -o -d /home/sunny myfile.zip 把myfile.zip文件解压到 /home/sunny/ -o:不提示的情况下覆盖文件; -d:-d /home/sunny 指明将文件解压缩到/home/sunny目录下 zip 命令: # zip test.zip test.txt 它会将 test.txt 文件压缩为 test.zip ,当然也可以指定压缩包的目录,例如 /root/test.zip # unzip test.zip 它会默认将文件解压到当前目录,如果要解压到指定目录,可以加上 -d 选项 # unzip test.zip -d /root/
The above is the detailed content of A complete list of commonly used Linux commands. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

To view the Git repository address, perform the following steps: 1. Open the command line and navigate to the repository directory; 2. Run the "git remote -v" command; 3. View the repository name in the output and its corresponding address.

VS Code One-step/Next step shortcut key usage: One-step (backward): Windows/Linux: Ctrl ←; macOS: Cmd ←Next step (forward): Windows/Linux: Ctrl →; macOS: Cmd →

Although Notepad cannot run Java code directly, it can be achieved by using other tools: using the command line compiler (javac) to generate a bytecode file (filename.class). Use the Java interpreter (java) to interpret bytecode, execute the code, and output the result.

There are six ways to run code in Sublime: through hotkeys, menus, build systems, command lines, set default build systems, and custom build commands, and run individual files/projects by right-clicking on projects/files. The build system availability depends on the installation of Sublime Text.

To install Laravel, follow these steps in sequence: Install Composer (for macOS/Linux and Windows) Install Laravel Installer Create a new project Start Service Access Application (URL: http://127.0.0.1:8000) Set up the database connection (if required)

The main uses of Linux include: 1. Server operating system, 2. Embedded system, 3. Desktop operating system, 4. Development and testing environment. Linux excels in these areas, providing stability, security and efficient development tools.

Installing Git software includes the following steps: Download the installation package and run the installation package to verify the installation configuration Git installation Git Bash (Windows only)
