![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | 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 !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Simple C question... Hopefully it's simple | Xeed | High Level Programming | 6 | 12-15-2006 10:29 AM |
| Very simple question | roger19 | UNIX for Dummies Questions & Answers | 4 | 07-17-2006 04:36 PM |
| Ok simple question for simple knowledge... | Corrail | UNIX for Dummies Questions & Answers | 1 | 11-28-2005 09:03 AM |
| a simple question | pnxi | UNIX for Advanced & Expert Users | 2 | 11-11-2003 10:10 PM |
| a very simple question (but i don't know) | dell9 | High Level Programming | 1 | 10-29-2001 11:37 PM |
|
|
LinkBack | Thread Tools | 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. |
| Forum Sponsor | ||
|
|
|
|||
|
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 * |
|||
| Google UNIX.COM |