Linux
Articles in the Linux category (156).
Articles in the Linux category (156).
- Accessing Windows SMB shares from Linux with cifs — List SMB shares with smbclient and mount them with mount -t cifs, keeping credentials in a protected file.
- Add a custom CA certificate on CentOS — Add an internal certificate authority to the CentOS trust store and test the HTTPS connection.
- Add and remove a PPA repository on Ubuntu — Add, remove and inspect PPA APT repositories on Ubuntu and derivatives.
- Analyzing memory usage on Linux — Find the processes that use the most memory on Linux and read the free, available and cache figures correctly.
- APT pinning: mixing stable, testing and backports — Configure APT pin priorities to install selected packages from testing or backports while staying on stable.
- Arch Linux maintenance routine — Weekly, fortnightly and monthly routine to keep an Arch Linux system up to date, clean and stable (Btrfs, LUKS, systemd).
- Arch Linux: Citrix client, install an older package and configure wfclient.ini — Install an archived package version with pacman -U and find the Citrix client's wfclient.ini file.
- Arch Linux: fetch a missing or unknown GPG key — Two gpg commands to fetch a missing public key: WKD lookup by e-mail and receive by key ID.
- Arch Linux: UEFI install with LUKS, Btrfs, XFCE and Timeshift — Arch Linux UEFI install with LUKS-encrypted root, Btrfs subvolumes, GRUB, XFCE, Timeshift and console troubleshooting.
- Back up a Raspberry Pi SD card over SSH with dd — Create a compressed raw image of a Raspberry Pi SD card over SSH with dd, and restore it to a card.
- Bash keyboard shortcuts and command history — Bash keyboard shortcuts for editing the command line, searching the history, managing processes and using ! history expansion.
- Basic Linux commands cheat sheet — Cheat sheet of common Linux commands: processes, memory, filesystems, permissions, networking, redirections and grep.
- Bluetooth on Arch Linux and the hands-free profile — Installing BlueZ, enabling the service, unblocking rfkill and switching a headset to the HFP profile with PulseAudio or PipeWire.
- BorgBackup to a Synology NAS over SSH — Borg command cheat sheet to back up, list, prune and search archives on a Synology NAS.
- CentOS 5: end_request I/O error on fd0 — Diagnose and disable the floppy module to clear the end_request I/O error on /dev/fd0 on CentOS 5.
- CentOS 6: change IP, gateway and DNS — Change the IP address, gateway and DNS servers through the CentOS 6 network configuration files.
- CentOS 6: fix yum after end of life — Make yum work again on end-of-life CentOS 6 by pointing the repositories to the CentOS Vault, including the archived EPEL and SCL repositories.
- CentOS 8: reset a forgotten root password — Reset the root password from GRUB using rd.break and chroot /sysroot.
- CentOS: configure Postfix to send mail through an SMTP relay — Setting up Postfix as a send-only mail server on CentOS / RHEL 8, relaying through the SMTP server found in the DNS MX record.
- CentOS: remove duplicate multilib packages with package-cleanup — List and remove duplicate multilib packages with package-cleanup on CentOS, then update yum.
- certbot: Let's Encrypt certificate for nginx with HTTPS redirect and OCSP stapling — Single certbot command to obtain a certificate, configure nginx, redirect to HTTPS and enable OCSP stapling.
- Change the default editor to vim (systemctl edit, sudo) — Three ways to make systemctl edit and other tools use vim as the default editor.
- Chroot into an installed Linux system from a live USB — Mount an installed Linux system from a live USB, prepare the mounts, enter the chroot, fix the locale and reinstall GRUB.
- Cleaning Arch Linux: orphan packages, caches and logs — Housekeeping steps for an Arch Linux system: pacman cache with paccache, orphan packages, user caches, duplicates with rmlint, disk usage and the systemd journal.
- Compress backups with tar and 7-Zip — tar and 7z commands to create, encrypt, test and extract backup archives, and to estimate their size.
- Configure per-interface DNS with systemd-networkd — Set per-interface DNS servers and split DNS with systemd-networkd and systemd-resolved.
- Configuring kernel parameters with sysctl (swappiness example) — Read, change, persist and reload Linux kernel parameters with sysctl, using swappiness and pid_max as examples.
- Connect to Windows over RDP from Linux with xfreerdp and rdesktop — xfreerdp and rdesktop command examples to open a Windows remote desktop from Linux.
- Create a swap file on Linux — Create a swap file on Linux, enable it and make it persistent through /etc/fstab.
- CUPS on Linux: monitor and unblock a print queue — lpstat, cupsenable and cancel commands, and a procedure to unblock a CUPS print queue.
- curl: useful commands (headers, download, certificate) — Headers, downloads, HTTPS target host override and certificate inspection with curl.
- Dangerous bash commands to avoid — Nine shell commands that can destroy data or make a system unusable, and why.
- Debian/Ubuntu: apt update fails due to wrong clock, resetting the time — Reset the system time from the HTTP Date header to unblock apt update.
- Deleting a Linux file by its inode number — Find a file's inode number with ls -li and delete it with find -inum, after checking the match.
- Disable and enable IPv6 on Linux — Disable IPv6 at runtime through /proc for one or all interfaces, and how IPv4-mapped listening behaves.
- Disable IPv6 on Linux (GRUB and sysctl) — Disable IPv6 at boot with GRUB and at runtime with sysctl, and check the state with an audit script.
- Encrypt a directory with eCryptfs on Linux — Interactive and non-interactive eCryptfs mounts on a directory, unmounting, and a pointer to LUKS.
- Extend an LVM volume after a VMware disk resize — Grow an LVM logical volume on Linux after extending the VMDK disk, or add a new disk to the volume group.
- Extract a single file from an RPM package — Download an RPM package and extract one file from it without installing the package, using rpm2cpio and cpio.
- Fail2ban: protecting SSH with nftables — Configuring a fail2ban sshd jail with nftables, all-ports banning and common commands.
- Find a file by its inode number on Linux — Find the path of a file from its inode number using find, debugfs (ext4) or btrfs inspect-internal.
- Find and merge .rpmnew and .rpmsave configuration files — List the .rpmnew and .rpmsave files left by RPM updates and merge them with rpmconf or yum-plugin-merge-conf.
- Find the last boot and shutdown on Linux — Using last, who, ausearch and the systemd journal to date the last boot and tell a graceful stop from an ungraceful one.
- Find the Linux system install date — Find when a Linux system was installed, using the filesystem creation date, rpm, pacman or emerge.
- Find when an open TCP connection was created on Linux — List open TCP connections with lsof and timestamp their /proc file descriptors to estimate when each connection was opened.
- Fix an APT installation blocked by dependency conflicts — Steps to unblock apt when packages stay held back or have unresolved dependency conflicts.
- FreeIPA: DNSSEC and global forwarding to an AD domain — Use dig to check resolution of an AD domain's Kerberos and LDAP SRV records from an IPA server.
- Get a file's owner and group on Linux — Use ls -l and stat to display a file's owner and group.
- GoAccess: real-time nginx report over HTTPS with basic auth — Analyse nginx logs with GoAccess in terminal or HTML mode, served over TLS with basic auth and Certbot.
- Growing a KVM virtual machine disk with LVM and ext4 — Procedure to grow a QEMU/KVM guest disk image, then the partition, the LVM volumes and the ext4 file systems.
- Install and remove the linux-lts kernel on Arch Linux — Add the linux-lts LTS kernel to Arch Linux with GRUB, then remove it and regenerate the boot loader configuration.
- Install Arch Linux on UEFI with LVM, LUKS, GRUB and XFCE — Encrypted Arch Linux install (LVM, LUKS, GRUB, XFCE) and GRUB repair after a firmware update.
- Install btop on Linux — Install or upgrade btop from the static binary archive published on GitHub, with install paths and uninstall steps.
- Install ncdu, the disk usage analyzer, on CentOS — Install ncdu 2.3 on CentOS from the precompiled binary or by building it from source.
- Installing Arch Linux on UEFI with LVM — GPT partitioning, LVM volumes, file systems and mount points for an Arch Linux installation on UEFI.
- Installing Arch Linux with LUKS, Btrfs and Sway — Step-by-step installation of Arch Linux on a UEFI laptop with LUKS2 encryption, Btrfs, a swapfile and the Sway (Wayland) desktop.
- journald: persistent storage and log size limits — Enable persistent journald storage, read the logs of an offline system and limit their size.
- Keeping Linux performance history with atop and PCP — Record and review Linux server performance history with atop, then use PCP archives (pmlogger, pmrep, pmiostat) on Red Hat.
- Kill orphaned CLOSE_WAIT TCP connections on Linux — Find and terminate TCP connections in CLOSE_WAIT state by port or remote IP, using netstat and lsof.
- KVM command-line cheat sheet — virsh, virt-manager and brctl commands to list, start, suspend and resume KVM virtual machines on Linux.
- Linux (CentOS): access denied in /proc, disabling fs.protected_symlinks — Temporarily disable the kernel symlink protection with sysctl.
- Linux command-line cheat sheet: find, du, grep, lsof, signals and archives — Linux command-line recipes: zombie processes and signals, lsof, copying, deleting and measuring files with find and du, grep, tar, zip.
- Linux directory structure and bash startup files — Role of the main Linux directories, common configuration files and the order in which bash reads its startup files.
- Linux file system commands: ext4, XFS, Btrfs and NTFS — Cheat sheet to create, check, resize, defragment and modify ext4, XFS, Btrfs and NTFS file systems on Linux.
- Linux firewall cheat sheet: iptables, nftables and firewalld — Common iptables, nftables and firewalld commands: rules, logging, blocklists, zones and services.
- Linux hardware inventory: useful commands — Linux commands to inventory hardware: CPU, memory, disks, PCI, USB, network and BIOS/UEFI.
- Linux login history with w, last and lastb — Where Linux stores logins (wtmp, utmp, btmp) and how to read them with w, last and lastb.
- Linux network and I/O monitoring tools — Tools and commands to monitor network traffic, disk I/O and open connections on Linux.
- Linux network configuration overview — Interface naming, network managers (systemd-networkd, NetworkManager, netplan, netctl), statistics and DHCP checks on Linux.
- Linux service management cheat sheet: systemd, SysV init and OpenRC — systemctl, journalctl, systemd-analyze, chkconfig and rc-update commands to manage, analyse and troubleshoot Linux services.
- Linux users and groups: create, lock, remove — Commands and files to create, lock, age, audit and remove Linux user accounts and groups.
- Linux: check and enable SSD TRIM with fstrim — Commands to check TRIM support, run fstrim and enable fstrim.timer.
- Linux: clear page cache and swap, monitor swap usage — Drop the page cache, dentries and inodes, reset swap, schedule the cleanup and monitor swap usage per process.
- Linux: configure an SNMPv3 user (SHA and AES) for monitoring — Create a read-only SNMPv3 user with SHA authentication and AES encryption in snmpd.conf (net-snmp) and test it with snmpwalk.
- Linux: copying files and directories with scp — Examples of copying files and directories between hosts with scp, and the common options.
- Linux: detect whether a reboot is pending — Bash scripts to check whether a reboot is required on Ubuntu/Debian, CentOS/RHEL and Arch Linux.
- Linux: disable the CUPS printing service at boot — Disable the CUPS service with systemctl on a server that does not print.
- Linux: find failed services and systemd journal errors — systemctl --failed and journalctl -p 3 -xb for a first diagnosis.
- Linux: find the vendor id and product id of a USB device — Show the VID:PID of a USB device with lsusb and usb-devices.
- Linux: follow failed SSH logins in the logs — journalctl and tail commands to watch errors and failed SSH passwords live.
- Linux: fstab file structure and options — The six columns of /etc/fstab, common mount options and the role of systemd.
- Linux: increase the size of /tmp (tmpfs) temporarily or permanently — Enlarge a tmpfs-mounted /tmp with mount -o remount, then make it permanent via fstab or systemd.
- Linux: install Zsh and set it as the default shell — Install Zsh on Arch Linux with pacman and set it as the login shell with chsh.
- Linux: language, locale and time zone — Configure the locale, the LANG, LC_ALL and LC_TIME variables, date formats and the time zone on Linux.
- Linux: list scheduled jobs (cron, at, timers) and check logrotate — Where to find cron, at, anacron and systemd timer jobs on a Linux server, and how to check logrotate.
- Linux: monitor system, disks and network with vmstat and vnstat — vmstat commands (interval, timestamp, disk summary) and vnstat (per-interface traffic).
- Linux: mount an NFS share from a Synology NAS — Install nfs-utils and mount a Synology NFS export, with the NFS server packages.
- Linux: overview of defensive security tools by category — Linux defensive tools grouped by category: firewalls, intrusion detection, integrity, encryption, VPN, hardening.
- Linux: overview of distributions and the kernel — Simplified diagram of Linux distribution families and the kernel's place between applications and hardware.
- Linux: recover a deleted file still open (lsof and /proc) — Recover the contents of a deleted file still held open by a process, using lsof and /proc//fd.
- Linux: remove duplicate lines without sorting using awk — Deduplicate lines of one or more files with awk while preserving the original order.
- Linux: replacing net-tools with iproute2 — Mapping from the deprecated net-tools commands (ifconfig, route, arp, netstat) to their iproute2 equivalents (ip, ss) on Linux.
- Linux: screenFetch, neofetch and colored Bash prompt — Display system information with screenFetch or neofetch and colour the Bash prompt per environment.
- Linux: show the kernel boot command-line parameters — Read /proc/cmdline to see the parameters the Linux kernel was booted with.
- Linux: SSH login without typing a password (ssh-copy-id, expect) — Key-based login with ssh-copy-id, or an expect script to automate a password.
- Linux: systemd removing IPC resources of PostgreSQL or Oracle (RemoveIPC) — Disable RemoveIPC in logind.conf so systemd does not delete a database service's shared memory.
- Linux: Terminator keyboard shortcuts — Terminator keyboard shortcuts for splitting panes, opening tabs and moving between terminals.
- Linux: understanding cgroups and CPU quotas — How cgroups work (quota and period) and commands to observe per-group usage.
- Linux: update the BIOS of a Lenovo laptop — Update a Lenovo BIOS from Linux with fwupd (recent models) or a USB stick (older models).
- Linux: X11 forwarding over SSH and minimal Xorg install — Setting up X11 forwarding over SSH, testing it, using a Windows X server and installing a minimal Xorg without a desktop.
- List a user's sessions and kill them (Linux, AIX) — ps, pgrep, pkill, who and ss commands to list and terminate a user's processes and SSH connections.
- List all cron jobs on Linux — Where crontabs are stored, how to list user and system cron jobs, and how to check their execution in the logs.
- List and change DNS servers on Linux with resolvectl — resolvectl, systemd-resolve and netplan commands to show and change the DNS servers of a Linux system.
- List connected SSH sessions on Linux — List connected SSH sessions with who, w, last and ss.
- Load all CPU cores on Linux with yes and gzip — Bash script that loads all CPU cores for one minute with yes and gzip, to test load on Linux.
- Log LDAP with rsyslog on CentOS 6 — Send the LDAP service (slapd) messages to a dedicated file with rsyslog on CentOS 6.
- LVM cheat sheet: physical volumes, volume groups and logical volumes — Common Linux LVM commands: create, extend, reduce, mirrors, snapshots, configuration backup and recovery scenarios.
- Monitor processes with top, iotop and pidstat — Read the CPU fields of top, its shortcuts, filter by command line and measure I/O per process with iotop and pidstat.
- Monitoring Linux performance with sar (sysstat) — sar commands from sysstat to analyse CPU, memory, disk I/O and network on Linux, including reading historical data.
- Mount a CD, USB key or disk on Linux (fstab and UUID) — Detect an optical drive, mount a media, identify a disk by UUID and configure fstab.
- Mount a Hetzner Storage Box on Linux (CIFS and SSHFS) — Mount a Hetzner Storage Box sub-account on Linux with CIFS (fstab included) or SSHFS, then unmount it.
- Mounting a DFS share with cifs: error 126 Required key not available — Fix mount error 126 when mounting a Windows DFS share with cifs and Kerberos on Linux.
- Nginx: monitoring with stub_status — Enable and test the nginx stub_status endpoint, and count client IPs from journalctl.
- NTP time synchronisation on Linux and Windows — Commands to check, test and force clock synchronisation with ntpd, chrony, systemd-timesyncd and w32time.
- OpenLDAP and ldapsearch: Oracle Net directory on Ubuntu, backup and logging — ldapsearch commands, OpenLDAP installation on Ubuntu, Oracle Net schema, backup/restore, admin password and logging.
- Pacemaker: pcs commands and fencing (STONITH) — Main pcs commands to manage a Pacemaker cluster and the STONITH fencing principle.
- pacman and yay cheat sheet with apt/dnf/zypper/emerge equivalents — Everyday pacman and yay commands on Arch Linux, equivalents in other package managers, and RPM troubleshooting.
- pCloud on Linux: removal and backup with rclone and borg — Remove the pCloud client, back up the account with rclone then borg, and mount it with rclone.
- PrivateBin on nginx and uWSGI: /run folder, Certbot and GoAccess — Memo: ownership, missing /run folder for uWSGI, Let's Encrypt certificate with Certbot and a real-time GoAccess report.
- Query packages with apt and dpkg (Debian) — apt, apt-cache and dpkg commands to list, search, describe and locate Debian packages.
- Ranger terminal file manager: settings and shortcuts — rc.conf settings and shortcut cheat sheet for ranger.
- Read boot messages and hardware state on Linux — Read boot logs (boot, journalctl, dmesg) and inventory the hardware detected by the kernel.
- Redis over a Unix socket for Nextcloud caching — Configure Redis on a Unix socket and enable it as cache and locking backend in Nextcloud.
- Reinstall an older package version with yum — Archive repositories by distribution, yum commands to go back to an earlier version, and the exclude directive to block an update.
- Remove the virbr0 and lxcbr0 interfaces (libvirt, LXC) — Disable libvirt and remove the virbr0 and lxcbr0 network bridges on RHEL/CentOS.
- Reset a garbled Linux terminal — Restore a terminal after binary output using reset, stty sane and tput.
- Reset the XFCE 4 panel — Reset the XFCE 4 panel configuration and locate the .desktop files behind the menu entries.
- RHEL: subscription-manager, release pinning and ABRT cleanup — subscription-manager commands for subscription and release pinning, plus ABRT report cleanup.
- Roll back and pin a package version with yum (RHEL 8) — List available versions with yum, install a specific version and lock it with the versionlock plugin on RHEL 8.
- Run commands as another user and configure passwordless sudo — Using sudo and su to switch users, and configuring NOPASSWD in sudoers.
- Send the same command to all tmux panes — Turn on tmux pane synchronization to type the same command in every pane of a window.
- Set a static IP address on CentOS or RHEL — Configure a static IPv4 address, gateway and DNS servers in the ifcfg file of a CentOS or RHEL interface, then restart networking.
- Set up a network Epson printer/scanner on Arch Linux (CUPS, SANE, Avahi) — IPP printing with CUPS, AirScan scanning with SANE, Avahi discovery and .local resolution with nss-mdns.
- setuid, setgid and sticky bits with chmod — Meaning of the setuid, setgid and sticky bits in chmod octal modes on Linux.
- Shell script: CPU, memory and disk usage — Shell script that prints memory, root disk and CPU load usage on a Linux system.
- SNMP agent on Linux: setup, configuration and useful OIDs — Install and configure net-snmp, test with snmpwalk, and a list of OIDs for load, CPU, memory and disk.
- SSH: "no such identity" message for id_rsa — Understand and fix the no such identity messages shown by the SSH client.
- SSH: multiple keys, ProxyJump and failed login troubleshooting — Configure several SSH keys, a ProxyJump bastion, handle legacy ssh-rsa keys and diagnose failed logins.
- sshfs and encrypted MySQL connection to shared hosting — Mount a remote directory with sshfs and connect to MySQL over TLS from Linux.
- systemd timers: basic commands — List, check and test systemd timers, with an example service and timer.
- systemd unit file specifiers — Short reference of the % specifiers usable in systemd unit files: names, instances, host, user and directories.
- Systemd-homed: journal spam when the service is disabled — Steps to stop repeated journal messages when systemd-homed is disabled on Arch Linux.
- Termux: installation prefix and Android storage access — Show the Termux prefix and grant access to the phone's shared storage with termux-setup-storage.
- Testing disk speed and integrity on Linux — Quickly measure disk read and write speed on Linux, and detect a faulty disk or memory with checksums.
- tmux: copy, paste and manage buffers — Copy and paste in tmux with emacs and vi key bindings, save buffers to a file, and fix a corrupted status bar.
- Tracing system calls with strace — Use strace to trace a program's file access and network calls, and save a timestamped trace to a log file.
- Troubleshoot memory issues on Linux — Find OOM events, identify the memory-consuming process, read its OOM score and inventory the installed memory.
- Ubuntu: enable or disable automatic updates (unattended-upgrades) — Install and configure unattended-upgrades on Ubuntu/Debian, with a link to a detailed guide.
- Ubuntu: remove old kernels, swappiness and journal size — Free space in /boot, tune swappiness and cap the systemd journal size on Ubuntu.
- Understanding and managing the Linux OOM killer — Find the processes the kernel killed for lack of memory, read and adjust their OOM score, and choose the allocation behaviour.
- VMware: "sda: failed to get udev uid" error on Ubuntu 20.04 — Set disk.EnableUUID on the VM to fix the udev uid error on Ubuntu 20.04.
- Work around a flaky USB/SD disk: usb-storage and sdhci quirks — Disable UAS for a USB disk with usb-storage.quirks and reload sdhci with a quirk flag.
- Xfce keyboard shortcuts reference — Reference of the default Xfce keyboard shortcuts for windows and workspaces, and how to disable F11 in xfce-terminal.
- yum history: list, undo and redo transactions — List yum transaction history, undo or redo a transaction, and change how yum history list displays entries.
- Yum to DNF: command and plugin equivalents — Table of yum commands and plugins with their dnf equivalents on Fedora and RHEL.
- yum: repositories, EPEL and common commands — yum cheat sheet for RHEL/CentOS: EPEL, CentOS 8 vault, updates, cache and metadata troubleshooting.