Daily Commands

Commands I use often during normal Linux/RHEL work.

This page is for quick lookup. More detailed explanations can go into the other pages like Logs, Systemd, Networking, and Storage and LVM.


System information

Hostname and OS details

hostnamectl

RHEL version

cat /etc/redhat-release

Alternative:

cat /etc/os-release

Kernel version

uname -r

Uptime and load

uptime

Current user

whoami

User ID and groups

id

Disk and storage

Disk usage

df -h

Folder size

du -sh /path/to/folder

Example:

du -sh /var/log

List block devices

lsblk

Show filesystem UUIDs

blkid

Show mounted filesystems

mount

Cleaner view:

findmnt

Memory and CPU

Memory usage

free -h

Running processes

ps aux

Top processes

top

If available:

htop

CPU information

lscpu

Services

Check service status

systemctl status SERVICE_NAME

Example:

systemctl status sshd

Show failed services

systemctl --failed

Start service

sudo systemctl start SERVICE_NAME

Stop service

sudo systemctl stop SERVICE_NAME

Restart service

sudo systemctl restart SERVICE_NAME

Enable service at boot

sudo systemctl enable SERVICE_NAME

Disable service at boot

sudo systemctl disable SERVICE_NAME

Logs

Recent important logs

journalctl -xe

Logs from current boot

journalctl -b

Logs for a service

journalctl -u SERVICE_NAME

Example:

journalctl -u sshd

Follow service logs live

journalctl -u SERVICE_NAME -f

Last 100 system messages

sudo tail -n 100 /var/log/messages

Networking

Show IP addresses

ip a

Show routes

ip r

Show listening ports

ss -tulpn

Test ping

ping example.com

Test DNS

dig example.com

Alternative:

nslookup example.com

Test HTTP/HTTPS response

curl -I https://example.com

Trace route

traceroute example.com

If traceroute is not installed:

tracepath example.com

Users and login checks

Logged-in users

who

Recent logins

last

Failed logins

sudo lastb

Check user groups

id USERNAME

Files and permissions

List files

ls -lah

Find a file by name

find /path -name "filename"

Example:

find /etc -name "*.conf"

Search text inside files

grep -R "search_text" /path

Example:

grep -R "PermitRootLogin" /etc/ssh

Change owner

sudo chown USER:GROUP FILE_OR_FOLDER

Change permissions

chmod 755 FILE_OR_FOLDER

Package checks

Search package

dnf search PACKAGE_NAME

Package information

dnf info PACKAGE_NAME

Installed packages

rpm -qa

Search installed package

rpm -qa | grep PACKAGE_NAME

Which package owns a file

rpm -qf /path/to/file

Example:

rpm -qf /usr/bin/ssh

Quick first-check command set

When I do not know what is wrong yet:

hostnamectl
uptime
df -h
free -h
systemctl --failed
ip a
ip r
ss -tulpn
journalctl -xe

Notes

Add commands here that I use often but keep forgetting.