Note - Linux

2023-05-16

1    Terminal Command

1.1  ls -- list

List files of current direction or target direction

$ ls [option] [file]
OptionExplanation
-aList all files and direction -A excludes '.' and '..'
-lLong list and show details
-TUse tabular length instead of 8- bit length
-BIgnore files ending with '~'
-dList content of directory
-hhuman - readable mode "G, M, K"
-rReversed sort
-cSort out files by created time
-t Sort out files by modified time
-sSort out files by file size
-u Sort out files by last access time

1.2  top

Displays the resource usage of each process in the system in real time

$ top [option]
OptionExplanation
-sSafe mode
-SAccumulation mode
-p pidPID Monitor the status of some process
-iNo idle or zombie processes (Internal command)
-dSpecifies the refresh interval (unit: s) (Internal command)
-cDisplays the entire command line

Internal commands are used to control the display mode of processes
\Rightarrow N                 根据 PID 大小排序
\Rightarrow P                 根据 CPU 占用量排序
\Rightarrow M                根据 Memory 占用量排序
\Rightarrow K                 Kill a process.
\Rightarrow r                  Reprioritize a process.
\Rightarrow N                 Set the number of processes to be displayed in the process list.

1.3  du -- disk usage, df -- disk free

du : Display the size of objective directory or file.

df : Statistics on file system disk usage 

$ du [option]
$ df -h
OptionExplanation
-aDisplay individual sizes of all single files.
-cDisplay all single files and summary. 
-hhuman-readable K M G
-sDisplay summary
-X [file]Exclude objective file
--max-depthIgnore exceeding depth

1.4  cat -- Concatenate

View the contents of file.

$ cat [filename]
$ cat [filename] | grep [option] Pattern

Create a file (Not exist), ending with EOF marker.

$ cat > [filename] <<EOF

Concatenate several files and append the contents into one.

$ cat [file1] [file2] ... >> [file]
OptionExplanation
-nNumber all lines starting with 1
-bSimilar with '-n', ignoring blank lines
-sSqueeze 2+ blank lines into one

1.5  grep -- Global Regular Expression Print

Use regular expressions to search for text and print out matching lines.

$ grep [option] Pattern [filename1] [filename2]...
OptionExplanation
-iIgnore case.
-vDisplay dismatching lines.
-oOnly matched strings are displayed
-A #Display the line matched by the pattern and the following # lines
-B #Display the line matched by the pattern and the preceding # lines
-C # -A # and -B #

2. Linux Tool

2.1 unar 解压缩

Installation

$ yum install epel-release -y
$ yum install unar -y

使用

# specify directory
$ unar -o /opt example.rar

# specify password
$ unar -p 123456 examaple.rar

# specify decoder
$ unar -e GBK robin.tar.xz

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Note - Linux 的相关文章

随机推荐