Basic CentOS Linux Commands in linux
Last Updated :
26 Dec, 2023
CentOS is a free and open-source operating system that aims to provide a stable reliable, and community-supported platform for servers and other enterprise applications.
In this article, we will be covering CentOS Linux basics commands and functions of CentOS and also we will look into the advanced commands. These CentOS commands allow you to manage files and directories perform system tasks, and troubleshoot problems.
What is CentOS Linux?
It is a Linux distribution Operating system that aims to provide a free, enterprise-class, community-supported computing platform. It is functionally compatible with its upstream source, Red Hat Enterprise Linux (RHEL).
Why Choose CentOS Linux?
CentOS, a Community Enterprise Operating System, is a popular server choice due to its stability, reliability, and free availability. Based on Red Hat Enterprise Linux (RHEL), CentOS offers robust performance and is widely used for hosting, databases, and as a general-purpose server operating system.
CentOS is known for its long-term support, security, and compatibility with enterprise-level environments, making it a preferred choice for businesses and developers who require a stable and secure Linux distribution.
Basic CentOS Commands and Their Functions
CentOS, like any Linux distribution, comes with a powerful set of command-line tools. Understanding these commands is crucial for system administration and troubleshooting. Here are some essential CentOS commands:
Added mkdir , rmdir , touch and cat commands in one go . Please focus on ls after each command It will give you insights :
mkdir , rmdir , touch and cat commands in one goFile archiving in CentOS :
file archiving command this will give gfg.tar file Upgrading Packages in centOs :
yum check-update will update the package database to make you have latest pacakes and dependencies installed ls: Lists directory contents. Example: ls -l lists files with detailed information.

cd: Changes the current directory. Example: cd /home moves to the home directory.
cd/home to home directory (Inside Home Directory)pwd: Displays the current directory path.

cp: Copies files and directories. Example: cp file1.txt file2.txt copies file1.txt to file2.txt.

rm: Removes files or directories. Example: rm file.txt deletes file.txt.

mkdir: Creates a new directory.
rmdir: Removes empty directories.
touch: Creates an empty file or updates the timestamp of an existing file.
cat: Concatenates and displays file content. (Below all commands in single terminal)
mkdir ,rmdir , cat , touch commands in one go
These commands form the foundation of daily operations in a CentOS environment, helping users manage files, navigate directories, and perform basic system tasks.
Advanced CentOS Commands
Beyond basic file and directory management, CentOS offers a range of advanced commands for system administration and configuration. Some of these include:
- grep: Searches text using patterns. Example: grep 'text' filename searches for 'text' in the specified file.
- find: Searches for files in a directory hierarchy.
- tar: Archives files. Example: tar -cvf archive.tar folder/ creates an archive of a folder.
- chmod: Changes file access permissions.
- chown: Changes file owner and group.
- ps: Displays information about running processes.
- kill: Sends a signal to a process, typically to stop the process.
- top: Displays real-time information about running processes.
- df: Shows disk space usage.
- du: Estimates file space usage.
top command output
kill , find , vim, cat, chmod command
kill , find , vim, cat, chmod commandPractical Examples and Use Cases of CentOS Commands
Let's explore some practical examples and use cases of CentOS commands:
- System Update: Use sudo yum update to update all installed packages to their latest versions.
- Network Configuration: The ifconfig or ip addr command can be used to configure or display network interface parameters.
- File Compression: Compress files using gzip filename or create compressed archives with tar -czvf archive.tar.gz folder/.
- User Management: Add a new user with useradd username or modify user information with usermod.
- Monitoring Disk Usage: Use df -h to check disk space and du -sh to check the size of a directory.
- Process Management: Identify running processes with ps aux and terminate a process using kill -9 PID.
top,du ,ifconfig,useradd ,tar
ifconfig(For network config changes)
These examples illustrate how CentOS commands are applied in real-world scenarios, from system maintenance to resource monitoring and user management.
Similar Reads
Chaining Commands in Linux Chaining commands in Linux is a powerful technique that allows you to execute multiple commands sequentially or simultaneously through the terminal. This approach resembles writing short shell scripts that can be directly executed in the terminal, enhancing the efficiency of your workflow. By using
7 min read
Basic Shell Commands in Linux: Complete List Anyone using Linux should become an expert in the essential shell commands, as they form the backbone of working with the Linux terminal. These commands enable you to navigate the system, manage files, handle processes, and configure settings effectively.The Linux shell serves as an interface for us
5 min read
ls Command in Linux The ls command is one of the most used commands in the Linux terminal to display the files and directories or path in the terminal. So, using the ls command is a basic skill for navigating the Linux file system, handling files, and managing directories.What is the ls Command in LinuxThe ls command i
10 min read
25 Basic Linux Commands For Beginners [2025] While performing a task, we all need shortcuts. Shortcuts help us to complete a task quickly. Linux comes with such commands which are one to two words, using that commands, you can perform several operations in no time. As a beginner, you must be aware of those basic Linux commands to complete an o
13 min read
batch command in Linux with Examples batch command is used to read commands from standard input or a specified file and execute them when system load levels permit i.e. when the load average drops below 1.5. Syntax: batch It is important to note that batch does not accepts any parameters. Other Similar Commands: atq: Used to display th
1 min read
apt command in linux with examples apt provides a high-level Command Line Interface (CLI) for the APT package management system, offering a user-friendly interface intended for interactive use. It simplifies common tasks like installation, upgrades, and removal, with better defaults than more specialized tools like apt-get and apt-ca
5 min read
apropos command in Linux with Examples Linux/Unix comes with a huge number of commands and thus it become quite difficult sometimes to remember each and every command. apropos command becomes useful in such cases. apropos command helps the user when they don't remember the exact command but knows a few keywords related to the command tha
3 min read
adduser command in Linux with Examples adduser command in Linux is used to add a new user to your current Linux machine. This command allows you to modify the configurations of the user which is to be created. It is similar to the useradd command in Linux. The adduser command is much interactive as compared to useradd command. Installing
4 min read
chsh command in Linux with examples chsh command in Linux is used to change the user's login shell(currently login shell). Shell is an interactive user interface with an operating system and can be considered an outer layer of the operating system. The bash shell is one of the most widely used login shells in Linux. This command allow
1 min read
Linux Commands Cheat Sheet Linux, often associated with being a complex operating system primarily used by developers, may not necessarily fit that description entirely. While it can initially appear challenging for beginners, once you immerse yourself in the Linux world, you may find it difficult to return to your previous W
13 min read