Centos Cheat Sheet [Free PDF Download]

CentOS is a free and open-source Linux distribution based on the Red Hat Linux source code. Because of its stability, security, and ease of management, it is widely used in server environments. In this article, I have tried  to provide a comprehensive CentOS command list, as well as a CentOS Commands Cheat Sheet, covering important commands, file management, network configurations, package management, and more. In simple words, you will have access to a handy reference guide that will allow you to recall CentOS commands and configurations as needed quickly.

Download Centos Cheat Sheet

Centos cheat sheet image

Available Download Options


Most Popular

PDF (5 Pages)

DOC (5 Pages)

Combo Pack

ZIP (pdf, docx, png)

What is CentOS Mostly Used for?

CentOS is a stable, reliable, and secure operating system which is commonly used for servers and workstations. It provides a plethora of tools and features for managing system resources, networking, security, and software packages. It is known for its long-term support and predictable release cycles. That’s why it is a popular choice for organizations and businesses that require a stable and secure operating system for their infrastructure.

Furthermore, this operating system is maintained and supported by a community of developers and users who contribute to its development and provide support through online forums and documentation. That’s why some developers may prefer this for web servers, cloud computing, virtualization, database servers, development environments, and desktops.

Centos Commands List

In this section, I’ve compiled a comprehensive CentOS Commands List to serve as a useful guide for system administrators and other users. I have divided this list into the following sections: system management and administration commands, user and group management, partitions and disk management, networking, process management, package management, and help commands. You can also save this list as a Centos cheat sheet.

System Management and Administration Commands

This section gives an overview of the most important commands for managing and administering CentOS systems. The commands in this section cover many functions, such as system monitoring, system reporting, process monitoring, and more.

Commands Description
rpm -ql <packagename> Lists the files installed by a specific RPM package
dpkg -L <packagename> Lists the files installed by a specific Debian package
sosreport Gathers information about the system’s configuration and status for troubleshooting purposes
bcwipe Securely erases files or partitions
chkconfig Controls the services that start automatically when a SysVinit system boots
dstat Displays system resource usage statistics
fdisk Enables users to view information regarding a disk’s partition layout as well as create, modify, and delete disk partitions.
systemd Manages system services and processes
systemctl Controls and manages systemd services and other system components
systemctl halt Halts the Linux system
systemctl poweroff Turns off the power of the system
systemctl reboot Restarts the system
systemctl suspend Suspends the Linux system
systemctl hibernate Hibernates system
systemctl hybrid-sleep Suspends and hibernates the system
systemctl disable firewalld Disables the firewalld
systemctl start firewalld Starts the firewalld
strace Traces system calls and signals
shutdown Shuts down or reboots a system
service Calls the script to start, stop, and restart a daemon or service
lspci Lists information about all the PCI buses and devices in the system
lsusb Lists information about all the USB buses and devices in the system
last Shows a list of all the users who have logged in and out of the system, along with the time and date of their sessions
quota Displays and manages disk quotas for users and groups
xrandr Configurs display settings
xwininfo Displays information about X windows
uname Displays system information such as the operating system name, version, and architecture
localectl status Displays locale settings
localectl list-locales Lists all locales
locale list-keymaps Lists keyboard mappings
timedatectl set-timezone time_zone Sets timezone
timedatectl set-time YYYY-MM-DD Sets date
timedatectl set-time HH:MM:SS Sets time
timedatectl set-ntp yes Enables ntp server
hostnamectl status Views and modifies the system’s hostname and related settings
hostnamectl set-hostname <host-name> Changes hostnames
hostnamectl set-hostname -H username@hostname Sets hostname remotely
lsblk Lists the block devices on the system

User and Group Management Commands

The commands I have listed in this section cover a wide range of functions related to user and group management, such as creating and deleting users and groups, modifying user and group attributes, managing passwords, and more.

