CS-Notes/notes/Linux.md

1072 lines
26 KiB
Markdown
Raw Normal View History

2018-02-20 10:40:05 +08:00
<!-- GFM-TOC -->
* [<EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#<23><><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD>)
* [<EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#<23><><EFBFBD><EFBFBD>)
* [<EFBFBD>ػ<EFBFBD>](#<23>ػ<EFBFBD>)
* [<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#<23><EFBFBD><E9BFB4><EFBFBD><EFBFBD>)
* [<EFBFBD><EFBFBD>˿<EFBFBD>](#<23><EFBFBD>˿<EFBFBD>)
* [PATH](#path)
* [<EFBFBD><EFBFBD><EFBFBD>еȼ<EFBFBD>](#<23><><EFBFBD>еȼ<D0B5>)
* [sudo](#sudo)
* [GNU](#gnu)
* [<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
* [<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>а](#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>а)
* [<EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#<23><><EFBFBD><EFBFBD>)
* [<EFBFBD><EFBFBD><EFBFBD>̵<EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>](#<23><><EFBFBD>̵<EFBFBD><CCB5>ļ<EFBFBD><C4BC><EFBFBD>)
* [<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#<23><><EFBFBD><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. od](#7-od)
* [8. touch](#8-touch)
* [ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](<><D6B8><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>)
* [1. which](#1-which)
* [2. whereis](#2-whereis)
* [3. locate](#3-locate)
* [4. find](#4-find)
* [4.1 <20><>ʱ<EFBFBD><CAB1><EFBFBD>йص<D0B9>ѡ<EFBFBD><D1A1>](#41-<2D><>ʱ<EFBFBD><CAB1><EFBFBD>йص<D0B9>ѡ<EFBFBD><D1A1>)
* [4.2 <20><><EFBFBD>ļ<EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD>ߺ<EFBFBD><DFBA><EFBFBD><EFBFBD><EFBFBD>Ⱥ<EFBFBD><C8BA><EFBFBD>йص<D0B9>ѡ<EFBFBD><D1A1>](#42-<2D><><EFBFBD>ļ<EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD>ߺ<EFBFBD><DFBA><EFBFBD><EFBFBD><EFBFBD>Ⱥ<EFBFBD><C8BA><EFBFBD>йص<D0B9>ѡ<EFBFBD><D1A1>)
* [4.3 <20><><EFBFBD>ļ<EFBFBD>Ȩ<EFBFBD>޺<EFBFBD><DEBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>йص<D0B9>ѡ<EFBFBD><D1A1>](#43-<2D><><EFBFBD>ļ<EFBFBD>Ȩ<EFBFBD>޺<EFBFBD><DEBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>йص<D0B9>ѡ<EFBFBD><D1A1>)
* [<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ϵͳ](#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ϵͳ)
* [<EFBFBD>ļ<EFBFBD>ϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#<23>ļ<EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
* [inode](#inode)
* [Ŀ¼<EFBFBD><EFBFBD> inode <20><> block](#Ŀ¼<C4BF><C2BC>-inode-<2D><>-block)
* [ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
* [1. ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#1-ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
* [2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#2-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
* [ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](<><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
* [ѹ<EFBFBD><EFBFBD>](<><D1B9>)
* [1. gzip](#1-gzip)
* [2. bzip2](#2-bzip2)
* [3. xz](#3-xz)
* [<EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#<23><><EFBFBD><EFBFBD>)
* [BASH](#bash)
* [Bash<EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#bash<73><68><EFBFBD><EFBFBD>)
* [<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
* [ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD>](<><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><CBB3>)
* [<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><EFBFBD><EFBFBD>](#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><D8B6><EFBFBD>)
* [<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>](#<23><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>)
* [1. <20><>ȡָ<C8A1>cut](#1-<2D><>ȡָ<C8A1><D6B8>cut)
* [2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>sort<72><74>uniq](#2-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>sortuniq)
* [3. ˫<><CBAB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><D8B6><EFBFBD><EFBFBD><EFBFBD>tee](#3-˫<><CBAB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><D8B6><EFBFBD>tee)
* [4. <20>ַ<EFBFBD>ת<EFBFBD><D7AA>ָ<EFBFBD>tr<74><72>col<6F><6C>expand<6E><64>join<69><6E>paste](#4-<2D>ַ<EFBFBD>ת<EFBFBD><D7AA>ָ<EFBFBD><D6B8>trcolexpandjoinpaste)
* [5. <20><><EFBFBD><EFBFBD>ָ<EFBFBD>split](#5-<2D><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>split)
* [<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
* [grep](#grep)
* [printf](#printf)
* [awk](#awk)
* [vim <20><><EFBFBD><EFBFBD>ģʽ](#vim-<2D><><EFBFBD><EFBFBD>ģʽ)
* [<EFBFBD>ο<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#<23>ο<EFBFBD><CEBF><EFBFBD><EFBFBD><EFBFBD>)
<!-- GFM-TOC -->
# <20><><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD>
## <20><><EFBFBD><EFBFBD>
**1. --help**
ָ<EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>÷<EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܡ<EFBFBD>
**2. man**
man <20><> manual <20><><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD>ִ<EFBFBD><EFBFBD> man date ʱ<><CAB1><EFBFBD><EFBFBD> DATE(1) <20><><EFBFBD>֣<EFBFBD><D6A3><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD>ּ<EFBFBD><D6BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>
| <20><><EFBFBD><EFBFBD> | <20><><EFBFBD><EFBFBD> |
| -- | -- |
| 1 | <20>û<EFBFBD><C3BB><EFBFBD> shell <20><><EFBFBD><EFBFBD><EFBFBD>п<EFBFBD><D0BF>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>߿<EFBFBD>ִ<EFBFBD><D6B4><EFBFBD>ļ<EFBFBD> |
| 5 | <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD> |
| 8 | ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>ʹ<EFBFBD>õĹ<C3B5><C4B9><EFBFBD>ָ<EFBFBD><D6B8> |
**3. info**
info <20><> man <20><><EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD><EFBFBD><EFBFBD> info <20><><EFBFBD>ĵ<EFBFBD><C4B5>ֳ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ҳ<EFBFBD>棬ÿ<E6A3AC><C3BF>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD><D4BD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>
## <20>ػ<EFBFBD>
**1. <20><><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD> sync**
Ϊ<EFBFBD>˼ӿ<EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD>Ķ<EFBFBD>д<EFBFBD>ٶȣ<EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD>е<EFBFBD><EFBFBD>ļ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FBFBD><D6B8>**
reboot<EFBFBD><EFBFBD>halt<EFBFBD><EFBFBD>poweroff<EFBFBD><EFBFBD>
## <20><EFBFBD><E9BFB4><EFBFBD><EFBFBD>
ps ָ<>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>鿴 theadx <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>
```html
ps aux | grep threadx
```
## <20><EFBFBD>˿<EFBFBD>
netstat ָ<>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD> 80 <20>Ƿ<EFBFBD><C7B7><EFBFBD>ռ<EFBFBD>ã<EFBFBD>
```html
netstat -anp | grep 80
```
## PATH
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> PATH <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD>·<EFBFBD><C2B7>֮<EFBFBD><D6AE><EFBFBD><EFBFBD> : <20>ָ<EFBFBD><D6B8><EFBFBD>
```html
/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/dmtsai/.local/bin:/home/dmtsai/bin
```
## <20><><EFBFBD>еȼ<D0B5>
0<EFBFBD><EFBFBD><EFBFBD>ػ<EFBFBD>ģʽ
1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>ģʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ<EFBFBD>root<EFBFBD><EFBFBD><EFBFBD>
2<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD>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A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߡ<EFBFBD>RPM ȫ<><C8AB>Ϊ Redhat Package Manager<65><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Red Hat <20><>˾<EFBFBD>ƶ<EFBFBD>ʵʩ<CAB5><CAA9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> GNU <20><>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD>Ϊ<EFBFBD>ܶ<EFBFBD> Linux ϵͳ (RHEL) <20>ļȶ<C4BC><C8B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׼<EFBFBD><D7BC><EFBFBD><EFBFBD> RPM <20><><EFBFBD>о<EFBFBD><D0BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǻ<EFBFBD><C7BB><EFBFBD> Debian <20><><EFBFBD><EFBFBD>ϵͳ (UBUNTU) <20><> DEB <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߣ<EFBFBD> DPKG<4B><47>ȫ<EFBFBD><C8AB>Ϊ Debian Package<67><65><EFBFBD><EFBFBD><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD><EFBFBD><EFBFBD> RPM <20><><EFBFBD>ơ<EFBFBD>
YUM <20><><EFBFBD><EFBFBD> RPM <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߣ<EFBFBD><DFA3>ܹ<EFBFBD><DCB9><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>Դ<EFBFBD>ռ<D5BC><E4A3A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼<C4BF>ȣ<EFBFBD><C8A3>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF> RPM <20><><EFBFBD><EFBFBD><EFBFBD>Ұ<EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ء<EFBFBD><D8A1><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB7B1><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD>ء<EFBFBD><D8A1><EFBFBD>װÿһ<C3BF><D2BB><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⣬YUM <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǽ<EFBFBD><C7BD><EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
## <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>а
Linux <20><><EFBFBD>а<EFBFBD><D0B0><EFBFBD>Ԥ<EFBFBD>ȼ<EFBFBD><C8BC>ɺõ<C9BA> Linux <20>ں˼<DABA><CBBC><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
**<2A><><EFBFBD><EFBFBD> DPKG**
<EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD>а<EFBFBD>
- Ubuntu
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>а<EFBFBD>
- Debian
**<2A><><EFBFBD><EFBFBD> RPM**
<EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD>а<EFBFBD>
- Red Hat
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>а<EFBFBD>
- Fedora
- CentOS
# <20><><EFBFBD><EFBFBD>
## <20><><EFBFBD>̵<EFBFBD><CCB5>ļ<EFBFBD><C4BC><EFBFBD>
Linux <20><>ÿ<EFBFBD><C3BF>Ӳ<EFBFBD><D3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̵<EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
- SCSI/SATA/USB <20><><EFBFBD>̣<EFBFBD>/dev/sd[a-p]
- IDE <20><><EFBFBD>̣<EFBFBD>/dev/hd[a-d]
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFB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<EFBFBD><C2BC>Master boot record, MBR<42><52><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>partition table<6C><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> MBR ռ 446 bytes<65><73>partition table ռ 64 bytes<65><73>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD> 64 bytes<65><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD>ܴ洢 4 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 4 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Primary<72><79><EFBFBD><EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><D5B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Extended<65><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><D5B9><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>չ<EFBFBD><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BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD>߼<EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>Logical Block Address, LBA<42><41><EFBFBD><EFBFBD>
GPT <20><> 1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC> MBR<42><52><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 33 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 33 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڶԷ<DAB6><D4B7><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>б<EFBFBD><D0B1>ݡ<EFBFBD>
GPT û<><C3BB><EFBFBD><EFBFBD>չ<EFBFBD><D5B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEA3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Է<EFBFBD> 128 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/a5c25452-6fa5-49e7-9322-823077442775.jpg)
## <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
### 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C4B2><EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3>
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/f900f266-a323-42b2-bc43-218fdb8811a8.jpg)
<EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȱ<EFBFBD>װ Windows <20>ٰ<EFBFBD>װ Linux<75><78><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>װ Windows ʱ<><EFBFBD>ǵ<EFBFBD> MBR<42><52><EFBFBD><EFBFBD> Linux <20><><EFBFBD><EFBFBD>ѡ<EFBFBD>񽫿<EFBFBD><F1BDABBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0> MBR <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҿ<EFBFBD><D2BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD><EFBFBD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FBD>С<EFBFBD>
## <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>Ȩ<EFBFBD>޵<EFBFBD><DEB5>޸<EFBFBD>
### 1. <20>޸<EFBFBD><DEB8>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>Ⱥ<EFBFBD><C8BA>
```html
# chgrp [-R] groupname dirname/filename
-R<><52><EFBFBD>ݹ<EFBFBD><DDB9>޸<EFBFBD>
```
### 2. <20>޸<EFBFBD><DEB8>ļ<EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD><EFBFBD>ļ<EFBFBD>ӵ<EFBFBD><EFBFBD><EFBFBD>ߣ<EFBFBD>Ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱥ<EFBFBD>
```html
# chown [-R] <20>û<EFBFBD><C3BB><EFBFBD><><C8BA><EFBFBD><EFBFBD> dirname/filename
```
### 3. <20>޸<EFBFBD>Ȩ<EFBFBD><C8A8>
<EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD>һ<EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱһ<EFBFBD><EFBFBD>Ȩ<EFBFBD>޵<EFBFBD> 3 <20><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF>λ<EFBFBD><CEBB>ȨֵΪ 4<><34>2<EFBFBD><32>1<EFBFBD><31><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF>Ȩ<EFBFBD>޶<EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȨֵΪ r<><72>4<EFBFBD><34>w<EFBFBD><77>2<EFBFBD><32>x<EFBFBD><78>1<EFBFBD><31>
```html
# chmod [-R] xyz dirname/filename
```
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> .bashrc <20>ļ<EFBFBD><C4BC><EFBFBD>Ȩ<EFBFBD><C8A8><EFBFBD>޸<EFBFBD>Ϊ -rwxr-xr--<2D><>
```html
# chmod 754 .bashrc
```
Ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>÷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>趨Ȩ<EFBFBD>ޡ<EFBFBD>
```html
# chmod [ugoa] [+-=] [rwx] dirname/filename
- u<><75>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD>
- g<><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱥ<EFBFBD><C8BA>
- o<><6F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
- a<><61><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
- +<2B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8>
- -<2D><><EFBFBD>Ƴ<EFBFBD>Ȩ<EFBFBD><C8A8>
- =<3D><><EFBFBD>趨Ȩ<E8B6A8><C8A8>
```
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ .bashrc <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBF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FBD><D2B2><EFBFBD><EFBFBD>дȨ<D0B4>ޣ<EFBFBD><DEA3><EFBFBD><EFBFBD>˽<EFBFBD><CBBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʱĬ<CAB1>ϵ<EFBFBD>Ȩ<EFBFBD><C8A8>Ϊ -rw-rw-r-- <20><>
## Ŀ¼<C4BF><C2BC><EFBFBD><EFBFBD>
Ϊ<EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>ͬ Linux <20><><EFBFBD>а<D0B0><E6B1BE>Ŀ¼<C4BF><EFBFBD><E1B9B9><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ԣ<EFBFBD>Filesystem Hierarchy Standard (FHS) <20><EFBFBD><E6B6A8> Linux <20><>Ŀ¼<C4BF><EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼<C4BF><C2BC><EFBFBD>£<EFBFBD>
- / (root, <20><>Ŀ¼)
- /usr (unix software resource)<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳĬ<CDB3><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ᰲװ<E1B0B2><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼<C4BF><C2BC>
- /var (variable)<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/27ace615-558f-4dfb-8ad4-7ac769c10118.jpg)
# <20>ļ<EFBFBD><C4BC><EFBFBD>Ŀ¼
## <20>ļ<EFBFBD>ʱ<EFBFBD><CAB1>
1. modification time (mtime)<29><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݸ<EFBFBD><DDB8>¾ͻ<C2BE><CDBB><EFBFBD><EFBFBD>£<EFBFBD>
2. status time (ctime)<29><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>״̬<D7B4><CCAC>Ȩ<EFBFBD>ޡ<EFBFBD><DEA1><EFBFBD><EFBFBD>ԣ<EFBFBD><D4A3><EFBFBD><EFBFBD>¾ͻ<C2BE><CDBB><EFBFBD><EFBFBD>£<EFBFBD>
3. access time (atime)<29><><EFBFBD><EFBFBD>ȡ<EFBFBD>ļ<EFBFBD>ʱ<EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD>¡<EFBFBD>
## <20>ļ<EFBFBD><C4BC><EFBFBD>Ŀ¼<C4BF>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
### 1. ls
<EFBFBD>г<EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>Ŀ¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>а<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>
```html
# ls [-aAdfFhilnrRSt] file|dir
-a <20><><EFBFBD>г<EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
-d <20><><EFBFBD><EFBFBD><EFBFBD>г<EFBFBD>Ŀ¼<C4BF><C2BC><EFBFBD><EFBFBD>
-l <20><><EFBFBD>Գ<EFBFBD><D4B3><EFBFBD><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD><EFBFBD>г<EFBFBD><D0B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD>޵ȵ<DEB5><C8B5><EFBFBD><EFBFBD><EFBFBD>
```
### 2. cp
<EFBFBD><EFBFBD><EFBFBD>Ʋ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>һ<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>Ŀ¼<EFBFBD><EFBFBD><EFBFBD>С<EFBFBD>
```html
cp [-adfilprsu] source destination
-a <20><><EFBFBD><EFBFBD><E0B5B1> -dr --preserve=all <20><><EFBFBD><EFBFBD>˼<EFBFBD><CBBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> dr <20><><EFBFBD>ο<EFBFBD><CEBF><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>
-d <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD>ļ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
-i <20><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>ļ<EFBFBD><C4BC>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ڸ<EFBFBD><DAB8><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF>
-p <20><><EFBFBD><EFBFBD>ͬ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ƹ<EFBFBD>ȥ
-r <20><><EFBFBD>ݹ<EFBFBD><DDB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
-u <20><>destination <20><> source <20>ɲŸ<C9B2><C5B8><EFBFBD> destination<6F><6E><EFBFBD><EFBFBD> destination <20><><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>²Ÿ<C2B2><C5B8><EFBFBD>
--preserve=all <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -p <20><>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><D8B2><EFBFBD><EFBFBD><EFBFBD><E2A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SELinux <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, links, xattr <20><>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
```
### 3. rm
<EFBFBD>Ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
```html
# rm [-fir] <20>ļ<EFBFBD><C4BC><EFBFBD>Ŀ¼
-r <20><><EFBFBD>ݹ<EFBFBD>ɾ<EFBFBD><C9BE>
```
### 4. mv
<EFBFBD>ƶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
```html
# mv [-fiu] source destination
# mv [options] source1 source2 source3 .... directory
-f <20><> force ǿ<>Ƶ<EFBFBD><C6B5><EFBFBD>˼<EFBFBD><CBBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>ļ<EFBFBD><C4BC>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD>ʶ<EFBFBD>ֱ<EFBFBD>Ӹ<EFBFBD><D3B8><EFBFBD>
```
## <20><>ȡ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
### 1. cat
ȡ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݡ<EFBFBD>
```html
# cat [-AbEnTv] filename
-n <20><><EFBFBD><EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD>кţ<D0BA> <20><>ͬ<EFBFBD>հ<EFBFBD><D5B0><EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD><EFBFBD>кţ<D0BA><C5A3><EFBFBD> -b <20><>ѡ<EFBFBD>ͬ
```
### 2. tac
<EFBFBD><EFBFBD> cat <20>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>п<EFBFBD>ʼ<EFBFBD><CABC>ӡ<EFBFBD><D3A1>
### 3. more
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һҳһҳ<EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ơ<EFBFBD>
### 4. less
<EFBFBD><EFBFBD> more <20><><EFBFBD>ơ<EFBFBD>
### 5. head
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD>С<EFBFBD>
```html
# head [-n number] filename
-n <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֣<EFBFBD><D6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>е<EFBFBD><D0B5><EFBFBD>˼
```
### 6. tail
<EFBFBD><EFBFBD> head <20>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB>ȡ<EFBFBD><C8A1><EFBFBD>Ǻ<EFBFBD><C7BA><EFBFBD><EFBFBD>С<EFBFBD>
### 7. od
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʮ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>
### 8. touch
<EFBFBD>޸<EFBFBD><EFBFBD>ļ<EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>
```html
# touch [-acdmt] filename
-a <20><> <20><><EFBFBD><EFBFBD> atime
-c <20><> <20><><EFBFBD><EFBFBD> ctime<6D><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>򲻽<EFBFBD><F2B2BBBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
-m <20><> <20><><EFBFBD><EFBFBD> mtime
-d <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD><D4BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD>Ŀǰ<C4BF><C7B0><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9> --date="<22><><EFBFBD>ڻ<EFBFBD>ʱ<EFBFBD><CAB1>"
-t <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD><D4BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀǰ<C4BF><C7B0>ʱ<EFBFBD><EFBFBD><E4A3AC>ʽΪ[YYYYMMDDhhmm]
```
## ָ<><D6B8><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
### 1. which
ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
```html
# which [-a] command
-a <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD>г<EFBFBD><D0B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD>е<EFBFBD>һ<EFBFBD><D2BB>
```
### 2. whereis
whereis <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ٶȱȽϿ죬<CFBF><ECA3AC>Ϊ<EFBFBD><CEAA>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><D8B6><EFBFBD>Ŀ¼<C4BF><C2BC>
```html
# whereis [-bmsu] dirname/filename
```
### 3. locate
locate <20><><EFBFBD><EFBFBD><EFBFBD>ùؼ<C3B9><D8BC>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
locate ʹ<><CAB9> /var/lib/mlocate/ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E6B4A2><EFBFBD>ڴ<EFBFBD><DAB4>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>Σ<EFBFBD><CEA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޷<EFBFBD><DEB7><EFBFBD> locate <20><><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD><C2BD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9> updatedb <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ⡣
```html
# locate [-ir] keyword
-r<><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
```
### 4. find
find <20><><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ժ<EFBFBD>Ȩ<EFBFBD>޽<EFBFBD><DEBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
```html
# find filename [option]
```
#### 4.1 <20><>ʱ<EFBFBD><CAB1><EFBFBD>йص<D0B9>ѡ<EFBFBD><D1A1>
```html
-mtime n <20><><EFBFBD>г<EFBFBD><D0B3><EFBFBD> n <20><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>޸Ĺ<DEB8><C4B9><EFBFBD><EFBFBD>ݵ<EFBFBD><DDB5>ļ<EFBFBD>
-mtime +n <20><><EFBFBD>г<EFBFBD><D0B3><EFBFBD> n <20><>֮ǰ(<28><><EFBFBD><EFBFBD> n <20><EFBFBD><ECB1BE>)<29>޸Ĺ<DEB8><C4B9><EFBFBD><EFBFBD>ݵ<EFBFBD><DDB5>ļ<EFBFBD>
-mtime -n <20><><EFBFBD>г<EFBFBD><D0B3><EFBFBD> n <20><>֮<EFBFBD><D6AE>(<28><> n <20><EFBFBD><ECB1BE>)<29>޸Ĺ<DEB8><C4B9><EFBFBD><EFBFBD>ݵ<EFBFBD><DDB5>ļ<EFBFBD>
-newer file <20><> <20>г<EFBFBD><D0B3><EFBFBD> file <20><><EFBFBD>µ<EFBFBD><C2B5>ļ<EFBFBD>
```
+4<><34>4 <20><> -4 <20><>ָʾ<D6B8><CABE>ʱ<EFBFBD>Χ<E4B7B6><CEA7><EFBFBD>£<EFBFBD>
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/658fc5e7-79c0-4247-9445-d69bf194c539.png)
#### 4.2 <20><><EFBFBD>ļ<EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD>ߺ<EFBFBD><DFBA><EFBFBD><EFBFBD><EFBFBD>Ⱥ<EFBFBD><C8BA><EFBFBD>йص<D0B9>ѡ<EFBFBD><D1A1>
```html
-uid n
-gid n
-user name
-group name
-nouser <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD>߲<EFBFBD><DFB2><EFBFBD><EFBFBD><EFBFBD> /etc/passwd <20><><EFBFBD>ļ<EFBFBD>
-nogroup<75><70><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱥ<EFBFBD><EFBFBD><E9B2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> /etc/group <20><><EFBFBD>ļ<EFBFBD>
```
#### 4.3 <20><><EFBFBD>ļ<EFBFBD>Ȩ<EFBFBD>޺<EFBFBD><DEBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>йص<D0B9>ѡ<EFBFBD><D1A1>
```html
-name filename
-size [+-]SIZE<5A><45><EFBFBD><EFBFBD>Ѱ<EFBFBD><D1B0> SIZE <20><>Ҫ<EFBFBD><D2AA>(+)<29><>С(-)<29><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SIZE <20>Ĺ<EFBFBD><C4B9><EFBFBD><EFBFBD>У<EFBFBD>c: <20><><EFBFBD><EFBFBD> byte<74><65>k: <20><><EFBFBD><EFBFBD> 1024bytes<65><73><EFBFBD><EFBFBD><EFBFBD>ԣ<EFBFBD>Ҫ<EFBFBD>ұ<EFBFBD> 50KB<4B><42>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><E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BFBD><EFBFBD><EFBFBD>ԣ<EFBFBD>ͬʱ<CDAC><CAB1>¼<EFBFBD><C2BC><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD> block <20><><EFBFBD>
3. block<63><6B><EFBFBD><EFBFBD>¼<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ļ<EFBFBD>̫<EFBFBD><CCAB>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ռ<EFBFBD>ö<EFBFBD><C3B6><EFBFBD> block<63><6B>
<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ȡһ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> inode <20><>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD> block<63><6B>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> block <20><><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD><DDB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƭ<EFBFBD><EFBFBD>ָһ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD> block <20><><EFBFBD>ڷ<EFBFBD>ɢ<EFBFBD><C9A2>
Ext2 <20>ļ<EFBFBD>ϵͳʹ<CDB3><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>֮<EFBFBD>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD> block Ⱥ<><C8BA><EFBFBD>ĸ<EFBFBD><C4B8>Ҳ<EEA3AC><D2B2><EFBFBD>ǽ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ļ<EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD> block Ⱥ<><EFBFBD><E9A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/1974a836-aa6b-4fb8-bce1-6eb11969284a.jpg)
## inode
Ext2 <20>ļ<EFBFBD>ϵͳ֧<CDB3>ֵ<EFBFBD> block <20><>С<EFBFBD><D0A1> 1k<31><6B>2k <20><> 4k <20><><EFBFBD>֣<EFBFBD><D6A3><EFBFBD>ͬ<EFBFBD><CDAC> block <20><>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>һ<EFBFBD>ļ<EFBFBD><C4BC>Ĵ<EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF> inode <20><>С<EFBFBD>ǹ̶<C7B9>Ϊ 128 bytes<65><73>
inode <20>м<EFBFBD>¼<EFBFBD><C2BC><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD> block<63><6B><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF> block <20>dz<EFBFBD>С<EFBFBD><D0A1>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><E3B6BC>Ҫ<EFBFBD><D2AA>ʮ<EFBFBD><CAAE><EFBFBD><EFBFBD> block<63><6B><EFBFBD><EFBFBD>һ<EFBFBD><D2BB> inode <20><>С<EFBFBD><D0A1><EFBFBD>ޣ<EFBFBD><DEA3>޷<EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><C3B4> block<63><6B><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˼<EFBFBD><CBBC>ӡ<EFBFBD>˫<EFBFBD><CBAB><EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD> block <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD> block <20><><EFBFBD><EFBFBD>¼<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> block<63><6B>
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/89091427-7b2b-4923-aff6-44681319a8aa.jpg)
inode <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>
- <20><><EFBFBD>ļ<EFBFBD><C4BC>Ĵ<EFBFBD>ȡģʽ(read/write/excute)<29><>
- <20><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱥ<EFBFBD><C8BA>(owner/group)<29><>
- <20><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
- <20><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4>ı<EFBFBD><C4B1><EFBFBD>ʱ<EFBFBD><CAB1>(ctime)<29><>
- <20><><EFBFBD><EFBFBD>һ<EFBFBD>εĶ<CEB5>ȡʱ<C8A1><CAB1>(atime)<29><>
- <20><><EFBFBD><EFBFBD><EFBFBD>޸ĵ<DEB8>ʱ<EFBFBD><CAB1>(mtime)<29><>
- <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>Ե<EFBFBD><D4B5><EFBFBD><EFBFBD><EFBFBD>(flag)<29><><EFBFBD><EFBFBD> SetUID...<2E><>
- <20><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD>ָ<EFBFBD><D6B8> (pointer)<29><>
## Ŀ¼<C4BF><C2BC> inode <20><> block
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>Ŀ¼ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD> inode <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB> block<63><6B>block <20><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼<C4BF><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD> inode <20><><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Կ<EFBFBD><D4BF><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD> inode <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>Ŀ¼<C4BF>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>Щ<EFBFBD><D0A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼<C4BF><C2BC> w Ȩ<><C8A8><EFBFBD>йء<D0B9>
## ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
```html
# ln [-sf] source_filename dist_filename
-s <20><>Ĭ<EFBFBD><C4AC><EFBFBD><EFBFBD> hard link<6E><6B><EFBFBD><EFBFBD> -s Ϊ symbolic link
-f <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>5<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>Ŀ<EFBFBD><C4BF><EFBFBD>ļ<EFBFBD>
```
### 1. ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
hard link ֻ<><D6BB><EFBFBD><EFBFBD>ij<EFBFBD><C4B3>Ŀ¼<C4BF><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>ӵ<EFBFBD><D3B5>ļ<EFBFBD><C4BC><EFBFBD> inode <20>ϡ<EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>Ǵ<EFBFBD><C7B4>ڣ<EFBFBD>ֻҪ<D6BB><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ 0<><30>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܿ<EFBFBD>Խ Filesystem<65><6D><EFBFBD><EFBFBD><EFBFBD>ܶ<EFBFBD>Ŀ¼<C4BF><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ<EFBFBD>
```html
# ln /etc/crontab .
# ll -i /etc/crontab crontab
34474855 -rw-r--r--. 2 root root 451 Jun 10 2014 crontab
34474855 -rw-r--r--. 2 root root 451 Jun 10 2014 /etc/crontab
```
### 2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
symbolic link <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ Windows <20>Ŀ<EFBFBD><C4BF>ݷ<EFBFBD>ʽ<EFBFBD><CABD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵĶ<DDB5>ȡָ<C8A1><D6B8><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5>Ǹ<EFBFBD><C7B8>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>ʹ򲻿<CDB4><F2B2BBBF>ˡ<EFBFBD>
symbolic link <20><><EFBFBD><EFBFBD>ΪĿ¼<C4BF><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ<EFBFBD>
```html
# ll -i /etc/crontab /root/crontab2
34474855 -rw-r--r--. 2 root root 451 Jun 10 2014 /etc/crontab
53745909 lrwxrwxrwx. 1 root root 12 Jun 23 22:31 /root/crontab2 -> /etc/crontab
```
# ѹ<><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
## ѹ<><D1B9>
Linux <20><><EFBFBD><EFBFBD><EFBFBD>кܶ<D0BA>ѹ<EFBFBD><D1B9><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><D5B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>
| <20><>չ<EFBFBD><D5B9> | ѹ<><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |
| -- | -- |
| \*.Z | compress |
|\*.zip | zip |
|\*.gz | gzip|
|\*.bz2 | bzip2 |
|\*.xz | xz |
|\*.tar | tar <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>û<EFBFBD>о<EFBFBD><D0BE><EFBFBD>ѹ<EFBFBD><D1B9> |
|\*.tar.gz | tar <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> gzip <20><>ѹ<EFBFBD><D1B9> |
|\*.tar.bz2 | tar <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> bzip2 <20><>ѹ<EFBFBD><D1B9> |
|\*.tar.xz | tar <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> xz <20><>ѹ<EFBFBD><D1B9> |
### 1. gzip
gzip <20><> Linux ʹ<><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9>ָ<EFBFBD><EFBFBD><EEA3AC><EFBFBD>Խ⿪ compress<73><73>zip <20><> gzip <20><>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> gzip ѹ<><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD>ļ<EFBFBD><C4BC>Ͳ<EFBFBD><CDB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˡ<EFBFBD>
<EFBFBD><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<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>tar <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9> gip<69><70>bzip2<70><32>xz <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD>
```html
$ tar [-z|-j|-J] [cv] [-f <20>½<EFBFBD><C2BD><EFBFBD>tar<61>ļ<EFBFBD>] filename... ==<3D><><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9>
$ tar [-z|-j|-J] [tv] [-f <20><><EFBFBD>е<EFBFBD>tar<61>ļ<EFBFBD>] ==<3D>
$ tar [-z|-j|-J] [xv] [-f <20><><EFBFBD>е<EFBFBD>tar<61>ļ<EFBFBD>] [-C Ŀ¼] ==<3D><>ѹ<EFBFBD><D1B9>
-z <20><>ʹ<EFBFBD><CAB9>zip<69><70>
-j <20><>ʹ<EFBFBD><CAB9>bzip2<70><32>
-J <20><>ʹ<EFBFBD><CAB9>xz<78><7A>
-c <20><><EFBFBD>½<EFBFBD><C2BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
-t <20><><EFBFBD><EFBFBD><E9BFB4><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Щ<EFBFBD>ļ<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D>Ŀ¼
# BASH
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD> shell <20><><EFBFBD><EFBFBD><EFBFBD>ں<EFBFBD><DABA><EFBFBD><E1B9A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Bash <20><><EFBFBD><EFBFBD> shell <20><>һ<EFBFBD>֡<EFBFBD>
## Bash<73><68><EFBFBD><EFBFBD>
**1. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʷ**
<EFBFBD><EFBFBD>¼ʹ<EFBFBD>ù<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ε<EFBFBD>¼<EFBFBD><EFBFBD>ִ<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD>У<EFBFBD> \~/.bash_history <20>ļ<EFBFBD><C4BC>м<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>ǰһ<C7B0>ε<EFBFBD>¼<EFBFBD><C2BC>ִ<EFBFBD>й<EFBFBD><D0B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
**2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ȫ**
<EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><EFBFBD><EFBFBD>tab
**3. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>**
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> lm <20><> ls -al <20>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>
**4. shell scripts**
**5. ͨ<><CDA8><EFBFBD><EFBFBD>**
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> ls -l /usr/bin/X\* <20>г<EFBFBD> /usr/bin <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> X <20><>ͷ<EFBFBD><CDB7><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
## <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱֵ<EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD> = <20><><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>Ҫ<EFBFBD>ڱ<EFBFBD><DAB1><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD> \$ <20><>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD> \${} <20><><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9> echo <20><><EFBFBD>
```bash
$ var=abc
$ echo $var
$ echo ${var}
```
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>пո<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫʹ<EFBFBD><EFBFBD>˫<EFBFBD><EFBFBD><EFBFBD>Ż<EFBFBD><EFBFBD>ߵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>š<EFBFBD>˫<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>var="lang is \$LANG"<22><><EFBFBD><EFBFBD>var<61><72>ֵΪ lang is zh_TW.UTF-8<><38><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> var='lang is \$LANG'<27><><EFBFBD><EFBFBD> var <20><>ֵΪ lang is \$LANG<4E><47>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD> \`ָ<><D6B8>\` <20><><EFBFBD><EFBFBD> \$(ָ<><D6B8>) <20>ķ<EFBFBD>ʽ<EFBFBD><CABD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>ִ<EFBFBD>н<EFBFBD><D0BD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> version=\$(uname -r)<29><><EFBFBD><EFBFBD> version <20><>ֵΪ 3.10.0-229.el7.x86_64<36><34>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD> export <20><><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD>ɻ<EFBFBD><C9BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD><D3B3><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>ã<EFBFBD><C3A3><EFBFBD>ν<EFBFBD>ӳ<EFBFBD><D3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD>ǰ Bash <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Bash<73><68>
Bash <20>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>и<EFBFBD><D0B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͡<EFBFBD><CDA1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9> declare <20><><EFBFBD>
```html
$ declare [-aixr] variable
-a <20><> <20><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
-i <20><> <20><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
-x <20><> <20><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
-r <20><> <20><><EFBFBD><EFBFBD>Ϊreadonly<6C><79><EFBFBD><EFBFBD>
```
ʹ<EFBFBD><EFBFBD> [ ] <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD>
```bash
$ array[1]=a
$ array[2]=b
$ echo ${array[1]}
```
## ָ<><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><CBB3>
1. <20>Ծ<EFBFBD><D4BE>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4>ָ<EFBFBD><EFBFBD><EEA3AC><EFBFBD><EFBFBD> /bin/ls <20><><EFBFBD><EFBFBD> ./ls <20><>
2. <20>ɱ<EFBFBD><C9B1><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>ִ<EFBFBD>У<EFBFBD>
3. <20><> Bash <20>ڽ<EFBFBD><DABD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>ִ<EFBFBD>У<EFBFBD>
4. <20><> \$PATH <20><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>һ<EFBFBD><D2BB>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>ִ<EFBFBD>С<EFBFBD>
## <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><D8B6><EFBFBD>
<EFBFBD>ض<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͱ<EFBFBD>׼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
1. <20><>׼<EFBFBD><D7BC><EFBFBD><EFBFBD> (stdin) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ 0 <20><>ʹ<EFBFBD><CAB9> < <20><> << <20><>
2. <20><>׼<EFBFBD><D7BC><EFBFBD><EFBFBD> (stdout)&nbsp;&nbsp;&nbsp;&nbsp;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ 1 <20><>ʹ<EFBFBD><CAB9> > <20><> >> <20><>
3. <20><>׼<EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(stderr)<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ 2 <20><>ʹ<EFBFBD><CAB9> 2> <20><> 2>> <20><>
<EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>ı<EFBFBD>ʾ<EFBFBD>Ը<EFBFBD><EFBFBD>ǵķ<EFBFBD>ʽ<EFBFBD>ض<EFBFBD><EFBFBD>򣬶<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><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7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>Ϊ<EFBFBD><CEAA>׼<EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
```bash
$ find /home -name .bashrc > list 2>&1
```
## <20><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǽ<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD>׼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD>׼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD>֮<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵõ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ĸ<EFBFBD>ʽʱ<EFBFBD>Ϳ<EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>ù<EFBFBD><EFBFBD>ߡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮<EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD> | <20>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
```bash
$ ls -al /etc | less
```
### 1. <20><>ȡָ<C8A1>cut
<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>һ<EFBFBD>еؽ<EFBFBD><EFBFBD>С<EFBFBD>
cut <20><><EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><DDBD><EFBFBD><EFBFBD>з֣<D0B7>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>Ҫ<EFBFBD>IJ<EFBFBD><C4B2>֡<EFBFBD>
```html
$ cut
-d <20><><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD>
-f <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -d <20>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9> -f n ȡ<><C8A1><EFBFBD><EFBFBD> n <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
-c <20><><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>Ϊ<EFBFBD><CEAA>λȡ<CEBB><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
```
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><EFBFBD>last <20><><EFBFBD><EFBFBD>ʾ<EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD>Ϣ<EFBFBD><CFA2>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
```html
$ last
root pts/1 192.168.201.101 Sat Feb 7 12:35 still logged in
root pts/1 192.168.201.101 Fri Feb 6 12:13 - 18:46 (06:33)
root pts/1 192.168.201.254 Thu Feb 5 22:37 - 23:53 (01:16)
$ last | cut -d ' ' -f 1
```
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><EFBFBD><EFBFBD><EFBFBD> export <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѶϢ<D1B6><CFA2>ȡ<EFBFBD>õ<EFBFBD> 12 <20>ַ<EFBFBD><D6B7>Ժ<EFBFBD><D4BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>
```html
$ export
declare -x HISTCONTROL="ignoredups"
declare -x HISTSIZE="1000"
declare -x HOME="/home/dmtsai"
declare -x HOSTNAME="study.centos.vbird"
.....(<28><><EFBFBD><EFBFBD>ʡ<EFBFBD><CAA1>).....
$ export | cut -c 12
```
### 2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>sort<72><74>uniq
**sort** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
```html
$ sort [-fbMnrtuk] [file or stdin]
-f <20><><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD>Сд
-b <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD>Ŀո<C4BF>
-M <20><><EFBFBD><EFBFBD><EFBFBD>·ݵ<C2B7><DDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> JAN, DEC
-n <20><>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
-r <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
-u <20><><EFBFBD><EFBFBD><E0B5B1> unique <20><><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
-t <20><><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>Ϊtab
-k <20><>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
```
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/etc/passwd <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <20><><EFBFBD>ָ<EFBFBD><D6B8>ģ<EFBFBD><C4A3>Ե<EFBFBD><D4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
```html
$ cat /etc/passwd | sort -t ':' -k 3
root:x:0:0:root:/root:/bin/bash
dmtsai:x:1000:1000:dmtsai:/home/dmtsai:/bin/bash
alex:x:1001:1002::/home/alex:/bin/bash
arod:x:1002:1003::/home/arod:/bin/bash
```
**uniq** <20><><EFBFBD>Խ<EFBFBD><D4BD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻȡһ<C8A1><D2BB><EFBFBD><EFBFBD>
```html
$ uniq [-ic]
-i <20><><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD>Сд
-c <20><><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC><EFBFBD>
```
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD>ÿ<EFBFBD><EFBFBD><EFBFBD>˵ĵ<EFBFBD>¼<EFBFBD>ܴ<EFBFBD><EFBFBD><EFBFBD>
```html
$ last | cut -d ' ' -f 1 | sort | uniq -c
1
6 (unknown
47 dmtsai
4 reboot
7 root
1 wtmp
```
### 3. ˫<><CBAB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><D8B6><EFBFBD><EFBFBD><EFBFBD>tee
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD>У<EFBFBD><EFBFBD><EFBFBD> **tee** <20><><EFBFBD><EFBFBD><EFBFBD>ܹ<EFBFBD><DCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>ʹ<EFBFBD><CAB9> tee ָ<>һ<EEA3AC><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬʱ<CDAC><CAB1><EFBFBD>͵<EFBFBD><CDB5>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD>ϡ<EFBFBD>
```html
$ tee [-a] file
```
### 4. <20>ַ<EFBFBD>ת<EFBFBD><D7AA>ָ<EFBFBD>tr<74><72>col<6F><6C>expand<6E><64>join<69><6E>paste
**tr** <20><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>һ<EFBFBD><D2BB><EFBFBD>е<EFBFBD><D0B5>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߶<EFBFBD><DFB6>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E6BBBB>
```html
$ tr [-ds] SET1 ...
-d <20><> ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SET1 <20><><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
```
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> last <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>Сдת<D0B4><D7AA>Ϊ<EFBFBD><CEAA>д<EFBFBD><D0B4>
```html
$ last | tr '[a-z]' '[A-Z]'
```
**col** <20><> tab <20>ַ<EFBFBD>תΪ<D7AA>ո<EFBFBD><D5B8>ַ<EFBFBD><D6B7><EFBFBD>
```html
$ col [-xb]
-x <20><> <20><> tab <20><>ת<EFBFBD><D7AA><EFBFBD>ɶԵȵĿո<C4BF><D5B8><EFBFBD>
```
**expand** <20><> tab ת<><D7AA>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀո<C4BF><D5B8><EFBFBD>Ĭ<EFBFBD><C4AC><EFBFBD><EFBFBD> 8 <20><><EFBFBD><EFBFBD>
```html
$ expand [-t] file
-t <20><>tab תΪ<D7AA>ո<EFBFBD><D5B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
```
**join** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD>һ<EFBFBD>кϲ<D0BA><CFB2><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>
```html
$ join [-ti12] file1 file2
-t <20><><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>Ϊ<EFBFBD>ո<EFBFBD>
-i <20><><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD>Сд<D0A1>IJ<EFBFBD><C4B2><EFBFBD>
-1 <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>õıȽ<C4B1><C8BD>ֶ<EFBFBD>
-2 <20><><EFBFBD>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>õıȽ<C4B1><C8BD>ֶ<EFBFBD>
```
**paste** ֱ<>ӽ<EFBFBD><D3BD><EFBFBD><EFBFBD><EFBFBD>ճ<EFBFBD><D5B3><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>
```html
$ paste [-d] file1 file2
-d <20><><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>Ϊ tab
```
### 5. <20><><EFBFBD><EFBFBD>ָ<EFBFBD>split
**split** <20><>һ<EFBFBD><D2BB><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ֳɶ<D6B3><C9B6><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
```html
$ split [-bl] file PREFIX
-b <20><><EFBFBD>Դ<EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD>з<EFBFBD><D0B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɼӵ<C9BC>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> b, k, m <20><>
-l <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>з<EFBFBD><D0B7><EFBFBD><EFBFBD><EFBFBD>
- PREFIX <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
```
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
## grep
ʹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾʽ<EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
```html
$ grep [-acinv] [--color=auto] <20><>Ѱ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD> filename
-a <20><> <20><> binary <20>ļ<EFBFBD><C4BC><EFBFBD> text <20>ļ<EFBFBD><C4BC>ķ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѱ
-c <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD>
-i <20><> <20><><EFBFBD>Դ<EFBFBD>Сд
-n <20><> <20><><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD>
-v <20><> <20><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E0BCB4>ʾ<EFBFBD><CABE>û<EFBFBD><C3BB> <20><>Ѱ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD> <20><><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD>һ<EFBFBD><D2BB>
--color=auto <20><><EFBFBD>ҵ<EFBFBD><D2B5>Ĺؼ<C4B9><D8BC>ּ<EFBFBD><D6BC><EFBFBD>ɫ<EFBFBD><C9AB>ʾ
```
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѻ<EFBFBD><EFBFBD><EFBFBD> the <20>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>Ĭ<EFBFBD>ϻ<EFBFBD><CFBB><EFBFBD> --color=auto ѡ<><EFBFBD><EEA3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Linux <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB>ʾ the <20>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>
```html
$ grep -n 'the' regular_express.txt
8:I can't finish the test.
12:the symbol '*' is represented as start.
15:You are the best is mean you are the no. 1.
16:The world Happy is the same with "glad".
18:google is the best tools for search keyword
```
<EFBFBD><EFBFBD>Ϊ { <20><> } <20>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD><EFBFBD> shell <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>˱<EFBFBD><CBB1><EFBFBD>Ҫʹ<D2AA><CAB9>ʹ<EFBFBD><CAB9>ת<EFBFBD><D7AA><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD>
```html
$ grep -n 'go\{2,5\}g' regular_express.txt
```
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD>ο<EFBFBD> [<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ](https://github.com/00000H/notes/blob/master/notes/%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F.md).
## printf
<EFBFBD><EFBFBD><EFBFBD>ڸ<EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڹܵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڸ<EFBFBD> printf <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>Ҫʹ<D2AA><CAB9> $( ) <20><>ʽ<EFBFBD><CABD>
```html
$ printf '%10s %5i %5i %5i %8.2f \n' $(cat printf.txt)
DmTsai 80 60 92 77.33
VBird 75 55 80 70.00
Ken 60 90 70 73.33
```
## awk
```html
$ awk '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1{<7B><><EFBFBD><EFBFBD> 1} <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2{<7B><><EFBFBD><EFBFBD> 2} ...' filename
```
awk ÿ<>δ<EFBFBD><CEB4><EFBFBD>һ<EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1>λ<EFBFBD><CEBB><EFBFBD>ֶΣ<D6B6>ÿ<EFBFBD><C3BF><EFBFBD>ֶε<D6B6><CEB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽΪ<CABD><CEAA>\$n<><6E>n Ϊ<>ֶκţ<CEBA><C5A3><EFBFBD> 1 <20><>ʼ<EFBFBD><CABC>\$0 <20><>ʾһ<CABE><D2BB><EFBFBD>С<EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1<><31>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>¼<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD> ip
```html
$ last -n 5
dmtsai pts/0 192.168.1.100 Tue Jul 14 17:32 still logged in
dmtsai pts/0 192.168.1.100 Thu Jul 9 23:36 - 02:58 (03:22)
dmtsai pts/0 192.168.1.100 Thu Jul 9 17:23 - 23:36 (06:12)
dmtsai pts/0 192.168.1.100 Thu Jul 9 08:02 - 08:17 (00:14)
dmtsai tty1 Fri May 29 11:55 - 12:11 (00:15)
$ last -n 5 | awk '{print $1 "\t" $3}
```
awk <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
| <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |
| -- | -- |
| NF | ÿһ<C3BF><D2BB>ӵ<EFBFBD>е<EFBFBD><D0B5>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD> |
| NR | Ŀǰ<C4BF><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǵڼ<C7B5><DABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |
| FS | Ŀǰ<C4BF>ķָ<C4B7><D6B8>ַ<EFBFBD><D6B7><EFBFBD>Ĭ<EFBFBD><C4AC><EFBFBD>ǿո<C7BF><D5B8><EFBFBD> |
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2<><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>кţ<D0BA><C5A3><EFBFBD><EFBFBD><EFBFBD>ʾÿһ<C3BF><D2BB><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD>ֶ<EFBFBD>
```html
$ last -n 5 | awk '{print $1 "\t lines: " NR "\t columns: " NF}'
dmtsai lines: 1 columns: 10
dmtsai lines: 2 columns: 10
dmtsai lines: 3 columns: 10
dmtsai lines: 4 columns: 10
dmtsai lines: 5 columns: 9
```
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>ô<EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>߼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD> ==<3D><>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 3<><33>/etc/passwd <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>Ϊ UID<49><44><EFBFBD><EFBFBD> UID С<><D0A1> 10 <20><><EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><DDBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD>
```text
cat /etc/passwd | awk 'BEGIN {FS=":"} $3 < 10 {print $1 "\t " $3}'
root 0
bin 1
daemon 2
```
# vim <20><><EFBFBD><EFBFBD>ģʽ
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/341c632a-1fc1-4068-9b9f-bf7ef68ebb4c.jpg)
<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ<EFBFBD>£<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߴ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>
| <20><><EFBFBD><EFBFBD> | <20><><EFBFBD><EFBFBD> |
| -- | -- |
| :w | д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>|
| :w! | <20><><EFBFBD>ļ<EFBFBD>Ϊֻ<CEAA><D6BB>ʱ<EFBFBD><CAB1>ǿ<EFBFBD><C7BF>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD>̡<EFBFBD><CCA1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD>д<EFBFBD><EFBFBD><EBA3AC><EFBFBD>û<EFBFBD><C3BB>Ը<EFBFBD><D4B8>ļ<EFBFBD><C4BC><EFBFBD>Ȩ<EFBFBD><C8A8><EFBFBD>й<EFBFBD> |
| :q | <20>뿪|
| :q! | ǿ<><C7BF><EFBFBD><EFBFBD><EBBFAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>|
| :wq | д<><D0B4><EFBFBD><EFBFBD><EFBFBD>̺<EFBFBD><CCBA>뿪|
| :wq!| ǿ<><C7BF>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD>̺<EFBFBD><CCBA>뿪|
# <20>ο<EFBFBD><CEBF><EFBFBD><EFBFBD><EFBFBD>
- <20><><EFBFBD><EFBFBD>. <20><> <20><> <20><> Linux ˽ <20><> <20><> <20><> <20><> ƪ <20><> <20><> <20><>[J]. 2009.
- [Linux ƽ̨<C6BD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](https://www.ibm.com/developerworks/cn/linux/l-cn-rpmdpkg/index.html)