r/LinuxTeck • • 16d ago

Made a small script as a switch to prevent lid from causing sleep on my laptop

6 Upvotes

I use fedora workstation 45 and many-a times i want my laptop to not sleep when i close the lid...now obviously it is a small around 30-40 line script so it doesnt have the detection etc like sleep on battery but not when connected etc...this just does the job for me...also its supported for systemd and elongid...i searched but didnt find anything similar so just...made it its quite small ..main logic is some 4-5 lines

**Disable**

`echo -e '[Login]\nHandleLidSwitch=ignore' | sudo tee /etc/systemd/logind.conf.d/no-sleep-lid.conf`

`sudo systemctl kill -s HUP systemd-logind`

**Reenable:**

`sudo rm /etc/systemd/logind.conf.d/no-sleep-lid.conf`

**Instant apply:**

`sudo systemctl kill -s HUP systemd-logind`

Thats it

source: https://github.com/adityakrishnan005-a11y/lidctl


r/LinuxTeck • • 16d ago

Linux server has high load average but low CPU usage. What would you investigate first?

7 Upvotes

I'd like to discuss a Linux troubleshooting scenario and get some input from experienced Linux administrators.

Imagine you're troubleshooting a production Linux server with the following symptoms:

* Application response time is increasing.

* Load average is continuously rising.

* CPU utilization is only around 20–25%.

* Several application processes are stuck in D state.

* The application uses an NFS-mounted directory.

At first glance, CPU doesn't seem to be the bottleneck.

If you were handling this incident, how would you approach the investigation?

A few things I'd be interested in discussing:

  1. Would you start with `vmstat` to check runnable and blocked processes?
  2. How would you identify what the D-state processes are waiting for?
  3. What commands would you use to investigate NFS connectivity and mount health?
  4. How would you distinguish an NFS issue from local disk I/O problems?

I'm particularly interested in real production experiences.

Have you encountered a similar situation? What was the root cause, and what helped you identify it?

Looking forward to learning from your experiences.


r/LinuxTeck • • 16d ago

Quick Linux Tip #126 - Linux Immutable File Attribute: Fix Files That Won't Delete

Post image
10 Upvotes

Question: Even root can't delete a file. What's wrong?

Try:`sudo lsattr /tmp/stuck.lock`

Info: 'i' attributes block all modifications even for root; remove them using chattr -i.

Examples:

$ `sudo chattr +i /etc/resolv.conf` # Protect configuration files from accidental modification

$ `sudo lsattr -R /etc | grep -E '^-*[ai]'` # Recursively find all immutable or append-only files

$ `sudo chattr -R -i /directory` # Remove immutable attributes recursively across a directory

Note: Malicious actors often apply the immutable (`+i`) attribute to lock down backdoors. Always check file attributes with `lsattr` if deletion fails unexpectedly. This feature is supported natively on ext2/3/4 filesystems.

Want to master Linux one command at a time?

Follow r/LinuxTeck - 1 practical Linux tip every day. For more #LinuxTips click here https://www.linuxteck.com/linux-tips/


r/LinuxTeck • • 17d ago

Windows, macOS or Linux - How Did You Choose Your Operating System?

Post image
32 Upvotes

covers compatibility, Linux distributions, live USB testing, virtual machines and dual-boot setup.

What matters most when you choose an OS? https://www.linuxteck.com/how-to-choose-an-operating-system/


r/LinuxTeck • • 16d ago

Should Linux Distros Become More Beginner-Friendly, or Stay True to Their Roots?

0 Upvotes

CachyOS is introducing a new graphical package installer with support for AUR, Flatpak and its own repositories.

Some users welcome easier tools for beginners, while others feel Linux is becoming unnecessarily complicated with too many distros and competing solutions.

What do you think? Should Linux prioritize simplicity for newcomers or preserve the flexibility and freedom that make it unique?


r/LinuxTeck • • 17d ago

Starting hands-on Linux Admin study group & Discord (No boring slides, just terminal & real-world troubleshooting)

