What should be there is an x, standing for eXecutable. Finally, a dash, meaning whatever should be there is not. Then we have w for the writing permission. The first r stands for the reading permission. That is, basically, what those letters mean. There are three things you can normally do with a file: read it, write in it, and execute it. The last three are the permissions for all users that don’t fit this category.įor our explanation, let’s focus on the first three permissions, since we are not going to change groups or anything of the sort. The next shows the permissions for this group. The first trio show the permissions for the current user. For the sake of simplicity, I will focus on the simple files, although permissions are valid for all these kinds of files/folders.Īfter the first character, the other 9 can be divided in groups of three. The first character can be a dash ( -, for a common file), a d (for a directory), or an l (for a soft link). This is actually the mapping of permissions your file has. To begin with, we have a sequence of ten dashes and letters that may seem meaningless at first. We see the same file(s), but with plenty of information before it/them. This is the result when we type ls -l and press Enter: By adding the flag -l to it, it provides you with more information on the files in the directory. What it does is list all the visible files in the directory you are at the moment. In order to get some more information about your file, we will use the command that lists the files in a directory: ls.Īfter typing ls and pressing Enter, this is what we get in the command line: Then we'll move on to discovering how to change them. Let’s have a quick chat about permissions first. There is actually a reason for that – and, to be honest, most users should be thankful for it, since not being able to execute scripts without knowing what you’re doing often prevents you from putting your system at risk. I am the admin! How come I don’t have permission to run a script I wrote myself seconds ago? sample.sh and press Enter to see your script in action and…but what is this message telling me? Why do we need permissions? With everything ready, all that’s left to do is to test it. Once more, you can write in it using a file editor. Type touch example.sh, press Enter, and there you have it. Suppose you want to create a script using touch. Let me try to show you this with another example. However, when it comes to creating scripts, things can get a little more complicated. You can then write whatever you want in it using the file editor of your choice. If you ever try to create, for instance, a text file, all you have to do is type touch filename.txt, press Enter, and the file is created for you in the directory you are in. One of the first commands I learned on Linux was the touch command that creates a file using the command line.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |