6 ms·
This looks great, I submitted a feature request to also show permissions in Octal, which is one of the 'missing features' I've always considered to be present i
by Aloha 5y ago
This looks great, I submitted a feature request to also show permissions in Octal, which is one of the 'missing features' I've always considered to be present in ls.
It's always bugged me that chmod takes octal, but all of the other tools output a more human readable format, and its up to me to do the mental math in my head to convert - I dont know about you, but I'm bad at doing octal in my head ;-)
- Hendrikto 5y agochmod also takes human readable notation as input, as in chmod g+w,o-rx …
- tgv 5y agoOne octal digit comprises three bits: read, write and execute, with values 4, 2, and 1. Add them and you get the octal digit: 7 is everything permitted, 4 is read-only. The three octal digits represent permission for owner, group and the rest. So stay way from 777.
- Aloha 5y agoI set permissions on something just infrequently enough that I dont have that as muscle memory, and often I need to match permissions on something already there, so I'm trying to go "uhhh, its, rwxr-xr-x what does that translate to again?" Also, frankly, the computer is a calculator, why not have it act as the calculator for me, and tell me what the permissions already are, I can read the octal permissions and know what they mean.
- poewrljaf 5y agochmod --reference=file_with_permissions_i_want.txt file_whose_permissions_i_want_To_change.txt
- Aloha 5y agoyou learn something new every day!
- BenjiWiebe 5y agoYou can also just type --ref.
- mixmastamyk 5y agoThat’s what GUIs are for, this exact use case. The sibling with the reference param is a great option as well, if you can remember it.
- deleted 5y ago[deleted]
- BenjiWiebe 5y agoMy chmod usage generally looks like this: chmod a-rwx,u+rw,g+r,o+r filename a/u/g/o is all, user, group, other. - removes, + adds. r/w/x is read, write, execute (of course).
- randomswede 5y agoThey're bits, in groups of three. rwxr-xrwx would be "111, 101, 111", so 7, 5, 7. I may be odd, but I don't find reading "small numbers" in binary to be much harder than reading "small numbers" in decimal, or hex. Up to about 15-or-so... Maybe as far as 31. But get to six bits, and it's time to actually start doing multiplications and additions, for me.
- I_complete_me 5y agoI use the idea of the binary numbers from 1 to 7 as an aide memoire: rwx 0 000 1 001 2 010 3 011 --> -wx 4 100 5 101 6 110 7 111
- hprotagonist 5y agoonce — exactly once — i heard from down the hall in the dorm “oh fuck this, file permissions are bullshit it’s a single user machine! i’m going to chmod -R 777 / and be done with it” (clicking and the whack of an enter key) (time passes) “oh what th… oh, fuck ME!”
- everforward 5y agoI may just work with file permissions more than most, but I prefer the octal for its density. It's easy to tell my coworker the permissions are wrong, it should be 755 not 644. It's a lot harder to convey that they should be rwxr-xr-x instead of rw-r--r--. I also find diffing easier. 767 is different from 777, which is easy to see. It's harder to scroll in ls and find the one that's rwxrw-rwx rather than rwxrwxrwx. The last one is that the human format is legitimately awful at calling out setuid/setgid, and those are really important to notice. How many people are going to notice that 'rwxr-sr-x' is different than 'rwxr-xr-x'? The equivalent octal is 2755, which is very noticeably different from 755 (or 0755 if you prefer). I'm not opposed to having the option, but I do think there are advantages to octal. Those advantages do probably wane if you don't have to deal with some of the more arcane permission sets.
- Aloha 5y agoI agree, broadly. I'd rather have the option to have both if I could pick.