head
example:
Desktop:
λ df -h
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
/dev/disk1s7s1 113Gi 8.9Gi 8.6Gi 51% 355384 90345720 0% /
/dev/disk1s2 113Gi 3.3Gi 8.6Gi 28% 1743 90345720 0% /System/Volumes/Preboot
/dev/disk1s4 113Gi 24Ki 8.6Gi 1% 5 90345720 0% /System/Volumes/VM
/dev/disk1s6 113Gi 63Mi 8.6Gi 1% 660 90345720 0% /System/Volumes/Update
/dev/disk1s5 113Gi 91Gi 8.6Gi 92% 655534 90345720 1% /System/Volumes/Data
/dev/disk1s1 113Gi 64Ki 8.6Gi 1% 15 90345720 0% /Volumes/mnbvcxz - Data
/dev/disk3s1 58Gi 57Gi 843Mi 99% 209 8636800 0% /Volumes/Untitled
Desktop:
λ df -h | head -n1
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
Is there a cmd specifically that will show output of fields by space instead of new line?
A cmd what that will do what this awk
cmd does:
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on \
| awk -F ' ' '{print$1}'
Filesystem
head -n<number>
does withawk
. – Nickotine Nov 07 '23 at 23:55awk
will do a much better job thancut
for you. – muru Nov 08 '23 at 01:05cut -d ' ' -f 2
andawk '{print $2}'
will show otherwise (at least, for your given example input). – muru Nov 08 '23 at 01:34