$ chmod 640 foo.txt
Show permissions on linux:
$ stat foo.txt $ stat -c '%a %n' foo.txt
Show permissions on BSD:
$ stat -x foo.txt $ stat -f '%OLp' foo.txt
+4000executes with the privileges of the file’s owner.
+2000executes with the privileges of the file’s group.
+1000for directories, allows the contents to only be moved or deleted by the directory or file owner (or root). Typically set on /tmp to keep users from messing with each other’s files.
(The sticky bit was originally introduced to keep the text segment of an executable remain resident in memory, to make subsequent execution of that program start faster. This behavior is no longer widely supported.)