ls -s and ls -l returns different file size


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers ls -s and ls -l returns different file size
# 1  
Old 07-31-2012
Question ls -s and ls -l returns different file size

I found an weird thing when i browse through my files with ls -sh option.
Code:
512M -rw-rw---- 1  user user   20K  Jul  3 23:00 2012 /path/a.MYI .....(1)
512M -rw-rw---- 1  user user   19K  Jul  3 23:00 2012 /path/b.MYI .....(2)
512M -rw-rw---- 1  user user   16K  Jul  3 23:00 2012 /path/c.MYI .....(3)
512M -rw-rw---- 1  user user  5.0K  Jul  9 15:30 2012 /path/d.MYI .....(4)
4.0K -rw-rw---- 1  user user  4.0K  Jul  3 23:00 2012 /path/e.MYI .....(5)

The size returned by -s option and -l option are different (1)~(4)
I understand that -s prints the allocated size in blocks, but i expect smaller figure in this case.
But the result shows 512M block size for a file of 20K.
Hmm.. can i assume that something is wrong?
Or anyone can explain this situation?
Thank you.
# 2  
Old 07-31-2012
What OS do you have?

Please post the output of
Code:
df -k
cat /etc/mnttab

And no, you cannot assume something is wrong. It probably has to do with how the filesystem was set up. And what type of filesystem you have: ufs, ext3, etc.
# 3  
Old 07-31-2012
Quote:
Originally Posted by jim mcnamara
Please post the output of
Code:
cat /etc/mnttab

Depending on your OS this file could alternatively be named /etc/filesystems (AIX) or /etc/fstab (Linux, FreeBSD?) or even something different.

Either way, Jim wants to know what is mounted where and probably which (types of) filesystems are being used.

I hope this helps.

bakunin
# 4  
Old 08-03-2012
@rei125
What Operating System and version are you running and what Shell you you use?
The order of the fields from your ls command is weird. I wonder if someone has modied your ls command.
Please post the output from:
Code:
alias | grep "ls"
type ls

Post #1 does not match the commands to the output and appears to show 5 different files. Please re-post showing clearly what command you actually typed to get each line of output, making it clear where you believe there is an anomaly.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Ls directory size reporting byte size instead of file count

I have been searching both on Unix.com and Google and have not been able to find the answer to my question. I think it is partly because I can't come up with the right search terms. Recently, my virtual server switched storage devices and I think the problem may be related to that change.... (2 Replies)
Discussion started by: jmgibby
2 Replies

2. Shell Programming and Scripting

rm -rf ab returns find: `./ab': No such file or directory

Hi Gurus. This is driving me a bit batty. I now if must be a simple matter but I cant find anything that references it. I have a housekeeping script that searches for some huge dump directories then removes them using rm -rf. find ./ -name 'ab' -exec rm -rf {} \; This works but always... (7 Replies)
Discussion started by: rinser
7 Replies

3. Shell Programming and Scripting

Script to read file size and send email only if size > 0.

Hi Experts, I have a script like $ORACLE_HOME/bin/sqlplus username/password # << ENDSQL set pagesize 0 trim on feedback off verify off echo off newp none timing off set serveroutput on set heading off spool Schemaerrtmp.txt select ' TIMESTAMP COMPUTER NAME ... (5 Replies)
Discussion started by: welldone
5 Replies

4. Shell Programming and Scripting

Removal of carriage returns from a comma delimited file

Hi, I have a file which is having some carriage return in one of the field for which single line is coming in multiple lines. I want to combine all those multiple lines of that field into one line. Eg: Input: Id, Name, Location, Comments, Dept 2, John, US, I am from US. I... (5 Replies)
Discussion started by: mahish20
5 Replies

5. Shell Programming and Scripting

The scripts not able to make the file to size 0, every times it go back to its original size

#!/bin/sh ########################################################################################################## #This script is being used for AOK application for cleaning up the .out files and zip it under logs directory. # IBM # Created #For pdocap201/pdoca202 .out files for AOK #1.... (0 Replies)
Discussion started by: mridul10_crj
0 Replies

6. Emergency UNIX and Linux Support

Adding carriage returns to file using sed/awk

Hello, I need help adding carriage returns at specific intervals (say 692 characters) to a text file that's one continous string. I'm working in AIX5.3. Any quick help is appreciated. Thanks! (2 Replies)
Discussion started by: bd_joy
2 Replies

7. Programming

Some how the open(file,flag, acc) returns 0 and write to the screen, instead of the file ???

I am out of idea what to do to resolve the problem! I need to use the open(file, for.., access) function to write a file. Never have the situation like that: it is return 0 - zero. As a result all write(..) going to the screen! What the problem it could be? I do not even know... (2 Replies)
Discussion started by: alex_5161
2 Replies

8. Solaris

Directory size larger than file system size?

Hi, We currently have an Oracle database running and it is creating lots of processes in the /proc directory that are 1000M in size. The size of the /proc directory is now reading 26T. How can this be if the root file system is only 13GB? I have seen this before we an Oracle temp file... (6 Replies)
Discussion started by: sparcman
6 Replies

9. Shell Programming and Scripting

removing carriage returns in text file

Hi I have a text file that looks like this: A B C D E F G H I I want it to be reformatted to A;B;C; D;E;F; G;H;I; (4 Replies)
Discussion started by: coolnfunky
4 Replies

10. Solaris

command to find out total size of a specific file size (spread over the server)

hi all, in my server there are some specific application files which are spread through out the server... these are spread in folders..sub-folders..chid folders... please help me, how can i find the total size of these specific files in the server... (3 Replies)
Discussion started by: abhinov
3 Replies
Login or Register to Ask a Question