3 ms·
I've been using Unix for years and years on a variety of systems, including various sysadminy roles, and I still cannot keep the octal permission numbers in my
by david-given 10y ago
I've been using Unix for years and years on a variety of systems, including various sysadminy roles, and I still cannot keep the octal permission numbers in my head. My current job involves using one tool which only supports the octal and I always go to an online site which calculates them for me because otherwise I will just get them wrong.
I'd vastly prefer the symbolic forms (and am slightly surprised that the kernel source has raw octal in it at all). Although I wouldn't have tried to implement the change as a thousand separate patches...
- gkya 10y agochmod(1) man page would either contain the meaning of each number or a reference to where the definitions are on any decent Unix system.
- junke 10y agoThe symbolic form is frankly unreadable and the kernel people don't need them because they probably already dream of octal permissions when asleep. For an alternative symbolic approach, here is how it is done in Lisp, thanks to SETF (and the OSICAT library). (file-permissions #P"/tmp/file") NIL (setf (file-permissions #P"/tmp/file") '(:user-read :group-read :other-read)) ... or (nix:chmod #P"/tmp/file" #o444) By the magic of SETF, you can now use all other macros which modify a place: (push :user-write (file-permissions #P"/tmp/file")) And thus: (file-permissions #P"/tmp/file") => (:USER-READ :USER-WRITE :GROUP-READ :OTHER-READ)
- ajdlinux 10y agoI'm the exact opposite - I can instantly understand what 600, 777, 664 and so on mean with barely a thought, but having used Linux for the majority of my life I still struggle to remember "chmod u+w" and whatever.
- sanderjd 10y agoThose are different things though. "u+w" doesn't require me to know what the current permissions are, but only that I want to let the owner write.
- digi_owl 10y agoI think what trips me up about them is that they are effectively counted backwards. RWX is 421 rather than 124.