10 Lazy Sysadmin Hacks to Supercharge Linux Efficiency
This article shares ten practical Linux sysadmin tricks—from force‑ejecting a stuck DVD drive and resetting a frozen console to using screen sharing, SSH tunnels, VNC forwarding, bandwidth testing, and command‑line scripting—that dramatically cut task time and free up more leisure for administrators.
Technique 1: Unmount an Unresponsive DVD Drive
When a DVD device is busy, use fuser /media/cdrom to identify the holding process, then terminate it with fuser -k /media/cdrom before running eject to release the media.
Technique 2: Recover a Frozen Screen
If the terminal becomes garbled, simply execute reset. The command restores the display without rebooting the machine, saving time when you are logged in through multiple SSH hops.
Technique 3: Collaborative Screen Sessions
Use GNU screen to share a terminal with a colleague. Example workflow:
Switch to the colleague’s account: su - david SSH to the target host: ssh posh Create a named session: screen -S foo Invite the colleague: screen -x foo Both users can see and type commands simultaneously, facilitating joint debugging. Detach with Ctrl‑A D and re‑attach later using screen -x foo.
Technique 4: Recover a Forgotten Root Password
Reboot into GRUB, edit the kernel line (press E), append 1 to the end of the kernel parameters, and boot into single‑user mode. Then run: passwd Enter the new password, reboot, and log in with the updated credentials.
Technique 5: SSH Backdoor for Remote Support
Establish an SSH reverse tunnel from an internal machine ( ginger) to an external host ( blackbox.example.com) using:
ssh -R 2222:localhost:22 [email protected]Keep the session alive, then from the external side connect back to the internal host: ssh -p 2222 root@localhost This creates a secure channel that bypasses the firewall for remote assistance.
Technique 6: Remote VNC Over SSH Tunnel
Start a VNC server on the internal host: vncserver -geometry 1024x768 -depth 24 :99 Forward the VNC port (5999) from the internal host to the external host, then from the external host to the client machine using a chain of -R and -L tunnels:
ssh -R 5999:localhost:5999 [email protected] # on ginger
ssh -L 5999:localhost:5999 [email protected] # on techFinally, launch the viewer: vncviewer localhost:99 Windows users can achieve the same with PuTTY’s port‑forwarding settings.
Technique 7: Bandwidth Measurement
Install iperf on both ends, start the server: /home/bob/perf/bin/iperf -s -f M and run the client:
/home/bob/perf/bin/iperf -c ginger -P 4 -f M -w 256k -t 60Typical 1 GbE links show ~112 Mbit/s; bonding two NICs can reach ~220 Mbit/s. Use the results to verify expected throughput.
Technique 8: Command‑Line Scripting and Utilities
Generate a large /etc/hosts file with a single loop:
P=1; for i in $(seq -w 200); do echo "192.168.99.$P n$i"; P=$(expr $P + 1); done >>/etc/hostsCheck memory consistency across a cluster via SSH and awk:
for num in $(seq -w 200); do ssh n$num free -m | grep Mem | awk '{print $2}'; done | sort | uniqThe pipeline extracts total memory per node, sorts values, and removes duplicates.
Technique 9: Console Inspection
Read the virtual console device to see what is displayed on the physical console: cat /dev/vcs1 Replace 1 with other numbers for additional virtual terminals.
Technique 10: Random System Information Gathering
Collect CPU details: cat /proc/cpuinfo Count processors: cat /proc/cpuinfo | grep processor | wc -l Show disk usage: df -h Display BIOS information (requires root): dmidecode | less Check NIC driver and firmware:
ethtool -i eth0Conclusion
Regularly sharing screen sessions, reading manual pages, and solving real problems are the best ways to become a faster, more efficient Linux administrator, freeing up time for personal interests.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
ITPUB
Official ITPUB account sharing technical insights, community news, and exciting events.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
