How can extract only "name" and "available space" from df linux command.
You can use...
df | tail -n +2 | awk '{ print $1, $4 }'
...assuming you don't want the headers too. If you do, remove the tail
.
We are piping df
's output into tail
, where we cut the first line off (the headers), and then pipe that into awk
, using it to print the first and fourth columns.