Directories and the files are organized into a single rooted reverse tree structure. File system begins at the / directory. Names are case sensitive and all the path are delimited by ‘/’.
- Home directories : /root, /home/username
User Executable : /usr/bin, /usr/local/bin, /bin
System Executable : /usr/sbin, /usr/local/sbin, /sbin
Kernels and bootloader : /boot
Configuration : /etc
System information : /proc, /sys
Server data : /var, /srv
Libraries : /lib, /usr/lib, /usr/local/lib
Mount points : /media, /mnt
Temporary File : /tmp
??? bin
??? boot
??? dev
??? etc
??? home
??? lib
??? media
??? mnt
??? proc
??? root
??? sbin
??? srv
??? sys
??? tmp
??? usr
??? var
List the first level directories of the system.
tree -d -L 1
Linux naming convention
- All characters are allowed except the forward slash
Size of the name can be up to 255 characters
Name are case sensitive
Eg:
Access a file having special character in file name such as spaces
ls -l “Hello World”
OR
ls -l Hello\ World
File and Directory permissions
Users
- Every user has an ID (unique number). User root has the ID 0. Normally UID start at 500s
These details are stored in /etc/passwd
Each user can get a home directory at /home
User need permission to read files which owned by other user
- Users are grouped into a user group
Each group has unique ID; GID
These information are stored in /etc/group
All users in the same group can share the files each other
Linux access permission
This is totally based on the ownership where it has 3 levels
__ User (u)
|
Ownership _______ Group (g)
|
|__ Other (o)
This is also known as Discretionary Access Control (DAC). Users can perform 3 action on files and the directories
__ read (r)
|
File ________ write (w)
|
|__ execute (x)
__ list the content (r)
|
Directory ________ modify file and sub-dir (w)
|
|__ open, access move (x)
u g s | r w x | r w x | r w x