Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using SSH to connect to a CentOS server and I want to get the file in mb of some files and folders, how can I do it?

share|improve this question
up vote 28 down vote accepted

use the du command

du -m filename
share|improve this answer
If you use du -h instead, it'll chose (and print) the appropriate units. – Dentrasi Jun 22 '10 at 21:28
If you use du -ms folder, it will report the size of the folder contents. – KeithB Jun 22 '10 at 21:35
Is there a way where we can see the units - example mb, kb or any other information? – TheBlackBenzKid Mar 25 '13 at 9:58

du is the primary tool for this, but if you're looking for something more interactive, I quite like ncdu


share|improve this answer
+1 ncdu is great – bedwyr Jun 23 '10 at 14:49
 du -msh FolderName 

will get the size with units. Unlike using -h, this will show a single size, while -h shows all the individual files within the folder.

349M    FolderName 
share|improve this answer

protected by bwDraco Aug 20 '15 at 2:13

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.