Tutorial

Using the CLI on Fedora and RHEL

A practical guide to the Fedora and RHEL command line: dnf, SELinux basics, systemd, and the Red Hat ecosystem tooling.

Terminal entry points

On Fedora and RHEL, the default terminal is often GNOME Terminal or Konsole. Servers are accessed via SSH, typically with Bash as the default shell.

# Check current shell
$ echo $SHELL
/bin/bash

# Check distribution information
$ cat /etc/os-release

# Check kernel version
$ uname -a

dnf basics

dnf is the package manager for Fedora, RHEL, and their derivatives. It replaces the older yum command.

# Refresh package metadata
$ sudo dnf check-update

# Install common tools
$ sudo dnf install git curl tmux ripgrep

# Search for a package
$ dnf search tmux

# Upgrade installed packages
$ sudo dnf upgrade

# Remove a package
$ sudo dnf remove tmux
  • System packages Use dnf for shell tools, compilers, and base dependencies.

  • Language-specific packages Use npm, pip, cargo, or uv on top of the system layer when working inside a specific language ecosystem.

SELinux overview

Fedora and RHEL ship with SELinux enabled by default. It enforces mandatory access controls that can affect file permissions, service binding, and container behavior.

# Check SELinux status
$ getenforce
Enforcing

# View SELinux context of a file
$ ls -Z script.sh

# Temporarily set permissive mode (requires sudo)
$ sudo setenforce 0

# View SELinux denials
$ sudo ausearch -m avc -ts recent

When a command fails with "permission denied" on Fedora/RHEL, check both traditional permissions (ls -l) and SELinux context (ls -Z) before assuming a bug.

Filesystem and permissions

Linux follows a Unix-style filesystem rooted at /. Understanding home directories, hidden files, executable bits, and ownership is essential.

CommandPurposeExample
pwdShow current directory$ pwd
ls -laList files, including hidden ones$ ls -la ~/.config
chmodChange permissions$ chmod +x script.sh
chownChange owner/group$ sudo chown user:user file.txt
sudoRun with elevated privileges$ sudo systemctl restart nginx
# View file permissions
$ ls -l deploy.sh
-rwxr-xr-x 1 stone stone 914 Mar 20 09:14 deploy.sh

# Add execute permission
$ chmod +x deploy.sh

Services and logs

Modern Fedora and RHEL use systemd as the service manager. systemctl and journalctl are everyday tools.

# Inspect running processes
$ ps aux | head

# Check service state
$ systemctl status sshd

# View recent logs
$ journalctl -u sshd --since today

# Enable a service at boot
$ sudo systemctl enable nginx

Developer toolchain

Once dnf and permissions are familiar, install the common development stack.

# Common utilities
$ sudo dnf install git curl tmux jq ripgrep fd-find

# Git identity
$ git config --global user.name "Your Name"
$ git config --global user.email "you@example.com"

# Check language runtimes
$ python3 --version
$ node --version

Next steps

  1. Build confidence with dnf, chmod, and chown.
  2. Understand SELinux basics and how to read audit logs.
  3. Practice SSH and remote server management.
  4. Add one repeatable workflow using Git, Podman, or shell scripts.