Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I know the various permissions that you can set on files and directories, but how different are commands?
Every thing is meant to be a file in linux, so for the "ls" command i should be able to check out "ls" in /bin and who is allowed execute it.
But read permissions? what does read permissions on a command mean? Who wants to read binary files?
I also want to know what happens when you "ls -al" or "file" a file? That's not reading it, is it? I mean I know "more" is reading a file, but "ls"?. All you're doing is asking for a name and description.
The read bit allows you to access it. Without read you can't do the ls (unless you're root) because you don't have permission. Also find wouldn't find it. Another oddity is that you have to have the execute bit on directories to read them. Just the way it is.
The "-a" flag of ls is just so you can see "hidden" files which are those that begin with a dot (.bashrc, .profile etc...). You are correct that ls only lists files - it doesn't actually read their contents.
The "-l" flag gives a "long" listing. Without it you would see only the file names with no permissions, dates or other information.
ls -la (or -al as order doesn't matter in most flags) would give you a long listing of all files in a directory including the "hidden" files.
reading permission on binaries is useful for some special purposes. For instance, if you want to create a compressed archive with commands in order to send them to another computer, your compressor need to be allowed to read the file in order to compress it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.