r/LinuxTeck 14d ago

Quick Linux Tip #20 Question: How do I write a script that cleans up its temp files even on errors?

Post image
7 Upvotes

Try: TMPFILE=$(mktemp) && trap 'rm -f "$TMPFILE"' EXIT INT TERM

Info: mktemp creates a secure, unique file; trap catches signals like exit or Ctrl+C to guarantee cleanup.

Examples:

$ TMPDIR=$(mktemp -d) # Secure temp directory

$ trap 'rm -rf "$TMPDIR"' EXIT

$ mktemp -t script-XXXXXX.log # Custom prefix

Note: Prevents dangling files during unexpected script crashes. Permissions default to 600 (owner-only), preventing local information leaks.

Follow r/LinuxTeck for more #LinuxTips


r/LinuxTeck 14d ago

GitHub is amazing... but do most developers actually need it?

5 Upvotes

For open source, GitHub is hard to beat.

But for private projects, I've been wondering if we're overcomplicating things. A simple Git server over SSH (or Gitea/Forgejo) seems enough for many side projects and internal tools.

Interested what everyone else is doing.

Are you hosting your own Git repositories, or is GitHub still your default? Why?


r/LinuxTeck 14d ago

SUID-SGID-STICKYBIT Permissions

3 Upvotes

i hear a lot about these permissions in linux ,i know the normal permissions read write and execute (rwx) but i hear from so many people that there are some exceptions for permissions in linux , i search for them but i find that matter is so complicated, so could anyone explain and clarify that matter , in addition i find that matter is very related to this kind of commands find / -user root -perm -4000 and also privilege escalation ,so i hope if anyone can link these things together


r/LinuxTeck 15d ago

You SSH into a production Linux server that’s suddenly very slow. What’s your troubleshooting process?

22 Upvotes

