Home > Article > Operation and Maintenance > 29 Linux commands you must know
# Commands are instructions for the computer to perform tasks. You can use commands to shut down the computer, or list the file list of the current directory, or the contents of the current text, or display a message on the screen.
If you are a newbie and trying to use the command line interface, we have collected a variety of basic Linux commands for you to learn and help you complete various tasks in various Linux distributions. Although it is not very detailed, it is very useful for Linux beginners, ordinary users, or administrators.
##1.ls – List
ls will list the contents (files or folders) of the current working directory, just like you open a folder in the GUI to see the contents.
2.mkdir – Make Directory
##mkdir d2877a86fd0af3734f1b990aa4211634Common one New directory
3.pwd – Print Working Directory
pwd displays the current working directory
##
4.cd – Change Directory
For the session currently running in the terminal, cd 6f655ecf17a4459bb2d05758ed836e3dSets the given folder (or directory) to the current working directory.
5.rmdir – Remove Directory
rmdir 7bf591876ae1640dfe96d9e8ebd6abbdDeletes the given directory.
6.rm – Remove
##rm 581173c8107a8960113a326214cd75dd will remove the given For files or folders, you can use rm -r 7bf591876ae1640dfe96d9e8ebd6abbd to recursively delete the folder
7.cp – Copy
cp 90524ee9303c34f288d8fdc95a3dfb38 02f1a35c767351dc7308079ae0074d96 command copies files or folders. You can use the cp -r 54af5ededd5c4cd705f51cefdf504e1e d1a5ed9ba9cc6b30eca2bb66b71d5653 option to copy files recursively. folder. In addition, search the backend reply of the top architect on the public account for "algorithm" to get a surprise gift package.
8.mv – MoVe
##mv e02da388656c3265154666b7c71a8ddc ce0a1a63891a672e70a33dd5508b827f command to file or folder to move. If the file or folder exists in the current working directory, you can also rename the file or folder.
9.cat – concatenate and print files
cat 28897b20adb25fbae118a3f80f538dec is used to view the contents of a file on standard output (monitor or screen).
10.tail – print TAIL (from last) >
##tail 3ff4ed1b13ca37e101fa7a7745d884d1By default, the last 10 lines of a given file are displayed on the standard output. You can use tail -n N 581173c8107a8960113a326214cd75dd to specify that the last N lines of the file are displayed on the standard output.
11.less – print LESS
less 581173c8107a8960113a326214cd75ddPrint file contents by page or window. Very useful and efficient when viewing large files containing large amounts of text data. You can use Ctrl F to page forward and Ctrl B to page backward.
12.grep
#grep "98c455a79ddfebb79781bff588e7b37e" 581173c8107a8960113a326214cd75ddat Searches the given file for the specified string. grep -i "98c455a79ddfebb79781bff588e7b37e" 581173c8107a8960113a326214cd75dd will ignore the case of strings when searching, while grep -r "98c455a79ddfebb79781bff588e7b37e" 581173c8107a8960113a326214cd75dd will search for files in the current working directory. Search recursively for the specified string.
13.Find
This command will search for files matching the conditions in the given location. You can use the -name option of find 4a1d04e7a53d9a847c3d427a1a66abbf -name 581173c8107a8960113a326214cd75dd to perform a case-sensitive search, and find 4a1d04e7a53d9a847c3d427a1a66abbf -iname 581173c8107a8960113a326214cd75dd Perform a case-insensitive search.
##find 4a1d04e7a53d9a847c3d427a1a66abbf -iname 581173c8107a8960113a326214cd75dd
14.tar
##The tar command can create, view and extract tar compressed files. tar -cvf fc2f276c9f81c53a10f0377a66576b24 abc52f56ba5c9e6a56c23392e47c02d6 is to create the corresponding compressed file, tar -tvf 72dba88c47189b6dbe3e9f08344c93b7 to view the corresponding compression file, tar -xvf 086d1f12cea97bb3f734bce340296392 to extract the corresponding compressed file.
15.gzip
The gzip 2334ac29606bf8a170583e4f7533b1f4 command creates and extracts gzip compressed files. You can also use gzip -d 2334ac29606bf8a170583e4f7533b1f4 to extract compressed files.
16.unzip
#unzip bceb63d28a6e59d555f59d04ba893f3d for gzip documents Unzip. Before decompressing, you can use the unzip -l bceb63d28a6e59d555f59d04ba893f3d command to view the file contents.
牛逼啊!接私活必备的 N 个开源项目!赶快收藏吧
17.help
4cea801fd04ca7a324b451fbcbb2d24d --help will list all available commands in the terminal. You can use the -h or -help option of any command to view the command. Specific usage.
18.whatis – What is this command
##whatis 4cea801fd04ca7a324b451fbcbb2d24d will be used A single line describing the given command.
19.man – Manual
man 4cea801fd04ca7a324b451fbcbb2d24d displays a man page for the given command.
20.exit
##exit is used to end the current terminal session.
21.ping
ping d013b0a6afe443f1ccf4ef73a9ad68c2 Pings the remote host (server) by sending data packets, which is commonly used to detect network connections and server status.
22.who – Who Is logged in
who can list the currently logged in user name .
23.su – Switch User
su d6025a37ea8687b5422f951f7288bdc5 is used to switch between different users. Superusers can switch to other users even without using a password.
24.uname
##uname will display important information about the system, such as kernel name, Host name, kernel version, processor type, etc., use uname -a to view all information.
25.free – Free memory
free will display the system's free memory, occupied memory, available swap memory and other information. free -m will convert the units in the result into KB, while free -g will convert into GB.
26.df – Disk space Free
df View disk usage in the file system – Used and available storage space on hard drives and other storage devices. You can use df -h to display the results in a human-readable format.
27.ps – ProcesseS
ps displays the running process of the system.
28.Top – TOP processes
The top command will display according to the CPU usage by default. For processes that occupy a large amount of space, you can use top -u d6025a37ea8687b5422f951f7288bdc5 to view a user's CPU usage ranking.
29.shutdown
shutdown is used to shut down the computer, and shutdown -r is used to restart the computer.
The above is the detailed content of 29 Linux commands you must know. For more information, please follow other related articles on the PHP Chinese website!