Block size in listing files


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Block size in listing files
# 1  
Old 10-17-2010
Block size in listing files

I see the following in my prompt...
that is, i have only one file but i see 8 as total.

Code:
/home/asla>ls -l
total 8
-rw-r--r--   1 oracle   dba               6 Oct 17 18:59 simple

Can you please tell me why that 8? I checked different sources they say it is number of blocks but in this case it should be 1 because file "simple" occupies only one block!
# 2  
Old 10-17-2010
Code:
ls -al

by the way: are you sure your ls command point to the real ls command ?
Code:
type ls

Code:
alias


Last edited by ctsgnb; 10-17-2010 at 01:00 PM..
# 3  
Old 10-17-2010
Thank you.

Code:
/home/asla>type ls
ls is a tracked alias for /usr/bin/ls



---------- Post updated at 08:26 AM ---------- Previous update was at 08:25 AM ----------

also there is no alias

Code:
/home/asla>alias ls
ls: alias not found

# 4  
Old 10-22-2010
any update for this ?
# 5  
Old 10-22-2010
did you try the -a option of ls command ?
Code:
ls -al

the -a option should also display files that start with a dot "."

what gives the alias command (without any argument)
just
Code:
alias

# 6  
Old 10-25-2010
The output looks normal for "ls -l" under unix.

Quote:
total 8
It is the total number of disc blocks occupied by the directory and the files in the directory and can include indirect blocks as well. Thus the "total" is usually slightly higher than the figure from "du -s". A block is 512 bytes in most modern unix and Linux implementations.

Interestingly when you have a small number of very large files in a directory the value of "total" is nearly the sum of the sizes of the files.

I have seen a directory and files copied within a server and give a different figure for "total".
# 7  
Old 10-25-2010
Thank you so much for this information.

You can see the following output, here I have just created simple file with 13bytes content. When I do ls -l , it shows me 8 OS Block.. Do you mean that still system creates indirect block ?
I heard that indirect blocks will be created if the content of the file doesn't fit in original block.

My Os block size is 256 bytes.

Code:
/home/ammar>ls -l
total 8
-rw-r-----    1 ammar  trg           13 Oct 25 08:22 testing

your valuable inputs are anticipated.

Thanks,

Shahnaz.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Directory listing in the order of size

I want to display directory listing in the order of size. I do not have -S option in my version of UNIX. So I wrote a simple script. But it takes "| sort -n -k5,5" part as file names. Any suggestion? #!/bin/ksh cmd='ls -l *.TXT | sort -n -k 5,5' set -x $cmd return 0 (7 Replies)
Discussion started by: Soham
7 Replies

2. HP-UX

About Block Size and Fragment Size

Accordingly a lot of manuals - if you have block size 8KB and trying to write a 1KB file to the block, as result you waste 7KB of the block space. But recently I noticed about Fragments of File Block. In same case if you have File Block 8KB and Fragment size 1KB - you can save your block space,... (6 Replies)
Discussion started by: jess_t03
6 Replies

3. Shell Programming and Scripting

Listing the file name and no of records in each files for the files created on a specific day

Hi, I want to display the file names and the record count for the files in the 2nd column for the files created today. i have written the below command which is listing the file names. but while piping the above command to the wc -l command its not working for me. ls -l... (5 Replies)
Discussion started by: Showdown
5 Replies

4. Shell Programming and Scripting

Need help in finishing a bash script for listing subfolder by size in a large folder

Greetings everyone. I have seen that you do wonders here. I have a large folder on a Ubuntu linux. Organization main folder, inside 20 000 subfolders, and inside those subolders many other like 5-6 folders and files. I am interested to create an output to a txt file under the bash... (2 Replies)
Discussion started by: ultimo
2 Replies

5. UNIX for Advanced & Expert Users

Physical disk IO size smaller than fragment block filesystem size ?

Hello, in one default UFS filesystem we have 8K block size (bsize) and 1K fragmentsize (fsize). At this scenary I thought all "FileSytem IO" will be 8K (or greater) but never smaller than the fragment size (1K). If a UFS fragment/blocksize is allwasy several ADJACENTS sectors on disk (in a ... (4 Replies)
Discussion started by: rarino2
4 Replies

6. Shell Programming and Scripting

Just listing size, timestamp & name of files in a directory

How can I list the files in a directory and just show the file size, date stamp, timestamp and file name.. I've been trying to ls -lrt the directory to a file and then use the cut command but I'm not having any luck with getting the proper results.. I thought i could use the -f switch and count... (4 Replies)
Discussion started by: Jazmania
4 Replies

7. UNIX for Advanced & Expert Users

listing files excluding files from control file

I have a directory named Project.I have a control file which contains valid list of files.I would like list the files from directory Project which contains files other than listed in the control file. Sample control file: TEST SEND SFFFILE CONTL The directory contains followign... (15 Replies)
Discussion started by: ukatru
15 Replies

8. UNIX for Dummies Questions & Answers

listing files in a directory in bases of size

Hi , I want to list all files in the order of size . Just want to know which files occupies more size and which occupies less size . Is it possible with ls command ? :) Thanks, Arun. (1 Reply)
Discussion started by: arunkumar_mca
1 Replies

9. Shell Programming and Scripting

bash script working for small size files but not for big size files.

Hi, I have one file stat. Stat file contents are as follows: for example. H50768020040913,00260100,507680,13,0000000643,0000000643,00000,0000 H50769520040808,00260100,507695,13,0000000000,0000000000,00000,0000 H50770620040611,00260100,507706,13,0000000000,0000000000,00000,0000 Now i... (1 Reply)
Discussion started by: davidpreml
1 Replies

10. UNIX for Dummies Questions & Answers

Recursive directory listing without listing files

Does any one know how to get a recursive directory listing in long format (showing owner, group, permission etc) without listing the files contained in the directories. The following command also shows the files but I only want to see the directories. ls -lrtR * (4 Replies)
Discussion started by: psingh
4 Replies
Login or Register to Ask a Question