I need to get a list of sizes in human readable du output format. How do I get the output for du command in GB under Linux or UNIX operating systems?
The du command is used to estimate file space usage. To print sizes in human readable format such as 5K, 400M, or 3G, type the following command:
du -h du -h /tmp du -h /home/vivek
Sample outputs:
25M ./scripts 317M ./softwares/vmware-workstation-7 4.2G ./softwares/rhel-6-workstation 4.5G ./softwares 6.5M ./pdfs/SecurityGuide 1.3M ./images-up 2.6M ./images-down 1.4G ./iso-images/OracleSolaris11Express2010_11_VM 4.9G ./iso-images
You can sort du command output using the sort command:
du -hs * | sort -h
All commands were tested using GNU/Linux and GNU coreutils v8.x only. Please refer to your local Linux / UNIX du and sort command man pages for more information.
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop












{ 1 comment… read it below or add one }
How about?