The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



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 !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
sed or awk to convert text files with recurring headings to rows and colum Bjoeboo Shell Programming and Scripting 5 05-07-2008 10:47 AM
how to read the column and print the values under that column gemini106 Shell Programming and Scripting 6 03-28-2008 07:05 AM
How to check Null values in a file column by column if columns are Not NULLs Mandab Shell Programming and Scripting 7 03-15-2008 09:57 AM
replace a column values with the first value in column sumeet UNIX for Advanced & Expert Users 3 02-06-2007 01:13 PM
Replace 10th column with a new column--- Terriblly hurry ahmedwaseem2000 Shell Programming and Scripting 2 09-06-2005 01:10 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-16-2007
thoughts thoughts is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 25
ls -l column headings

I'm trying to see if there's a way to see column headings when I type the

ls -l command.

I know what some of the fields mean for example in the following listing:

Code:
total 136
drwxr-xr-x  2 root root  4096 Jun  5 15:16 bin
drwxr-xr-x  3 root root  4096 Jul  9 15:25 boot
drwxr-xr-x  9 root root  3240 Jul 17 20:08 dev
drwxr-xr-x 40 root root  4096 Aug 14 16:51 etc
the first column is permissions.

I don't know what the 2nd, 3rd and 4th column mean.

man ls , says "-l use a long listing format" but doesn't detail what's listed.

I searched everywhere, but couldn't find an answer to this question.

I appreciate any information on getting the headings to display.
  #2 (permalink)  
Old 08-16-2007
robotronic's Avatar
robotronic robotronic is offline Forum Advisor  
Can I play with madness?
  
 

Join Date: Apr 2002
Location: Italy
Posts: 370
As far as I know, it's impossible to show column headings for the ls command. However, instead of man, try "info ls":

Code:
`-l'
`--format=long'
`--format=verbose'
     In addition to the name of each file, print the file type,
     permissions, number of hard links, owner name, group name, size in
     bytes, and timestamp (by default, the modification time).  For
     files with a time more than six months old or in the future, the
     timestamp contains the year instead of the time of day.  If the
     timestamp contains today's date with the year rather than a time
     of day, the file's time is in the future, which means you probably
     have clock skew problems which may break programs like `make' that
     rely on file times.

     For each directory that is listed, preface the files with a line
     `total BLOCKS', where BLOCKS is the total disk allocation for all
     files in that directory.  The block size currently defaults to 1024
     bytes, but this can be overridden (Note: Block size).  The
     BLOCKS computed counts each hard link separately; this is arguably
     a deficiency.

     The permissions listed are similar to symbolic mode specifications
     (Note: Symbolic Modes).  But `ls' combines multiple bits into the
     third character of each set of permissions as follows:
    `s'
          If the setuid or setgid bit and the corresponding executable
          bit are both set.

    `S'
          If the setuid or setgid bit is set but the corresponding
          executable bit is not set.

    `t'
          If the sticky bit and the other-executable bit are both set.

    `T'
          If the sticky bit is set but the other-executable bit is not
          set.

    `x'
          If the executable bit is set and none of the above apply.

    `-'
          Otherwise.

     Following the permission bits is a single character that specifies
     whether an alternate access method applies to the file.  When that
     character is a space, there is no alternate access method.  When it
     is a printing character (e.g., `+'), then there is such a method.
  #3 (permalink)  
Old 08-17-2007
thoughts thoughts is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 25
Thank you robotronic , that is very useful info.
  #4 (permalink)  
Old 08-20-2007
psiva_arul's Avatar
psiva_arul psiva_arul is offline
Registered User
  
 

Join Date: Jul 2007
Location: Bangalore, India
Posts: 97
If you issued the ls -l command it will list out the all files and DIR in the root.

ls -l command will display the below result

total 136
drwxr-xr-x 2 root root 4096 Jun 5 15:16 bin
drwxr-xr-x 3 root root 4096 Jul 9 15:25 boot
drwxr-xr-x 9 root root 3240 Jul 17 20:08 dev
drwxr-xr-x 40 root root 4096 Aug 14 16:51 etc

1st column is --> file type(DIR/Files) and access details for UGO (User Group Others).
2nd column is --> position of the file/dir and Name of the Root (2,9)
3rd Column is --> Name of the Root and file located path (root)
4th Column is --> - do-- (i am not sure)
5th Column is Size of the file and Dir (4096 )
6th Column is (Timestamp)Date and time of file / DIR created. (Aug 14 16:51
7th Column is File Directory name (dev,boot)

Let me know if you need any details

Regards,
Siva.P
Bangalore
  #5 (permalink)  
Old 07-21-2008
naughty21 naughty21 is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 16
how to display 2nd coloumn from a file ?
  #6 (permalink)  
Old 07-22-2008
psiva_arul's Avatar
psiva_arul psiva_arul is offline
Registered User
  
 

Join Date: Jul 2007
Location: Bangalore, India
Posts: 97
Hi,

If you want display the second column from the file, we can go for awk command

here is the correct command

ls- l | awk '{ print $2 }'

examaple:

ls -l

-rw-r--r-- 1 raroc raroc 0 2007-10-23 16:05 tt
-rw-r--r-- 1 raroc raroc 22 2008-05-09 21:19 web_orig_20070509 -
-rw-r--r-- 1 raroc raroc 23 2008-05-09 21:16 work -

correct command for retrieve the second column

ls- l | awk '{ print $2 }'

O/P is:
1
1
1


Regards,
MPS
  #7 (permalink)  
Old 07-22-2008
methyl methyl is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 1,163
Correction to Siva's reply


2nd column is --> Number of links (2,9)
3rd Column is --> File/directory owner (root)
4th Column is --> File/directory group (root)
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:31 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0