- CentOS Commands Cheat Sheet
- Most Useful CentOS Commands and Tools
- 1. top
- 2. nmap
- 4. sosreport
- 5. lsmod
- 6.tcpdump
- See the Top CentOS Alternatives
- Commonly-Used CentOS Commands
- CentOS command Cheat Sheet
- A Quick Overview of CentOS
- CentOS Commands Cheatsheet
- Help Commands
- File Operations
- Process Management
- Partitions and Disk Management
- Accounts and Security Administration
- Networking
- Directory Operations
- Some Frequently-used CentOS Commands
- top
- Nmap
- sosreport
- lsmod
- Final Thoughts
CentOS Commands Cheat Sheet
If you’re just getting started with CentOS, learning the commands and tools is a big help in increasing your productivity. In this blog, we go over some of the most useful CentOS commands and tools as chosen by our enterprise architects, then provide a list of common commands.
Most Useful CentOS Commands and Tools
There are lots of commands when it comes to CentOS and any tool that saves time and provides utility is a welcome addition to any person’s tool kit.
We asked several of our enterprise architects on the team what their favorite tools and commands were and here are some of the results:
1. top
The command top displays a list of processes or threads currently being used by the system kernel. This is useful for telling if something is holding up your systems resources. Summary is the first portion you’ll see followed by the fields and columns header and then the task area. You would use this to determine if a process is hung or hogging all the resources of your system prior to simply killing a pid at random.
2. nmap
Have you ever wondered from a networking perspective, what ports were open on various nodes of your network? Nmap allows you to quickly scan networks for open ports, application version information, running services, what operating system and version, what type of packet filters and firewalls are in use, and plenty of other useful and sensitive information. By listing information such as what ports are open, you can then seal the gaps in your security plan by closing those ports if possible. Nmap is a robust tool and the man pages are a highly recommended read to understand all the options and features available.
3. rpm -ql or dpkg -L
Have you ever wondered the easiest way to find all the files associated with a particular package? These two commands will show all the files and their location of the package named. Rpm is for RHEL/CentOS and dpkg is for Debian based systems.
4. sosreport
One of the commands we frequently have our customers run during break/fix issues is sosreport. It creates an archive of config and diagnostic data from the system to be used for debugging and troubleshooting later. Can be used with xsos, a tool used to read the reports generated by sosreport.
5. lsmod
This command arranges and formats the output of modules in /proc/modules and any kernel modules that are currently loaded.
6.tcpdump
An incredibly useful tool that allows you to examine the content of packets on a network interface matching a Boolean expression. This includes such information as handshakes between two devices, logins to sites, server traffic, UDP traffic, requests to printers, but more importantly it can detect traffic going to sketchy destinations or from unknown sources. Has a GUI version known as Wireshark.
See the Top CentOS Alternatives
With CentOS 7 left as the only community-supported CentOS version, many teams are looking for their next Enterprise Linux distribution. In our 2022 Decision Maker’s Guide to Enterprise Linux, our experts look at the top distributions available today, and which ones will provide the most stable and dependable experience going forward.
Grab Your Free Copy
Commonly-Used CentOS Commands
While our list above is useful, there are many more commonly-used CentOS commands for Linux that you should keep close by. Here are some that make working from the command line a lot easier.
lists the contents of the directory
CentOS command Cheat Sheet
In this blog, we will go through a comprehensive list of CentOS commands that everyone should know when using the system.
List of content you will read in this article:
If you’re new to CentOS, mastering the commands and tools will go a long way toward enhancing your productivity. The blog is a compilation of nearly every important CentOS command that you need to work smoothly. But before jumping on that, let’s brush up with the basics.
A Quick Overview of CentOS
Community Enterprise Operating System or CentOS is a free and open-source commercial operating system compatible with Red Hat Enterprise Linux (RHEL). Gregory Kurtzer founded centOS, and CentOS developers use the RHEL source code to create a product that is quite similar to RHEL.
CentOS is a development platform that is one of the best and most influential Linux distributions available. It’s a community-driven free software project that aims to create a stable foundation for open source communities. It’s versatile, as well as safe and durable. It also includes multiple corporate-level security updates, making it a fantastic solution for any application. Have a look at the benefits of using CentOS:
- It virtualises using a Kernel -based Virtual Machine and gives maximum availability and performance.
- CentOS has a committed developer community that keeps it up to date and guarantees compatibility with both new and old applications.
- CentOS releases are revised on average every six months, and each release has a ten-year support period.
- Red Hat’s security team is adept at detecting threats and maintaining a high level of security. The Security-Enhanced Linux kernel addition is also included with CentOS.
CentOS Commands Cheatsheet
Help Commands
It is used to find concise descriptions of system commands by searching the Whatis database for entire words.
Displays full path to shell commands
Search and discover command’s binary, source, and man pages
Look for help and man pages containing specific phrases and instructions by searching a database of short descriptions.
Lists Manual pages for the respective command
File Operations
Concatenate files or print a file on the monitor.
Make a new file and modify the timestamps.
Copy files or directories.
Moves files or directories.
Removes directories or files in a recursive manner
It is used for creating a symbolic or hard link for a file.
Viewing a single file on a single page, along with the ability to go backwards.
Printing the first ten lines of a file.
Printing the last ten lines of a file.
Counts the total number of words or characters there are in a file.
Shows the status of a file or a file system.
Remove parts of input lines.
Combine multiple lines of text in a single file.
Process Management
Provide an update on existing procedures.
Displays a tree of processes.
Demonstrate real-time procedures.
PID is used to terminate a process.
Stop a process permanently via name
Looking up for processes or signals based on the same and other attributes.
Look for information on the process.
Stop the task instead of keeping it on halt permanently.
The addition of this after a command puts the process in the background.
Displays all the jobs running in process
Partitions and Disk Management
Report on the amount of disc space used by the file system.
Mount a file system or see what’s mounted.
Identifies processes via files or sockets.
Displays a list of the system’s open files
Accounts and Security Administration
Used for creating new groups
Manipulating the description of a particular group
Modifying a user’s account
Updating a user’s password
Editing the password or shadow password of a group
Editing groups or shadow groups
Modifying password policies
Networking
Set up the network interface.
Shows and manipulates IP routing table
Replaces ifconfig, arp, and route by displaying and manipulating routing, devices, policies, and tunnels.
It brings up the network interfaces
It brings the network interfaces down
Sends ICMP ECHO_REQUEST to network hosts
Directory Operations
Removes all the contents from your screen
Displays running directory on the screen
Lists down all the content of a directory
Some Frequently-used CentOS Commands
top
This command provides a list of processes or threads that the system kernel is currently using. This is important for determining if something is clogging up your system’s resources. The first section you’ll notice is a summary, followed by the fields and columns heading, and finally, the task area. You’d use this to see if a process is hung or using up all of your system’s resources before keeping it on halt.
Nmap
Nmap allows you to swiftly scan networks for open ports, application version information, and a variety of other important and sensitive data. You can close any gaps in your security plan by listing information such as what ports are open. Nmap is a powerful tool, and reading the man pages is a must to comprehend all of the choices and capabilities available fully.
rpm -ql or dpkg -L
These two commands are used to quickly locate all of the files connected with a specific package. It will display all of the files as well as the package name’s location. Rpm is for RHEL/CentOS systems, while dpkg is for Debian systems.
sosreport
Sosreport is one of the scripts that our customers regularly use during break/fix issues. It creates a backup of the system’s configuration and diagnostic data, which can be utilised for further debugging and troubleshooting. It’s compatible with xsos, a software that reads the reports created by sosreport.
lsmod
This command organises and arranges the output of modules in /proc/modules as well as any presently loaded kernel modules.
Final Thoughts
Finally, CentOS comes with a plethora of other tools and utilities, and the ones mentioned earlier cover pretty much all the crucial and frequently-used ones.