Chapter Summary
Introduction to the filesystem structure
- Data in the disk are organized by structures called filesystems.
- The file system used in GNU/Linux is called ext4
- Ext4 uses structures called inodes to access data.
- Disks are usually partitioned by a structure called partitions.
- There can be more than one partitions in a drive.
- Partitions can be seen with the command df -h.
- A file is a stream of bytes represented in the filesystem.
- There are many types of files in the filesystem.
| Representative letter in the ls command | - | l | d | b | c | s | p |
|---|---|---|---|---|---|---|---|
| Types of files | Simple file: a simple file without any other features | Link: a file that shows another file | Directory: a file that is a list of files | Block device: a device that takes data as block, such as storage devices | Special file: a mechanism used for input and output | Socket: a file that allows inter-process communication with TCP-IP semantics | Named pipe: like sockets but doesn't neccesarily have a network like structure |
- The filesystem begins from the root directory.
- The root directory has different child directories for different purposes.
- Absolute path takes the start from the root directory
- Relative path takes the start from the current directory.
- In Linux file names are case-sensitive.
File and directory manipulation
| Command | Meaning |
|---|---|
| touch | Creates new files |
| rm | Deletes files |
| mkdir | Creates new directories |
| rmdir | Deletes empty directories |
| less | Views text files |
| mv | Moves files to a new destination |
| cp | Copies files to another destination |
File permissions
- File permissions are represented by three bits.
- The biggest bit is for reading permission, the middle bit is for writing permission and the smallest bit is for executing permission.
- Permissions can be set using the chmod command.
Mount points
- A device can be mounted using the mount command.
- A device can be unmounted using the umount command.