convert file size into human readable format in linux

3,326 views
Skip to first unread message

vinay kumar

unread,
Sep 6, 2013, 8:40:17 AM9/6/13
to linuxus...@googlegroups.com
i have to convert the file size into human readable format like MB,GB,KB,TB,PB with linux command or function...
guide me...

thanks,
Vinay

Jeremiah Bess

unread,
Sep 6, 2013, 9:27:30 AM9/6/13
to LUG
ls -h will display files in human readable format.


Jeremiah E. Bess
Network Ninja, Penguin Geek, Father of five.

 


--
--
You received this message because you are subscribed to the Linux Users Group.
To post a message, send email to linuxus...@googlegroups.com
To unsubscribe, send email to linuxusersgro...@googlegroups.com
For more options, visit our group at http://groups.google.com/group/linuxusersgroup
References can be found at: http://goo.gl/anqri
Please remember to abide by our list rules (http://tinyurl.com/LUG-Rules or http://cdn.fsdev.net/List-Rules.pdf)
 
---
You received this message because you are subscribed to the Google Groups "Linux Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linuxusersgro...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Jeremiah Bess

unread,
Sep 6, 2013, 9:29:19 AM9/6/13
to LUG
Sorry, use the long listing option with the human readable option (-lh) and that will show the file sizes.


Jeremiah E. Bess
Network Ninja, Penguin Geek, Father of five.

 


Bill Oliver

unread,
Sep 6, 2013, 10:26:47 AM9/6/13
to linuxus...@googlegroups.com
> --

Do you mean something like "ls -lh | grep <filename>"?

billo

vinay kumar

unread,
Sep 6, 2013, 11:40:32 PM9/6/13
to linuxus...@googlegroups.com
I know that ls -lh will work.But For example.....say a large number in bytes 12345678 is there .How would I convert this number into nearest MB,GB,KB .
Suppose the number is 1024..so my output would be  1MB
10240 --------10MB
How to do it by any command or the function in linux..
need help ...

Guillermo Prado Obando

unread,
Sep 6, 2013, 8:47:07 AM9/6/13
to linuxus...@googlegroups.com
ls -lh


2013/9/6 vinay kumar <vinay...@gmail.com>

--
--
You received this message because you are subscribed to the Linux Users Group.
To post a message, send email to linuxus...@googlegroups.com
To unsubscribe, send email to linuxusersgro...@googlegroups.com
For more options, visit our group at http://groups.google.com/group/linuxusersgroup
References can be found at: http://goo.gl/anqri
Please remember to abide by our list rules (http://tinyurl.com/LUG-Rules or http://cdn.fsdev.net/List-Rules.pdf)
 
---
You received this message because you are subscribed to the Google Groups "Linux Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linuxusersgro...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Atentamente,


Guillermo Prado Obando.
Bogotá D.C Colombia.

Alessandro Io

unread,
Sep 6, 2013, 11:40:29 AM9/6/13
to linuxus...@googlegroups.com

ls -h

--
Reply all
Reply to author
Forward
0 new messages