Commands Description
alias Create an alias or shortcut for another command
sudo Allows a user to run commands with the security privileges of another user
useradd Creates a new system user account
userdel Removes a user from the system
usermod Modifies an existing user account on the system
passwd Changes a user account’s password
vipw Edits the password file on the system
vigr Changes the system’s group file
groupadd Creates a new group on the system
groupdel Removes a group from the system
groupmod Modifies an existing group on the system
chage Changes a user account’s password expiration and other account aging information
who Displays users who are currently logged in

File and Directory Management Commands

Here you can find commands to perform a variety of tasks, such as listing files and directories, changing permissions and ownership, copying and moving files, navigating the file system, creating and removing directories, searching for files, and more.

Commands Description
ls Displays a list of the files and directories in the current working directory
ls -a Lists all files and directories in the current directory, including hidden files
ls -aF List every file and directory in the current directory, including hidden files, and add a character to every entry to denote the type of the file or directory.
ls -l Lists in long format all files and directories in the current directory, including details such as permissions, owner, size, and modification time.
chmod Changes a file’s permissions
chown Changes a file’s ownership
cp Copies files and directories
mv Moves or renames files and directories
cd Changes the current working directory
cd .. Moves one level up from the current directory
cd ~ Moves one level back from the current directory
pwd Shows the current working directory
ll Provides detailed information about the files and directories in the current working directory
find Searches for files and directories in a specified location
rm Deletes files and directories
ln Creates a hard or symbolic link between files
touch Creates an empty file or updates the access and modification times of an existing file
less Displays a file’s contents one page at a time
head Displays the first ten lines of a file
tail Displays the last ten lines of a file
wc Counts the number of lines, words, and characters in a file
stat Displays file information such as the owner, permissions, and timestamps
cut Extracts specific columns or fields from a text file
paste Combines lines from multiple files
diff Compares two files and shows the differences between them
mkdir Creates a new directory
rmdir Removes an empty directory
grep Searches text files or streams for a given pattern or regular expression
unzip Unzips the archived files
dd Copies a file, converting and formatting it according to the options specified
fsck Checks and repairs filesystem integrity on unmounted filesystems.
locate Uses a database to quickly locate files rather than searching the file system
tar Archives and compresses files and directories

Partitions and Disk Management Commands

The commands I have covered here perform a wide range of tasks, such as showing disk usage, mounting and unmounting file systems, figuring out which processes are using which files or directories, and more.

Commands Description
fuser Identifies which processes are currently using a particular file, directory, or socket
df Provides information about the amount of disk space used by the file system
mount Attaches a file system to a directory
unmount Detaches a mounted file system from its mount point
du Displays disk usage statistics for a file or directory

Networking Commands

The commands that I have listed here perform a wide range of functions, such as network scanning, packet capturing, configuring network interfaces, routing, pinging, and more.

Commands Description
nmap Scans for open ports and services on a network.
tcpdump Captures and displays network traffic in real-time
ifconfig Displays and configures network interface information
route Displays and configures the network routing table
ip Displays and sets up network interfaces, addresses, and routes
ping Sends packets to a remote host in order to check the network’s connectivity
hostname Displays or changes the hostname of the system
ifup Brings up a network interface
ifdown Brings a network interface down
iftop Displays a list of network connections sorted by their bandwidth usage
iptop Displays network traffic in real-time
netstat Displays network connection information such as active connections and listening ports.
ss Similar to netstat, but offers more thorough information
firewall-cmd Allows users to open or close ports, enable or disable services, and create custom rules for network traffic management
iptraf Views various network statistics, such as network traffic by IP address, port activity, and protocol distribution
jwhois Obtains registration information for domain names and IP addresses
rsync Copies and synchronizing files and directories between two system

Process Management Commands

In this section, I have listed commands that you can use to identify and manage processes, including terminating them when necessary.

Commands Description
ps Displays information about currently active processes
pstree Displays a tree of currently running processes
top Shows current system performance indicators and the processes utilizing the system’s resources
kill Sends a signal to a process to end it
killall Terminates all processes with the specified name
pkill Sends signals to processes based on their name or other attributes
pgrep Lists the process IDs (PIDs) of processes based on their name or other attributes
jobs Lists the currently active jobs in the shell
init Starts a process control

Package Management Commands

Here, you will find commands that can be used in listing running processes, displaying process trees, monitoring system resource usage, terminating processes, and more.

Commands Description
yum Enables users to install, update, and uninstall software packages and dependencies from local or remote repositories
yum search <package_name> Searches for a package in the configured repositories
yum install <package_name> Installs a package and its dependencies from the configured repositories
yum help install Provides information on the options and syntax for the command
yum update Updates all installed packages to their latest available version
yum check-update Checks for available package updates in the configured repositories
yum update –security Updates only the packages that have security updates available in the configured repositories
yum update <package_name> Updates a specific package and its dependencies to their latest available version
yum remove <package_name> Removes a package and its dependencies from the system
yum clean all Removes all cached packages from the system to free up disk space
yum list installed Lists all packages installed on the system
yum list all Lists all packages available in the configured repositories, including installed and available packages
yum list updates Lists only the packages that have available updates
yum list available Lists all packages available in the configured repositories that are not currently installed on the system
yum info <package_name> Displays detailed information about a package, including its description, version, and dependencies
yum deplist <package_name> Displays the dependencies of a package and their details
yum erase <package_name> Uninstalls a package and removes its dependencies that are no longer needed
yum autoremove Removes packages that were installed as dependencies but are no longer required
yum grouplist Lists all available package groups that can be installed or removed
yum clean all Removes all cached package data from the system
yum check Checks the system for any issues with dependencies and missing files
yum repolist Displays a list of all configured repositories and their status, including the number of packages available
yum info <package_name> Displays detailed information about a package
yum provides <file_name> Finds which package provides a specific file on the system
yum history Displays the system’s yum transaction history
yum groupinstall <group_name> Installs a group of packages
yum groupremove <group_name> Removes a group of packages

Help Commands

You can use these commands for locating command binaries, identifying command locations, searching for command names or descriptions, and more.

Commands Description
whatis Displays a brief description of a command
which Locates the binary executable file associated with a command
whereis Locates the binary, source, and manual page files associated with a command
apropos Searches a specified database file set, then output the results as standard output
man Shows the manual pages for a specific command

Miscellaneous Commands

In this section, I have listed commands that can be used for tasks like clearing and exiting terminal, and displaying kernel module.

Commands Description
lsmod Displays currently loaded kernel modules
exit Exits a login terminal or session as a specific user
clear Clears the terminal screen
cal Displays a calendar for a specific month or year in the terminal
ncal Displays calendar in a different format than cal command
bc Performs mathematical calculations in a command line calculator
cron Allows to schedule and automate recurring tasks on your system
crontab Edits, creates, or views the cron jobs that are scheduled to run on a Linux system
date Displays or set the system date and time
neofetch Displays system information, such as the operating system, kernel version, CPU and GPU information, and more, in a visually appealing way
tree Displays the directory structure of a file system in a tree-like format
at Schedules a one-time task to run at a specified time in the future
tee Redirects output from a command to a file and also display it on the terminal at the same time

Conclusion

To summarize, knowing how to use the CentOS commands is a must-have skill for system administrators and users who want to manage their systems effectively. Users can save time and effort by referring to this Centos cheat sheet when performing tasks on their CentOS systems. Moreover, this cheat sheet is an excellent starting point and reference guide for anyone learning how to use CentOS commands. I hope you found this article useful. Please leave a comment if you have any questions or suggestions.

5/5 - (1 vote)
LINUX
FUNDAMENTALS
A Complete Guide for Beginners Enroll Course Now
icon linux

Lamisa Musharrat

Hello there. My name is Lamisa Musharat, and I'm an Linux Content Developer Executive at SOFTEKO. I earned a bachelor's degree in Naval Architecture and Marine Engineering from Bangladesh University of Engineering and Technology (BUET).I learned Linux out of my curiosity and now I find it useful as automation is easier using Linux. I take great pleasure in assisting others with Linux-related issues. I really want you to enjoy and benefit from my efforts.Read Full Bio

Leave a Comment