======================================================================================================================= ||| ||| ||||||||| ||| ||| --- --- ||||||||| ||||||||| ||||||||| ||||||||| ||||||||| ||| ||| ||| ||| ||| ||| --- --- ||| ||| ||| ||| ||| ||| ||| ||| ||| ||| ||| ||| ||| --- ||| ||| ||| ||| ||| |||||| ||||||||| ||| ||| ||| ||| ||| ||| --- --- ||| ||| ||| ||| ||| ||| ||| |||||| ||| ||| ||| ||||||||| --- --- ||| ||| ||||||||| ||| ||||||||| ||||||||| ======================================================================================================================= 260501 _______________________________________________________________________________________________________________________ # T E R M I N A L sudo apt update 1.download list of updated packages from the repository (do before upgrading) sudo apt upgrade 2.download and install the latest updates for the packages used sudo apt autoremove 3.removing unnecessary packages from the system after uninstall sudo apt autoclean 4.cleaning the downloaded package cache after autoremove sudo apt search xxx search the package xxx sudo apt install xxx install the package xxx sudo apt install -f resolve missing dependencies if necessary sudo apt remove --purge xxx* completely remove the package xxx and its associated configuration files sudo apt autoremove --purge remove the orphaned outbuildings that had been installed and are no longer of any use wget url download a file via url sudo dpkg -i file.deb install from the .deb file sudo dpkg -i *.deb install all .deb files in the directory (there should only be .deb files) sha256sum xxx.iso check integrity of iso file with SH256 sum su - login as root sudo passwd root set a password for root groups xxx check association of the user xxx in groups sudo usermod -aG sudo xxx add the user xxx to sudo group (login as root before & reboot to make effective) passwd change pass to current user apropos xxx linux command function clear clear displayed terminal contents man xxx linux command help name_package --version now the version of the package sudo run a command as administrator sudo dpkg-reconfigure tzdata change time zone sudo nano xxx open gnu nano editor to edit the xxx file sudo nano /etc/ssh/sshd_config ssh server configuration sudo reboot reboot now sudo shutdown -h now shutdown now sudo shutdown -h 20:00 shutdown at 20:00 sudo snap refresh if update problem with snap ubuntu, close snap and use this command first ... sudo snap refresh snap-store ... then use this command second ./myscript.sh run myscript.sh python3 myscript.py run myscript.py pwd show current directory cd change directory (cd /home/user/....) pkill xxx kill process xxx pkill -9 xxx force stop process xxx apt list --installed show list of installed packages with version details cat /proc/cpuinfo show cpu info cat /proc/meminfo show memory info cat /proc/version show linux kernel version cat /etc/os-release show linux distro version cat myfile display plain text of myfile in terminal date show date df -h show list of disk partitions free -h show memory usage whoami show user name history show history of commands used history -c 01.clear the history in memory > ~/.bash_history 02.empty the history file history -w 03.close the session properly and saving the empty history hostnamectl show hostname, name of machine, bios version and date ip a show network info & ip ping xxx.xxx.x.xx ping ip to check communication logname displays machine's users lsblk show disks lscpu show cpu info lsusb show usb connections nmcli device status show internet network connection uname -a show machine name and kernel version uptime show uptime uptime -s show last boot time sudo dmidecode show machine details (serial, bios, etc.) sudo smartctl -a /dev/x show details about disks with smartmontools (replace x with the correct disk) timedatectl status check time synchronization status systemctl --failed identify failed services ping -c 3 8.8.8.8 to confirm basic outbound connectivity sudo passwd user edit sudo pass for user sudo raspi-config start raspberry pi software configuration tool sudo rpi-eeprom-update check if the bootloader needs an update sudo apt full-upgrade to be used occasionally to keep the system completely up to date sudo rpi-update to be used as a last resort (firmware update) pictrl show info on GPIO pins pinout show pinout layout on your raspberry vcgencmd measure_temp show soc temperature watch -n 0.5 vcgencmd measure_temp show soc temperature with refresh every 0.5 sec vcgencmd version show firmware version on your raspberry add pass for sudo (on raspberry) sudo visudo /etc/sudoers.d/010_pi-nopasswd pi ALL=(ALL) NOPASSWD: ALL >>> pi ALL=(ALL) ALL dpkg --get-selections > mypackages.txt create a text file with all installed packages sudo dpkg --set-selections < mypackages.txt to select the packages you want to restore (update before) sudo apt-get -u dselect-upgrade to install the packages _______________________________________________________________________________________________________________________ # P A C K A G E S AUDACIOUS audacious audio player BAMBU STUDIO via flatpak 3D printing slicer by Bambu Lab BLUEFISH bluefish multi-platform editor BLUEMAN blueman graphical bluetooth manager BRAVE https://brave.com/ web browser BTOP btop terminal resource monitor for processor, memory, disks, network and processes CMATRIX cmatrix for fun! terminal based "The Matrix" like implementation DMIDECODE dmidecode reports information about system (hardware and bios) COCKPIT cockpit a web-based graphical interface for servers DOCUMENT SCANNER simple-scan scanner manager EXHIBIT via flatpak 3d viewer & rendering powered by the F3D library for stl, stp, 3mf, etc. F3D f3d fast and minimalist 3D viewer desktop application FAIL2BAN fail2ban intrusion prevention software (if ssh & web servers are active) FASTFETCH fastfetch best alternative to screenfetch FEDORA MEDIA WRITER https://fedoraproject.org/ tool to create a bootable live USB drive FLATPAK flatpak utility for software deployment and package management FREE FILE SYNC freefilesync backup tool manager GALCULATOR galculator gnome calculator GIMP gimp image manipulation GNOME DISK gnome-disk-utility gnome disk tool manager GNOME GEARY geary email application GNOME TEXT EDITOR gnome-text-editor gnome text editor GPARTED gparted disk tool manager (alternative to gnome disk tool manager) GSMARTCONTROL gsmartcontrol graphical interface of smartmontools HARDINFO2 hardinfo system information and benchmark for linux HTOP htop tasks visual manager KICAD EDA kicad electronics design automation suite LIB FUSE 2 libfuse2 appimage file reader LIBRE OFFICE libreoffice open office suite LUKS cryptsetup linux inified key setup is a disk encryption specification MIDNIGHT COMMANDER mc simple file manager from the terminal MOSQUITTO https://mosquitto.org/ open source message broker that implements the MQTT protocols NCDU ncdu displaying and sorting files by size (ncdu /) NTP ntp more accurate & more resource intensive than systemd-timesyncd ONLY OFFICE via flatpak open office suite ORCA SLICER https://www.orcaslicer.com/ open-source 3D printing slicer OPEN TTD https://www.openttd.org/ open source game based upon Transport Tycoon Deluxe written by Chris Sawyer PI-HOLE https://docs.pi-hole.net/ network-wide ad blocking via your own Linux hardware PRUSA SLICER via flatpak open-source 3D printing slicer by Prusa Research PSENSOR psensor graphical sensor monitoring PSUTIL python3-psutil process and system utilities for retrieving information on system PYGAME python3-pygame python library designed for creating 2D video games PYTHON VENV python3-venv python virtual environments (source /home/greg/myenv/bin/activate) QEMU qemu-system generic and open source machine emulator and virtualizer REAL VNC https://www.realvnc.com/ remote access software REMMINA remmina remote desktop software client SAMBA samba samba-common-bin file and print sharing between computers running Unix/Linux/Windows SCREENFETCH screenfetch displays system information alongside the ASCII distro logo SHORTWAVE shortwave internet radio player that provides access to over 50,000 stations SMARTMONTOOLS smartmontools control and monitor storage systems STRESS NG stress-ng tool to load and stress a computer system THONNY thonny python editor TIMESHIFT timeshift system backups & restore TKINTER python3-tk python library for creating graphical user interfaces TMUX tmux terminal multiplexer TOR PROJECT go to website download tar file on https://www.torproject.org/ TRANSMISSION tranmsission torrent manager VIRT MANAGER virt-manager user interface for managing virtual machines through libvirt VLC vlc cross-platform multimedia player WINE HQ https://www.winehq.org/ compatibility layer capable of running Windows applications on Linux & BSD XCLIP xclip command line utility that allows you to copy from nano to text editor ZED EDITOR https://zed.dev/ code editor designed for high-performance _______________________________________________________________________________________________________________________ # U F W sudo apt install ufw install UFW sudo ufw enable enable UFW sudo ufw reload to do after each new rule or modification sudo ufw status verbose view firewall status sudo ufw status numbered view rules with numbers sudo ufw delete 3 delete a rule by its number (3 for exemple) sudo ufw default deny incoming block all incoming connections sudo ufw default allow outgoing allow all outgoing connections sudo ufw deny from 192.168.1.100 block an IP sudo ufw app list display the list of applications known by UFW sudo ufw disable disable UFW most secure settings to set by default before any other specific authorization: Status: active Logging: on (low) Default: deny (incoming), allow (outgoing), disabled (routed) _______________________________________________________________________________________________________________________ # F A I L 2 B A N 01.sudo apt install fail2ban 02.sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local 03.sudo nano /etc/fail2ban/jail.local 04.xclip -sel clip < /etc/fail2ban/jail.local (to copy all the text directly into the file) 05.past all the text in a new file to keep in your files for information if needed 06.replace all original text with the following available on https://mosfetime.com/etc_fail2ban_jail.local.txt 07.close and save 08.sudo rm -rf /var/run/fail2ban/fail2ban.sock (sometimes the fail2ban.sock file remains stuck and prevents restarting) 09.sudo systemctl restart fail2ban 10.sudo systemctl status fail2ban 11.sudo fail2ban-client status (to check that your addresses are being ignored) manipulations in nano editor ctrl + shift + 5 to start text selection, and then scroll with the mouse to the end crtrl + k to delete all the text selected before ctrl + shift + v to copie all the texte from https://mosfetime.com/etc_fail2ban_jail.local.txt ctrl + shift + c to exit and save _______________________________________________________________________________________________________________________ # S S H sudo systemctl status ssh sudo systemctl enable ssh sudo systemctl start ssh sudo systemctl stop ssh sudo systemctl disable ssh sudo systemctl restart ssh ssh -p XXXXX user@IP to SSH access from another PC with XXXXX the port you dedicated to SSH (avoid the 22) _______________________________________________________________________________________________________________________ # S A M B A smb://cpgx04.local/sambaserver/ _______________________________________________________________________________________________________________________ # M P R E M O T E (TO CONTROL RASPBERRY PICO LOGS) sudo apt install python3-venv -y python3 -m venv ~/venv-pico source ~/venv-pico/bin/activate pip install mpremote 01.plug the raspberry pico, the main.py program will start automatically 02.source ~/venv-pico/bin/activate > you should have in return: (venv-pico) user@machine:~ $ 03.ls /dev/ttyACM* > you should have in return: /dev/ttyACM0 04.mpremote connect /dev/ttyACM0 repl > you should have in return: Connected to MicroPython at /dev/ttyACM0 and each new log will be now directly visible _______________________________________________________________________________________________________________________ # T M U X (very useful without Desktop Environment) to split terminal 01. launch tmux with "tmux" command 02. then use the following commands: tmux split-window -h for vertical splitting tmux split-window -v for horizontal splitting tmux ls to check how many windows are open ctrl+b and <- or -> to navigate exit to close ______________________________________________________________________________________________________________________ # S T R E S S N G nproc to find the number of CPU cores cat /proc/meminfo | grep MemTotal to find the size of RAM memory available methods : sqrt: calculates square roots matrix: matrix multiplication fft: fast fourier transform calculations crc32: CRC32 calculation all: all of the above methods in parallel example with CPU 4 cores : stress-ng --cpu 4 --cpu-method all --timeout 60s --verbose --metrics-brief or with dynamic method : stress-ng --cpu $(nproc) --timeout 60s --verbose --metrics-brief example with 16GB RAM memory : stress-ng --vm 1 --vm-bytes 12G --timeout 60s --verbose --metrics-brief do not use more than 80% of the total available : 16 x 0.80 = 12GB or with dynamic method with 80% usage of total memory : stress-ng --vm 1 --vm-bytes $(awk '/MemAvailable/ {printf "%.0fK", $2 * 0.8}' /proc/meminfo) --timeout 60s --verbose --metrics-brief interruption at any time : 1.ctrl + c 2.pkill stress-ng 3.pkill -9 stress-ng _______________________________________________________________________________________________________________________ # T I M E S Y N C D 01.timedatectl status to check the synchronization status, you should have in return: Local time: sam 2025-12-13 07:42:38 CET Universal time: sam 2025-12-13 06:42:38 UTC RTC time: sam 2025-12-13 06:42:38 Time zone: Europe/Zurich (CET, +0100) System clock synchronized: yes NTP service: active RTC in local TZ: no 02.if not you have to install the systemd-timesyncd package with: sudo apt install systemd-timesyncd 03.an then enable the NTP service with: sudo timedatectl set-ntp true 04.check the synchronization status again: timedatectl status _______________________________________________________________________________________________________________________ # N T P S E R V E R 01.sudo apt install ntp 02.sudo systemctl start ntp 03.sudo nano /etc/ntp.conf 04.copy/past text below step 6 and then ... 05.sudo systemctl restart ntp 06.sudo systemctl status ntp # /etc/ntp.conf, configuration for ntpd # NTP servers server 0.debian.pool.ntp.org iburst server 1.debian.pool.ntp.org iburst server 2.debian.pool.ntp.org iburst server 3.debian.pool.ntp.org iburst # Drift file driftfile /var/lib/ntp/ntp.drift # Restrictions restrict 127.0.0.1 restrict ::1 restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap restrict default kod nomodify notrap nopeer noquery # Statistics Options statsdir /var/log/ntpstats/ statistics loopstats peerstats clockstats filegen loopstats file loopstats type day enable filegen peerstats file peerstats type day enable filegen clockstats file clockstats type day enable _______________________________________________________________________________________________________________________ # P I H O L E Debugger pihole debug Log Flush pihole flush Network Flush pihole networkflush Repair pihole repair Tail pihole tail Set password pihole setpassword Gravity pihole updateGravity Logging pihole logging Query pihole query Update pihole updatePihole Version pihole version Uninstall pihole uninstall Status pihole status Enable pihole enable Checkout pihole checkout Gravity pihole -g (for reloads the blocklists) Best Pi-hole blocklists in 2026: https://raw.githubusercontent.com/hagezi/dns-blocklists/main/adblock/multi.txt https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts https://v.firebog.net/hosts/Easylist.txt https://v.firebog.net/hosts/Easyprivacy.txt _______________________________________________________________________________________________________________________ # A P P I M A G E & F L A T P A K 01.install the libfuse2 package 02.create a directory /Applications & move the file inside 03.authorize its execution (right-click > Properties > Permissions > Allow execution) 04.start the application by double-clicking on it 01.sudo apt install flatpak #(install Flatpak) 02.sudo apt install gnome-software-plugin-flatpak #(install the plugin for gnome or XFCE) 03.flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo #(add the Flathub repository) 04.reboot 05.flatpak update _______________________________________________________________________________________________________________________ # E R A S E D A T A O N D I S K Best partition table for modern disks: GPT (avoid MBR/msdos except for very old hardware) Best general Linux filesystem: ext4 If you lack write permissions after formatting: lsblk -f (you'll see something like this: sdb1 ext4) mount | grep sdX (to check where it is mounted, and you'll see something like this: /dev/sdb1 on /media/greg/sandisk) sudo chown -R greg:greg /media/greg/sandisk (to grant the rights to your user), then: chmod 755 /media/greg/sandisk 01.use lsblk command to display the disks 02.identify the disk to erase (in the example below we want to erase the data from sdX) 03.there are 3 solutions to make the restoration very complex: > for HDD option 1: fills the disk with zeros (more than sufficient for most uses) with: sudo dd if=/dev/zero of=/dev/sdX bs=16M status=progress oflag=direct > for HDD option 2: fills the disk with random data (much longer and in an ultra-secure environment) with: sudo dd if=/dev/urandom of=/dev/sdX bs=16M status=progress oflag=direct > for SSD only: sudo blkdiscard /dev/sdX Why not use dd on SSD? - It wears out the SSD and is very slow - There are a lot of unnecessary writes - Some physical blocks aren't even actually rewritten 04.sudo wipefs -a /dev/sdX (to remove remaining filesystem signatures) 05.use gparted to recreate partitions (create GPT partition tabe, and then create a new ex4 partition) Procedure for mounting an external hard drive without a graphical interface (on a Raspberry Pi, for example): 01.plug the disk and then identify his name with: lsblk -f 02.create a mount point: sudo mkdir -p /mnt/hdd or sudo mkdir -p /mnt/ssd 03.mount the disc with: sudo mount /dev/sdX /mnt/hdd or sudo mount /dev/sdX /mnt/ssd 04.check that it is mounted with: mount | grep sdX 05.grant permissions to your user: sudo chown -R greg:greg /mnt/hdd or sudo chown -R greg:greg /mnt/ssd 06.disassemble before disconnecting is VERY IMPORTANT with: sudo umount /dev/sdX or sudo umount /mnt/hdd or sudo umount /mnt/ssd 07.check that it is properly disassembled with: lsblk 08.you can physically unplug the hard drive _______________________________________________________________________________________________________________________ # T O P 1 0 D A N G E R O U S L I N U X C O M M A N D S rm -rf / #deletes the entire filesystem rm -rf * #deletes everything in the current directory. One wrong path can ruin a system dd if=/dev/zero of=/dev/sda #overwrites a disk with zeros. All data is lost dd if=/dev/random of=/dev/sda #same as above, but slower and just as destructive mkfs.ext4 /dev/sda #formats a disk and erases all data :(){ :|:& };: #fork bomb that freezes the system chmod -R 777 / #breaks system security by giving full access to everyone chown -R root:root / #changes ownership of all files and breaks services kill -9 -1 #kills almost all running processes instantly curl URL | sh #executes untrusted code directly from the internet _______________________________________________________________________________________________________________________ # D E B I A N X F C E P O W E R M A N A G E R 01.settings > session and startup > disable auto-start of "Screen Locker" 02.settings > session and startup > add the autostart of the command: xset s off s noblank -dpms 03.add the name "Stop Screen Blanking" and description "Prevent the screen from going black" 04.disable the XFCE screensaver with: xfconf-query -c xfce4-screensaver -p /saver/enabled -n -t bool -s false 05.disables the lock when in sleep mode with: xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/lock-screen-suspend-hibernate -s false 06.disable screen shutdown via power management with: xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/blank-on-ac -s 0 xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/dpms-on-ac-sleep -s 0 07.reboot 08.check with: xset q 09.you should see: Screen Saver: prefer blanking: no allow exposures: yes DPMS is Disabled _______________________________________________________________________________________________________________________ # F O N T S sudo apt install fonts-osifont _______________________________________________________________________________________________________________________ # D E B I A N manual partitioning during installation with calamares: Partition number 01 Partition type GPT Size 512 MiB File system FAT32 Mount point /boot/efi Fs label EFI Flags boot Partition number 02 Partition type GPT Size remaining space File system ext4 Mount point / Fs label root Flags - sudo nano /etc/apt/sources.list to edit the source list of places you can download Debian packages # See https://wiki.debian.org/SourcesList for more information deb http://deb.debian.org/debian trixie main contrib non-free-firmware deb-src http://deb.debian.org/debian trixie main contrib non-free-firmware deb http://deb.debian.org/debian trixie-updates main contrib non-free-firmware deb-src http://deb.debian.org/debian trixie-updates main contrib non-free-firmware deb http://security.debian.org/debian-security/ trixie-security main contrib non-free-firmware deb-src http://security.debian.org/debian-security/ trixie-security main contrib non-free-firmware # Backports allow you to install newer versions of software made available for this release deb http://deb.debian.org/debian trixie-backports main contrib non-free-firmware deb-src http://deb.debian.org/debian trixie-backports main contrib non-free-firmware sudo nano /etc/default/grub add or remove "quiet splash" mode when booting debian GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" version with "quiet splash" mode GRUB_CMDLINE_LINUX_DEFAULT="" version without "quiet splash" mode sudo update-grub to do after modifying the grub file pactl set-sink-volume @DEFAULT_SINK@ +5% keyboard shortcut to setup (for pulseaudio) to increase volume pactl set-sink-volume @DEFAULT_SINK@ -5% keyboard shortcut to setup (for pulseaudio) to decrease volume hostnamectl check the machine hostname sudo hostnamectl set-hostname NEWNAME rename the machine hostname sudo nano /etc/hosts edit the file /etc/hosts 127.0.1.1 NEWNAME edit the new name 127.0.0.1 localhost don't change anything with this line quit, save, and reboot, and check that the new name is effective with hostnamectl or hostname _______________________________________________________________________________________________________________________ # D O C K E R D E B I A N STIRLING PDF Powerful PDF editor & tools _______________________________________________________________________________________________________________________ # D E B I A N C O M M A N D G U I D E # PACKAGE MANAGEMENT (APT COMMANDS) |----------------------------------------|------------------------------------------------------------| | `sudo apt update` | Updates the package list. | | `sudo apt upgrade` | Upgrades installed packages. | | `sudo apt autoremove` | Removes unused dependencies. | | `sudo apt autoclean` | Cleans obsolete package files. | | `sudo apt full-upgrade` | Performs a full system upgrade (do it occasionally only). | | `sudo apt install [package]` | Installs a package. | | `sudo apt remove [package]` | Removes a package. | | `sudo apt purge [package]` | Removes a package and its config files. | | `sudo apt list --upgradable` | Lists packages that can be upgraded. | | `apt search [keyword]` | Searches for a package. | | `apt show [package]` | Displays package details. | | `apt list --installed` | Lists all installed packages. | | `apt-cache depends [package]` | Shows package dependencies. | # DPKG COMMANDS (.deb packages) |----------------------------------------|------------------------------------------------------------| | `sudo dpkg -i [file.deb]` | Installs a local .deb package. | | `dpkg -l` | Lists all installed packages. | | `dpkg -L [package]` | Lists files installed by a package. | | `dpkg -s [package]` | Displays package status and info. | # SYSTEMD SERVICE MANAGEMENT |----------------------------------------|------------------------------------------------------------| | `sudo systemctl start [service]` | Starts a service. | | `sudo systemctl stop [service]` | Stops a service. | | `sudo systemctl restart [service]` | Restarts a service. | | `systemctl status [service]` | Shows the status of a service. | | `sudo systemctl enable [service]` | Enables autostart on boot. | | `sudo systemctl disable [service]` | Disables autostart on boot. | | `systemctl is-enabled [service]` | Checks if a service is enabled. | | `systemctl list-units --type=service` | Lists active services. | # SYSTEM INFORMATION & HARDWARE |----------------------------------------|------------------------------------------------------------| | `uname -a` | Displays kernel and system info. | | `lsb_release -a` | Displays Debian version info. | | `cat /etc/debian_version` | Displays Debian release version. | | `lscpu` | Shows CPU details. | | `lsblk` | Lists block devices and partitions. | | `lsusb` | Lists connected USB devices. | | `lspci` | Lists PCI devices. | | `sudo lshw` | Displays detailed hardware info. | | `sudo dmidecode` | Shows BIOS and hardware data. | | `sensors` | Displays temperature sensors (needs `lm-sensors`). | # PROCESSES |----------------------------------------|------------------------------------------------------------| | `htop` | Interactive process viewer. | | `ps aux` | Lists all processes. | | `ps aux | grep [process]` | Searches a process by name. | | `kill [PID]` | Terminates a process. | | `kill -9 [PID]` | Forcefully kills a process. | | `pkill [name]` | Kills processes by name. | | `top` | Displays running processes. | # SYSTEM RESOURCES |----------------------------------------|------------------------------------------------------------| | `free -h` | Shows RAM usage. | | `vmstat 1` | Displays system stats in real time. | | `iostat` | Shows disk I/O statistics. | | `uptime` | Displays system uptime and load. | # MISCELLANEOUS USEFUL COMMANDS |----------------------------------------|------------------------------------------------------------| | `history` | Shows command history. | | `!!` | Repeats the last command. | | `!n` | Runs command number *n* from history. | | `alias` | Lists or creates command aliases. | | `which [command]` | Shows command path. | | `whereis [command]` | Locates binaries and man pages. | | `man [command]` | Displays command manual. | | `[command] --help` | Displays quick command help. | | `clear` | Clears the terminal screen. | | `reboot` | Reboots the system (shortcut). | # NETWORK CONFIGURATION |----------------------------------------|------------------------------------------------------------| | `ip a` | Shows all network interfaces. | | `ip addr show` | Displays IP addresses. | | `ip route show` | Displays routing table. | | `hostname -I` | Shows the current IP addresses. | | `ss -tuln` | Lists open TCP/UDP ports. | | `ping [host]` | Tests connectivity. | | `curl -I [url]` | Tests HTTP response headers. | | `hostnamectl` | Displays or sets the hostname. | | `sudo hostnamectl set-hostname [name]` | Changes the hostname. | # DNS AND RESOLUTION |----------------------------------------|------------------------------------------------------------| | `systemd-resolve --status` | Displays DNS resolver status. | | `dig [domain]` | Performs a DNS query. | | `nslookup [domain]` | Looks up DNS records. | # FILE SYSTEM NAVIGATION AND MANAGEMENT |----------------------------------------|------------------------------------------------------------| | `ls -la` | Lists files with details. | | `pwd` | Prints current directory. | | `cd [directory]` | Changes directory. | | `mkdir [directory]` | Creates a directory. | | `rm -r [directory]` | Removes a directory recursively. | | `cp -r [source] [destination]` | Copies files/directories recursively. | | `mv [source] [destination]` | Moves or renames files. | # FILE SYSTEM PERMISSIONS |----------------------------------------|------------------------------------------------------------| | `chmod 755 [file]` | Sets file permissions. | | `chown user:group [file]` | Changes owner and group. | | `chgrp [group] [file]` | Changes group ownership. | | `ls -l` | Displays file permissions. | # SEARCH AND DISK USAGE |----------------------------------------|------------------------------------------------------------| | `find / -name "[file]"` | Searches for a file. | | `locate [file]` | Quickly searches (requires `updatedb`). | | `df -h` | Displays disk usage. | | `du -sh [folder]` | Shows folder size. | | `ncdu` | Interactive disk usage viewer. | # TEXT MANIPULATION |----------------------------------------|------------------------------------------------------------| | `grep [pattern] [file]` | Searches for a pattern. | | `grep -r [pattern] [folder]` | Recursive search in folder. | | `cat [file]` | Displays file contents. | | `less [file]` | Views file page by page. | | `head -n 10 [file]` | Shows the first 10 lines. | | `tail -n 10 [file]` | Shows the last 10 lines. | | `tail -f [file]` | Follows file output in real time. | | `wc -l [file]` | Counts lines in a file. | # ARCHIVING & COMPRESSION |----------------------------------------|------------------------------------------------------------| | `tar -czvf archive.tar.gz [folder]` | Creates a .tar.gz archive. | | `tar -xzvf archive.tar.gz` | Extracts a .tar.gz archive. | | `gzip [file]` | Compresses a file into .gz. | | `gunzip [file.gz]` | Decompresses a .gz file. | | `zip -r archive.zip [folder]` | Creates a .zip archive. | | `unzip archive.zip` | Extracts a .zip archive. | # ADMINISTRATION & SYSTEM CONTROL |----------------------------------------|------------------------------------------------------------| | `sudo -i` | Switches to root shell. | | `su - [user]` | Switches to another user. | | `sudo visudo` | Edits sudoers securely. | | `crontab -e` | Edits cron jobs. | | `sudo systemctl reboot` | Reboots the system. | | `sudo systemctl poweroff` | Powers off the system. | | `sudo shutdown -h now` | Immediately shuts down the system. | | `sudo shutdown -r now` | Immediately reboots the system. | # USER & GROUP MANAGEMENT |----------------------------------------|------------------------------------------------------------| | `sudo adduser [name]` | Adds a new user (interactive). | | `sudo deluser [name]` | Deletes a user. | | `sudo usermod -aG [group] [user]` | Adds a user to a group. | | `sudo addgroup [name]` | Creates a new group. | | `sudo delgroup [name]` | Deletes a group. | | `sudo passwd [user]` | Changes user password. | | `visudo` | Safely edits sudoers configuration. | | `whoami` | Displays current username. | | `id` | Displays UID, GID, and groups. | # SYSTEM LOGS |----------------------------------------|------------------------------------------------------------| | `sudo journalctl -xe` | Shows detailed system logs. | | `sudo journalctl -f` | Follows logs in real time. | | `sudo journalctl -p err -b` | Shows only error logs since last boot. |