Also see chmod.
I recommend always using
ls -lah. Set up the alias for
- l for long-listing format
- a for all files
- h for human-readable file sizes
I had this on my CS138 midterm and I had no idea how to read the things, so might as well write it down.
Let’s analyze this, which the console outputted after
-rwxrw-r-- 1 root root 4096 Dec 18 16:41 somefile.txt
|-||rwx||rw-||r—||1||root||root||4096||Dec 18 16:41||somefile.txt|
-for regular file,
- The owner can read, write and execute this file
- The owner’s group can read and write this file
- Other users can read, but not write nor execute this file.
- The number of hard links to this file or directories inside this directory.
- The object’s owner
- The object’s owner’s group. All of the users in this group (for example,
www-data, etc.) are affected by the permissions in 3.
- The object’s size in bytes. Note:
ls -lhwill use
Tetc. for human readable.
- The object’s last modified time; for directories this is not inheritive.
- The object’s name as stored in the filesystem’s table of contents