Skip to content

DeadmanXXXII/RedHat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

RedHat

Red Hat Enterprise Linux (RHEL) Command Line Interface (CLI)

System Information and Management

  • View System Information:

    uname -a
  • View RHEL Version:

    cat /etc/redhat-release
  • Check Kernel Version:

    uname -r
  • List All Loaded Kernel Modules:

    lsmod
  • View CPU Information:

    lscpu
  • View Memory Information:

    free -h

Package Management

  • List Installed Packages:

    rpm -qa
  • Install a Package:

    yum install package_name
  • Remove a Package:

    yum remove package_name
  • Update All Packages:

    yum update
  • Search for a Package:

    yum search package_name
  • List Available Updates:

    yum check-update
  • Install a Package from an RPM File:

    rpm -ivh package_name.rpm
  • Upgrade a Package with RPM:

    rpm -Uvh package_name.rpm

User and Group Management

  • Add a New User:

    useradd username
  • Delete a User:

    userdel username
  • Change User Password:

    passwd username
  • Add a Group:

    groupadd groupname
  • Delete a Group:

    groupdel groupname
  • Add User to Group:

    usermod -aG groupname username
  • List All Users:

    cat /etc/passwd
  • List All Groups:

    cat /etc/group

File and Directory Management

  • List Files and Directories:

    ls -l
  • Change Directory:

    cd /path/to/directory
  • Create a New Directory:

    mkdir directoryname
  • Remove a Directory:

    rmdir directoryname
  • Copy Files:

    cp sourcefile destinationfile
  • Move Files:

    mv sourcefile destinationfile
  • Delete Files:

    rm filename
  • Search for Files:

    find /path -name filename
  • Find Files Containing Specific Text:

    grep -r "searchtext" /path/to/directory

Network Management

  • View Network Configuration:

    ip addr show
  • View Routing Table:

    ip route show
  • Configure Network Interface:

    nmtui
  • Restart Network Service:

    systemctl restart network
  • Check Network Service Status:

    systemctl status network
  • Ping a Host:

    ping hostname
  • Trace Route to a Host:

    traceroute hostname
  • View Network Connections:

    netstat -an
  • Display Open Ports:

    ss -tuln

Firewall Management

  • Check Firewall Status:

    systemctl status firewalld
  • Start Firewall Service:

    systemctl start firewalld
  • Stop Firewall Service:

    systemctl stop firewalld
  • Enable Firewall Service:

    systemctl enable firewalld
  • Disable Firewall Service:

    systemctl disable firewalld
  • Add Firewall Rule:

    firewall-cmd --permanent --add-port=port_number/tcp
    firewall-cmd --reload
  • Remove Firewall Rule:

    firewall-cmd --permanent --remove-port=port_number/tcp
    firewall-cmd --reload
  • List All Firewall Rules:

    firewall-cmd --list-all

System Monitoring

  • View System Load:

    uptime
  • View Memory Usage:

    free -m
  • Monitor System Processes:

    top
  • View Disk Usage:

    df -h
  • Check Disk Space Usage by Directory:

    du -sh /path/to/directory
  • List All Running Processes:

    ps -aux
  • View System Logs:

    journalctl -xe
  • Monitor Real-Time Logs:

    tail -f /var/log/messages

Disk Management

  • List All Disks:

    lsblk
  • Check Disk Partitions:

    fdisk -l
  • Create a New Partition:

    fdisk /dev/sda
  • Format Partition:

    mkfs.ext4 /dev/sda1
  • Mount a Partition:

    mount /dev/sda1 /mnt
  • Unmount a Partition:

    umount /mnt
  • Check Disk Filesystem:

    fsck /dev/sda1

Service Management

  • List All Services:

    systemctl list-units --type=service
  • Start a Service:

    systemctl start service_name
  • Stop a Service:

    systemctl stop service_name
  • Restart a Service:

    systemctl restart service_name
  • Enable a Service:

    systemctl enable service_name
  • Disable a Service:

    systemctl disable service_name
  • Check Service Status:

    systemctl status service_name

Advanced Techniques

  • Configure SELinux Mode:

    setenforce 0  # Permissive Mode
    setenforce 1  # Enforcing Mode
  • Check SELinux Status:

    sestatus
  • List All SELinux Booleans:

    getsebool -a
  • Enable/Disable SELinux Boolean:

    setsebool boolean_name on/off
  • Generate SSH Key Pair:

    ssh-keygen -t rsa -b 2048
  • Copy SSH Key to Remote Host:

    ssh-copy-id user@remote_host
  • Mount NFS Share:

    mount -t nfs remote_host:/path/to/share /mnt
  • Mount CIFS Share:

    mount -t cifs //remote_host/share /mnt -o username=user,password=pass
  • Create Logical Volume:

    lvcreate -L 10G -n lv_name vg_name
  • Extend Logical Volume:

    lvextend -L +10G /dev/vg_name/lv_name
  • Reduce Logical Volume:

    lvreduce -L -10G /dev/vg_name/lv_name
  • Display Logical Volumes:

    lvdisplay
  • Display Volume Groups:

    vgdisplay
  • Display Physical Volumes:

    pvdisplay
  • Set System Timezone:

    timedatectl set-timezone America/New_York
  • Synchronize System Time with NTP:

    timedatectl set-ntp true

Summary

This extensive list of RHEL CLI commands covers a broad range of tasks for system management, package management, user and group management, file and directory operations, network configuration, firewall management, system monitoring, disk management, service management, and advanced techniques. These commands

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published