Aller au contenu

Disk & File System#

Disk Management Commands#

Bash
# Disk left on disk
df -h

# find the file system type
df -hT

# Disk usage for each directory
du -h -s * | sort -rh

# List Disk
lsblk

# List Partitions
fdisk -l

# Extend a partion
growpart /dev/nvme2n1 1

# mount a disk
mount /dev/nvme2n1p1 /newdir

# unmount
umount /newdir

# To Get Filesystem Type & size
df -hT

# resize the file system (if XFS type)
xfs_growfs -d /newdir

# resize the file system (if EXT4 type)
resize2fs /dev/nvme2n1p1

File System#

Bash
# Where Executable is located
which

chmod u+x [filename] #Add Execute to User to a file
chmod 330 [filename] #Set Read Write to User & Group

chown

# Number of files in a directory
ls | wc -l

# Create directory with a full path
mkdir -p [path]

# See Current directory
pwd

Standard Directory#

Location Usage
/bin Essential User Binaries
/etc Configuration Files
/etc/opt Configuration files for add-on packages that are stored in
/home Home Folders
/lib Essential Shared Libraries
/opt Optional Packages
/root Root Home Directory
/sbin System Administration Binaries
/tmp Temporary Files
/usr User Binaries & Read-Only Data
/usr/bin Non-essential command binaries (not needed in single-user mode); for all users.
/usr/lib
/var Variable Data Files
/var/log Log files. Various logs.
/var/tmp Temporary files to be preserved between reboots.
/boot Static Boot Files
/dev Device Files
/mnt Temporary Mount Points
/proc Kernel & Process Files
/lost+found Recovered Files

Reference