Knowledgebase

Commands and Scripts

Cpanel ,Linux ,Server Commands and Scripts

Articles

.git changing file permission issue Updated 22 October 2026 If git pull changes your files' permissions on the server, it can break writable-group permissions and even produce a 500 Internal Server Error on the site. 1. Stop... Bash Arrays: Indexed and Associative Arrays with Examples Bash 4 and later on Linux (examples tested with Bash 5.1); macOS ships Bash 3.2, which has no associative arrays Arrays let a Bash script keep a list of values, such as server names, files or ports, and loop over them. Bash has indexed arrays (numbered from 0) and associative... Bash Functions: How to Write and Use Them (with Examples) Bash 5 on Linux and macOS (examples tested with Bash 5.1) A Bash function is a named block of commands you can call like a small command. Functions make scripts shorter, easier to read and easier to change. Every example here... Basic Linux Commands with Examples: ls, cd, grep, chmod Updated 22 October 2026 These are the Linux commands used most often at the command line: listing, viewing, editing, searching and managing files, checking who is logged in, and checking... Best Command Line Download Accelerators for Linux Updated 28 September 2026 Ubuntu 24.04, Debian 12, AlmaLinux 9 and Rocky Linux 9 These command-line tools download files on a server. All are available on Ubuntu 24.04, Debian 12, AlmaLinux 9 and Rocky Linux 9 (aria2 and axel from EPEL on... Best Command Line HTTP Clients for Linux HTTP clients are utility software that enables you to download files over the Internet. Apart from being able to download files remotely, these command line tools can... Check Disk Usage, Directory and File Size in Linux and Ubuntu Updated 12 October 2026 Ubuntu 24.04 (GNU coreutils 9.4), Ubuntu 26.04 (uutils coreutils 0.10.0 for du and ls, GNU df 9.7), AlmaLinux 10 (GNU 9. To check disk usage in Linux, run df -h: it shows the size, used space and free space of every disk. To show the size of a directory, run du -sh followed by the... Command-Line Translators for Linux (Translate Shell and Argos Translate) Updated 28 September 2026 Translate Shell 0.9.7 on Ubuntu 24.04 and 26.04 and AlmaLinux and Rocky Linux 9 and 10 (EPEL); Argos Translate for offli You can translate text straight from a Linux terminal, which is handy for reading log messages, error texts or documentation in another language on a server without a... Cool Linux Terminal Tools: 16 Useful and Fun Command Line Tools to Install Updated 4 November 2026 Debian 13, Ubuntu 24.04 and 26.04, AlmaLinux 10 with EPEL (package versions from those repositories) The most useful terminal tools for a Linux server or desktop are btop or htop (live system monitor), ncdu (what is using disk space), tmux (sessions that survive a... Create a script: Hello World Follow these steps to create a Hello World script: 1. Create a new file called hello-world.sh using touch hello-world.sh 2. Make the script executable by running chmod... Create a script: Hello World using variables Updated 11 October 2026 AlmaLinux 9, Rocky Linux 9, Ubuntu 24.04 and Debian 12 A first Bash script that uses a variable. Steps Create hello.sh:#!/usr/bin/env bash name="World" echo "Hello, $name!"Make it executable: chmod +x... FTP connection time out error: how to fix it You might encounter the following type of error: !connection failed xx.xx.xxx.xxx - connection timed out!connectio:error 0PORT xxx,xxx,x,x,x,xxx500 Illegal PORT... Fast: Test Your Internet Download Speed in Linux If you want to check the current internet speed of your Linux server from the command-line, you can use a utility called fast, a minimal zero-dependency script,... Fix rpmdb open failed and cannot open Packages database Errors in dnf Updated 4 November 2026 dnf and RPM 4.16 to 4.19 on AlmaLinux and Rocky Linux 9 and 10, RHEL 9 and 10 When the RPM package database cannot be opened, dnf and rpm stop with errors such as: error: sqlite failure: CREATE TABLE IF NOT EXISTS 'Packages' (...): database disk... Guide to Raise ulimit open files and MySQL open_files_limit The operating system provides ways of limiting the amount of resource that can be used. Limits are set for each user but are applied separately to each process that is... How To Add User To A Group In Linux? Prerequisites: A system running Linux A user account with sudo or root privileges Access to a terminal window/command-line (Ctrl-Alt-T, Ctrl-Alt-F2)   What is... How To List All Users In A MySQL Database? Updated 28 September 2026 Ubuntu 24.04, Debian 12, AlmaLinux 9 and Rocky Linux 9 MariaDB and MySQL store accounts in the mysql.user table. These queries work on MariaDB 10.x/11.x and MySQL 8.x. Log in sudo mariadb # or: mysql -u root -p... How to Calculate IP Subnet Address with ipcalc Tool? Ipcalc actually does a lot more, it takes an IP address and netmask and provides the resulting broadcast, network, Cisco wildcard mask, and host range. You can also... How to Clear the npm Cache (npm cache clean --force) npm 11 with Node.js 24 LTS (tested with npm 11.17 and Node.js 24.19 on AlmaLinux 9) npm keeps a copy of every package it downloads in a cache, so the next install is faster. Clearing it is rarely needed, but it helps when installs fail with strange... How to Compare Local and Remote Files in Linux? diff (short for difference) is a simple and easy to use tool which analyzes two files and displays the differences in the files by comparing the files line by line. It... How to Concatenate Strings in Bash Bash 4 and later on Linux (examples tested with Bash 5.1) In Bash you join strings simply by writing them next to each other. There is no special operator. These are the patterns you need, all tested in Bash 5.1. Put... How to Count Lines in a File in Linux (wc -l and More) GNU coreutils 9.7 (Debian 13), GNU coreutils 9.5 (AlmaLinux 10.2) and uutils coreutils 0.10.0 (Ubuntu 26.04), with GNU g To count the lines in a file on Linux, run wc -l with the file name: $ wc -l access.log 10 access.log To get only the number (for a script or a variable), let wc read... How to Count Word Occurrences in a Text File? Graphical User Interface word processors and note-taking applications have information or detail indicators for document details such as the count of pages, words, and... How to Create Disk Partitions in Linux With parted and fdisk Updated 4 November 2026 util-linux fdisk and GNU parted on AlmaLinux and Rocky Linux 9 and 10, RHEL 9 and 10, Ubuntu 24.04 and 26.04, Debian 13 Before you can store data on a new disk, you create one or more partitions on it, put a file system on each partition, and mount it. This guide uses parted, which... How to Delete in Vim Editor: All Text, Lines, Words and Characters Updated 4 November 2026 Vim 9.1 (Debian 13, Ubuntu 26.04, AlmaLinux 10) and Neovim 0.10.4 and 0.11.6 To delete all text in Vim, press Esc to be in normal mode, then type ggdG: gg jumps to the first line and dG deletes everything down to the last line. You can also...