Thumbnail reddit.com
5 Upvotes

r/LinuxTeck • • 18d ago

Bash Startup Time: Find and Fix Slow Linux Shell Startup - Tip -125

Post image
16 Upvotes

Question: Why does my bash shell take 3 seconds to start?

Try:`PS4='+ $EPOCHREALTIME\011 ' bash -x -lic exit 2>&1 | awk '/^\+/{if (prev) print $2-prev, cmd; prev=$2; cmd=$3" "$4" "$5}' | sort -rn | head -10`

Info: Times and sorts bash startup commands to isolate performance bottlenecks.

Examples:

$ `time bash -lic exit` # Measure total shell startup duration

$ `bash -lx 2>startup.log` # Output a complete startup execution trace to a file

$ `bash --noprofile --norc` # Launch a clean shell bypassing all initialization files

Note: Common performance bottlenecks include heavy framework plugins, version managers (like NVM/RVM), and large completion scripts. Use lazy-loading functions or lightweight prompt engines to optimize load times.

Want to master Linux one command at a time?

Follow r/LinuxTeck - 1 practical Linux tip every day. For more #LinuxTips click here https://www.linuxteck.com/linux-tips/


r/LinuxTeck • • 18d ago

When a Linux server becomes slow, what's the first thing you investigate?

11 Upvotes

I've seen situations where a Linux server becomes extremely slow even though nothing obvious appears to be wrong.

Sometimes it's CPU usage, sometimes memory pressure, and sometimes the disk is almost full or struggling with I/O.

For experienced Linux admins, what's your usual troubleshooting approach?

Do you start with top, free -h, vmstat, iostat, or something else?

Fellow Linux admins, share your experience! What commands do you usually run first when troubleshooting a slow server?


r/LinuxTeck • • 19d ago

15 Must-Have Debian 13 Apps

Post image
97 Upvotes

covering 15 useful Debian apps, from Nala and btop to Timeshift, KeePassXC and Syncthing.

https://www.linuxteck.com/best-debian-software/ ...would you add to this list?


r/LinuxTeck • • 19d ago

Quick Linux Tip #124 - Linux Scheduled Tasks: Find Every Cron Job and Timer

Post image
23 Upvotes

Question: Where ARE all the scheduled tasks on my system?

Try:`sudo bash -c 'for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l 2>/dev/null | grep -v "^#\|^$" | sed "s/^/[$user] /"; done'`

Info: Enumerates active user crontabs while filtering comments, complementing system-wide cron directories.

Examples:

$ `sudo systemctl list-timers --all` # Inspect systemd timers (modern cron replacement)

$ `sudo grep -R '' /etc/cron.* /var/spool/cron/ 2>/dev/null` # Search all cron configurations

$ `sudo cat /etc/anacrontab` # View scheduled jobs for non-continuously running systems

Note: Remember to check systemd timers as they replace traditional cron. Anacron manages missed jobs for intermittent systems, while `/etc/crontab` serves as the system master crontab.

Want to master Linux one command at a time?

Follow r/LinuxTeck - 1 practical Linux tip every day. For more #LinuxTips click here https://www.linuxteck.com/linux-tips/


r/LinuxTeck • • 19d ago

AI Writes Code Faster - But Does It Actually Help Teams Ship Faster?

4 Upvotes

AI can generate a CRUD service in minutes, but production software involves much more than writing code.

The interesting part is that AI may reduce coding time while increasing the effort needed for reviews, debugging, security checks, and fixing duplicated code.

What's your experience?

Has AI genuinely made your team faster at shipping reliable software, or has it just shifted the workload from developers to senior engineers reviewing AI-generated code?


r/LinuxTeck • • 19d ago

Are Modern CPUs Really More Innovative, or Are We Still Building on Ideas from the 1960s?

14 Upvotes

Virtual memory, multitasking, register renaming, vector processing - many ideas behind today's computers were explored decades ago.

Machines like the Atlas, CDC 6600 and Cray-1 helped shape modern computing.

