Ubuntu – What’s the difference between + and = when using chmod

chmodcommand line

I read everything about chmod, but I don't get something. If I write chmod u=rwx file this "affects" me for all rights on the file, and if I write chmod u+rwx file this "adds" me all the rights on the file, but what is the difference between + and =?

Best Answer

Since you're specifying all the read, write and execute bits, there's no difference.

The difference comes if you only specify some of the bits:

$ umask 022
$ touch afile ; ls -l afile
-rw-r--r-- 1 jackman jackman 0 Aug 21 11:23 afile
$ chmod u+x afile; ls -l afile
-rwxr--r-- 1 jackman jackman 0 Aug 21 11:23 afile*
$ chmod u=x afile; ls -l afile
---xr--r-- 1 jackman jackman 0 Aug 21 11:23 afile*