Operations 20 min read

10 Essential Linux Sysadmin Hacks to Boost Efficiency

This article presents ten practical Linux system‑administration tricks—from ejecting a stuck DVD drive and resetting a frozen console to sharing screen sessions, creating SSH tunnels for VNC, measuring network bandwidth, and gathering system diagnostics—each designed to save time and improve operational productivity.

ITPUB
ITPUB
ITPUB
10 Essential Linux Sysadmin Hacks to Boost Efficiency

Efficient Linux system administrators can dramatically reduce routine task time with a handful of proven tricks.

Tip 1: Eject an Unresponsive DVD Drive

Identify the process holding the DVD device and terminate it:

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

In another terminal run:

# eject

If the device is busy, find the owning process:

# fuser /media/cdrom

Terminate it as root:

# fuser -k /media/cdrom

Then the drive can be ejected safely.

Tip 2: Recover a Frozen Console

When the terminal becomes garbled, use the reset command (not reboot or shutdown) to restore normal output without restarting the machine.

Tip 3: Collaborative Screen Sessions

Share a screen session between two users:

# su - david # ssh posh # screen -S foo

On the second machine, attach to the same session:

# screen -x foo

Detach with Ctrl‑A D and re‑attach later using screen -x foo.

Tip 4: Reset a Forgotten Root Password (CentOS example)

Reboot, interrupt GRUB, edit the kernel line, append 1 to start in single‑user mode, then run:

# passwd

After setting a new password, reboot the system.

Tip 5: Create an SSH Backdoor

Use a publicly reachable host ( blackbox.example.com) as a relay. On the internal server ( ginger) run:

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

Keep the session open, then from the external machine connect back:

# ssh [email protected]

From there forward the connection to the internal host:

# ssh -p 2222 root@localhost

Tip 6: Remote VNC via SSH Tunnels

Start a VNC server on ginger:

# vncserver -geometry 1024x768 -depth 24 :99

Forward the VNC port through the same relay host:

# ssh -R 5999:localhost:5999 [email protected] # ssh -L 5999:localhost:5999 [email protected] # vncviewer localhost:99

Windows users can achieve the same with PuTTY port‑forwarding.

Tip 7: Measure Network Bandwidth

Compile and run iperf on both nodes, then start a server:

# /home/bob/perf/bin/iperf -s -f M

On the client:

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

Typical results show ~112 Mbit/s on a single NIC and up to ~220 Mbit/s when bonding two NICs.

Tip 8: Command‑Line Scripting for Automation

Generate a large /etc/hosts file:

# 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 across a cluster via SSH:

# for num in $(seq -w 200); do ssh n$num free -m | grep Mem | awk '{print $2}'; done | sort | uniq

The pipeline uses free, grep, awk, sort, and uniq to reveal uniform or differing memory sizes.

Tip 9: Console Inspection

Read the virtual console device to see what a remote user typed:

# cat /dev/vcs1

This can be faster than accessing the machine physically.

Tip 10: Random System Information Gathering

Collect CPU details:

# cat /proc/cpuinfo

Count processors:

# cat /proc/cpuinfo | grep processor | wc -l

Check disk usage:

# df -h

Inspect BIOS with dmidecode and NIC firmware with ethtool -i eth0.

Conclusion

Learning from experienced command‑line users, sharing screen sessions, reading manual pages, and constantly solving problems are the best ways to become a more efficient Linux administrator and free up time for personal interests.

Source: IBM/developerWorks Link: http://www.ibm.com/developerworks/cn/linux/l-10sysadtips/index.html
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.

OperationsLinuxShellTips
ITPUB
Written by

ITPUB

Official ITPUB account sharing technical insights, community news, and exciting events.

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.