Directory Tree:
In Microsoft (MS) Windows, the C:\ drive is where your operating system (OS), programs, and other files typically reside. In Linux, this is known as the “root” directory and is represented with the forward slash character ( / ).
In Windows, your “folders” are structured in a tree form, such as; C:\Users\your_username. Linux is similar but will appear as /home/your_username. The following image shows a minimal Linux hierarchical structure (tree). Keep this in mind as you begin navigating.
/
Root directory holds all other directories and mounted file systems
/bin
Essential command binaries (executables) often used by users
/boot
Static files used by the boot loader to begin operating system startup
/dev
Hardware device files (drivers) used by the operating system
/etc
Host-specific system configuration files. This is where admins can tell the OS, applications, and other programs how to behave.
/lib
Essential shared libraries and kernel modules.
/media
Mount point for removable media
/mnt
Mount point for mounting a filesystem such as additional drives or network shares.
/opt
Add-on application software packages. Equivalent to Windows Program Files folder or OSX Applications directory.
/sbin
Essential system binaries. Executable files for the operating system.
/tmp
Temporary files. Extra space for the OS, applications, and users which should be considered subject to purge.
/usr
User home directories.
/var
Variable data that changes often such as logs and mail.
Files in Linux
Linux doesn’t require file extensions like .gif, .png, .m4v, .exe. It actually knows what each file is without the explicit extension.
This is a typical Linux GUI file explorer from the root (/) view:
Linux command line Tree view of the root directory, same as the previous screen:
Finally, the more useful view of the same information for Linux admins:
A great deal more information is provided in this last screen grab. Notice the very first column of each row: “d” indicates a directory, “l” indicates a link, – indicates a regular file.
Linux also has a few file types that are unique :
- – : regular file.
- d : directory.
- c : character device file.
- b : block device file.
- s : local socket file.
- p : named pipe.
- l : symbolic link.
Only a few of these are relevant here; however, it is important to note that the first position of each row indicates a type.
Next are the permissions in three clusters of “rwx.” Read, Write, and Execute for the Owner, Group(s) that have permissions, and Everyone else respectively.
The last screenshot is a user home directory who happens to be in the admin’s group. You can see the owner name and the group to which they belong in the columns after permissions. File size in KB, date, and filename follow.
Permissions:
Permissions are pretty universal in operating systems; what user(s) or group(s) can do what action (read, write, execute). The same goes for inherited permissions from parent directories, etc.. Linux has some unique methods of working with permissions in addition to more well-known traditions. A quick example is granting read permission for a resource to all users by either checking a property box in a GUI or using command line commands such as chmod a+r, or chmod 400 commands for the same results.
Despite the similarities to Microsoft Windows, working with Linux directories can seem daunting at first. It doesn’t take much practice to become familiar and with a little time, it becomes second nature.