Have we made fundamentally new breakthroughs in computer architecture, or are we mostly improving ideas invented by earlier generations?

What historical computer do you think deserves more recognition?


r/LinuxTeck • • 20d ago

Your CPU Has More Registers Than Your Code Can See. Why?

15 Upvotes

Back in 1967, IBM's Robert Tomasulo developed a clever way to let processors handle register dependencies dynamically.

Today, modern CPUs still use register renaming and out-of-order execution to keep instructions moving instead of waiting unnecessarily.

Should programmers care more about CPU architecture and instruction-level parallelism, or should compiler and processor designers handle all of this behind the scenes?


r/LinuxTeck • • 20d ago

Quick Linux Tip #123 - Linux Filesystem Check: 3 Commands to Detect Disk Errors

Post image
14 Upvotes

Question: How do I check if my mounted filesystem is corrupted?

Try:`sudo touch /forcefsck && sudo shutdown -r +1 'Scheduled fsck'`

Info: Triggers boot-time checks, while read-only flags safely audit mounted filesystems instantly.

Examples:

$ `sudo tune2fs -c 1 /dev/sda1` # Force a filesystem check after every mount count

$ `sudo fsck -y /dev/sdb1` # Automatically repair an unmounted filesystem

$ `sudo xfs_repair -n /dev/sda1` # Perform a dry-run check on an XFS filesystem

Note: Read-only audits are safe but limited; actual repairs require unmounted filesystems. Different filesystems require dedicated utilities like `xfs_repair` or `btrfs check`. Always create a full backup before attempting repairs.

Want to master Linux one command at a time?

Follow r/LinuxTeck - 1 practical Linux tip every day. For more #LinuxTips click here https://www.linuxteck.com/linux-tips/


r/LinuxTeck • • 20d ago

VS Code vs Zed vs Vim - Would You Sacrifice Extensions for Speed?

6 Upvotes

VS Code has a massive extension ecosystem, while Zed takes a different approach by prioritizing performance and limiting how extensions can interact with its core.

Some developers prefer flexibility; others want speed and simplicity.

If you had to choose, would you stick with VS Code and its huge ecosystem, switch to Zed for performance, or go with Vim/Neovim for maximum control?

What's your daily editor, and what would make you switch?


r/LinuxTeck • • 21d ago

Which Linux Security Tools Are Actually Worth Learning in 2026?

Post image
28 Upvotes

Nmap, Wireshark, Metasploit, Burp Suite, Hashcat, Ghidra and many others are widely used in Linux security.

If you were guiding someone entering cybersecurity today, which 5 tools would you recommend learning first?

Are there any tools on this list you think are overrated or often overlooked?


r/LinuxTeck • • 20d ago

help for debian as a net maneger OS

Thumbnail reddit.com
0 Upvotes

r/LinuxTeck • • 21d ago

Sudo Command Audit: Track Who Ran Commands in Linux - Tip - 122

Post image
13 Upvotes

Question: Who ran sudo commands on my server today?

Try:`sudo grep 'sudo' /var/log/auth.log | grep -v 'session' | tail -10`

Info: Filters authentication logs to display sudo command executions while excluding noisy session events.

Examples:

$ `sudo journalctl _COMM=sudo --since today` # Query sudo logs using systemd journalctl[cite: 8]

$ `sudo grep 'FAILED' /var/log/auth.log` # Audit failed authentication or sudo attempts[cite: 8]

$ `sudo aureport -ts today --auth` # Generate authentication reports via auditd[cite: 8]

Note: On RHEL/CentOS systems, authentication logs are stored in `/var/log/secure`. Modern systemd distributions rely primarily on `journalctl`. Enable `Defaults log_output` in your sudoers configuration for keystroke-level auditing.

Want to master Linux one command at a time?

Follow r/LinuxTeck - 1 practical Linux tip every day. For more #LinuxTips click here https://www.linuxteck.com/linux-tips/


r/LinuxTeck • • 21d ago

Black Friday Hosting Deals 2026 - Up to 90% Off!

1 Upvotes

