-p 参数用于建立多级目录是时。 好比咱们要建立 a 目录和a目录下的b目录:html
mkdir -p a/b
还能够在多个文件夹下建立,好比在A,B,C 三个目录下穿件test 目录:linux
mdkir -p {a,b,c}/test
建立a目录并在在 a 目录下建立 b,c 两个目录:正则表达式
mkdir -p a/{b,c}
问题: 1 tar: Removing leading `/’ from member names”的错误shell
| 其缘由是tar默认为相对路径,使用绝对路径的话就回报这个错,可使 用-P参数(注意大写)解决这个问题vim
[root@iZryxshkbkz2x2Z a]# tar -jPcf shell.tar /root/shell
定义: 在文件中搜素符合条件的字符串,若是须要匹配,使用正则表达式进行匹配。服务器
[root@iZryxshkbkz2x2Z ~]# grep savepath ./backups.sh savepath=/root/tar/$(date +%F_%H%M) if [ ! -d $savepath ] mkdir -p $savepath tar -jPcf $savepath/96.tar /www/wwwroot/default/96weixin.ewm
grep -E 'bin|sacepath' ./backups.sh # 重点必定要加E参数。将范本样式为延伸的普通表示法来使用,意味着使用能使用扩展正则表达式
grep pattern1 files | grep pattern2 //显示既匹配 pattern1 又匹配 pattern2 的行。ssh
[root@iZryxshkbkz2x2Z ~]# grep 'mkdir' backups.sh | grep 'savepath' mkdir -p $savepath
[root@iZryxshkbkz2x2Z find]# ls testABC.txt testA.txt testB.txt test.txt [root@iZryxshkbkz2x2Z find]# find . -name test [root@iZryxshkbkz2x2Z find]# find . -name test.txt # 因此find彻底匹配 ./test.txt
***** :tcp
[root@iZryxshkbkz2x2Z find]# ls test testA testABC [root@iZryxshkbkz2x2Z find]# find ./ -name 'test*' ./testABC ./test ./testA
? :工具
[root@iZryxshkbkz2x2Z find]# ls test testA testABC [root@iZryxshkbkz2x2Z find]# find . -name 'test?' ./testA
[] :this
find . -name 'test[AB]' 碰到tes后跟 A 或 B 就返回,注意只返回一个
[root@iZryxshkbkz2x2Z find]# ls test testA testABC testBc [root@iZryxshkbkz2x2Z find]# find . -name 'test[AB]' ./testA
[root@iZryxshkbkz2x2Z ~]# find ./ -mtime 2 ./shell/if.sh ./shell/a.txt ./shell/for.sh ./shell/while.sh ./shell/.until.swp
[root@iZryxshkbkz2x2Z ~]# find . -size +20k -a -size -10M; # 注意,k小写,M大写。 ./.acme.sh/acme.sh
https://blog.csdn.net/makang456/article/details/78694120
[root@iZryxshkbkz2x2Z default]# free -m total used free shared buffers cached Mem: 996 883 112 103 62 456 -/+ buffers/cache: 365 630 Swap: 1024 57 967
总内存: total 996M
系统使用内存: userd - free - buffers - cached (-buffer/cached)
系统剩余内存: free + buffers + cached (+buffer/cached)
[root@iZryxshkbkz2x2Z ~]# cat /proc//meminfo MemTotal: 1019988 kB MemFree: 347060 kB Buffers: 24876 kB Cached: 305160 kB SwapCached: 8828 kB Active: 242408 kB Inactive: 356236 kB Active(anon): 158404 kB Inactive(anon): 216016 kB Active(file): 84004 kB Inactive(file): 140220 kB Unevictable: 0 kB Mlocked: 0 kB
[root@iZryxshkbkz2x2Z ~]# uname -o GNU/Linux
[root@iZryxshkbkz2x2Z ~]# cat /etc/issue CentOS release 6.10 (Final) Kernel \r on an \m
[root@iZryxshkbkz2x2Z ~]# uname -m x86_64
[root@iZryxshkbkz2x2Z ~]# uname -r 2.6.32-696.10.1.el6.x86_64
[root@iZryxshkbkz2x2Z ~]# uname -a Linux iZryxshkbkz2x2Z 2.6.32-696.10.1.el6.x86_64 #1 SMP Tue Aug 22 18:51:35 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@iZryxshkbkz2x2Z ~]# hostname iZryxshkbkz2x2Z
[root@iZryxshkbkz2x2Z ~]# hostname -I 172.17.0.1
[root@iZryxshkbkz2x2Z ~]# cat /etc/resolv.conf nameserver 100.100.2.136 nameserver 100.100.2.138 options timeout:2 attempts:3 rotate single-request-reopen
[root@iZryxshkbkz2x2Z ~]# who root pts/5 2018-08-16 08:13 (222.173.241.202)
未完待续。。。
[root@iZryxshkbkz2x2Z ~]# du -s 51000 .
[root@iZryxshkbkz2x2Z ~]# du -sh 50M .
[root@iZryxshkbkz2x2Z ~]# du -ah 4.0K ./b.docx 4.0K ./backups.sh 4.0K ./.ssh/known_hosts 4.0K ./.ssh/id_rsa 4.0K ./.ssh/id_rsa.pub 4.0K ./.ssh/authorized_keys 20K ./.ssh 4.0K ./firewall.sh 20K ./.cache/pip/http/b/b/8/7/6/bb876b2e6a22c2739002e9ef3388ae978b7a6192a19fe67d8b0030f2 24K ./.cache/pip/http/b/b/8/7/6 28K ./.cache/pip/http/b/b/8/7 32K ./.cache/pip/http/b/b/8 36K ./.cache/pip/http/b/b 40K ./.cache/pip/http/b 4.0K ./.cache/pip/http/f/e/d/0/e/fed0ed508030b766d5b0c2792132c8bf197804464765b46b361f93a4 8.0K ./.cache/pip/http/f/e/d/0/e 12K ./.cache/pip/http/f/e/d/0
[root@iZryxshkbkz2x2Z ~]# du -h --max-depth=1 # 重点 20K ./.ssh 80K ./.cache 4.0K ./.gconf 46M ./tar 8.0K ./.pip 12K ./a 1.7M ./.openoffice 4.0K ./find 600K ./html 56K ./.subversion 184K ./.acme.sh 124K ./shell 1.8M ./.config 8.0K ./.pki 50M .
[root@iZryxshkbkz2x2Z ~]# du -h test.txt 4.0K test.txt
vim /etc/sysconfig/iptables
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT # 添加3306 端口
service iptables restart # 重启iptables
1 shutdow
f
如当即重启:
shutdown -r now
在5:30 重启服务器:
[root@iZryxshkbkz2x2Z ~]# shutdown -r 05:30 Broadcast message from root@iZryxshkbkz2x2Z (/dev/pts/5) at 11:12 ... The system is going down for reboot in 1098 minutes!
取消上一个关机命令:
[root@iZryxshkbkz2x2Z ~]# shutdown -c shutdown: Shutdown cancelled [1]+ Done shutdown -r 05:30 [root@iZryxshkbkz2x2Z ~]# shutdown -c shutdown: Cannot find pid of running shutdown
2 其余关机命令
# halt
# poweroff
# init 0
# reboot
# init 6
并不建议使用以上命令,建议使用shutdown。
3 关于linux init
init命令是Linux下的进程初始化工具,init进程是全部Linux进程的父进程,它的进程号为1。init命令是Linux操做系统中不可缺乏的程序之一,init进程是Linux内核引导运行的,是系统中的第一个进程
能够在 在/etc/inittab中查看 # 0 - halt (Do NOT set initdefault to this) # 1 - Single user mode # 2 - Multiuser, without NFS (The same as 3, if you do not have networking) # 3 - Full multiuser mode # 4 - unused # 5 - X11 # 6 - reboot (Do NOT set initdefault to this) # id:3:initdefault: 中文: #0 停机(千万不能把initdefault 设置为0) #1 单用户模式 #2 多用户,没有 NFS(和级别3类似,会中止部分服务) #3 彻底多用户模式 #4 没有用到 #5 x11(Xwindow) #6 从新启动(千万不要把initdefault 设置为6)
未完待续 。。。