LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-24-2005, 08:24 AM   #1
cmfarley19
Member
 
Registered: Nov 2002
Location: Central VA
Distribution: Ubuntu/Debian
Posts: 228

Rep: Reputation: 32
Finding File Size


I am playing around with a script to rotate an RSS feed based on file size.
I came up with two different ways to do it, but they yield two different results.

I'm proabaly missing something. Can anybody explain this?
Code:
[cfarley@wombat cfarley]$ du path_to_file/file.rss| cut -f1
12K
[cfarley@wombat cfarley]$ ll -h path_to_file/|grep file.rss|grep -v template|awk '{print $5}'
8.5K
FYI...
In the second example, the
Code:
grep -v template
is to filter out a file called file.rss.template.
 
Old 01-24-2005, 09:36 AM   #2
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
Try 'du -bh'. du reports in blocks of 512/1024k which are actually used by the file while ls (or du -bh) reports the byte-length of the file.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding the file size harrylmh Programming 8 04-29-2006 04:59 PM
Finding installed raw disks and size looseCannon Solaris / OpenSolaris 5 02-23-2005 02:26 PM
finding size of total files in a directory blackzone Linux - Newbie 3 01-07-2005 04:01 AM
Finding files via their size ivanatora Linux - General 1 09-08-2004 09:23 AM
Finding size of a directory chrisk5527 Linux - General 2 12-30-2003 09:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration