Operations 21 min read

10 Essential Linux Sysadmin Hacks to Boost Efficiency

This guide presents ten practical Linux system‑administration tricks—from unmounting a stuck DVD drive and resetting a frozen console to using screen for collaborative debugging, recovering a lost root password, creating SSH backdoors, tunneling VNC, measuring bandwidth, and automating host‑file generation—helping admins work faster and smarter.

Liangxu Linux
Liangxu Linux
Liangxu Linux
10 Essential Linux Sysadmin Hacks to Boost Efficiency

Tip 1: Unmount an Unresponsive DVD Drive

When a DVD drive cannot be ejected because a process is holding it, identify the culprit and force‑unmount it.

mount /media/cdrom
cd /media/cdrom
while [ 1 ]; do echo "All your drives are belong to us!"; sleep 30; done
eject

The command returns umount: /media/cdrom: device is busy. Find the owning process: fuser /media/cdrom Terminate it (as root) and eject again:

fuser -k /media/cdrom
eject

Tip 2: Recover a Frozen Screen

If the console is garbled, the reset command restores a usable display without rebooting.

reset

Tip 3: Screen Collaboration

Use screen to share a terminal session with a colleague.

su - david
ssh posh
screen -S foo

Ask the colleague to attach: screen -x foo Both users can see and type simultaneously, allowing real‑time debugging. Detach with Ctrl‑A D and re‑attach later using the same command.

Tip 4: Recover a Lost Root Password (CentOS Example)

Reboot and edit the GRUB entry to boot into single‑user mode.

GRUB screen after reboot
GRUB screen after reboot

At the GRUB menu, press E to edit the kernel line, append 1 after kernel, then press Enter and B to boot.

Editing kernel parameters in GRUB
Editing kernel parameters in GRUB

When the system drops to a sh-3.00# prompt, change the password: passwd Enter the new password twice; the system reports success. Reboot and log in with the new root password.

Tip 5: Create an SSH Backdoor Through a Firewall

Use a publicly reachable machine (e.g., blackbox.example.com) as a relay.

Diagram of SSH backdoor setup
Diagram of SSH backdoor setup

On the internal host ( ginger) run:

ssh -R 2222:localhost:22 [email protected]

Keep the session open. From the external machine ( tech) connect to the relay: ssh [email protected] Then forward back to the internal host: ssh -p 2222 root@localhost Both parties now share a shell on the internal server.

Tip 6: Tunnel a Remote VNC Session Over SSH

Start a VNC server on ginger: vncserver -geometry 1024x768 -depth 24 :99 Forward the VNC port (5999) from ginger to the relay:

ssh -R 5999:localhost:5999 [email protected]

From the external machine, forward the port back:

ssh -L 5999:localhost:5999 [email protected]

Finally, launch the VNC viewer: vncviewer localhost:99 Windows users can achieve the same with PuTTY; see the diagram.

PuTTY port‑forwarding configuration
PuTTY port‑forwarding configuration

Tip 7: Measure Network Bandwidth with iperf

Compile and install iperf on both servers ( ginger and beckham).

wget http://dast.nlanr.net/Projects/Iperf2.0/iperf-2.0.2.tar.gz
tar zxvf iperf-2.0.2.tar.gz
cd iperf-2.0.2
./configure --prefix=/home/bob/perf
make && make install

Run the server on ginger: /home/bob/perf/bin/iperf -s -f M Run the client on beckham:

/home/bob/perf/bin/iperf -c ginger -P 4 -f M -w 256k -t 60

Typical results are ~112 Mbit/s per NIC; bonding two NICs can reach ~220 Mbit/s. Use the data to verify expected throughput.

Tip 8: Command‑Line Scripts and Utilities

Generate 200 /etc/hosts entries in one line:

P=1; for i in $(seq -w 200); do echo "192.168.99.$P n$i"; P=$(expr $P + 1); done >> /etc/hosts

Check 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

The pipeline prints a single value if all nodes have identical memory, or multiple values if they differ.

Tip 9: Console Scouting

Read the virtual console buffer directly: cat /dev/vcs1 Replace vcs1 with vcs2, vcs3, etc., to view other virtual terminals.

Tip 10: Random System‑Information Collection

CPU details: cat /proc/cpuinfo Count CPUs: cat /proc/cpuinfo | grep processor | wc -l Disk usage (human‑readable): df -h BIOS and firmware info: dmidecode | less Network driver version:

ethtool -i eth0

Conclusion

Mastering these command‑line techniques—collaborating via screen, automating repetitive tasks, probing hardware, and tunneling services—greatly reduces the time spent on routine administration, giving sysadmins more freedom and efficiency.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxShellNetworkingSSHTips
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.