Sponsored Content
Top Forums Shell Programming and Scripting Fields in the Output of ls -ltr for a directory Post 303023216 by apmcd47 on Thursday 13th of September 2018 04:42:02 AM
Old 09-13-2018
Quote:
Originally Posted by infernalhell
Thank You, it is on network.

By Size in Blocks - would this give an idea of how much size it occupies in GB ?

But i see the parent directory of this dir has a lower block size.. So i am a little confused.


Code:
cd /prod/
@:/prod #ls -ld logs
drwxrwsr-x   28 xyz  abc   134217728 Sep 12 17:49 logs
@:/prod #cd logs
@:/prod/logs #ls -ld job
drwxrwsr-x 4294967295 xyz abc  2147614720 Sep 12 17:49 job

The size of the directory is not the size of the blocks, but rather the product of blocksize and number of blocks used. Consider this on my system:
Code:
$ echo > file
$ mkdir dir
$ ls -ld file dir
drwxr-xr-x 2 apm sog 4096  13-Sep 09:15 dir
-rw-r--r-- 1 apm sog    1  13-Sep 09:14 file
$ du file dir
4	file
4	dir
$ du -b file dir
1	file
4096	dir

Both file and dir occupy a single 4096 byte-sized block. ls shows the size of the file regardless of the amount of disk space it occupies. The directory, on the other hand, appears to fit the block it occupies. As you add more to the file it grows until it occupies two, three, or even twenty blocks. Think of the directory as look-up table, containing two fields per record: the name of the file it "contains", and the files inode number. As you add files to the directory it fills up the table until there is no more room, at which point it will grow into a second block. Now look at the number of links if your two directories. Evidently job contains more files than logs, requiring it to use more disk space Hence the discrepancy.

I should point out that I don't know the full workings of file systems; I don't really need to. The above assumptions just give me that warm, fuzzy feeling that I need to use them.

Andrew
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extracting fields from an output 8-)

I am getting a variable as x=2006/01/18 now I have to extract each field from it. Like x1=2006, x2=01 and x3=18. Any idea how? Thanks a lot for help. Thanks CSaha (6 Replies)
Discussion started by: csaha
6 Replies

2. Shell Programming and Scripting

To get an output by combining fields from two different files

Hi guys, I couldn't find solution to this problem. If anyone knows please help me out. your guidance is highly appretiated. I have two files - FILE1 has the following 7 columns ( - has been added to make columns visible enough else columns are separated by single space) 155.34 - leg - 1... (8 Replies)
Discussion started by: smriti_shridhar
8 Replies

3. Shell Programming and Scripting

Cut 2 fields and write to a output file

Hi, I am writing a code where the file is a pipe delimited and I would need to extract the 2nd part of field2 if it is "ATTN", "C/O" or "%" and check to see if field9 is populated or not. If field9 is already populated then leave it as is but if field9 is not populated then take the 2nd part of... (3 Replies)
Discussion started by: msalam65
3 Replies

4. Shell Programming and Scripting

AWK Compare files, different fields, output

Hi All, Looking for a quick AWK script to output some differences between two files. FILE1 device1 1.1.1.1 PINGS device1 2.2.2.2 PINGS FILE2 2862 SITE1 device1-prod 1.1.1.1 icmp - 0 ... (4 Replies)
Discussion started by: stacky69
4 Replies

5. Shell Programming and Scripting

awk to compare diff output by fields

Diff output as follows: < AAA BBB CCC DDD EEE 123 > PPP QQQ RRR SSS TTT 111 > VVV WWW XXX YYY ZZZ 333 > AAA BBB CCC DDD EEE 124 How can i use awk to compare the last field to determine if the counter has increased, and need to ensure that the first 4 fields must have the same... (15 Replies)
Discussion started by: ux4me
15 Replies

6. Shell Programming and Scripting

compare 2 CSV fields from same diff output

Attached is a file called diff.txt It is the output from this command: diff -y --suppress-common-lines --width=5000 1.txt 2.txt > diff.txt I have also attached 1.txt and 2.txt for your convenience. Both 1.txt and 2.txt contain one very long CSV string. File 1.txt is a CSV dump of... (0 Replies)
Discussion started by: gvolpini
0 Replies

7. Shell Programming and Scripting

Get output of fields starting from 2nd line

