disk/file management
FHS - Filesystem Hierarchy Standard
📂 The Core System Directories
/(Root): The starting point of the entire directory tree./bin(Essential Binaries): Contains fundamental user command binaries likels,cp, andping./sbin(System Binaries): Essential commands for system administration, likeiptablesandreboot./boot(Boot Loader): Stores files needed to boot the system, including the Linux kernel./etc(Configuration): Holds all system-wide configuration files and startup scripts./lib(System Libraries): Contains shared library files required by binaries in/binand/sbin.
👥 User and Application Data
/home(User Profiles): Personal folders for regular users (e.g.,/home/john)./root(Admin Home): The separate home directory for the root (administrator) user./usr(User Programs): The largest directory; contains user binaries, documentation, and libraries./opt(Optional Software): Reserved for manual installation of third-party software packages.
⚙️ Virtual and Runtime Directories
/dev(Device Files): Represents hardware components as files (e.g.,/dev/sdafor a hard drive)./proc(Process Info): A virtual filesystem showing system resource and process information./sys(System Devices): A virtual directory to view and change kernel-tuned hardware settings./run(Runtime Data): Stores volatile runtime data since the last system boot.
💾 Storage and Temporary Files
/var(Variable Data): Files that change constantly, such as system logs (/var/log) and mail./tmp(Temporary Files): Stores temporary files created by applications; usually cleared on reboot./media(Removable Media): Automatic mount points for USB drives, CDs, and external disks./mnt(Mount Point): A location for administrators to manually mount temporary filesystems.
disk
lsblk: Lists all block devices (hard drives, partitions, and USBs) in a visual tree layout without needing root rights.lsblk -f: Shows block devices along with their assigned file system types and unique UUIDs.df -h- show disk size human readable
show folder size
- show folder size:
sudo du -shc ./*
find biggest folders of current directory
du -hs * | sort -rh | head -5
backup and write usb drive
sudo dd if=/dev/sdX of=~/MeinLaufwerkBackup.img bs=4M status=progress conv=fdatasynccreate image of usb driveif=/dev/sdX: The input file (your target physical disk or block device, e.g., /dev/sda or /dev/sdb).of=...: The output file path where the raw .img will be written.bs=4M: Sets a larger block size (4 megabytes) to dramatically accelerate the reading and writing speed.status=progress: Prints a live counter showing bytes transferred and elapsed time.conv=fdatasync: Forces the system to physically write and flush all buffers to the destination storage before finalizing the command.
sudo dd if=/path/to/image.iso of=/dev/sdX bs=4M status=progress oflag=syncwrite image on usb driveoflag=syncforces the system to physically write both data and metadata
resize partition
use gparted
file movements
rsync
Links
- https://wiki.ubuntuusers.de/rsync/
options
a- contains highly recommended-rcopy subfolder-lcopy symbolic links-pkeep permissions of source files-tkeep timestamps of source files-gkeep group permissions of source files-okeep user permissions of source files (only root)-Dkeep device permissions of source files (only root)
v- verboseh- human readablez- with compression-e- remote shell auswählen-e 'ssh -p 222'ändert ssh port auf e.g. 222
local to remote server
rsync [option] [source] user@hostname-or-ip:[destination path]
rsync -avhz /home/source-rsync/ user@your-remote-server.com:/home/dest-rsync/
remote to local server
rsync -avhz user@your-remote-server.com:/home/dest-rsync/ /home/source-rsync/
scp
scp <Optionen> <Quellpfad> <Zielpfad>
- Quellpfad:
<Nutzer>@<Host>:<Verzeichnis/Datei.Endung> - optionen:
-CKompression nutzen (compression)-pDatei-Attribute auf Zieldateien übertragen (permissions)-rVerzeichnisse rekursiv kopieren (recursive)-vErweiterte Ausgabe anzeigen (verbose)-qAusgabe unterdrücken (quiet)-3Daten durch lokales System senden (third party)
example:
scp -r srv01-local_draab:/var/lib/docker/volumes/wireguard_wireguard-config/_data/ /home/danielraab/wireguard/
No comments to display
No comments to display