Find the second biggest file/directory in size using commands.
What I have
du /etc/ -hsx * | sort -rh | head -2
This command shows me two lines which, by the options I've chosen, gets me the 2 biggest files/directories inside /etc/.
What if I only want to find the second biggest file? How can I do it?
Example, by doing the command
sudo du /etc/ -hsx * | sort -rh | head -2 | tail -1
I get the result
but what I expected is to get only it's name, not the size or else. Just the name. I've also read that can be done with the
ls command too.