Bo's Oracle Station

查看: 1710|回复: 0

课程第9次

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2019-4-25 20:18:47 | 显示全部楼层 |阅读模式
s位的小实验:
  1. [root@station60 ~]# ls -l /usr/bin/passwd
  2. -rwsr-xr-x. 1 root root 27832 Jan 29  2014 /usr/bin/passwd
  3. [root@station60 ~]# ls -l /usr/bin/sleep
  4. -rwxr-xr-x. 1 root root 33216 Jun 15  2018 /usr/bin/sleep
  5. [root@station60 ~]# chmod u+s /usr/bin/sleep
  6. [root@station60 ~]# ls -l /usr/bin/sleep
  7. -rwsr-xr-x. 1 root root 33216 Jun 15  2018 /usr/bin/sleep
  8. [root@station60 ~]# chmod u-s /usr/bin/sleep
  9. [root@station60 ~]# ls -l /usr/bin/sleep
  10. -rwxr-xr-x. 1 root root 33216 Jun 15  2018 /usr/bin/sleep
  11. [root@station60 ~]# chmod u-x /usr/bin/sleep
  12. [root@station60 ~]# ls -l /usr/bin/sleep
  13. -rw-r-xr-x. 1 root root 33216 Jun 15  2018 /usr/bin/sleep
  14. [root@station60 ~]# chmod u+s /usr/bin/sleep
  15. [root@station60 ~]# ls -l /usr/bin/sleep
  16. -rwSr-xr-x. 1 root root 33216 Jun 15  2018 /usr/bin/sleep
  17. [root@station60 ~]# chmod 755 /usr/bin/sleep
  18. [root@station60 ~]# ls -l /usr/bin/sleep
  19. -rwxr-xr-x. 1 root root 33216 Jun 15  2018 /usr/bin/sleep
  20. [root@station60 ~]# chmod 4755 /usr/bin/sleep
  21. [root@station60 ~]# ls -l /usr/bin/sleep
  22. -rwsr-xr-x. 1 root root 33216 Jun 15  2018 /usr/bin/sleep
  23. [root@station60 ~]#
复制代码
目录group上s位的背景:
  1. [root@station60 /]# mkdir sdir
  2. [root@station60 /]# groupadd shareg
  3. [root@station60 /]# chgrp shareg /sdir
  4. [root@station60 /]# ls -ld /sdir
  5. drwxr-xr-x. 2 root shareg 6 Apr 25 08:38 /sdir
  6. [root@station60 /]# chmod g+w /sdir/
  7. [root@station60 /]# ls -ld /sdir/
  8. drwxrwxr-x. 2 root shareg 6 Apr 25 08:38 /sdir/
  9. [root@station60 /]# gpasswd -a student shareg
  10. Adding user student to group shareg
  11. [root@station60 /]# gpasswd -a vistor shareg
  12. gpasswd: user 'vistor' does not exist
  13. [root@station60 /]# gpasswd -a visitor shareg
  14. Adding user visitor to group shareg
复制代码
管道和文本处理:
  1. [root@station60 ~]# ifconfig
  2. ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
  3.         inet 192.168.0.60  netmask 255.255.255.0  broadcast 192.168.0.255
  4.         inet6 fe80::20c:29ff:fee2:5e6d  prefixlen 64  scopeid 0x20<link>
  5.         inet6 fd00:ac20:2e24:80e2:20c:29ff:fee2:5e6d  prefixlen 64  scopeid 0x0<                                                                             global>
  6.         ether 00:0c:29:e2:5e:6d  txqueuelen 1000  (Ethernet)
  7.         RX packets 38347  bytes 5350032 (5.1 MiB)
  8.         RX errors 0  dropped 3  overruns 0  frame 0
  9.         TX packets 14824  bytes 3004099 (2.8 MiB)
  10.         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

  11. lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
  12.         inet 127.0.0.1  netmask 255.0.0.0
  13.         inet6 ::1  prefixlen 128  scopeid 0x10<host>
  14.         loop  txqueuelen 1000  (Local Loopback)
  15.         RX packets 633  bytes 79406 (77.5 KiB)
  16.         RX errors 0  dropped 0  overruns 0  frame 0
  17.         TX packets 633  bytes 79406 (77.5 KiB)
  18.         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

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

  26. [root@station60 ~]# ifconfig  | head -n 2 | tail -n 1
  27.         inet 192.168.0.60  netmask 255.255.255.0  broadcast 192.168.0.255
  28. [root@station60 ~]# ifconfig  | head -n 2 | tail -n 1  | cut -c 14-
  29. 192.168.0.60  netmask 255.255.255.0  broadcast 192.168.0.255
  30. [root@station60 ~]# ifconfig  | head -n 2 | tail -n 1  | cut -c 14-  | cut -f 1 -d ' '
  31. 192.168.0.60
  32. [root@station60 ~]# MYIPADDR=$(ifconfig  | head -n 2 | tail -n 1  | cut -c 14-  | cut -f 1 -d ' ')
  33. [root@station60 ~]# echo $MYIPADDR
  34. 192.168.0.60
复制代码
gunzip -c :
  1. [root@station60 labs]# lvs
  2.   LV   VG   Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  3.   root rhel -wi-ao---- <17.00g                                                  
  4.   swap rhel -wi-ao----   2.00g                                                  
  5. [root@station60 labs]# vgs
  6.   VG   #PV #LV #SN Attr   VSize   VFree
  7.   rhel   1   2   0 wz--n- <19.00g    0
  8. [root@station60 labs]# dd if=/dev/rhel/swap bs=4M | gzip > /root/swap.gz
  9. ^C268+0 records in
  10. 267+0 records out
  11. 1119879168 bytes (1.1 GB) copied, 23.2432 s, 48.2 MB/s

  12. [root@station60 labs]# gunzip  -c /root/swap.gz  | dd of=/dev/rhel/swap bs=4M
复制代码








回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-4-29 04:10 , Processed in 0.040089 second(s), 24 queries .

快速回复 返回顶部 返回列表