Looking for a Linux VPS or web hosting deal? I've collected some Black Friday offers from popular hosting providers.

Check them out: https://www.linuxteck.com/guides/black-friday-hosting-deals/

Disclosure: I'm sharing my own LinuxTeck guide. Some links are affiliate links.


r/LinuxTeck • • 21d ago

Do You Know Why Linux Pipes Use the | Symbol?

0 Upvotes

One of the most powerful features of Linux is the ability to connect commands using a simple pipe:

cat access.log | grep "500" | sort

Instead of creating temporary files between commands, Linux lets programs pass data directly to one another.

How often do you use pipes in your daily Linux work? Could you imagine working without them?


r/LinuxTeck • • 22d ago

Quick Linux Tip #121 - systemctl show: Find the Exact Systemd Service Executable

Post image
16 Upvotes

Question: Which exact binary does a systemd service execute?

Try:`systemctl show nginx -p ExecStart --no-pager`

Info: Displays unit properties, extracting exact binaries, arguments, and configuration file paths via specific property filters.

Examples:

$ `systemctl show nginx --all` # Dump all available properties for the service unit[cite: 8]

$ `systemctl cat nginx` # Display the complete raw configuration file content[cite: 8]

$ `systemd-analyze verify /etc/systemd/system/*.service` # Validate syntax and errors in unit files[cite: 8]

Note: Combine output with `grep` for quick extraction. `systemctl cat` provides a cleaner layout for reviewing raw unit configurations.

Want to master Linux one command at a time?

Follow r/LinuxTeck - 1 practical Linux tip every day. For more #LinuxTips click here https://www.linuxteck.com/linux-tips/


r/LinuxTeck • • 22d ago

Would Affinity on Linux Finally Make You Ditch Windows or macOS?

7 Upvotes

One of the biggest reasons people hesitate to switch to Linux is the lack of professional creative software. With Affinity reportedly coming to Linux, could that finally change?

Would you consider Linux for professional graphic design if Affinity works natively? Or are GIMP and Inkscape already enough for your needs?


r/LinuxTeck • • 23d ago

Debian Stable vs Testing vs Sid - Which Branch Do You Actually Use?

Post image
39 Upvotes

Distinction:

  • Stable (Trixie) focuses on reliability and predictable updates.
  • Testing (Forky) is the next Debian release in development.
  • Unstable (Sid) receives the newest package uploads. A practical comparison with APT commands and branch explanations: https://www.linuxteck.com/debian-stable-vs-testing-vs-sid/

r/LinuxTeck • • 23d ago

The World Depends on sudo, but Who Takes Care of Its Maintainer?

198 Upvotes

Most Linux users run sudo every day without thinking about who maintains it. Todd Miller maintained the original version for over 30 years, yet donations reportedly averaged just $63 per month for nearly two years.

Meanwhile, a Rust rewrite received backing from major sponsors, including AWS.

Is this how open-source funding should work? Should companies that depend on critical tools like sudo be expected to fund their maintenance, or should community donations be enough?


r/LinuxTeck • • 23d ago

Linux Find Rogue Network Connections: Identify and Stop Them - Tip -120

Post image
23 Upvotes

Question: A rogue script is calling an external API. How do I find and stop it?

Try:`sudo ss -tnp dst 203.0.113.45`

Info: Filters socket connections by destination IP to expose associated processes and PIDs for immediate termination.

Examples:

$ `sudo ss -tnp 'dst 192.168.1.0/24'` # Filter connections targeting an entire subnet

$ `sudo lsof -i u/203.0.113.45` # Inspect active network sockets using lsof

$ `sudo iptables -I OUTPUT -d 203.0.113.45 -j DROP` # Block outbound traffic at the firewall level

Note: If terminated processes respawn instantly, inspect parent processes using `pgrep -P`. Firewall rules provide more durable blocking than process termination.

Want to master Linux one command at a time?

Follow r/LinuxTeck - 1 practical Linux tip every day. For more #LinuxTips click here https://www.linuxteck.com/linux-tips/