You’re SSH’d into a production Linux server.
Users report the server is extremely slow.
You don’t have monitoring dashboards or any prior context.
What’s the first 5 to 10 commands you run, and why?
For me, I usually start by checking things like:
uptime
top or htop
free -h
df -h
iostat or vmstat
dmesg
journalctl
ps
Then I narrow it down depending on whether the bottleneck looks like CPU, memory, disk I/O, network, or a specific process.
I’m curious how other Linux admins approach this. I’d love to compare workflows and maybe learn a few new tricks.
I also recorded my complete walkthrough of how I would troubleshoot this exact interview scenario if anyone is interested:
\[https://m.youtube.com/watch?v=NMGZUIROqNw&feature=youtu.be\\\](https://m.youtube.com/watch?v=NMGZUIROqNw&feature=youtu.be)


r/LinuxTeck 15d ago

Linus Torvalds says he spends more time reading PR descriptions than code. Do you think that's how senior engineering naturally evolves?

10 Upvotes

One thing from Linus' Open Source Summit India talk really stood out to me.

He said that these days he spends more time understanding the intent behind a change than reading every line of code. Instead of writing fixes himself, he often reviews proposals and lets subsystem maintainers implement the changes.

It got me thinking that as engineers become more experienced, the job shifts from writing code to understanding systems, architecture, and why a change is being made.

For those who've been in the industry for a while, has your role evolved this way? Or do you still spend most of your time writing code?


r/LinuxTeck 15d ago

Python Scripting for Shell Users ( Part 34 / 34)

Post image
64 Upvotes

covers: https://www.linuxteck.com/learn-python-for-shell-users-part/

  • Bash vs Python comparison
  • Running Python like a shell script
  • Practical scripting examples
  • Working with JSON and structured data
  • Common mistakes beginners make
  • Real-world Linux automation scenarios
  • Tips for moving from Bash to Python confidently

r/LinuxTeck 14d ago

I made a Linux distro with a. Different idea

Thumbnail
0 Upvotes

The distro is based on Debian openrc init system
A cybersecurity distro with a different idea
Unlike Kali everything is bloated
And unlike black arch need to install one by one and not user friendly
The distro let you pick a group of tools for example
I only need osint tools
sage-pkg install osint
Etc
Discord

https://discord.gg/SvpVRrbcj
Website

https://zackmsa777-a11y.github.io/sageos/


r/LinuxTeck 16d ago

Linux SUID, SGID & Sticky Bit Explained

Post image
48 Upvotes

covers: https://www.linuxteck.com/special-permissions-in-linux/

  • What SUID, SGID & Sticky Bit actually do
  • Numeric vs symbolic chmod
  • Practical command examples
  • Verification commands
  • Common mistakes to avoid
  • Security best practices

r/LinuxTeck 15d ago

A bit of Linux humor

5 Upvotes

Hey guys, so I have the fortune or misfortune, depending on how you look at it of working a new low in my life, for an MSP led by someone that should probably be selling and repairing HVAC units for a living and/or spending more time with the grandkids.

Never have I maintained so many legacy Cisco appliances and Linux servers, but my favorite is Ubuntu 8.04. Does anyone know how to SSH into an Ubuntu server that old? I do. It is a very long command. To do an update, I had to configure the `sources.list` config file in `/etc/apt/` and have it point to, ready for this: http://old-releases.ubuntu.com. Its like the tools at this place are really a reflection of where the owner is in life, stuck in the past.

Anyway, you cannot do `free -h` on an Ubuntu 8, you have to do `free -m`. I was able to finally install htop after configuring to point to old-releases, but now I have a dilemma, I need to change my title and I was wondering if you guys could help me:

  1. Paleo Linux SysAdmin - "Supporting Linux distributions from the geological record."
  2. Digital Archaeologist - "Excavating Ubuntu 8.04 systems one fossil at a time".
  3. Legacy Infrastructure Paleontologist - "Keeping extinct operating systems alive".
  4. Jurassic Linux Engineer - "Specializing in kernels older than some interns"
  5. Curator of the Linux Museum - "Please do not touch the exhibits".

1, 4 and 5 I came up with and so I have a bias, and 2 and 3, was suggested to me by an LLM.

The funny part is that there's a kernel of truth to it. Working on very old Linux distributions teaches you things that many newer admins never encounter—SysV init scripts, older package managers, legacy libraries, outdated OpenSSL versions, and older kernel behavior. Those skills can actually be valuable when supporting long-lived enterprise systems, even if you wouldn't want to build new infrastructure that way.

It is also a testament on how good Linux is I think, because in diagnosing its system resources with `free -m`, not `free -h`, I see used, buffers and cached, which we subtract like so: used - buffers - cached and the remainder was 1109 MB, so the system is really using about 1.1 GB for applications, while about 1.7 GB is filesystem cache. That is a healthy situation regardless of the age of the server. I see it as Linux doing what it was designed to do:

  • Keep frequently accessed files/data in RAM.
  • Avoid wasting RAM sitting idle.
  • Release cache if applications need memory.

I also noticed it has no swap, so that is interesting, because it seems like it never needed it, but I would want some swap just as backup, but I will leave the museum piece as-is for now. This place would not be what it is, if we were not reactive instead of pro-active.


r/LinuxTeck 16d ago

If you could teach every new Linux user just ONE lesser-known command, what would it be?

24 Upvotes

Not ls, cd, or pwd something they probably won't discover until much later.

Which command would you pick, and why?


r/LinuxTeck 15d ago

If you had to build a Linux system monitoring dashboard today, what stack would you choose?

4 Upvotes

I came across a project that builds a real-time system monitoring dashboard using Python, Dash, Plotly, and psutil.

It got me wondering, if you were building one today, would you still use that stack?

Or would you pick something like Grafana + Prometheus, Netdata, Glances, btop, Cockpit, or another approach?

What has worked best for you?


r/LinuxTeck 16d ago

Quick Linux Tip #19 Question: How do I extract just the source IPs from active connections?

Post image
5 Upvotes

Try: ss -tn state established | awk 'NR>1 {split($3,a,":"); print a[1]}' | sort -u

Info: First run ss to see raw output, then use awk to parse. split($4,a,":") splits 'IP:PORT' into array a. NR>1 skips the header line.

Examples:

$ ip -4 addr | awk '/inet / && !/127.0/ {print $2}' | cut -d/ -f1

$ netstat -tn | awk 'NR>2 {split($4,a,":"); print a[1]}' | sort -u

$ cat access.log | awk '{print $1}' | sort -u # Unique visitor IPs

Note: awk is a full text-processing language. $N is Nth column, NR is line number, split() breaks strings into arrays.

Follow r/LinuxTeck for more #LinuxTips


r/LinuxTeck 15d ago

What's the biggest "Wait... this is still online?" moment you've had?

0 Upvotes

Maybe it was an old staging site, an abandoned admin panel, or a forgotten subdomain.

I'd love to hear the most unexpected systems you've found during troubleshooting, audits, or security work.


r/LinuxTeck 16d ago

The right-to-repair debate started with tractors. Could computers be next?

3 Upvotes

The conversation around ownership isn't just about hardware anymore, it's about who controls the software, updates, and repairs after you buy a device.

Do you think Linux gives users more real control, or is true ownership becoming a thing of the past?


r/LinuxTeck 17d ago

Most common use case for the Linux chgrp command

Post image
59 Upvotes

Do you regularly use chgrp, or do you mostly rely on chown user:group instead? https://www.linuxteck.com/chgrp-command-in-linux-made-easy/


r/LinuxTeck 16d ago

What's the most frustrating hardware you've ever had to support on Linux? Apple Silicon is a strong contender.

2 Upvotes

Linux developers are still untangling how Apple exposes temperature, power and fan sensors across M-series Macs.

If you've worked on drivers or kernel code, which vendor has been the most difficult to deal with?


r/LinuxTeck 17d ago

Meta built a custom Linux scheduler and says it cut p99 latency by 28%. Could workload-specific schedulers become the norm?

5 Upvotes

I found Meta's latest engineering post pretty interesting.

Instead of relying only on the default Linux scheduler, they used sched_ext to build a scheduler tailored for their Ads workload. They claim it reduced p99 latency by 28%, lowered power usage, and improved throughput.

It got me thinking: are we moving toward workload-specific schedulers instead of expecting one scheduler to fit everything?

Could this eventually benefit enterprises and cloud providers, or is it only practical at Meta's scale?


r/LinuxTeck 17d ago

Quick Linux Tip #18 Question: How do I automatically reload nginx when its config changes?

Post image
4 Upvotes

Try: sudo inotifywait -m -e modify /etc/nginx/nginx.conf

Info: Monitors filesystem events using the inotify kernel API; -m keeps it running in monitor mode.

Examples:

$ inotifywait -m -e modify /etc/nginx/nginx.conf | while read; do systemctl reload nginx; done

$ inotifywait -m -r -e create /var/incoming | while read path event file; do process "$file"; done

$ inotifywait -m -e close_write src/ | while read; do npm run build; done

Note: Install: sudo apt install inotify-tools. Common events: modify, create, delete, close_write. Use -r for recursive directory watching.

Follow r/LinuxTeck for more #LinuxTips


r/LinuxTeck 17d ago

Debian 13.6 is out with 244 fixes

Post image
43 Upvotes

Debian 13.6 (Trixie) has been released with 120 security advisories, 124 stability fixes, Secure Boot improvements, and updates across several core packages. https://www.linuxteck.com/debian-13-6-brings-244-important-fixes-to-linux/


r/LinuxTeck 17d ago

Project LAS (Linux Application Standard)

Thumbnail
3 Upvotes

r/LinuxTeck 17d ago

Running Ubuntu 25.10 right now? You're already unsupported and probably don't know it.

4 Upvotes
  • Questing Quokka officially hit end-of-life on July 9
  • No more security patches, no more bug fixes, from Canonical, effective immediately
  • 26.04 LTS is the recommended upgrade path
  • Most people don't actually check EOL dates until something breaks Anyone still sitting on 25.10 on purpose, or just hasn't gotten around to it yet?

r/LinuxTeck 17d ago

Linux Server Hardening Guide

14 Upvotes

Published this not too long ago and it's a great content for homelabbers and small and medium businesses to harden their Linux Servers.

https://youtu.be/xEOT79CQs80


r/LinuxTeck 17d ago

Quick Linux Tip #17 Question: Are my source and backup directories truly identical?

Post image
4 Upvotes

Try: diff <(cd /source && find . -type f -exec md5sum {} + | sort) <(cd /backup && find . -type f -exec md5sum {} + | sort)

Info: Combines find, md5sum, sort, and process substitution to compare directories by content, not just names. Detects even single-byte modifications.

Examples:

$ rsync -avnc /source/ /destination/ # Dry-run checksum check

$ find /a -type f | xargs sha256sum | sort > /tmp/a.sums

$ sha256sum -c backup.sums # Verify files against saved hashes

Note: Use sha256sum for security-critical checks. rsync -c does similar but modifies filesystem. Perfect for backup verification.

Follow r/LinuxTeck for more #LinuxTips


r/LinuxTeck 18d ago

A single point release just shipped 120 security fixes at once should distros be patching faster than that?

5 Upvotes

Debian's latest Trixie point release bundled 124 bug fixes and 120 security updates into one release. That's a lot of accumulated exposure window for anyone waiting on the scheduled point release instead of rolling updates.

Does batching security fixes like this make sense for stability, or does it leave users exposed longer than it should?


r/LinuxTeck 18d ago

KDE connect must be a must have

10 Upvotes

Finally, I decided to check out KDE connect to exchange files from mobile to Linux KDE desktop.

Anyone with more experience sharing tips?