In today’s installment, I will cover Operating System directories, and file protections. The ls and cat commands will be used, and you will be introduced to chown, chmod, and chgrp.
Operating System Directories
Operating System Directories are where the mystical files that keep the operating system alive live, like so:
/boot
Files for booting the system. This is where the kernel lives, typically named /boot/vmlinuz.
/lost+found
Damaged files that were rescued by a disk recovery tool.
/proc
Describes currently running processes; for advanced users.
The files in /proc provide views into the running kernel and have special properties. They always appear to be zero sized, read-only, and dated now:
$ ls -l /proc/version
-r--r--r-- 1 root root 0 Oct 3 22:55 /proc/versionHowever, their contents magically contain information about the Linux kernel:
$ cat /proc/version
Linux version 2.4.22-1.2115.nptl ....Mostly these files are used by programs. Go ahead and explore. Here are some examples.
| /proc/ioports | A list of your computer’s input/output hardware. |
| /proc/version | The operating system version. The uname command prints the same information. |
| /proc/uptime | System uptime, i.e., seconds elapsed since the system was last booted. run the uptime command for a more human-readable result. |
| /proc/nnn | Where nnn is a positive integer, information about the Linux process with process ID nnn. |
| /proc/self | Information about hte current process you’re running: a symbolic link to /proc/nnn file, automatically updated. Try ls -l /proc/self a few times in a row: you’ll see /proc/self changing where it points. |
File Protections
A Linux system may have many users with login accounts. To maintain privacy and security, each user can access only some files on the system, not all. This access control is embodied in two questions:
Who has permission Every file and directory has an owner who has permission to do anything with it. Typically the user who created a file is its owner, but relationships can get more complex.
Additionally, a predefined group of users may have permission to access a file. Groups are defined by the system administrator.
Finally, a file or directory can be opened to all users with login accounts on the system. You’ll also see this set of users called the world or simply other.
What kind of permission is granted? File owners, groups, and the world may each have permission to read, write (modify), and execute (run) particular files. Permissions also extend to directories, which users may read (access files within the directory), write (create and delete files within the directory), and execute (enter the directory).
To see the ownership and permissions of a file, run:
$ ls -l filenameTo see the ownership and permissions of a directory, run:
$ ls -ld directory_nameThe file permissions are the 10 leftmost characters in the output, a string of r (read), w (write), x (execute), and other letters. For example:
drwxr-x---Here’s what these letters and symbols mean:
| Position | Meaning |
| 1 |
File type: |
| 2-4 | Read, write, and execute permissions for the file’s owner. |
| 5-7 | Read, write, and execute permissions for the file’s group. |
| 8-10 | Read, write, and execute permissions for all other users. |
To change the owner, group ownership, or permissions of a file, use the chown, chgrp, and chmod commands, respectively.
Related posts:




