Linux
Linux, cPanel, CentoOs
Articles
How to Change a User Password in Linux (passwd and chpasswd)
On Linux you change passwords with the passwd command. Any user can change their own password; the root user (or a user with sudo) can change anyone’s. We tested...
How to Change or Set System Locales in Linux?
A locale is a set of environmental variables that defines the language, country, and character encoding settings (or any other special variant preferences) for your...
How to Change the Default Shell in Linux and Ubuntu with chsh or usermod, and Switch to Another User
To change your own default shell in Linux, run chsh -s with the full path of the new shell and enter your password, then log out and back in:
chsh -s /usr/bin/zsh
To...
How to Change the Hostname Permanently in Linux (Fedora, Rocky Linux, RHEL 9 and Ubuntu) and Set the Domain Name
To change the hostname permanently in Linux, run sudo hostnamectl set-hostname server1.example.com. It writes the new name to /etc/hostname, so it survives a reboot,...
How to Check CPU Frequency in Linux (lscpu, cpupower)
To check the CPU frequency in Linux, run grep MHz /proc/cpuinfo: it prints the current clock of every CPU in MHz. lscpu adds the model name and, on hardware with...
How to Check CPU Usage on Linux: top, htop, mpstat and sar
To check CPU usage on Linux, run top and read the %Cpu(s) line at the top. us plus sy is the share of CPU time spent on work; id is idle. The process list below it is...
How to Check Execution Time of a Process in Linux?
These tools measure how long a command or process runs. They work on Ubuntu 24.04, Debian 12, AlmaLinux 9 and Rocky Linux 9.
time: measure a command
time tar czf...
How to Check Open Ports in Linux and Ubuntu (Listening Ports)
To check open ports on Linux, run sudo ss -tulpn. It lists every TCP and UDP port a program is listening on, with the program’s name. Listening is only half the...
How to Check if a Port Is in Use on Linux (Port Status)
To check if a port is in use on Linux, run ss -ltn 'sport = :8080' (replace 8080 with your port, and use -lun for a UDP port). If only the header line comes back, the...
How to Check the Kernel Version in Linux: Running Kernel, Installed Kernels and Reboot Check
Run uname -r to see which kernel your server is running right now. It works on every Linux distribution and doesn’t need root. The kernel that is running can be...
How to Clear BASH Command Line History in Linux?
To clear the current shell's bash history, run history -c, then also clear the history file on disk with history -w so a new shell does not load the old entries back...
How to Clone a Partition or Hard drive in Linux?
With dd command you can copy an entire hard drive or just a Linux partition. Let's start with cloning one of our partitions. In my case, I have the following drives:...
How to Compare Files in Linux: diff, cmp, vimdiff and Meld
To compare two files in Linux, run diff file1 file2. It prints only the lines that differ; no output means the files are identical. For output that is easier to read,...
How to Compare Two Directories With diff and Meld
To see how two folders differ, for example a backup and the live site, or two releases of an application, use diff on the command line or Meld on a desktop. diff is...
How to Configure and Manage firewalld on AlmaLinux and Rocky Linux
CentOS 8 reached end of life in 2021. Its firewall, firewalld, works the same on AlmaLinux 9 / Rocky Linux 9, so this guide uses those.
Check the firewall
systemctl...
How to Connect Wi-Fi from Linux Terminal Using Nmcli Command?
There are several command-line tools for managing a wireless network interface in Linux systems. A number of these can be used to simply view the wireless network...
How to Convert Images to WebP Format in Linux?
WebP is a relatively new, open-source image format that offers exceptional lossless and lossy compression for images on the web, designed by Google. To use it, you...
How to Copy Files with Permissions in Linux (cp -p, rsync -a and chmod --reference)
To copy a file and keep its permissions, owner and timestamps, use cp -p; for a whole folder use cp -a. To give an existing file the same permissions and owner as...
How to Copy Folders with scp -r (Recursive Copy over SSH)
scp copies files between computers over SSH. To copy a whole folder with its subfolders, add -r (recursive). We tested every example below between a Mac and a Ucartz...
How to Create Hard and Symbolic Links in Linux?
To Create Hard Links in Linux
To create a hard links in Linux, we will use ln utility. For example, the following command creates a hard link named tp to the file...
How to Create Multiple User Accounts in Linux
The two utilities for adding or creating user accounts in Unix/Linux systems are adduser and useradd. These commands are designed to add a single user account in the...
How to Create a Disk Image in Linux with dd: Back Up, Compress, Mount and Restore
To create a disk image in Linux, copy the whole disk into a file with dd: sudo dd if=/dev/sdb of=/backup/sdb.img bs=4M status=progress conv=fsync. The file is an...
How to Create a New Ext4 File System (Partition) in Linux?
The ext4 or fourth extended filesystem is a widely-used journaling file system for Linux. It was designed as a progressive revision of the ext3 file system and...
How to Create a Virtual HardDisk Volume Using a File in Linux
Virtual Hard Disk (VHD) is a disk image file format which represents a virtual hard disk drive, capable of storing the complete contents of a physical hard drive. It’s...
How to Create and Execute a .Jar File in Linux Terminal?
A JAR (Java ARchive) is platform-independent file format used to aggregate many Java class files and associated metadata and resources such as text, images, etc, into...