File Permissions - chmod

Discussion in 'Beginner Tutorials' started by Rob, Jul 9, 2013.

  1. Saptarshi Nag

    Saptarshi Nag Member

    Joined:
    Jan 26, 2014
    Messages:
    45
    Likes Received:
    29
    the link says it all! :)

     
  2. DevynCJohnson

    DevynCJohnson Well-Known Member Staff Member Staff Writer

    Joined:
    May 21, 2013
    Messages:
    1,635
    Likes Received:
    1,285
    I hope that helps. Explaining to people how a folder is executable is hard to explain.
     
    Saptarshi Nag and Haider92 like this.
  3. hindu tadakamalla

    hindu tadakamalla New Member

    Joined:
    Mar 23, 2014
    Messages:
    1
    Likes Received:
    1
    thank u..u made it very simple for me
     
    DevynCJohnson likes this.
  4. plotozoidz

    plotozoidz New Member

    Joined:
    Mar 21, 2014
    Messages:
    4
    Likes Received:
    1
    stat

    If you want a bit more information than ls -l file/directory provides, you can use the command stat. Lets say i have a file called file1.txt:

    Code:
    ls -l file1.txt
    outputs:
    -rw-r--r-- 1 username username 71 Mar 24 20:45 file1.txt

    Code:
    stat file1.txt
    outputs:
    File: `file1.txt'
    Size: 71 Blocks: 24 IO Block: 4096 regular file
    Device: 14h/20d Inode: 6029568 Links: 1
    Access: (0644/-rw-r--r--) Uid: ( 1000/username) Gid: ( 1000/username)
    Access: 2014-03-24 21:37:49.826768784 +0000
    Modify: 2014-03-24 21:50:23.618789336 +0000
    Change: 2014-03-24 21:50:23.618789336 +0000
    Birth: -

    As you can see stat gives more detail, including the numeric 'chmod' value: 0644
    Handy if you want to check the corresponding numeric value permission of a file or directory!
     
    Last edited: Mar 24, 2014
    Jay S likes this.
  5. Arvind Kumar Singh

    Arvind Kumar Singh New Member

    Joined:
    Aug 3, 2014
    Messages:
    3
    Likes Received:
    1
    Hi,

    I wanted to know if we can check when the permission of a directory got changed in Linux?
     
    DevynCJohnson likes this.
  6. Saptarshi Nag

    Saptarshi Nag Member

    Joined:
    Jan 26, 2014
    Messages:
    45
    Likes Received:
    29
    By ls -l directory_name , you can check permission of directory.
     
    DevynCJohnson likes this.
  7. Arvind Kumar Singh

    Arvind Kumar Singh New Member

    Joined:
    Aug 3, 2014
    Messages:
    3
    Likes Received:
    1
    Thanks!! but I want to know the time the directory permissions got changed.
     
  8. Saptarshi Nag

    Saptarshi Nag Member

    Joined:
    Jan 26, 2014
    Messages:
    45
    Likes Received:
    29
    You can see the bash history with time stamp by the following command
    HISTTIMEFORMAT="%d/%m/%y %T "
    and then type 'history'

    To see your modifications you can use grep.
    That is,
    history | grep directory_name
    Now you can see all the modifications made through terminal.
     
  9. Arvind Kumar Singh

    Arvind Kumar Singh New Member

    Joined:
    Aug 3, 2014
    Messages:
    3
    Likes Received:
    1
    Thanks Saptarshi
     
  10. DevynCJohnson

    DevynCJohnson Well-Known Member Staff Member Staff Writer

    Joined:
    May 21, 2013
    Messages:
    1,635
    Likes Received:
    1,285
    I love your answers. Thanks!
     
    Saptarshi Nag likes this.
  11. Saptarshi Nag

    Saptarshi Nag Member

    Joined:
    Jan 26, 2014
    Messages:
    45
    Likes Received:
    29
    You all are welcome :)
     
  12. Rupam Das

    Rupam Das New Member

    Joined:
    Oct 23, 2014
    Messages:
    1
    Likes Received:
    0
    I am using Ubuntu and Windows 7 on a same machine. Just install Ubuntu on your Windows OS. You will see dual boot option at the time of startup.

    ps: You can install both OS in same directory :)
     
  13. sudlin

    sudlin New Member

    Joined:
    Oct 25, 2014
    Messages:
    4
    Likes Received:
    0
    Hi Rob, really good explanation. I liked it...
     
  14. cwilson56

    cwilson56 New Member

    Joined:
    Dec 3, 2014
    Messages:
    2
    Likes Received:
    1
    Thanks for the lesson ... time to practice!!
     
    DevynCJohnson likes this.
  15. kundai

    kundai New Member

    Joined:
    Dec 5, 2014
    Messages:
    4
    Likes Received:
    2
    Another fancy but simple way of assigning permission like chmod 777 is
    chmod ugo+rwx filename
    This means all permissions are granted to all.
    where u=user, g=group and 0=others
    Also r=read, w=write and x=execute.

    You can assign individual permisions like;
    chmod u+r filename
    This means only the user is given that read permission to that file/directory.

    If you want to remove a permision you can say
    chmod u-r filename
    This means the user no longer has read permission i.e. "-" removes while "+" adds permission(s).

    In case of directories/folder, if you want the permissions to be recurring use "-R" option then the permissions will apply to everything in that directorye.g
    chmod -R ugo+rwx directory_name
     
    Sahadat Khan and DevynCJohnson like this.
  16. cwilson56

    cwilson56 New Member

    Joined:
    Dec 3, 2014
    Messages:
    2
    Likes Received:
    1
    Kundal, thank you for the instructions. These are simple and explicit instructions.
     
  17. cuellarsd

    cuellarsd New Member

    Joined:
    Dec 19, 2014
    Messages:
    5
    Likes Received:
    1
    thanks, excellent info for newbies, very concise
     
    DevynCJohnson likes this.
  18. MikeR

    MikeR New Member

    Joined:
    Feb 6, 2015
    Messages:
    1
    Likes Received:
    1
    Excellent explanation of chmod...this helped me a lot: specifically I thought it was decimal.
     
    DevynCJohnson likes this.
  19. Pinguin

    Pinguin New Member

    Joined:
    Jun 2, 2015
    Messages:
    1
    Likes Received:
    0
    hi everybody, I have a large CSV file with lots of literature references. ‘;’ is used as the delimiter. Each row contains 4 fields:
    I want to use linux commands to get out names of all the authors of the paper and year of the publication (written within the parentheses)..
    can anyone help please, thank you in advance.
     
  20. MuthuV

    MuthuV New Member

    Joined:
    Jun 16, 2015
    Messages:
    1
    Likes Received:
    0
    Its a great post and would help beginners in lots !!!!!!!!!!!!!!
     

Share This Page