1 Terminal Command
1.1 ls -- list
List files of current direction or target direction
$ ls [option] [file]
Option | Explanation |
-a | List all files and direction -A excludes '.' and '..' |
-l | Long list and show details |
-T | Use tabular length instead of 8- bit length |
-B | Ignore files ending with '~' |
-d | List content of directory |
-h | human - readable mode "G, M, K" |
-r | Reversed sort |
-c | Sort out files by created time |
-t | Sort out files by modified time |
-s | Sort 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]
Option | Explanation |
-s | Safe mode |
-S | Accumulation mode |
-p pid | PID Monitor the status of some process |
-i | No idle or zombie processes (Internal command) |
-d | Specifies the refresh interval (unit: s) (Internal command) |
-c | Displays the entire command line |
Internal commands are used to control the display mode of processes
N 根据 PID 大小排序
P 根据 CPU 占用量排序
M 根据 Memory 占用量排序
K Kill a process.
r Reprioritize a process.
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
Option | Explanation |
-a | Display individual sizes of all single files. |
-c | Display all single files and summary. |
-h | human-readable K M G |
-s | Display summary |
-X [file] | Exclude objective file |
--max-depth | Ignore 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]
Option | Explanation |
-n | Number all lines starting with 1 |
-b | Similar with '-n', ignoring blank lines |
-s | Squeeze 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]...
Option | Explanation |
-i | Ignore case. |
-v | Display dismatching lines. |
-o | Only 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