Linux 如何在 SunOs 的 df -k 命令中省略标题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6571826/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to omit heading in df -k command of SunOs
提问by AabinGunz
Input: df -k
输入: df -k
Output:
输出:
Filesystem kbytes used avail capacity Mounted on
/dev/dsk/c0t0d0s0 10332220 443748 9785150 5% /
/devices 0 0 0 0% /devices
ctfs 0 0 0 0% /system/contract
proc 0 0 0 0% /proc
mnttab 0 0 0 0% /etc/mnttab
swap 45475864 1688 45474176 1% /etc/svc/volatile
objfs 0 0 0 0% /system/object
sharefs 0 0 0 0% /etc/dfs/sharetab
/dev/dsk/c0t0d0s3 10332220 3513927 6714971 35% /usr
I want to omit the 1st line Filesystem kbytes used avail capacity Mounted on
from the output.
我想Filesystem kbytes used avail capacity Mounted on
从输出中省略第一行。
I used df -k | tail -n+2
in linux to get exactly what i wanted, but in SunOs I get
我df -k | tail -n+2
在 linux 中使用以获得我想要的东西,但是在 SunOs 中我得到了
zenvo% df -k | tail -n+2
usage: tail [+/-[n][lbc][f]] [file]
tail [+/-[n][l][r|f]] [file]
How can i achieve the Required output:
我怎样才能实现所需的输出:
/dev/dsk/c0t0d0s0 10332220 443748 9785150 5% /
/devices 0 0 0 0% /devices
ctfs 0 0 0 0% /system/contract
proc 0 0 0 0% /proc
mnttab 0 0 0 0% /etc/mnttab
swap 45475864 1688 45474176 1% /etc/svc/volatile
objfs 0 0 0 0% /system/object
sharefs 0 0 0 0% /etc/dfs/sharetab
/dev/dsk/c0t0d0s3 10332220 3513927 6714971 35% /usr
Note: No. of rows might change
注意:行数可能会改变
采纳答案by wollw
I haven't used SunOS but using sed you should be able to delete the first line like this:
我没有使用过 SunOS,但使用 sed 你应该能够像这样删除第一行:
df -k | sed -e /Filesystem/d
edit: But you would have to be careful that the word Filesystem doesn't show up elsewhere in the output. A better solution would be:
编辑:但是你必须小心,文件系统这个词不会出现在输出的其他地方。更好的解决方案是:
df -k | sed -e /^Filesystem/d
回答by hsz
What about:
关于什么:
df -k | tail -$((`df -k | wc -l`-1))
回答by Bart N
I know it's an old thread, but the shortest and the clearest of all:
我知道这是一个旧线程,但最短和最清晰:
df -k | sed 1d