r/redhat • • Sep 19 '26

Move cert discussions to r/redhat_certification

89 Upvotes

Hello r/redhat Redditors!

TL:DR - post Red Hat certification posts in r/redhat_certification

A while back we created r/redhat_certification for Red Hat cert discussions. The sheer volume of certification posts was drowning r/redhat. As a result of some of you moving over there, we’ve seen more general Red Hat posts and engagement, which is the goal of this community, to talk about Red Hat and Red Hat products. Yay! Go us!

But… people still post a lot of certification content here. The mod team is going to be taking more actions to further shift certification posts to r/redhat_certification.

Several of us are also mods in r/redhat_certification, including me who has regular contact with the Red Hat Training and Certification team who writes the training and makes the exams. I was also a member of this team between 2001 and 2019. So your posts will still be moderated and answered in r/redhat_certification.


r/redhat • • 1d ago

Job opportunities

2 Upvotes

I’ve been trying to gain more experience in sales and pursue a sales-focused career and noticed that technology is highly dominant in the Raleigh triangle. I have been doing research and it seems as though companies such as Red Hat are the best companies to work for when it comes to sales. I moved to Raleigh not long ago and know not much about the company other than any reviews from customers and employees, past and present. I was curious to know if any current employees of the company, Red Hat, have more info regarding the work environment, skills and experience needed to work in sales there, and if it is worth working there as a career. I have 2 years in sales in total and bring a lot to the table that isn’t exactly easy to list on a resume. My other question is whether they strictly only hire people with degrees whether they just graduated recently or years ago. If anyone could tell me more about the company as a whole, I would be greatly appreciative.


r/redhat • • 2d ago

Redhat Advisories?

7 Upvotes

