boucle ∞

Sparking curiosity, facilitating knowledge-sharing, and fostering community interaction.

Handy Commands for Red Hat CentOS
Published 12 july 2023

When working with Red Hat CentOS, it’s essential to become familiar with the terminal and the wide range of commands that you can use to navigate, modify, and manage your Linux system. In this article, we’re going to explore some of the most useful commands that will aid your CentOS journey.

1. Basic File and Directory Commands

ls - List Directory Contents

This command is used to list the contents of a directory.

1
ls


cd - Change Directory

To navigate through the Linux files and directories, use the cd command.

1
cd /path/to/directory


pwd - Print Working Directory

If you want to know the absolute path of your current directory, pwd comes in handy.

1
pwd


touch - Create a New File

Creating a new, empty file is as easy as typing touch followed by the file name.

1
touch myfile.txt


rm - Remove a File or Directory

You can remove a file or directory using rm command. Use -r option for directories.

1
2
rm myfile.txt
rm -r mydirectory

2. System Information Commands

uname - Print System Information

uname displays the important information about your system. The -a option prints all system information.

1
uname -a


top - Monitor System, Process, and Users

top gives you real-time information about your system, the current processes, and users.

1
top


df - Disk Space Usage of File Systems

df displays the amount of disk space used and available on Linux file systems.

1
df -h


free - Memory Usage

This command gives you a summary of the memory usage in your system.

1
free -m

3. Package Management with YUM

yum install - Install a Package

Use yum install followed by the package name to install a new package.

1
sudo yum install packageName


yum remove - Remove a Package

To remove an installed package, use yum remove followed by the package name.

1
sudo yum remove packageName


yum update - Update System Packages

To update all the system packages to their latest versions, just type yum update.

1
sudo yum update


yum search - Search for a Package

If you need to find a package in the repositories, use yum search.

1
yum search packageName


ping - Send ICMP ECHO_REQUEST to Network Hosts

You can check your connectivity to a network host using ping.

1
ping host


ifconfig or ip - Display or Configure a Network Interface

Use ifconfig or ip to configure, control, and query TCP/IP network interface parameters.

1
2
ifconfig
ip addr


netstat - Network Statistics

netstat provides a variety of information about network connections.

1
netstat


ssh - OpenSSH Remote Login Client

ssh command is used for logging into a remote machine and for executing commands on a remote machine.

1
ssh username@hostname


The above commands are just the tip of the iceberg when it comes to managing and navigating a CentOS system, but they’re a good starting point for both beginners and experienced users alike. Don’t hesitate to explore the man pages for any command you’re interested in, as it provides in-depth information about usage, options, and examples.

Lucian

Open source enthousiast.

×