From the course: Learning Linux Command Line

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Modify file permissions

Modify file permissions - Linux Tutorial

From the course: Learning Linux Command Line

Modify file permissions

- [Instructor] Let's practice changing permissions on files. I have a small bash script here called test.sh, which is a simple program that just prints out a line of text when we run it. To run this, I'll need to use the Bash interpreter, so I'll write bash as my command and provide that script as an argument, and there's the output, but I could also change the permission mode on this program so that I can run it or execute it directly as if it were a command. I'll take a look at the permission mode string for this file with ls -l test.sh. And here I can see that while my user and the group can both read and write the file and others can read it, there's no X's in the mode string, meaning that nobody has execute permission on the file. Let's change that using chmod and +x. This adds the execute permission for everybody, the user, the group, and other. I'll run that and then I'll recall my command to take a look at the mode string for the file. Here, I can see the difference. My user…

Contents