botang 发表于 2019-4-25 20:18:47

课程第9次

s位的小实验:
# ls -l /usr/bin/passwd
-rwsr-xr-x. 1 root root 27832 Jan 292014 /usr/bin/passwd
# ls -l /usr/bin/sleep
-rwxr-xr-x. 1 root root 33216 Jun 152018 /usr/bin/sleep
# chmod u+s /usr/bin/sleep
# ls -l /usr/bin/sleep
-rwsr-xr-x. 1 root root 33216 Jun 152018 /usr/bin/sleep
# chmod u-s /usr/bin/sleep
# ls -l /usr/bin/sleep
-rwxr-xr-x. 1 root root 33216 Jun 152018 /usr/bin/sleep
# chmod u-x /usr/bin/sleep
# ls -l /usr/bin/sleep
-rw-r-xr-x. 1 root root 33216 Jun 152018 /usr/bin/sleep
# chmod u+s /usr/bin/sleep
# ls -l /usr/bin/sleep
-rwSr-xr-x. 1 root root 33216 Jun 152018 /usr/bin/sleep
# chmod 755 /usr/bin/sleep
# ls -l /usr/bin/sleep
-rwxr-xr-x. 1 root root 33216 Jun 152018 /usr/bin/sleep
# chmod 4755 /usr/bin/sleep
# ls -l /usr/bin/sleep
-rwsr-xr-x. 1 root root 33216 Jun 152018 /usr/bin/sleep
#
目录group上s位的背景:
# mkdir sdir
# groupadd shareg
# chgrp shareg /sdir
# ls -ld /sdir
drwxr-xr-x. 2 root shareg 6 Apr 25 08:38 /sdir
# chmod g+w /sdir/
# ls -ld /sdir/
drwxrwxr-x. 2 root shareg 6 Apr 25 08:38 /sdir/
# gpasswd -a student shareg
Adding user student to group shareg
# gpasswd -a vistor shareg
gpasswd: user 'vistor' does not exist
# gpasswd -a visitor shareg
Adding user visitor to group shareg
管道和文本处理:
# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>mtu 1500
      inet 192.168.0.60netmask 255.255.255.0broadcast 192.168.0.255
      inet6 fe80::20c:29ff:fee2:5e6dprefixlen 64scopeid 0x20<link>
      inet6 fd00:ac20:2e24:80e2:20c:29ff:fee2:5e6dprefixlen 64scopeid 0x0<                                                                           global>
      ether 00:0c:29:e2:5e:6dtxqueuelen 1000(Ethernet)
      RX packets 38347bytes 5350032 (5.1 MiB)
      RX errors 0dropped 3overruns 0frame 0
      TX packets 14824bytes 3004099 (2.8 MiB)
      TX errors 0dropped 0 overruns 0carrier 0collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>mtu 65536
      inet 127.0.0.1netmask 255.0.0.0
      inet6 ::1prefixlen 128scopeid 0x10<host>
      looptxqueuelen 1000(Local Loopback)
      RX packets 633bytes 79406 (77.5 KiB)
      RX errors 0dropped 0overruns 0frame 0
      TX packets 633bytes 79406 (77.5 KiB)
      TX errors 0dropped 0 overruns 0carrier 0collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>mtu 1500
      inet 192.168.122.1netmask 255.255.255.0broadcast 192.168.122.255
      ether 52:54:00:a6:b5:89txqueuelen 1000(Ethernet)
      RX packets 0bytes 0 (0.0 B)
      RX errors 0dropped 0overruns 0frame 0
      TX packets 0bytes 0 (0.0 B)
      TX errors 0dropped 0 overruns 0carrier 0collisions 0

# ifconfig| head -n 2 | tail -n 1
      inet 192.168.0.60netmask 255.255.255.0broadcast 192.168.0.255
# ifconfig| head -n 2 | tail -n 1| cut -c 14-
192.168.0.60netmask 255.255.255.0broadcast 192.168.0.255
# ifconfig| head -n 2 | tail -n 1| cut -c 14-| cut -f 1 -d ' '
192.168.0.60
# MYIPADDR=$(ifconfig| head -n 2 | tail -n 1| cut -c 14-| cut -f 1 -d ' ')
# echo $MYIPADDR
192.168.0.60
gunzip -c :
# 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                                                
# vgs
VG   #PV #LV #SN Attr   VSize   VFree
rhel   1   2   0 wz--n- <19.00g    0
# 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

# gunzip-c /root/swap.gz| dd of=/dev/rhel/swap bs=4M








页: [1]
查看完整版本: 课程第9次