10 Essential Linux Sysadmin Hacks to Boost Efficiency and Save Time
This article presents ten practical Linux system‑administration techniques—from ejecting a stuck DVD drive and resetting a frozen console to using screen sharing, SSH tunnels, bandwidth testing, and powerful command‑line scripts—each designed to streamline tasks, reduce downtime, and give administrators more free time.
Technique 1: Unmount an Unresponsive DVD Drive
A common issue on Linux servers is a DVD drive that cannot be ejected because a process is holding it. Mount the drive, locate the offending process with fuser /media/cdrom, then terminate it using fuser -k /media/cdrom and finally run eject again.
Technique 2: Recover a Frozen Screen
If the terminal becomes garbled, the safe way to restore it is to run the reset command (not reboot or shutdown). This clears the screen without restarting the machine.
Technique 3: Collaborative Screen Sessions
Use screen to share a terminal with a colleague. After both users log in as the same user, start a session with screen -S foo, then have the partner attach using screen -x foo. Detach with Ctrl‑A D and re‑attach later with the same command.
Technique 4: Recover a Forgotten Root Password
Reboot the machine, interrupt GRUB, edit the kernel line, and append 1 to the parameters to boot into single‑user mode. Once at the sh‑3.00# prompt, run passwd to set a new root password, then reboot.
Technique 5: SSH Backdoor for Remote Support
Establish a reverse SSH tunnel from an internal machine ( ginger) to an Internet‑accessible host ( blackbox.example.com) using ssh -R 2222:localhost:22 [email protected]. Keep the session alive, then have the external support engineer connect back to ginger via ssh -p 2222 root@localhost. The tunnel is encrypted, and the internal host never exposes a direct inbound port.
Technique 6: Remote VNC Over SSH Tunnel
Start a VNC server on the internal host ( ginger) with vncserver -geometry 1024x768 -depth 24 :99. Forward the VNC port (5999) through the same reverse tunnel ( ssh -R 5999:localhost:5999 [email protected]) and then forward it from the external host to the support machine using ssh -L 5999:localhost:5999 [email protected]. Finally, connect with vncviewer localhost:99 on the support machine.
Technique 7: Bandwidth Measurement
Combine two Gigabit NICs for higher throughput, then use iperf to measure actual bandwidth. Build iperf from source, run a server on ginger ( /home/bob/perf/bin/iperf -s -f M) and a client on beckham ( /home/bob/perf/bin/iperf -c ginger -P 4 -f M -w 256k -t 60). Results typically show ~112 MBit/s per NIC, up to ~220 MBit/s with dual‑NIC bonding.
Technique 8: Command‑Line Scripts 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: for num in $(seq -w 200); do ssh n$num free -m | grep Mem | awk '{print $2}'; done | sort | uniq
Technique 9: Console Inspection
Read the virtual console device directly to see what is displayed on the physical console: cat /dev/vcs1 (or /dev/vcs2 , etc.). This works even when the SSH session does not show the console output.
Technique 10: Random System Information Gathering
Collect CPU info with cat /proc/cpuinfo and count processors via cat /proc/cpuinfo | grep processor | wc -l . Get disk usage with df -h . Retrieve BIOS and firmware details with dmidecode and NIC driver/firmware versions with ethtool -i eth0 .
Conclusion
Effective sysadmins continuously share screen sessions, read manual pages, and solve real problems. By mastering these command‑line tricks, they can complete tasks faster, reduce downtime, and enjoy more free time.
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.
