![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Simple C question... Hopefully it's simple | Xeed | High Level Programming | 6 | 12-15-2006 02:29 PM |
| Very simple question | roger19 | UNIX for Dummies Questions & Answers | 4 | 07-17-2006 07:36 PM |
| Ok simple question for simple knowledge... | Corrail | UNIX for Dummies Questions & Answers | 1 | 11-28-2005 01:03 PM |
| a simple question | pnxi | UNIX for Advanced & Expert Users | 2 | 11-12-2003 02:10 AM |
| a very simple question (but i don't know) | dell9 | High Level Programming | 1 | 10-30-2001 03:37 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Simple fle size question
I'm sure this is a simple one, but I'm new to UNIX and I can't figure it out.
How do I view file size in Megabytes? I have files in a directory and the size is 184710. I think this is in bytes but I'm not usre. How can I view this in MB. Thanks. |
|
||||
|
Code:
# FILE=mybigfile.txt
# ls -l $FILE
-rw-r--r-- 1 root staff 14639794 Aug 22 2006 mybigfile.txt
# awk 'BEGIN{"ls -l " "'$FILE'"|getline;printf "%s %5.2fMiB\n",$NF,$5/2^20}'
mybigfile.txt 13.96MiB
# awk 'BEGIN{"ls -l " "'$FILE'"|getline;printf "%s %5.2fMB\n",$NF,$5/10^6}'
mybigfile.txt 14.64MB
See Megabyte - Wikipedia for the differences between megabyte (MB) and mebibyte (MiB). |
|
||||
|
Quote:
For example: ls -lh or du -sh * |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|