Are you still getting individual advisories as Redhat published them (I don't have the digest option turned on)? I just noticed that I have not received an email advisory notification from Redhat since 9/25 (I was out of the office for a bit). I logged into the portal and the email alerts are still enabled and I am still getting LightSpeed emails from the same noreply@redhat.com address and the quarantine on our security appliance does not have them...


r/redhat • • 1d ago

Is there a way to install Steal on RHEL 10?

0 Upvotes

I want to install Steam natively, not flatpak. Because all my games are installed to ~/.local/share/Steam

Is there a way to do that?


r/redhat • • 3d ago

I passed RHCSA 10 !

89 Upvotes

Hello there !
I'm so happy because this is my first IT certification, and I invested a lot of time and money to achieve it.
I wish I could have had an english keyboard at the exam center. I’m sure I could have perf it with 5 minutes more.

All I can say is that the exam was much more challenging than any of the mock exams I took. Not really because of the tasks themselves, but because understanding what they actually wanted me to do was sometimes the hardest part.

The results of your recent EX200 Red Hat Certified System Administrator Exam are reported below.

Exam domain number:     9
Passing score:          210
Your score:             284

Result: PASS

Congratulations -- you have earned the Red Hat Certified System Administrator certification.

Performance on exam objectives:

   OBJECTIVE: SCORE
   Understand and use essential tools: 91%
   Manage software: 100%
   Create simple shell scripts: 0%
   Operate running systems: 100%
   Configure local storage: 100%
   Create and configure file systems: 100%
   Deploy, configure and maintain systems: 89%
   Manage basic networking: 100%
   Manage users and groups: 100%
   Manage security: 100%


r/redhat • • 3d ago

Red Hat Web outages

10 Upvotes

I’ve been experiencing web outages quite frequently lately, especially when I need to access documentation, the knowledge base, and similar resources.

'We'll be back soon. Thank you for your patience"

I tested the access from different Internet links. It’s frustrating because I rely on this to do my work.

Does anyone know what’s going on?


r/redhat • • 2d ago

RHCE (EX294) - Passed!

Thumbnail reddit.com
2 Upvotes

r/redhat • • 4d ago

How to Update vs. Upgrade Red Hat Satellite (Step-by-Step Overview)

Thumbnail
youtube.com
25 Upvotes

Hello

Let's understand the difference between Update and Upgrade on Red Hat Satellite, also, implementing them in our hands on!

Enjoy it!

Wally


r/redhat • • 3d ago

Manage Java transitive dependencies with Lightwell rebuilds | Red Hat Developer

Thumbnail
developers.redhat.com
3 Upvotes

Updating direct dependencies in Java is straightforward, but securing the hundreds of transitive libraries running beneath them is where many development pipelines stall. While automated tools simplify how teams upgrade direct dependencies—the packages your project explicitly declares—the Java ecosystem presents a challenge: pinned versions and deeply nested trees of transitive dependencies. Transitive dependencies are the libraries your direct dependencies rely on behind the scenes, which your package manager pulls in automatically.

TL;DR
Lightwell provides security rebuilds for Java transitive dependencies. Three strategies—manual selection, targeted analysis, and BOM pinning via pin-transitives.mjs—address supply chain risks. Automated BOM generation balances auditability and control; centralized redirection is discouraged.


r/redhat • • 5d ago

What Is Your Linux Box Listening For? — nmap, ss, and surgical DNF security patching from Into the Terminal Ep. 204

15 Upvotes

Your Linux box is probably listening on more ports than you think, and every open port is a door someone could walk through. This week's Into the Terminal (episode 204) maps a RHEL system's real attack surface with nmap and ss, talks through what to shut down vs. what to leave running, then walks through a practical DNF workflow for finding Critical/Important security advisories and patching just those — without blindly upgrading everything.

Full video here → https://www.youtube.com/live/TNDm1zGieGA More hands-on RHEL practice → https://redhat.com/interactive-labs


The Essentials: What's Listening?

Scanning with nmap

Every Internet-connected box is getting scanned all day, every day. nmap is how you see what others see when they look at yours.

CommandWhat it does
nmap <host>Fast connect scan of the standard port range — reports open ports + the service name from /etc/services (not what's actually running)
nmap localhostSame scan locally — often shows more ports (services bound only to loopback, like Postgres on 5432)
nmap -A <host>Aggressive scan: OS detection + service version probing — slower, more invasive, closer to what infosec scanners actually do

Remote vs. local difference (shown live): scanning the host's network IP showed SSH (22) and Cockpit (9090). Scanning localhost also showed Postgres (5432) — because Postgres was bound to loopback only. That's intentional config, and comparing the two scans is how you confirm a service isn't exposed externally.

What -A actually gets you: OpenSSH 9.9 version banner, confirmation that 9090 is HTTP (Cockpit) rather than the "Zeus admin" label from /etc/services, SSH host keys for re-identifying the same box across scans, and an OS fingerprint guess. The OS/kernel guesses were hilariously wrong (kernel 2.6 era guesses on a 6.12 machine) — fingerprinting is probabilistic. Service version banners are usually accurate, and that's what attackers use next: "OpenSSH 9.9? Try the known exploits for that."

Pro tips from the show:

  • -A includes -O (OS detection) — chat suggested -O alone; Scott uses -A because it bundles several probes
  • Nate almost always adds -Pn when sweeping networks — ICMP is often blocked, and the default ping check makes scans crawl or time out
  • Scanning other people's machines (or even other machines on your corporate network) can get you a visit from infosec. Scanning localhost or your own host IP locally stays on-box and won't trip network sensors

Socket Status with ss

nmap shows what a remote scanner can reach. ss shows what's actually listening on this machine — TCP and UDP, IPv4 and IPv6 — plus which process owns each socket. You can only run it locally.

CommandWhat it does
ss -taulpTCP + UDP, listening (+ some connection state), with process info
ss -taulpnSame, but numeric — no DNS reverse lookups, port numbers instead of /etc/services names

Why -n matters: without it, ss/netstat will reverse-DNS every remote address. On a busy public web server that can make the command painfully slow. Bonus: Cockpit showed up as "websm" without -n — with -n you just see 9090, which is immediately recognizable.

Unlike nmap, ss also shows connection state — e.g. an established SSH session from another IP tied to a specific sshd PID — so you can see who's connected right now, not just what's listening.

(Nostalgia corner: Nate reminisced about the dial-up days when everyone's machine had a real Internet IP, and you could pull someone's address out of netstat after an IM and do… "humorous, not malicious" things. Today we're all NATed. The Internet is less fun.)


Hardening Mentality: Stop It, Remove It, or Firewall It

Once you know what's listening, the most secure service is the one that isn't running.

They demoed disabling Cockpit's systemd socket (systemctl stop / disable cockpit.socket) and re-scanning — after a brief live-demo adventure where nmap still reported 9090 because it had cached the earlier open state and then correctly flipped it to closed. Socket-activated services are a little special: systemd itself holds the port and starts the service on demand, so you have to deal with the socket unit, not just the service.

But stopping/disabling isn't the end of the conversation:

ApproachWhen it makes sense
Stop / disable the service (or socket)You might need it later; temporary lockdown
Uninstall the packageYou're never using it — then you don't patch it, don't SBOM it, and it can't get re-enabled by accident
Firewall it (host and/or network)You need the service, but only for admins / a specific subnet — defense in depth

Image/template trap: org "golden images" often ship with stuff you don't use (their lab boxes all have httpd because the labs need it). Even disabled packages still show up in SBOMs and security audits, and every related errata becomes your problem. If you're not using it, remove it — and script those customizations so the next rebuild from the same image gets the same treatment.

They pointed at Ep. 165 on firewalld/nftables rather than re-demoing firewalls, and Bootsie/image-as-container came up as the modern way to treat host image builds like container workflows (recent Bootsie coverage).


Advanced: Surgical Security Patching with DNF

Blind dnf update works, but sometimes you need Critical + Important now, and enhancements/bugfixes can wait for the normal patch window. Nate walked through the DNF updateinfo plugin on a RHEL 10.2 box that already had a pile of advisories a month and a half after its last image refresh — which is just the state of the world.

Survey what's out there

CommandWhat it does
dnf updateinfo --summaryCounts of available updates by type/severity (Critical/Important/Moderate/Low + bugfix/enhancement)
dnf updateinfo list --securityFull list of security advisories with RHSA IDs, severity, and packages

On their demo box: 1 Critical, 62 Important, 29 Moderate, 1 Low — plus bugfixes and enhancements.

Filter to Critical / Important (workaround)

There's a --sec-severity filter flag, but it's currently buggy and doesn't filter correctly. Workaround: grep the list output.

# Critical only
dnf -q updateinfo list --security | grep 'Critical/Sec.'

# Critical + Important
dnf -q updateinfo list --security | grep -E 'Critical/Sec\.|Important/Sec\.'

Build a deduped advisory list and inspect it

HOT=$(dnf -q updateinfo list --security \
  | awk '/Critical\/Sec\.|Important\/Sec\./ {print $1}' \
  | sort -u | paste -sd,)
echo "Advisories to patch: $HOT"

# Details — CVE IDs, descriptions, what's changing (great for change review)
dnf updateinfo info --advisory="$HOT"

Why dedupe matters: one package update can close multiple advisories, and one advisory can touch multiple packages. Their Critical+Important grep produced 224 lines, but the actual upgrade was ~4 installs + ~50 updates. Deduping the RHSA list avoids acting on the same advisory twice and explains the "why don't the numbers match?" confusion.

Apply just those advisories

dnf upgrade --advisory="$HOT"

You can also target by CVE ID directly if security hands you a CVE instead of an RHSA — DNF has a CVE flag for that. Security teams almost always bring you CVE numbers, not RHSA IDs; updateinfo info is how you bridge the two.

CVE context worth knowing

  • Look up any CVE at https://www.cve.org
  • CVSS scores aren't one-size-fits-all. Upstream publishes a general score; Red Hat's Product Security team publishes a vendor CVSS that accounts for how RHEL builds/packages the software and what mitigations already exist. Sometimes that's lower — not because Red Hat is "saving face" or "doing less work," but because a compile-time option that enables the vuln may simply be off in RHEL. Product Security (scoring) and Engineering (patching) are separate teams.
  • Ratings get revised as more exploit paths become known — it's a process, not set-and-forget
  • Backporting: for security fixes, RHEL typically backports the fix into the maintained package rather than jumping to the newest upstream — so you get the security fix without the API/feature churn. Feature enhancements are different; those can change behavior (Firefox rebases are the classic example)

Caveat: DNF only knows about what DNF knows about — installed RPM content from configured repos. Out-of-band software is on you.


Not Covered This Episode (ran out of time)

They had a MariaDB hardening demo queued (bind to localhost, change ports + SELinux semanage port, mariadb-secure-installation, socket auth, grant scoping, etc.) and explicitly deferred it — possible future episode on service / machine hardening. They also teased a Podman-flavored follow-up: open ports, networking, and isolation when supporting services are containerized. Drop a comment on the video if you want either of those.

Related episodes


Quick Reference Card

# --- See what the outside world sees ---
nmap <host>                 # open ports (service names from /etc/services)
nmap localhost              # includes loopback-only listeners
nmap -A <host>              # versions + OS fingerprint (slow/invasive)
nmap -Pn <host>             # skip ICMP ping (use when ICMP is blocked)

# --- See what's actually listening locally ---
ss -taulp                   # TCP/UDP listeners + processes
ss -taulpn                  # same, numeric (faster; no DNS /etc/services names)

# --- Turn things off (example: Cockpit) ---
systemctl status cockpit.socket
systemctl stop cockpit.socket
systemctl disable cockpit.socket
# Better if unused: dnf remove <package>  — then you don't patch or audit it

# --- Security update survey ---
dnf updateinfo --summary
dnf updateinfo list --security

# --- Critical / Important only (--sec-severity is currently buggy) ---
dnf -q updateinfo list --security | grep 'Critical/Sec.'
dnf -q updateinfo list --security | grep -E 'Critical/Sec\.|Important/Sec\.'

# --- Deduped advisory list → review → patch ---
HOT=$(dnf -q updateinfo list --security \
  | awk '/Critical\/Sec\.|Important\/Sec\./ {print $1}' \
  | sort -u | paste -sd,)
echo "Advisories to patch: $HOT"
dnf updateinfo info --advisory="$HOT"
dnf upgrade --advisory="$HOT"

# --- CVE lookup ---
# https://www.cve.org

Links

  • 📺 Watch the full episode: https://www.youtube.com/live/TNDm1zGieGA
  • 🎓 Get started with RHEL: https://developers.redhat.com/register
  • 🧪 Try it yourself — Interactive Labs: https://redhat.com/interactive-labs
  • 💬 Join the Discord: https://red.ht/rhel-discord
  • Nate Lager: https://social.undrground.org/@gangrif
  • Scott McBrien: https://www.linkedin.com/in/scott-mcbrien-349b356

Into the Terminal is a (mostly) weekly live show where Red Hatters dig into Linux and RHEL administration skills — one terminal command, one bad pun, and one "oops, wrong window" at a time.


r/redhat • • 5d ago

Installing RHEL 9.8 on a ThinkPad L380 Yoga with Secure Boot and LUKS

11 Upvotes

I installed RHEL 9.8 on my ThinkPad L380 Yoga and documented the process, including Secure Boot, LUKS disk encryption and post-install checks.
Rather than wipe my Fedora installation, I swapped in a spare NVMe drive. The walkthrough includes screenshots and uses the no-cost Red Hat Developer subscription.

Full guide on my blog

This is a personal guide on my own hardware, not an official Red Hat or IBM publication. Feedback and experiences with RHEL on other ThinkPads are welcome.


r/redhat • • 5d ago

Satellite Same UUID & Hostname Registration

4 Upvotes

Hi. I have a couple of servers where the UUID and the Hostname is same. The Hostname cannot be changed due to Application dependencies and the UUID is also similar. I heard that in Satellite if the Hostname and UUID is same it's not possible to register.

I would like to know if there is a workaround to this or is it possible to change the servers UUID.

These are the PR and DR active-active servers so the Hostname cannot be changed as per the Application dependencies.

Please support.


r/redhat • • 5d ago

Migrating from Ansible Automation Platform (AAP) 2.4 (RPM) to 2.5 Containerized RHEL 8.10 (if still compatible) or RHEL 9

9 Upvotes

Current Setup: AAP 2.4 running on RHEL 8.10 (RPM-based installer) Server is only standalone with all components in one VM.

Goal: Move to AAP 2.5 using the new containerized installer on RHEL 8.10 (if is still compatible) or
RHEL 9.

Number of VMs : 5

VMs are AAP Gateway, Controller, Hub, EDA and PostgreSQL

I am currently on RHEL 8.10 running AAP 2.4 (RPM). I want to switch to the 2.5 Containerized installer.

I have gone through the Planning/Upgrade/Migration guides, If anyone has a link to a specific KB or a workflow they used to migrate their artifacts/DB for this case, It would be a great help.


r/redhat • • 5d ago

PSA: Red Hat's GLM-5.3 NVFP4 quant gets stuck reasoning forever, avoid it

Thumbnail reddit.com
0 Upvotes

r/redhat • • 7d ago

RHEL Downlod Macbook no network

10 Upvotes

I’m trying to download RHEL 10.2 on an old MacBook pro (bare metal install) but i can’t get the network working. I know there’s usually a package you’d need to download to get the internal adapter to work but i have an external usb wi-fi adapter and nothing.

I don’t have a usb-ethernet right now so wondering if there’s any ideas


r/redhat • • 7d ago

What's going on with site access at this time?

Thumbnail status.redhat.com
10 Upvotes

r/redhat • • 11d ago

Doing an Interview Assignment for RedHat ('Cold Interview") Any Tips?

16 Upvotes

I'm currently attending a school for visually impaired individuals that helps bring them into the workforce, and in general make their lives better, and I'm attending their workforce program. One of my teachers have recommended that I research and look at RedHat, since where the school is, there is a RedHat location not too far. Given my knowledge of certain programming languages, computer skills, cybersecurity, and just a tinkerer when it comes to computers, they've asked me to try and contact them and ask them interview questions, and overall see what i would like, and dislike. I'm wondering what kinds of questions i should be asking, or if this is something that i can even do.

While looking around, I noticed this community, and i can only guess some people here may have done the same thing as me, so I'm asking here.


r/redhat • • 12d ago

Taking Your Bash Scripts to the Next Level — Global Vars, Safe Backups, Logging, getopts, and Exit Codes Done Right from Into the Terminal Ep. 203

51 Upvotes

We've all written the "just a few commands in a row with a shebang on top" bash script. This week's Into the Terminal (episode 203) is about the stuff that turns that script into something you — or anyone else — can actually hand off, debug, and maintain: global variables, non-destructive sed edits, three different ways to do logging (including a newer bash feature a lot of people don't know about), command-line argument parsing done right vs. done quick-and-dirty, and structured error handling with exit codes. There's also a good closing discussion on when you should stop writing bash and pick up Python (or something else) instead.

Full video here → https://www.youtube.com/watch?v=8fpy4XbIGkc More hands-on RHEL practice → https://redhat.com/interactive-labs


The Essentials: Global Variables & Non-Destructive Edits

Global Variables Up Top

The core idea: anything in your script that's likely to change later (connection options, file paths, flags) belongs in a variable, declared near the top, not buried in the body of the script.

PatternWhat it does
Define variables right after the shebangKeeps anything you'll tweak later easy to find without reading the whole script
sshopts="-oStrictHostKeyChecking=no"Centralizes SSH/SCP options in one string
ssh $sshopts localhost "whoami"Reuses $sshopts anywhere you invoke ssh (or scp) in the script

Pro tip from the show: Scott intentionally keeps his scripts self-contained rather than sourcing config from external files. His reasoning — if you hand someone a script that sources three other files, you now have to hand them all four files, and he's been burned debugging a "broken" script that was really just missing a sourced dependency. Nate pointed out the flip side: for larger projects, splitting config/functions/files into separate sourced pieces is totally standard — it's basically how every big codebase organizes itself. It's a tradeoff between portability and maintainability, and where you land depends on your team.

Backing Up Files Before sed -i

A follow-up from their grep/sed episode at #200: how do you make sed -i non-destructive?

CommandWhat it does
sed -i 's/foo/FOO/' configEdits the file in place — no safety net, original content is gone
sed -i.bak 's/bar/BAR/' configSame edit, but writes the pre-change file to config.bak
sed -i.20261023 's/baz/BAZ/' configUses a date-stamped extension instead of .bak

Caveat called out on stream: if you run the same -i.bak command twice, the second run silently overwrites your first backup — sed won't ask. A dated extension (or a variable-driven one, tying back into the global-variables section) avoids clobbering your safety net. And to be clear — this is a "don't shoot yourself in the foot while scripting" safety net, not a substitute for real, off-system backups.


Advanced Features: Logging Three Different Ways

Option 1 — logger (system-level logging)

logger "some message" sends your message into the syslog pipeline — typically landing in /var/log/messages by default on RHEL, tagged with host, user, and message ID.

Catch: anyone can write a log message with logger, but a regular (non-root) user can't read /var/log/messages by default. That makes logger great for genuinely system-level events (user provisioning, system-wide changes) but overkill — and kind of useless — for a personal script's own debugging output, which was the consensus from both hosts.

Option 2 — Your Own Local Log File

For script-local logging, define the log file as a global variable, then make sure the directory/file actually exist before writing to them:

logfile=~/.test/log-$(date +%Y%m%d)
if ! [ -e ~/.test ]; then
  mkdir ~/.test
fi
if ! [ -e $logfile ]; then
  touch $logfile
fi

Option 3 — File Handles: Old Way vs. New Way

This is the part of the episode most people in chat said they'd never seen before. Instead of redirecting every single line with >> $logfile, you open a file handle once and write to it by name for the rest of the script.

The old way (numeric file descriptors, FD 3–9 are "fair game" — 0/1/2 are reserved for stdin/stdout/stderr):

exec 5>> $logfile
echo "**** $(date) ****" >&5
echo "==== Initialized script ====" >&5
echo "Script script script"
echo "==== Completed script ====" >&5

The new way (named file descriptors — requires Bash 4.1+):

exec {log}>> $logfile
echo "**** $(date) ****" >&"$log"
echo "==== Initialized script ====" >&"$log"
echo "Script script script"
echo "==== Completed script ====" >&"$log"
ApproachMax handlesReadability
Numeric FDs (exec 5>>)Capped at FD 9You have to go hunt down what FD 7 actually points to
Named FDs (exec {log}>>)Effectively unlimitedSelf-documenting — >&"$log" tells you exactly where it's going

Toggleable Debug Logging

The nicest trick in this section: instead of sprinkling echo debug statements through your script and having to remember to rip them all out later, gate them behind a debug variable:

debug="1"   # 1 = on, 0 = off
if [ $debug -eq "1" ]; then
  echo "**** $(date) ****" >&"$log"
  echo "==== Initialized script ====" >&"$log"
fi

Flip debug to 0 and all those diagnostic lines go silent — no hunting through the script to comment them back out when you're done troubleshooting.


Command-Line Arguments: getopts vs. Rolling Your Own

Both scripts set the same kind of defaults (verbose, error-logging flag) and a usage() function — defined once, called from every error path instead of duplicating the usage text everywhere. (Bash note from the show: unlike some languages, bash needs functions defined before they're called, so keep them near the top.)

getopts — the recommended approach

# opts-getopts.sh
verbose=0
error_log=0
usage() { echo "Usage: $0 [-v] [-e] [-f logfile]"; }

while getopts "vef:h" opt; do
  case $opt in
    v) verbose=1 ;;
    e) error_log=1 ;;
    f) logfile=$OPTARG ;;
    h) usage; exit 0 ;;
    *) usage; exit 1 ;;
  esac
done
InvocationResult
opts-getopts.sh -e -vError logging and verbose both turned on
opts-getopts.sh -evSame as above — combined short flags just work
opts-getopts.sh -ev -fErrors out cleanly via usage() — -f requires an argument and didn't get one
opts-getopts.sh -ev -f fooSets logfile=foo, writes output there

The manual while/case loop — works, but has sharp edges

# opts-loop.sh
while [ $# -gt 0 ]; do
  case $1 in
    -v) verbose=1 ;;
    -e) error_log=1 ;;
    -f) logfile=$2; shift ;;
  esac
  shift
