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
Non-linear Components In electrical circuits, Non-linear Components are electronic devices that need an external power source to operate actively. Non-Linear Components are those that are changed with respect to the voltage and current. Elements that do not follow ohm's law are called Non-linear Components. Non-linear Co
11 min read
Spring Boot Tutorial Spring Boot is a Java framework that makes it easier to create and run Java applications. It simplifies the configuration and setup process, allowing developers to focus more on writing code for their applications. This Spring Boot Tutorial is a comprehensive guide that covers both basic and advance
10 min read
Class Diagram | Unified Modeling Language (UML) A UML class diagram is a visual tool that represents the structure of a system by showing its classes, attributes, methods, and the relationships between them. It helps everyone involved in a projectâlike developers and designersâunderstand how the system is organized and how its components interact
12 min read
Steady State Response In this article, we are going to discuss the steady-state response. We will see what is steady state response in Time domain analysis. We will then discuss some of the standard test signals used in finding the response of a response. We also discuss the first-order response for different signals. We
9 min read
Backpropagation in Neural Network Back Propagation is also known as "Backward Propagation of Errors" is a method used to train neural network . Its goal is to reduce the difference between the modelâs predicted output and the actual output by adjusting the weights and biases in the network.It works iteratively to adjust weights and
9 min read
Polymorphism in Java Polymorphism in Java is one of the core concepts in object-oriented programming (OOP) that allows objects to behave differently based on their specific class type. The word polymorphism means having many forms, and it comes from the Greek words poly (many) and morph (forms), this means one entity ca
7 min read
3-Phase Inverter An inverter is a fundamental electrical device designed primarily for the conversion of direct current into alternating current . This versatile device , also known as a variable frequency drive , plays a vital role in a wide range of applications , including variable frequency drives and high power
13 min read
What is Vacuum Circuit Breaker? A vacuum circuit breaker is a type of breaker that utilizes a vacuum as the medium to extinguish electrical arcs. Within this circuit breaker, there is a vacuum interrupter that houses the stationary and mobile contacts in a permanently sealed enclosure. When the contacts are separated in a high vac
13 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
AVL Tree Data Structure An AVL tree defined as a self-balancing Binary Search Tree (BST) where the difference between heights of left and right subtrees for any node cannot be more than one. The absolute difference between the heights of the left subtree and the right subtree for any node is known as the balance factor of
4 min read