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

Basic commands for linux

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

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

Common instruction

Ls displays files or directories

-l list file details l (list)

-a lists all files and directories in the current directory, including hidden a (all)

Mkdir create directory

-p create a directory, if there is no parent directory, create p (parent)

Cd changes directories

Touch creates an empty file

Echo creates a file with content.

Cat views the contents of the file

Cp copy

Mv move or rename

Rm deletes a file

-r Recursive deletion, subdirectories and files can be deleted

-f forcibly delete

Find searches the file system for a file

Wc counts the number of lines, words and characters in a text.

Grep looks for a string in a text file

Rmdir delete empty directory

Tree tree structure display directory, need to install tree package

Pwd displays the current directory

Ln creates a linked file

More and less display text file content in paging

Head and tail display the header and tail of the file.

Ctrl+alt+F1 command line full screen mode

System management command

Stat displays the details of the specified file, which is more detailed than ls

Who displays online login users

Whoami displays the current operation user

Hostname displays hostname

Uname displays system information

Top dynamically displays the process information that consumes the most resources

Ps displays instantaneous process status ps-aux

Du view directory size du-h / home displays directory information with units

Df View disk size df-h displays disk information with units

Ifconfig to check the network situation

Ping tests network connectivity

Netstat displays network status information

Man command will not be used, find a man such as: man ls

Clear screen cleaning

Alias renames commands such as alias showmeit= "ps-aux" and removes the use of unaliax showmeit

Kill kills the process. You can first use the ps or top command to view the id of the process, and then use the kill command to kill the process.

Packaging Compression related commands

Gzip:

Bzip2:

Tar: package compression

-c Archive document

-x compressed file

-z gzip compressed file

-j bzip2 compressed file

-v shows the compression or decompression process v (view)

-f use file name

Example:

Tar-cvf / home/abc.tar / home/abc is packaged only, not compressed

Tar-zcvf / home/abc.tar.gz / home/abc is packaged and compressed with gzip

Tar-jcvf / home/abc.tar.bz2 / home/abc is packaged and compressed with bzip2

Of course, if you want to extract it, just replace the "c" in the above command tar-cvf / tar-zcvf / tar-jcvf with "x".

Shut down / restart the machine

Shutdown

-r shutdown and restart

-h shutdown does not restart

Now shuts down immediately

Halt shutdown

Reboot restart

Linux pipeline

Use the standard output of one command as the standard input of another command. That is, several commands are used together, and the latter command is the result of dividing the previous command.

Example: grep-r "close" / home/* | more looks in all files in the home directory, including close files, and outputs them in pages.

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

Network Security

Wechat

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

12
Report