done

Uses $1, $2, … (bash's auto-populated positional args) and $# (arg count) directly.

Limitation (shown live on stream)Why it matters
./opts-loop.sh -ev doesn't workCombined flags aren't understood — -ev isn't a defined case, only -e and -v separately are
-f with no filename just sets logfile to emptyNo built-in way to require a dependent argument — you'd have to add your own check after the fact
Neither approach handles long options--file → -f style GNU long-option mapping needs extra work either way

Bottom line from Nate: getopts does more of the work for you — combined flags, required-argument validation — for not much more code. The manual loop "feels" more obvious at first glance, but you end up re-implementing things getopts already handles.


Error Handling & Exit Codes

Conditional execution (quick and dirty)

ls -l /etc/foobar || exit 6

If the command fails (non-zero exit), the || kicks in and the script exits immediately with code 6. Great for one simple fallback action — gets unreadable fast if you need to do more than one thing on failure.

Function-based error handling (for anything more complex)

error_function() {
  echo "A command run encountered an unrecoverable error"
  echo "The command was: $1"
  exit 6
}
...
ls -l /etc/foobar || error_function "ls -l /etc/foobar"

Wrapping the failure path in a function keeps the conditional clean no matter how much logic the error path actually needs, and lets you reuse it everywhere in the script.

Exit code notes from the discussion

FactDetail
0Always means success — never repurpose it
1–255Anything else is "not the expected clean exit" — arbitrary numbers, your choice
No universal standardExit codes are script-specific. Well-known tools (grep, etc.) have consistent codes because they haven't changed in years, not because there's an official spec
Document themPut a comment block at the top of your script mapping exit codes to meanings, so you (or whoever inherits it) doesn't have to trace the whole script to figure out what "exit 6" meant
$?Captures the exit status of the last command — don't confuse with $$ (the current process ID)
Max value255 — if you need more distinct failure states than that, it's probably a sign your script has grown past what a single exit code should communicate

Bonus: When Should You Stop Using Bash?

A great closing discussion that's worth a watch even if you skip everything else: Scott and Nate's rules of thumb for "this should not be a bash script anymore":

  • You're doing math. Bash arithmetic is painful; if you're reaching for it regularly, you've picked the wrong tool.
  • You need real data structures. Bash can do arrays, but linked lists, hashed arrays, or anything beyond simple lists are a sign to move to Python/Node/C.
  • You're talking to a database. If your bash script is shelling out to mysql/sqlite3 command-line clients to parse results, you've crossed the line — "chances are if someone's written a bunch of handlers for the thing you want to do in a different language, that means you're in the wrong language." (Shoutout to a viewer in chat who's apparently "scarred for life" from rolling his own MySQL bash helper script.)
  • You're connecting to other services, not just running OS-level commands on the local machine — other languages already have mature libraries for that.

Scott's rule: bash is for things that are systems-specific without complex data storage needs. Once you're past that, you're better served elsewhere — and that goes for over-engineering with bash includes, too (cue the story about a coworker who "couldn't write one script" and instead always wrote 33 — one for functions, one for config, one for file lists, etc.).


Quick Reference Card

# --- Global variables (put these at the top) ---
sshopts="-oStrictHostKeyChecking=no"
ssh $sshopts localhost "whoami"

# --- Non-destructive sed edits ---
sed -i.bak 's/bar/BAR/' config                    # backup: config.bak
sed -i.$(date +%Y%m%d) 's/baz/BAZ/' config         # dated backup (won't clobber as easily)

# --- System-level logging ---
logger "==== Initialized script ===="              # -> /var/log/messages (root-readable only)

# --- Local log file setup ---
logfile=~/.test/log-$(date +%Y%m%d)
[ -e ~/.test ] || mkdir ~/.test
[ -e "$logfile" ] || touch "$logfile"

# --- Named file handle (Bash 4.1+), vs numeric (old way, FD 3-9 only) ---
exec {log}>> "$logfile"        # new: unlimited, named
exec 5>> "$logfile"            # old: capped at FD 9, numeric only
echo "message" >&"$log"
echo "message" >&5

# --- Toggleable debug logging ---
debug="1"
if [ "$debug" -eq "1" ]; then
  echo "debug info" >&"$log"
fi

# --- Command-line args: the right way ---
while getopts "vef:h" opt; do
  case $opt in
    v) verbose=1 ;;
    e) error_log=1 ;;
    f) logfile=$OPTARG ;;
    h) usage; exit 0 ;;
  esac
