Commands and Scripts
Cpanel ,Linux ,Server Commands and Scripts
Articles
.git changing file permission issue
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
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)
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
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
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
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)
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
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
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
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?
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 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
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)
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
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
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...