Files
linux/README.md
2023-01-05 15:19:34 +00:00

174 lines
4.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Linux
## Filesystem
### Types
- **ext4**
- **btrfs**
- **zfs**
- **xfs**
### Structure
```bash
$ ls -l
/bin
/boot
/dev
/etc
/home
/lib
/media
/mnt
/opt
/run
/sbin
/srv
/tmp
/proc
/sys
/var
/lost+found
/root
/usr
```
- `/` - This is the beginning of the Linux filesystem hierarchy. All the file paths originate from the root.
- `/bin` - Stores essential command binaries which can be used by both system administrator and the user such as cat,ls,mv,ps,mount etc.
- `/boot` - This directory contains all the files necessary for the system to boot up
- `/dev` - Contains device files for all the physical and virtual devices mounted in the system.
- `/etc` - This directory contains configuration files of your system.
- `/home` - The home contains all the personal user-specific files. It contains separate directories for each user which can be accessed by cd /home/username
- `/lib` - Libraries are standard code files that define the commands used in a programming language. During compilation, a compiler looks up these libraries to make sense of the code just as we might look up a dictionary to understand the meaning of words while reading a book.
- `/media` - This directory contains several sub-directories where the system mounts removable devices such as USB drives.
- `/mnt` - This directory can be used by a user to manually mount a device. (as opposed to /media which is only used by the system)
- `/opt` - Cntains libraries and binaries related to packages which are not installed by your systems package managers but are installed through third-party means like using Discords in-application update button.
- `/run` - This directory contains the metadata of the device since the last boot. This includes data of all the system processes and daemons that were executed in the current session. Files under this directory are cleared (removed or truncated) at the beginning of the boot process.
- `/sbin` - Just like /bin, /sbin also contains essential system binaries. However, these binaries are only meant to be used by a system administrator rather than a normal user. These binaries are mostly used for device management. For example, fdisk, fsck, mkfs, ifconfig, reboot.
- `/srv` - You will only ever use this directory if your device is acting as a webserver, as this directory contains all the files regarding web servers.
- `/tmp` - Contains temporary files of the currently running processes. This data is also flushed after every boot.
- `/proc` - Just like /dev which provides devices as files, this folder contains system information and kernel information as files.
- `/sys`- It contains information similarly held in /proc/, but displays a hierarchical view of specific device information in regards to hot-plug devices.
- `/var` - Contains variable data regarding the running processes. This includes the logs, cache and spools for all applications.
- `/lost+found` (ext4 feature) - While not listed in the FHS, this directory is automatically generated by fsck.
- `/root` - This is supposed to be the home directory for the root user, as opposed to /home which is the home directory for the non-root users.
- `/usr` - The /usr directory has very interesting origins. At the time of formation, it was supposed to act like the /home directory, but when people ran out of space on /bin, they started storing the non-essential binaries in /usr. You can read the whole story here.
### Mounting
### Attributes
#### Owneship attributes
- **user**
- **group**
- **other**
## Shell
### Types
### Shortcuts
## Processes
### Foreground & background
### Services & systemd
## Administration
### Installing software
#### packages
#### archives
#### source
## Applications
### `tmux`
### `vim`
## Commands
- `ls` -
- `cd` -
- `cat` -
- `tac` -
- `more` -
- `less` -
- `cut` -
- `head` -
- `tail` -
- `diff` -
- `wc` -
- `grep` -
- `find` -
- `chmod` -
- `chown` -
- `chmod` -
- `rm` -
- `rmdir` -
- `touch` -
- `mkdir` -
- `ln` -
- `cp` -
- `mv` -
- `tar` -
- `gzip` -
- `zip` -
- `unzip` -
- `du` -
- `df` -
- `mount` -
- `umount` -
- `sed` -
- `history` -
- `sudo` -
- `su` -
- `passwd` -
- `passwd` -
- `ps` -
- `top` -
- `htop` -
- `which` -
- `kill` -
- `bg` -
- `fg` -
- `disown` -
- `sleep` -
- `lscpu` -
- `wall` -
- `shutdown` -
- `reboot` -
- `halt` -
- `ss` -
- `dig` -
- `curl` -
- `wget` -
- `ssh` -
- `tmux` -