Knowledgebase

Commands and Scripts

Cpanel ,Linux ,Server Commands and Scripts

Articles

How to Exclude Files and Directories with rsync rsync 3.5.0 (Debian 13, AlmaLinux 10.2) and rsync 3.2.7 (Ubuntu 24.04) To make rsync skip files or folders, add --exclude with a pattern, once per pattern: rsync -av --exclude='cache/' --exclude='*.log' /var/www/site/ /backup/site/ Three... How to Find Out Who is Using a File in Linux? Lsof is used on a file system to identify who is using any files on that file system. You can run the lsof command on Linux filesystem and the output identifies the... How to Find the Geographic Location of a Server From the Terminal Updated 30 September 2026 curl and jq on any Linux server (AlmaLinux, Rocky Linux, Ubuntu, Debian and others) To find where a server, or any IP address, is located, ask an IP geolocation service from the terminal. The result is an estimate based on registration and routing... How to Increase Swap Space in Linux Updated 4 November 2026 Debian 13, Ubuntu 24.04 and 26.04, AlmaLinux and Rocky Linux 9 and 10, Fedora 44; tested with util-linux 2.41 on a Linux To increase swap space in Linux without a reboot, add a second swap file next to the swap you already have: create it with fallocate, run chmod 600, mkswap and swapon,... How to Read ls -l Output in Linux: Permissions, Links, Owner, Size and Date Explained Updated 4 November 2026 Debian 13 (GNU coreutils ls 9.7), AlmaLinux 10 (GNU ls 9.5) and Ubuntu 26.04 (uutils ls 0.10.0) Each line of ls -l has the same fields, left to right: file type and permissions, hard link count, owner, group, size in bytes, last modification time and name. This... How to Use rsync to Copy and Sync Files and Directories in Linux Updated 11 October 2026 rsync 3.2.7 (Ubuntu 24.04), 3.4.1 (Ubuntu 26.04) and 3.5.0 (Debian 13, AlmaLinux 10) To copy files with rsync, run rsync -av SOURCE DESTINATION. For example rsync -av site/ /backup/site/ copies the contents of the site folder to /backup/site/, keeping... Input Redirection in Linux: stdin, Here Documents and Here Strings Explained Updated 22 October 2026 Input redirection feeds a file, or text you type in the script, to a command’s standard input instead of the keyboard. command < file reads from a file,... Linux Commands List by Category: A Quick Reference Access Control exit - terminate a shell (see "man sh" or "man csh") logout - sign off; end session (C shell and bash shell only;) passwd - change login... Linux Uptime Command With Usage Examples Uptime is a command that returns information about how long your system has been running together with the current time, number of users with running sessions, and the... Nginx Redirect: How to Redirect a URL, HTTP to HTTPS and www Updated 12 October 2026 nginx 1.28.3 on Ubuntu 26.04 (tested) and nginx 1.26.3 on AlmaLinux 10 (file locations checked); the same directives wor To redirect a URL in nginx, add a return line to the site's server block: location = /old-page.html { return 301 /new-page.html; } for one page, or return 301... OpenVZ useful commands Here is the list of some useful OpenVZ commands which should be run from the main node :   1. To fetch the consumption of disk for each container in the node along... Script to restart server if load increases above a given limit Updated 22 October 2026 This script reboots the server automatically if its load average goes above a limit you set. Treat it as a stopgap for sudden load spikes, not a fix: if the server... Setuid, Setgid and Sticky Bit in Linux: What They Do on Files and Directories Updated 4 November 2026 Linux: Debian 13 (GNU chmod 9.7), AlmaLinux 10 (GNU chmod 9.5) and Ubuntu 26.04 (uutils chmod 0.10.0) Linux has three special permission bits on top of read, write and execute. The setuid bit (octal 4, u+s) makes a program run with the rights of the file's owner... Terminalizer: Record Your Linux Terminal and Generate Animated GIF Terminalizer is a free, open source, simple, highly customizable and cross-platform program to record your Linux terminal session and generate animated gif images or... The ar Command in Linux: Create and Extract Archives GNU ar from binutils 2.44 (Debian 13), 2.46 (Ubuntu 26.04) and 2.41 (AlmaLinux 10), all tested To extract an ar archive, run ar x archive.a: every member is written to the current directory. ar t archive.a lists the members first, and ar rcs archive.a file1... The echo Command in Linux: Print Text and Variables with Examples Bash 5.2.37 and GNU coreutils 9.7 on Debian 13 (tested); the same on other Linux distributions with Bash echo prints its arguments followed by a new line. The $ belongs to the shell, not to echo: before echo runs, Bash replaces $name with the value of the variable name.... The sleep Command in Linux: Pause a Script for Seconds, Minutes or Hours Linux: GNU coreutils 9.7 (Debian 13), uutils coreutils 0.8.0 (Ubuntu 26.04) and BusyBox 1.37 (Alpine 3.24); tested on al sleep pauses for the time you give it, then exits. sleep 5 waits five seconds. Add a suffix for other units: s seconds, m minutes, h hours, d days. It is mostly used... Todo.txt: Manages Your Todo Tasks from Linux Terminal odo.txt (todo.txt-cli) is an easy and extensible shell script for managing your todo.txt file. It allows you to add todos, list added todos, mark an entry as done,... Understand more about vmstat Updated 22 October 2026 vmstat (virtual memory statistics) reports a summary of memory, processes, interrupts, paging and block I/O. Give it a delay (in seconds) to sample system activity... bash: lsb_release: command not found on Debian: How to Fix It Updated 9 November 2026 Debian 13 (trixie, lsb-release 12.1-1) and Debian 12 (bookworm, lsb-release 12.0-1) bash: lsb_release: command not found on Debian means the lsb-release package is not installed. Minimal installs, cloud images and containers leave it out. Install it... findmnt: Shows Currently Mounted File Systems in Linux The findmnt command is a simple command-line utility used to display a list of currently mounted file systems or search for a file system in /etc/fstab, /etc/mtab or... how to find and replace a word in the entire folder using single command? Updated 28 September 2026 Linux (GNU grep and sed) Replace a word or URL in every file of a folder with one command, for example after changing a domain. Steps Back up the folder first: tar czf ~/backup-site.tar.gz... npm Commands Cheat Sheet: install, ci, update, run and audit npm 11 with Node.js 24 LTS (tested with npm 11.17 and Node.js 24.19 on AlmaLinux 9) npm is the package manager that comes with Node.js. These are the commands you use every day, with what they printed in our tests. Start a project npm init -y... cPanel License Update Command: Update, Refresh or Renew a cPanel License Key (cpkeyclt) Updated 4 November 2026 cPanel & WHM 138 on AlmaLinux 9 and Ubuntu 24.04 (root access) To update a cPanel license, run /usr/local/cpanel/cpkeyclt as root on the server. It fetches the licence issued to your server's IP address from cPanel's licence... Common cPanel Commands: Accounts, Services, Email, DNS and Backups Updated 29 September 2026 cPanel & WHM 138 on AlmaLinux, Rocky Linux and CloudLinux 8, 9 and 10, and Ubuntu 24.04 (checked on an AlmaLinux 9 s A quick reference of the command-line tools a cPanel server administrator uses for everyday jobs: accounts, services, updates, email, databases, DNS and backups. Run...