df -h

[wangshumin@CentOSNode3 shell]$ df -h /
文件系统        容量  已用  可用 已用% 挂载点
/dev/sda3        17G  6.1G   11G   36% /
[wangshumin@CentOSNode3 shell]$ df -h 
文件系统        容量  已用  可用 已用% 挂载点
/dev/sda3        17G  6.1G   11G   36% /
devtmpfs        478M     0  478M    0% /dev
tmpfs           492M     0  492M    0% /dev/shm
tmpfs           492M  7.2M  485M    2% /run
tmpfs           492M     0  492M    0% /sys/fs/cgroup
/dev/sda1      1014M  194M  821M   20% /boot
tmpfs            99M   12K   99M    1% /run/user/42
tmpfs            99M     0   99M    0% /run/user/1000
[wangshumin@CentOSNode3 shell]$ df -h | grep "/boot"
/dev/sda1      1014M  194M  821M   20% /boot
[wangshumin@CentOSNode3 shell]$ df -h | grep "/boot" | awk '{print $6}'
/boot
[wangshumin@CentOSNode3 shell]$ df -h | grep "/boot" | awk '{print $5}'
20%
[wangshumin@CentOSNode3 shell]$ df -h | grep "/boot" | awk '{print $5}' | cut -d "%" -f 1
20
[wangshumin@CentOSNode3 shell]$ v=df -h | grep "/boot" | awk '{print $5}' | cut -d "%" -f 1
bash: -h: 未找到命令...
[wangshumin@CentOSNode3 shell]$ v=(df -h | grep "/boot" | awk '{print $5}' | cut -d "%" -f 1)
-bash: 未预期的符号 `|' 附近有语法错误
[wangshumin@CentOSNode3 shell]$ v=(df -h | grep "/boot" | awk '{print $5}' | cut -d "%" -f 1 )
-bash: 未预期的符号 `|' 附近有语法错误
[wangshumin@CentOSNode3 shell]$ v=$(df -h | grep "/boot" | awk '{print $5}' | cut -d "%" -f 1 )
[wangshumin@CentOSNode3 shell]$ echo $v
20
[wangshumin@CentOSNode3 shell]$ netstat -tnlu
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN     
tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN     
tcp6       0      0 :::111                  :::*                    LISTEN     
tcp6       0      0 :::22                   :::*                    LISTEN     
tcp6       0      0 ::1:631                 :::*                    LISTEN     
tcp6       0      0 ::1:25                  :::*                    LISTEN     
udp        0      0 192.168.122.1:53        0.0.0.0:*                          
udp        0      0 0.0.0.0:67              0.0.0.0:*                          
udp        0      0 0.0.0.0:40579           0.0.0.0:*                          
udp        0      0 0.0.0.0:5353            0.0.0.0:*                          
[wangshumin@CentOSNode3 shell]$ netstat -tnlu | awk '{print $4}'
(only
Local
0.0.0.0:111
192.168.122.1:53
0.0.0.0:22
127.0.0.1:631
127.0.0.1:25
:::111
:::22
::1:631
::1:25
192.168.122.1:53
0.0.0.0:67
0.0.0.0:40579
0.0.0.0:5353
[wangshumin@CentOSNode3 shell]$ netstat -tnlu | awk '{print $4}' | grep ":80$"
[wangshumin@CentOSNode3 shell]$ netstat -tnlu | awk '{print $4}' | grep ":25$"
127.0.0.1:25
::1:25
[wangshumin@CentOSNode3 shell]$ v2=$(netstat -tnlu | awk '{print $4}' | grep ":25$")
[wangshumin@CentOSNode3 shell]$ echo v2
v2
[wangshumin@CentOSNode3 shell]$ echo $v2
127.0.0.1:25 ::1:25
[wangshumin@CentOSNode3 shell]$ v2=$(netstat -tnlu | awk '{print $4}' | grep "0.1:25$")
[wangshumin@CentOSNode3 shell]$ echo $v2
127.0.0.1:25
[wangshumin@CentOSNode3 shell]$ 
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值