5.7 KiB
5.7 KiB
Linux
Filesystem
Types
- ext4
- btrfs
- zfs
- xfs
Structure
$ 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 system’s package managers but are installed through third-party means like using Discord’s 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
Lists files
ls /
afs bin boot dev etc home lib lib64 lost+found media mnt opt proc root run sbin srv sys tmp usr var
ls -la /
total 20
dr-xr-xr-x. 1 root root 170 Nov 14 16:18 .
dr-xr-xr-x. 1 root root 170 Nov 14 16:18 ..
dr-xr-xr-x. 1 root root 0 Aug 9 15:57 afs
lrwxrwxrwx. 1 root root 7 Aug 9 15:57 bin -> usr/bin
dr-xr-xr-x. 7 root root 4096 Nov 14 16:25 boot
drwx------. 1 root root 0 Aug 30 04:57 .cache
drwxr-xr-x. 21 root root 3880 Jan 3 20:37 dev
drwxr-xr-x. 1 root root 5706 Jan 3 20:37 etc
drwxr-xr-x. 1 root root 22 Aug 9 15:57 home
lrwxrwxrwx. 1 root root 7 Aug 9 15:57 lib -> usr/lib
lrwxrwxrwx. 1 root root 9 Aug 9 15:57 lib64 -> usr/lib64
drwx------. 1 root root 0 Apr 23 2021 lost+found
drwxr-xr-x. 1 root root 0 Aug 9 15:57 media
drwxr-xr-x. 1 root root 0 Aug 9 15:57 mnt
drwxr-xr-x. 1 root root 42 Aug 9 15:57 opt
dr-xr-xr-x. 295 root root 0 Jan 3 20:36 proc
dr-xr-x---. 1 root root 574 Dec 27 22:01 root
drwxr-xr-x. 62 root root 1640 Jan 3 20:39 run
lrwxrwxrwx. 1 root root 8 Aug 9 15:57 sbin -> usr/sbin
drwxr-xr-x. 1 root root 0 Aug 9 15:57 srv
dr-xr-xr-x. 13 root root 0 Jan 3 20:36 sys
drwxrwxrwt. 20 root root 460 Jan 6 21:18 tmp
drwxr-xr-x. 1 root root 202 Dec 26 21:31 usr
drwxr-xr-x. 1 root root 200 Jan 3 20:37 var
-
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-