Wednesday, October 20, 2010

How to interpret the information about a file when using command : "ls -lrt"

Here is an example of the additional information about a file which we can get when used with "ls -lrt"

Example:

lrwxrwxrwx   1 sarala  7 2010-10-20 03:40 testfile



(l , d) -
rwx

rwx

rwx

1

sarala
7

2010-10-20  03:40

testfile

 (Symlink, directory) file owner group Everyone else links owner size Modified date File name

chmod command

chmod: command is used to set the access permissions of a specific file or directory.

Example:

chmod who=permissions filename   (This gives “who” the specified permissions for a given filename.) 
Permissions: 
Of course, the permissions are the same letters that you see in the directory listing: 

  r   Permission to read the file.
  w   Permission to write the file.
  x   Permission to execute the file, or, in the case of a directory, search it.


who: 

The “who” is a list of letters that specifies whom you’re going to be giving permissions to. These may be specified in any order. 

LetterMeaning
  u   The user who owns the file (this means “you.”)
  g   The group the file belongs to.
  o   The other users
  a   all of the above (an abbreviation for ugo