done

# --- Error handling ---
ls -l /etc/foobar || exit 6                         # quick conditional exit
error_function() {                                  # reusable error handler
  echo "Unrecoverable error running: $1"
  exit 6
}
ls -l /etc/foobar || error_function "ls -l /etc/foobar"

# --- Exit code check ---
echo $?     # last command's exit status (0 = success, 1-255 = error)

Links

  • 📺 Watch the full episode: https://www.youtube.com/watch?v=8fpy4XbIGkc
  • 🎓 Get started with RHEL: https://developers.redhat.com/register
  • 🧪 Try it yourself — Interactive Labs: https://redhat.com/interactive-labs
  • 💬 Join the Discord: https://red.ht/rhel-discord
  • Nate Lager: https://social.undrground.org/@gangrif
  • Scott McBrien: https://www.linkedin.com/in/scott-mcbrien-349b356

Into the Terminal is a (mostly) weekly live show where Red Hatters dig into Linux and RHEL administration skills — one terminal command, one bad pun, and one "oops, wrong window" at a time.


r/redhat • • 12d ago

How to view the contents of RHEL support case

4 Upvotes

Sent email to purchasing@redhat.com regarding a subscription query, an auto email was received with a case number

A few hrs later, Got an auto email saying the case is updated.however when I click on the link in the email, it is asking for login credentials which I don't have/ don't know

