Operations 10 min read

Master Essential Linux Command-Line Tricks for Faster Sysadmin Work

This guide presents ten practical Linux command-line shortcuts and techniques—ranging from cursor navigation and Vim editing to quick directory switching, file transfer, process inspection, and output logging—designed to boost productivity for system administrators and developers working in terminal environments.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Master Essential Linux Command-Line Tricks for Faster Sysadmin Work

TOP-1: Cursor Movement Shortcuts

Recommendation: ★★★★★

Scenario: When a command line is long and you need to edit specific parts.

Ctrl + a Move cursor to the beginning of the line</code>
<code>Ctrl + e Move cursor to the end of the line</code>
<code>Ctrl + w Delete the word before the cursor</code>
<code>Esc + b Move left by one word</code>
<code>Esc + f Move right by one word

TOP-2: Vim Quick Operations

Recommendation: ★★★★★

Scenario: Editing configuration files efficiently.

All commands assume you are in Vim’s command mode (press Esc first if unsure).

:set nu Show line numbers</code>
<code>:20 Jump to line 20</code>
<code>:%s/aaa/bbb/g Replace all occurrences of "aaa" with "bbb"</code>
<code>ddp Swap the current line with the next line</code>
<code>ci" Delete everything inside double quotes (use <code>ci'</code> for single quotes)

TOP-3: Return to the Previous Directory

Recommendation: ★★★★★

Scenario: Quickly toggle between two directories. cd - Switch to the last visited directory Running the command again returns you to the original directory.

TOP-4: Cross‑Server File Copy Without Password

Recommendation: ★★★

Scenario: Transfer files between servers when you cannot use scp because the remote password is unknown.

Method 1 – Netcat:

# On the source machine
nc -l 10017 < abc.sh
# On the destination machine
nc 1.1.1.1 10017 > abc.sh

Method 2 – Simple HTTP Server:

# On the source machine
python -m SimpleHTTPServer 10010
# On the destination machine
wget http://1.1.1.1:10010/abc.sh

TOP-5: Simplify Command Output Redirection

Recommendation: ★★★★★

Scenario: Clear a file’s contents or create a new empty file (useful for truncating large logs).

> a.log Truncate <code>a.log</code> if it exists, or create an empty <code>a.log</code>

Appending Ctrl + C after this command stores any buffered output into a.log.

TOP-6: Retrieve Local In‑tranet IP

Recommendation: ★★★★

Scenario: Need to know the machine’s internal IP address.

hostname -i Display the machine’s internal IP

Note: This works only on hosts with DNS resolution; hostname changes the host name, while host queries DNS records.

TOP-7: Quick Redis Connection Without Client

Recommendation: ★★★★

Scenario: When a Redis client is unavailable, use telnet for simple queries.

telnet 127.0.0.1 6379 Connect to a local Redis instance

Use telnet <host> <port> for remote instances. For production, prefer a proper Redis client such as redis-cli.

TOP-8: Send a Job to the Background

Recommendation: ★★★★★

Scenario: While editing a script in Vim, you need to run a command without leaving the editor.

Ctrl + z Suspend the current foreground job (e.g., Vim)</code>
<code>fg Resume the suspended job

Example: Edit vim /abc/aaa.py, press Ctrl+z, run python aaa.py, then type fg to return to Vim.

TOP-9: Locate the Directory of a Running Process

Recommendation: ★★★★★

Scenario: Find where the executable file of a process resides.

pwdx <pid> Show the working directory of the given process ID

Replace <pid> with the actual process ID (e.g., the PID of python test.py).

TOP-10: Save Command Output While Still Viewing It

Recommendation: ★★★★★

Scenario: Run a script, keep a log file, and watch the output live.

python test.py | tee a.log Execute the script, display output, and write it to <code>a.log</code> simultaneously

Alternatively, you can redirect to a file and tail it in another terminal, but tee does it in a single window.

These ten tips provide a compact toolbox for everyday Linux terminal work, helping administrators and developers operate more efficiently and avoid repetitive manual steps.

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.

OperationsLinuxcommand-lineSysadminVimBashTips
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.