Page 164 - DCAP106_OPERATING_SYSTEM_TOOLS
P. 164

Unit 9: The File System




                                                                                                Notes
                 Example:

          $ ls -l bar
          -rw-r--r-- 1 swift  users   0 May 13 20:41 bar
          $ chgrp dialout bar
          $ ls -l bar
          -rw-r--r-- 1 swift  dialout 0 May 13 20:41 bar
          If you want to change the owner and group, a single chown command can be used. That is, just
          separate the target owner and group with a colon.

                 Example:

          # chown jack:dialout template.txt

          9.2.8 Attributes

          Some file systems provides permission to add more attributes to files. These attributes might
          have impact on the permissions/usage of these files, or on how the operating system works with
          these files. Not many distributions use these attributes, because not all file systems support them.

          Listing and Modifying Attributes

          In order to view the attributes of a file, the lsattr command (list attributes) is used; to modify the
          attributes, chattr (change attributes) command is used. Now let us create an example file:

          # touch /tmp/foo
          # chattr +asS /tmp/foo
          Now let’s see what lsattr has to say:

          # lsattr /tmp/foo
          s-S--a---------  /tmp/foo
          Not  a  big  surprise,  given  the  chattr  command  before.  But  what  does  it  mean?  Well,  man
          chattr gives us the information we need, but here is it in short-hand:
          z z  s: when the file is deleted, its blocks are zeroed and written back to disk (unlike regular files
               where only the reference to the file is deleted).
          z z  S: when changes are made to the file, the changes are immediately synchronized to disk
               (no memory caching allowed).

          z z  a: the file can only be appended (data is added to the file); changes are not allowed to
               existing content. Very useful for log files.


             Did u know? Another very interesting attribute is the immutable flag (i) that doesn’t allow
             the file to be deleted, changed, modified, renamed or moved.

          Self Assessment

          Fill in the blanks:
          4.   The ...................................... command by itself, without any arguments, shows you a list of
               mounted file systems.




                                           LOVELY PROFESSIONAL UNIVERSITY                                   157
   159   160   161   162   163   164   165   166   167   168   169