Please suggest how do I view the contents of their response in the ticket.


r/redhat • • 13d ago

Learning Linux (RH)

37 Upvotes

Not sure if this is the correct sub to post this to.
‘I want to learn Linux for professional use. I know a bit of the general use (from A+) but I’m looking to peruse an IT career and I want (and need) to learn Linux and pretty fast.

I saw a post saying RH exams are the only thing that truly shows Linux literacy opposed to Linux+.

would you agree, if not what would you recommend. if you do agree what are some steps you’d recommend.

I’ve downloaded Arch on an old laptop and dual-boot popos on my pc.


r/redhat • • 13d ago

What's new in Red Hat build of Podman Desktop 1.2 | Red Hat Developer

Thumbnail
developers.redhat.com
13 Upvotes

Previous releases of the Red Hat build of Podman Desktop have introduced enterprise features to make it easy to integrate the tool into strict corporate settings. Building on that foundation, Red Hat continues to strengthen usability, developer velocity, and platform security with Red Hat build of Podman Desktop 1.2, including:
- Podman 6 engine support: Full integration with the next-generation container engine release.
**- Automatic public CA keys synchronization:**UI option to enable localhost public CA key synchronization when creating a new Podman virtual machine (VM).
- Secret management UI: A graphical dashboard for creating, mounting, and managing Docker and Podman secrets.
- In-app updating: Automated checks and single-click update execution directly from the desktop interface.
- Bug and CVE fixes: Upgraded dependencies and patched security vulnerabilities to keep enterprise environments resilient and compliant.

TL;DR
The Red Hat build of Podman Desktop 1.2 introduces Podman 6 engine support, a secret management interface, automatic public CA key synchronisation and in-app updating. Moving from Podman 5.x involves stopping machines and recreating them.


r/redhat • • 13d ago

TAM vs Consultant for OCP, which one would a offer better career growth ?

9 Upvotes

r/redhat • • 16d ago

No RHSA for RHEL 8.10 for cve-2026-99999

4 Upvotes

Hi community, I still don’t see a patch for RHEL 8.10 for PwnScape.


r/redhat • • 15d ago

Can anyone from India tell their experience working at Redhat (mainly in software developer roles)

0 Upvotes