UNIX: Find the largest files and directories

Today I was connected to my server through SSH copying over a site to a new domain and needed to figure out if I had enough server space for the copy and which files/folders were taking up the most space. I’d never done this before so I did a quick search in google and pulled up this site.

I found this article

[pre lang=’unix’]
# du -a /var | sort -n -r | head -n 10
So I changed “/var” to my httpdocs folder and changed 10 to 100 and boom, I got list of all these files I had totally forgotten about. What a sweet command. It let me get back a ton of server space from files and folders I no longer needed.

Thanks cyberciti for the article.

[carousel keywords=”unix, linux, administration” category=”Books” tag=”damnsemi01-20″ showBorder=”True”]

Continue Reading