□ [root@wen ~]# ifconfig |awk 'NR==2 {print $3}' | awk -F ":" '{print $2 }'
192.168.59.255
□ Linux 正则表达式三剑客
^ 以……什么开头 ^d,以d开头
$ 以……什么结尾 /$,以/结尾
/ 转义符 还原本身含义
. 代表任意单个字符
cd - 返回上一目录
一. 查找目录方法
1. 根据颜色区分目录和文件
2. ^d,以什么开头的
- [root@wen data]# ls -l |grep "^d"
drwxr-xr-x. 3 root root 4096 10月 3 01:52 926
drwxr-xr-x. 2 root root 4096 9月 19 05:44 __pycache__
drwxr-xr-x 2 root root 4096 10月 3 02:47 qq
3. 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 926
drwxr-xr-x. 2 root root 4096 9月 19 05:44 __pycache__
drwxr-xr-x 2 root root 4096 10月 3 02:47 qq
4. ls -F,给不同文件结尾加标识 #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__
./qq
6. [root@wen data]# ls -l|sed -n '/^d/p'
drwxr-xr-x. 3 root root 4096 10月 3 01:52 926
drwxr-xr-x. 2 root root 4096 9月 19 05:44 __pycache__
drwxr-xr-x 2 root root 4096 10月 3 02:47 qq
7. [root@wen data]# ll|awk '/^d/'
drwxr-xr-x. 3 root root 4096 10月 3 01:52 926
drwxr-xr-x. 2 root root 4096 9月 19 05:44 __pycache__
drwxr-xr-x 2 root root 4096 10月 3 02:47 qq
8. [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__
qq
selectors.py
test_from_windows
#./ 目录及目录本身
./*目录下的东西
二. 第二关
1. [root@wen data]# date
2017年 10月 03日 星期二 14:17:26 CST
[root@wen data]# date -s '2017/10/04 12:27'
2017年 10月 04日 星期三 12:27:00 CST