|
s位的小实验:
- [root@station60 ~]# ls -l /usr/bin/passwd
- -rwsr-xr-x. 1 root root 27832 Jan 29 2014 /usr/bin/passwd
- [root@station60 ~]# ls -l /usr/bin/sleep
- -rwxr-xr-x. 1 root root 33216 Jun 15 2018 /usr/bin/sleep
- [root@station60 ~]# chmod u+s /usr/bin/sleep
- [root@station60 ~]# ls -l /usr/bin/sleep
- -rwsr-xr-x. 1 root root 33216 Jun 15 2018 /usr/bin/sleep
- [root@station60 ~]# chmod u-s /usr/bin/sleep
- [root@station60 ~]# ls -l /usr/bin/sleep
- -rwxr-xr-x. 1 root root 33216 Jun 15 2018 /usr/bin/sleep
- [root@station60 ~]# chmod u-x /usr/bin/sleep
- [root@station60 ~]# ls -l /usr/bin/sleep
- -rw-r-xr-x. 1 root root 33216 Jun 15 2018 /usr/bin/sleep
- [root@station60 ~]# chmod u+s /usr/bin/sleep
- [root@station60 ~]# ls -l /usr/bin/sleep
- -rwSr-xr-x. 1 root root 33216 Jun 15 2018 /usr/bin/sleep
- [root@station60 ~]# chmod 755 /usr/bin/sleep
- [root@station60 ~]# ls -l /usr/bin/sleep
- -rwxr-xr-x. 1 root root 33216 Jun 15 2018 /usr/bin/sleep
- [root@station60 ~]# chmod 4755 /usr/bin/sleep
- [root@station60 ~]# ls -l /usr/bin/sleep
- -rwsr-xr-x. 1 root root 33216 Jun 15 2018 /usr/bin/sleep
- [root@station60 ~]#
复制代码 目录group上s位的背景:
- [root@station60 /]# mkdir sdir
- [root@station60 /]# groupadd shareg
- [root@station60 /]# chgrp shareg /sdir
- [root@station60 /]# ls -ld /sdir
- drwxr-xr-x. 2 root shareg 6 Apr 25 08:38 /sdir
- [root@station60 /]# chmod g+w /sdir/
- [root@station60 /]# ls -ld /sdir/
- drwxrwxr-x. 2 root shareg 6 Apr 25 08:38 /sdir/
- [root@station60 /]# gpasswd -a student shareg
- Adding user student to group shareg
- [root@station60 /]# gpasswd -a vistor shareg
- gpasswd: user 'vistor' does not exist
- [root@station60 /]# gpasswd -a visitor shareg
- Adding user visitor to group shareg
复制代码 管道和文本处理:
- [root@station60 ~]# ifconfig
- ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
- inet 192.168.0.60 netmask 255.255.255.0 broadcast 192.168.0.255
- inet6 fe80::20c:29ff:fee2:5e6d prefixlen 64 scopeid 0x20<link>
- inet6 fd00:ac20:2e24:80e2:20c:29ff:fee2:5e6d prefixlen 64 scopeid 0x0< global>
- ether 00:0c:29:e2:5e:6d txqueuelen 1000 (Ethernet)
- RX packets 38347 bytes 5350032 (5.1 MiB)
- RX errors 0 dropped 3 overruns 0 frame 0
- TX packets 14824 bytes 3004099 (2.8 MiB)
- TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
- lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
- inet 127.0.0.1 netmask 255.0.0.0
- inet6 ::1 prefixlen 128 scopeid 0x10<host>
- loop txqueuelen 1000 (Local Loopback)
- RX packets 633 bytes 79406 (77.5 KiB)
- RX errors 0 dropped 0 overruns 0 frame 0
- TX packets 633 bytes 79406 (77.5 KiB)
- TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
- virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
- inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
- ether 52:54:00:a6:b5:89 txqueuelen 1000 (Ethernet)
- RX packets 0 bytes 0 (0.0 B)
- RX errors 0 dropped 0 overruns 0 frame 0
- TX packets 0 bytes 0 (0.0 B)
- TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
- [root@station60 ~]# ifconfig | head -n 2 | tail -n 1
- inet 192.168.0.60 netmask 255.255.255.0 broadcast 192.168.0.255
- [root@station60 ~]# ifconfig | head -n 2 | tail -n 1 | cut -c 14-
- 192.168.0.60 netmask 255.255.255.0 broadcast 192.168.0.255
- [root@station60 ~]# ifconfig | head -n 2 | tail -n 1 | cut -c 14- | cut -f 1 -d ' '
- 192.168.0.60
- [root@station60 ~]# MYIPADDR=$(ifconfig | head -n 2 | tail -n 1 | cut -c 14- | cut -f 1 -d ' ')
- [root@station60 ~]# echo $MYIPADDR
- 192.168.0.60
复制代码 gunzip -c :
- [root@station60 labs]# lvs
- LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
- root rhel -wi-ao---- <17.00g
- swap rhel -wi-ao---- 2.00g
- [root@station60 labs]# vgs
- VG #PV #LV #SN Attr VSize VFree
- rhel 1 2 0 wz--n- <19.00g 0
- [root@station60 labs]# dd if=/dev/rhel/swap bs=4M | gzip > /root/swap.gz
- ^C268+0 records in
- 267+0 records out
- 1119879168 bytes (1.1 GB) copied, 23.2432 s, 48.2 MB/s
- [root@station60 labs]# gunzip -c /root/swap.gz | dd of=/dev/rhel/swap bs=4M
复制代码
|
|