Current location - Recipe Complete Network - Food world - Linux command line usage tutorial
Linux command line usage tutorial
universal command

Ls display file or directory

-l List file details l (list)

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

Mkdir create directory

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

Cd switching directory

Touch to create an empty file.

Echo creates a file with content.

Caterpillar View File Contents

Cp copy

Mv move or rename

Rm delete file

-r recursive deletion, you can delete subdirectories and files.

-f forced deletion

Find searches the file system for files.

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

Grep looks for a string in a text file.

Rmdir delete empty directory

The tree-tree structure displays the directory, and the tree package needs to be installed.

Pwd displays the current directory

Create a linked file

Display the contents of the text file in more or less pages.

The header and trailer show the contents of the header and trailer of the file.

Ctrl+alt+F 1 command line full screen mode

System management command

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

Who displays online login users?

Whoami displays the current operating user.

Host Name Displays the host name.

Uname displays system information.

Top dynamically displays the process information that currently consumes the most resources.

Ps shows the instantaneous process state ps -aux.

View directory size and display directory information.

Display disk information in cells.

Ifconfig checks the network situation.

Ping to test network connectivity

Netstat displays network status information.

Men's orders don't work. Find a man like this: a man.

A clear screen.

Alias rename command, such as alias showmeit="ps -aux ",and disable unaliax showmeit.

Kill terminates a process. You can use ps or top command to check the id of the process first, and then use kill command to kill the process.

Compression related command

gzip:

bzip2:

Tar: packaging and compression

-c archive file

-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/abcis only packaged and not compressed.

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

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

Of course, if you want to decompress, just replace "c" with "x" in the above command tar-CVF/tar-zcff/tar-jcvf.

Shut down/restart the machine

switch an electrical device off

-r shutdown and restart

-h Shut down and do not restart.

Turn it off now.

Stop shutting down

Restart restart