Hi All, I am using the following command in Linux: sar -r 30 3 Linux 2.6.18-194.3.1.7.3.el5xen 02/07/2013 02:55:47 PM kbmemfree kbmemused %memused kbbuffers kbcached kbswpfree kbswpused %swpused kbswpcad 02:56:17 PM 128646024 22348920 14.80 230232 15575860 75497464 ... (4 Replies)
Discussion started by: a1_win
4 Replies

8. Red Hat

What fields we need to consider ntpq -p output?

In our environment we used to lot of events for ntp issues. I am unable to find the what needs to consider here. :( ntpq -p fields. remote refid st t when poll reach delay offset jitter ---------- Post updated at 05:13 AM ---------- Previous update was at 04:47 AM... (1 Reply)
Discussion started by: Naveen.6025
1 Replies

9. Shell Programming and Scripting

I have two commands “ls -h” and “ls -ltr”. How do i make sure “ls -ltr” is run after “ls -h” is suc

help me (2 Replies)
Discussion started by: sonu pandey
2 Replies

10. Shell Programming and Scripting

Match output fields agains two patterns

I need to print field and the next one if field matches 'patternA' and also print 'patternB' fields. echo "some output" | awk '{for(i=1;i<=NF;i++){if($i ~ /patternA/){print $i, $(i+1)}elif($i ~ /patternB/){print $i}}}' This code returnes me 'syntax error'. Pls advise how to do properly. (2 Replies)
Discussion started by: urello
2 Replies
elcsd.conf(5)							File Formats Manual						     elcsd.conf(5)

Name
       elcsd.conf - error logging configuration file

Description
       The  file  contains information used by the daemon to configure error logging for the system.  The system manager maintains this file.  The
       error logging daemon is dependent on the current order of the entries in the file.  Do not change the order.

       The information in the file shows any defaults and describes what you can enter.  A newline is used to delimit each entry in  the  file,  a
       null entry consists of a newline alone, and comments begin with #.
       #
       #    elcsd - errlog configuration file
       #

       {	   # delimiter DON'T remove or comment out!
       1	   # status 1-local,2-logrem,4-remlog,5-remlog+priloglocal
		   # errlog file size limit num. of blocks
       /usr/adm/syserr # errlog dir. path
		   # backup errlog dir. path
       /	   # single user errlog dir. path
       /usr/adm/syserr # log remote hosts errlog dir. path
		   # remote hostname to log to
       }	   # delimiter DON'T remove or comment out!
       #  hosts to log :S - separate file or :R - remotes file (together)
       remote1:S
       remote2:S
       #remote3:S	   # disabled
       remote4:S
	  .
	  .
	  .
       The status line of the file describes where you can log error packets, also called error messages:

	    Logs error packets locally =
		   1, the default.

	    Logs error packets from a remote system or systems to the local machine =
		   2.

	    Logs local and remote error packets locally =
		   3.

	    Logs error packets from the local system to a remote system =
		   4.

	    Logs error packets from the local system remotely and logs high
		   priority messages locally = 5.

       The  errorlog  file  size  defines  the	maximum size of an errorlog file.  If disk space is limited, you can specify the maximum number of
       blocks (512 bytes each) you want the errorlog file to be.  If you do not specify the maximum number of blocks, the system will  notify  you
       when the file system is 98% full.

       The  default  errorlog  directory path is You can direct error packets to a different directory; if you do, you must change the default for
       also. For further information, see

       If the error-logging daemon cannot write to the primary errorlog directory path, it attempts to log to the backup errorlog  directory  path
       automatically.

       The  root  directory  is  the default for the single-user errorlog directory path.  When the system makes the transition to multiuser mode,
       errors logged in single-user mode are transferred to the default errorlog directory path  You  can  direct  single-user	error  packets	to
       another directory.

       To log error packets from a remote system locally, set up an errorlog directory path on the local system.  The default is

       Errorlog  packets  from	remote systems can be logged to separate files or to one file.	S sets up a separate errorlog file for each remote
       system that logs locally.  R logs packets from the corresponding remote system to the file syserr.remotes.  The default is S.

Restrictions
       You must have superuser privileges to change the file.  However, anyone can view the file.

Files
       elcsd daemon messages

See Also
       elcsd(8), eli(8), uerf(8)
       Guide to the Error Logger System

																     elcsd.conf(5)
All times are GMT -4. The time now is 06:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy