10.4
□ [root@wen ~]# ifconfig |awk 'NR==2 {print $3}' | awk -F ":" '{print $2 }'
192.168.59.255□ Linux 正則表達式三劍客^ 以……什么開頭 ^d,以d開頭$ 以……什么結(jié)尾 /$,以/結(jié)尾/ 轉(zhuǎn)義符 還原本身含義. 代表任意單個字符 cd - 返回上一目錄
一. 查找目錄方法1. 根據(jù)顏色區(qū)分目錄和文件2. ^d,以什么開頭的- [root@wen data]# ls -l |grep "^d"drwxr-xr-x. 3 root root 4096 10月 3 01:52 926drwxr-xr-x. 2 root root 4096 9月 19 05:44 __pycache__drwxr-xr-x 2 root root 4096 10月 3 02:47 qq3. ll ,第二例inode大于1的都是目錄- [root@wen data]# ll |awk '{if($2>1) print $0}' #$0輸入整行drwxr-xr-x. 3 root root 4096 10月 3 01:52 926drwxr-xr-x. 2 root root 4096 9月 19 05:44 __pycache__drwxr-xr-x 2 root root 4096 10月 3 02:47 qq4. ls -F,給不同文件結(jié)尾加標識 #ls -p 只給目錄加標識- [root@wen data]# ls -F| grep "/$"926/__pycache__/qq/- [root@wen data]# ls -p | grep "/$"926/__pycache__/qq/5. 用find加深度[root@wen etc]# find ./ -type d- [root@wen data]# find ./ -maxdepth 1 -type d #深度././926./qq./__pycache__- [root@wen data]# find ./* -maxdepth 1 -type d ! -name "." #不包括當前目錄./926./926/test./__pycache__./qq6. [root@wen data]# ls -l|sed -n '/^d/p'drwxr-xr-x. 3 root root 4096 10月 3 01:52 926drwxr-xr-x. 2 root root 4096 9月 19 05:44 __pycache__drwxr-xr-x 2 root root 4096 10月 3 02:47 qq7. [root@wen data]# ll|awk '/^d/'drwxr-xr-x. 3 root root 4096 10月 3 01:52 926drwxr-xr-x. 2 root root 4096 9月 19 05:44 __pycache__drwxr-xr-x 2 root root 4096 10月 3 02:47 qq8. [root@wen data]# ls -F |awk '/\/$/'926/__pycache__/qq/- [root@wen data]# ls -F|sed -n '/\/$/p'926/__pycache__/qq/9. [root@wen data]# ls -a|grep '\.'...selectors.py[root@wen data]# ls -a|grep '.'...926__pycache__qqselectors.pytest_from_windows#./ 目錄及目錄本身./*目錄下的東西二. 第二關(guān)1. [root@wen data]# date2017年 10月 03日 星期二 14:17:26 CST[root@wen data]# date -s '2017/10/04 12:27'2017年 10月 04日 星期三 12:27:00 CST
總結(jié)
- 上一篇: 10.2-linux文件与目录管理
- 下一篇: 10.14.2 快捷键,环境变量等