[Day 2] 1. More about File Systems
Disk Partition Conventions
In Windows
- Hard Disk: Disk0, Disk1, ...
- Partitions: C:, D:, E:, ...
In Linux
- Hard Disk: sda, sdb, sdc, ...
- Partitions: sda1, sda2, sda3, ...
drwxr-xr-x 1 sunbeam sunbeam 4096 Sep 26 18:54 copy.txt| drwxr-xr-x | 1 | sunbeam | sunbeam | 4096 | Sep 26 18:54 | copy.txt | | ------------------------------------------------------------------------------------- | ---------- | ---------------------- | ------------- | --------------------- | ------------ | ---------------- | | First letter 'd' denotes the type of file. The other characters indicate permissions. | Link Count | User/Owner of the file | Group of file | Size of file in bytes | Time Stamp | name of the file |
Types of Files in Linux
- Regular File:
- - Directory File:
d - Link File:
l - Pipe File:
p- Used for Inter-Process Communication (IPC).
- Example commands:
- : Create a pipe file named
mkfifo fifo.fifo - : Check the type of file.
ls -l fifo
- Socket File:
s - Character Special File:
c- Data transfer is character by character; used by character devices.
- Block Special File:
b- Data transfer is block by block; used by block devices.
Groups in Linux
- Group: A collection of users with shared permissions.
- Examples:
- Students →
group1 - Staff →
group2 - Admins →
group3
- Students →
- Examples:
- Purpose of Groups: To assign permissions efficiently across users instead of individually.
File Ownership
- When a user creates a file, they become the owner.
- The file is assigned to the creator’s group.
- Example: If (part of
student1) createsgroup1, it belongs tofile.txt.group1
- Example: If
File Permissions
Permission Types
- Read (): View the file.
r - Write (): Modify the file.
w - Execute (): Run the file (for scripts/programs).
x
Permission Categories
- User (Owner): ,
rwx, etc.rw- - Group: ,
rwx, etc.r-- - Others: ,
rwx, etc.r--
Understanding Permissions
- means the permission is not granted.
- - Permissions follow an octal number system.
Example
- String:
rw- rw- r-- - Binary:
110 110 100 - Octal Representation:
- User: 6
- Group: 6
- Others: 4
- Total: (the leading
0664indicates it's octal)0
- View Octal Representation: Use command.
stat <filename>
Read Next
[Day 2] 2. Some more commands
### File Information Using `stat` To retrieve specific information about a file, you can use the `stat` command in Linux. Here are some examples:...
[Day 2] 3. Process Management
!3. ProcessManagement.png **Process**: Running an instance of a program. **Program**: A set of instructions for the machine (CPU). ### Compil...