0% found this document useful (0 votes)
76 views12 pages

RHCSA Full Command Reference Book

Linux Commands references
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views12 pages

RHCSA Full Command Reference Book

Linux Commands references
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

RHCSA + Linux Basics Full Command Reference

1. Basic Linux Commands


Command Explanation Example

pwd Print current working directory. pwd

whoami Show current logged-in username. whoami

date Display or set system date/time. date "+%d-%m-%Y %H:%M:%S"

cal Show calendar. cal 2025

echo Print text to screen. echo "Hello World"

clear Clear terminal screen. clear

history Show command history. history | grep dnf

uptime Show system uptime/load. uptime

uname Show system/kernel info. uname -a

man Show manual page. man ls

whatis Short description of command. whatis grep

whereis Locate binary/config/docs. whereis bash

which Show path to executable. which python3


2. File & Directory Navigation
Command Explanation Example

ls List contents of directory. ls -lAh

cd Change directory. cd /etc

mkdir Make new directory. mkdir projects

rmdir Remove empty directory. rmdir olddir

tree Show directory tree structure. tree /etc

touch Create empty file/update timestamp. touch file.txt

cat Show file contents. cat /etc/hosts

less View file one page at a time. less /var/log/messages

head Show first 10 lines. head -n 20 file.log

tail Show last 10 lines. tail -f /var/log/secure

stat Show detailed file info. stat file.txt


3. File Operations & Permissions
Command Explanation Example

cp Copy files/directories. cp -rp source.txt /backup/

mv Move or rename. mv file1 newfile

rm Remove files/directories. rm -rf /tmp/test

find Search files. find / -type f -name "*.conf"

grep Search text patterns. grep "error" /var/log/messages

wc Count lines/words/chars. wc -l file.txt

diff Compare files. diff old.conf new.conf

chmod Change file permissions. chmod 755 script.sh

chown Change owner/group. chown user:group file

chgrp Change group only. chgrp wheel file.txt


4. Compression & Archiving
Command Explanation Example

tar -cvf Create tar archive. tar -cvf backup.tar /home/user

tar -xvf Extract tar archive. tar -xvf backup.tar

gzip Compress file. gzip file.log

gunzip Decompress file. gunzip file.log.gz

zip Create zip archive. zip myfiles.zip a.txt b.txt

unzip Extract zip archive. unzip myfiles.zip


5. Process Management
Command Explanation Example

ps aux Show processes. ps aux

top Interactive process viewer. top

kill PID Kill process by PID. kill -9 1234

jobs Show background jobs. jobs

bg Resume job in background. bg %1

fg Bring job to foreground. fg %1

nice Run with priority. nice -n 10 sleep 60

renice Change priority of PID. renice +5 2345


6. Networking Basics
Command Explanation Example

ip a Show network interfaces/IP. ip a

ping Test connectivity. ping google.com

curl Fetch URL contents. curl https://example.com

wget Download file. wget https://example.com/file.txt

ss -tulnp Show open ports/services. ss -tulnp

scp Secure copy between hosts. scp file.txt user@remote:/tmp/

ssh Connect to remote host. ssh [email protected]


7. User & Group Management
Command Explanation Example

useradd Create new user. useradd -m -s /bin/bash alice

passwd Set password. passwd alice

usermod Modify user. usermod -aG wheel alice

userdel Delete user. userdel -r alice

groupadd Create new group. groupadd developers

groupmod Modify group. groupmod -n devteam developers

groupdel Delete group. groupdel devteam

id Show UID/GID/groups. id alice


8. Package Management (DNF/YUM)
Command Explanation Example

dnf search Search package. dnf search nginx

dnf install Install package. dnf install -y httpd

dnf remove Remove package. dnf remove httpd

dnf update Update all packages. dnf update -y

dnf provides Find which pkg has file. dnf provides /usr/bin/ls

dnf groupinstall Install group of pkgs. dnf groupinstall "Server with GUI"

dnf repolist Show enabled repos. dnf repolist


9. Flatpak Management
Command Explanation Example

flatpak remotes Show remote repos. flatpak remotes

flatpak remote-add Add repo. flatpak remote-add flathub https://flathub.org/repo/flathub.flatp

flatpak search Search apps. flatpak search firefox

flatpak install Install app. flatpak install flathub org.mozilla.firefox

flatpak list List installed apps. flatpak list

flatpak run Run app. flatpak run org.mozilla.firefox


10. SELinux Management
Command Explanation Example

getenforce Show SELinux mode. getenforce

setenforce 0/1 Change SELinux mode. setenforce 0

sestatus Detailed status. sestatus

ls -Z Show SELinux context. ls -Z /var/www/html

semanage fcontext Set file context. semanage fcontext -a -t httpd_sys_content_t "/web(/.*)?"

restorecon Apply default context. restorecon -Rv /web


11. Systemctl & Service Management
Command Explanation Example

systemctl start Start service. systemctl start httpd

systemctl stop Stop service. systemctl stop httpd

systemctl enable Enable service at boot. systemctl enable httpd

systemctl disable Disable service at boot. systemctl disable httpd

systemctl status Show service status. systemctl status sshd

systemctl list-unit-files List unit files. systemctl list-unit-files --type=service


12. Disk & Storage Management
Command Explanation Example

lsblk List block devices. lsblk

df -h Show disk usage. df -h

du -sh Show directory size. du -sh /var/log

mount Mount device. mount /dev/sdb1 /mnt

umount Unmount device. umount /mnt

blkid Show UUID/filesystem. blkid /dev/sdb1

fdisk Partition disk. fdisk /dev/sdb

mkfs.xfs Format XFS filesystem. mkfs.xfs /dev/sdb1

You might also like