Language Selection

English French German Italian Portuguese Spanish

Linux Basics - the Secrets of chmod

Filed under
HowTos

Chmod - short for CHange MODe has been around just about as long as Unix based operating systems have.

This is the command line tool used to modify the permissions of some file, set of files or directories.

It can look pretty complicated on the face of things but once you get used to using it, it’s a breeze. Not to mention that the modern chmod program doesn’t require you to use pesky octals anymore if you so choose.

In this tutorial we’ll go over chmod. The one important thing to remember is that in *nix land, everything and anything on your computer is consider a file by the OS. Keep that in mind and it will help you wrap your brain around chmod.

So how do you use it?

Full Story.

re: chmod

Do people actually use the letter code (chmod -R u+rwx,g=w,o=r foobar)?

I've always used only the number code (chmod -R 724 foobar)?

//just curious//

re: chmod

Quote:

Do people actually use the letter code (chmod -R u+rwx,g=w,o=r foobar)?

That's the way I always do it. It was just easier for me to memorize that way instead of the numbers.

----
You talk the talk, but do you waddle the waddle?

chmod with numbers

If one understands binary encoding, the number syntax is actually simpler and easier to remember. So, that's what I do at the command line--typically when I have an ssh connection to my server.

But often I'm lazy, and I don't want to think--if I have only a few chmod changes, then I just do it in the Konqueror file manager. I'm not a command line gorilla like some I've seen--I have a GUI and I'm not afraid to use it. Smile

re: chmod with numbers

gfranken wrote:
I have a GUI and I'm not afraid to use it. Smile

Sounds like a Jinx.com sticker/shirt!

re: chmod with numbers

vonskippy wrote:
gfranken wrote:
I have a GUI and I'm not afraid to use it. Smile

Sounds like a Jinx.com sticker/shirt!

Haha, I'd wear it.

Letters stick in my memory but GUI is good too

I use the letter code. The letters have a meaning and that makes them memorable.

I'm not afraid to use the GUI either, if it's up to the job (like a single or small number of files) - but I use Midnight Commander because it is more functional for that particular task. chown is the command where you are more likely to need the command line.

-----
I try to take one day at a time -- but sometimes several days attack me at once - Ashleigh Brilliant

chmod cheat sheet

I was cleaning out some old file directories tonight and came across this chmod using numbers cheat sheet.

I remember taping this to the frame of my monitor (it was a big clunky 19" crt so it gives you an idea of how old this is), so now of course it's burnt into my brain.

-----------------------------------------------------------------------------
|         owner          |        group           |       everyone          |
-----------------------------------------------------------------------------
| read | write | execute | read | write | execute | read | write  | execute |
-----------------------------------------------------------------------------
| 400  |  200  |   100   |  40  |  20   |    10   |  4   |   2    |    1    |
-----------------------------------------------------------------------------

Sorry about the formatting, I can't seem to get it to leave the fixed spaces in place without showing the line break code.

Very useful

Thanks for that tip. I've added another post-it to the monitor. This layout may help to burn the code into memory:

         r     w     x   
user  | 400 | 200 | 100 |
group |  40 |  20 |  10 |
other |   4 |   2 |   1 |

Sorry, I could not get rid of the line break indicators - they inserted themselves.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

More in Tux Machines

EPaper Tablet Gets Desktop Linux Install

ePaper is an interesting thing, providing a non-backlit viewing experience that is much more akin to reading a book than staring at a screen. The reMarkable tablet is a device designed around just such a display, and [davisr] has been hacking away at the platform. His latest work brings full-fat Linux to the fore. The work builds upon [davisr]’s earlier work, installing a microSD slot in the tablet to make development easier. Getting Linux running required a custom kernel, but once sorted, working with the reMarkable is easy. apt is available for easy software installs, and the tablet is demonstrated using several different pieces of software, like mtPaint and Xournal. Read more

Why snap and flatpak are so important to Linux

The internet is a fickle beast. Just when you think a company or community of developers have come out with a bit of technology that could help an operating system or piece of software rise above, that wacky internet sneaks up to say, "Nay, nay!" I remind myself over and over to not read the comment sections. But I do, and I see the flame wars that once threatened to slice and dice the heart of Linux rise back up. Once upon a time it was vi vs. emacs and GNOME vs. KDE. Read more

Stable Kernels: 5.6.15, 5.4.43, 4.19.125, 4.14.182, 4.9.225, and 4.4.225

  • Linux 5.6.15
    I'm announcing the release of the 5.6.15 kernel. All users of the 5.6 kernel series must upgrade. The updated 5.6.y git tree can be found at: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-5.6.y and can be browsed at the normal kernel.org git web browser: https://git.kernel.org/?p=linux/kernel/git/stable/linux-s...

  • Linux 5.4.43
  • Linux 4.19.125
  • Linux 4.14.182
  • Linux 4.9.225
  • Linux 4.4.225

Linux-powered wireless gateway supplies four surge-protected serial ports

Artila’s compact “IoT Gateway Matrix-704” runs Linux on a Microchip SAMA5D35 and provides GbE and Fast Ethernet, mini-PCIe and micro-SIM slots, a USB port, and 4x isolated, surge protected RS-485 ports. Artila has introduced several of its Matrix IoT gateways with isolated serial ports, including the Matrix-710 and Matrix-713. Its new Matrix-704 can have its 4x RS-485 ports configured with optional isolation and it also comes standard with surge protection. The Matrix-704 has the same 536MHz, Cortex-A5 Microchip ATSAMA5D35 SoC as the more feature rich Matrix-710 and Matrix-713, as well as the recent Matrix-702, which lacks serial ports. Read more