How do I retrieve only the needed line from terminal output?

This will output the 3rd line, regardless of content.

df -h | sed -n 3p

The df command actually accepts an argument identifying the filesystem you want. So you could use, for example, df /home or df /dev/sda3.

If you intend to parse the output for a script, you'll want to use df -P to guarantee it never wraps to multiple lines. So, for example, you could use df -Ph /home | tail -n +2 (but if you're parsing output for a script, be aware of the possibility of filenames with spaces in them)


You can use a combination of head and tail:

df -h | head -3 | tail -1

Or

df -h | tail -n +3 | head -1

But note that, df allows to filter the output from the options of df itself, you should look at those first before using any external command.

Check man df.