Operations 9 min read

10 Essential Linux Command-Line Tricks to Boost Your Productivity

This guide presents ten practical Linux terminal tips—from cursor‑movement shortcuts and Vim tricks to quick directory switches, file transfers, and process handling—helping developers and operations engineers work faster and more efficiently in complex online environments.

Open Source Linux
Open Source Linux
Open Source Linux
10 Essential Linux Command-Line Tricks to Boost Your Productivity

As online complexity rises, efficient Linux command usage is crucial for developers and operations engineers. This article compiles ten practical command‑line tips to improve daily productivity.

TOP‑1: Cursor‑movement shortcuts

Recommendation: ★★★★★

Scenario: Editing long commands quickly.

Methods:

Ctrl + a: move cursor to the start of the line
Ctrl + e: move cursor to the end of the line
Ctrl + w: delete the word before the cursor
Esc + b: move left one word
Esc + f: move right one word

TOP‑2: Vim quick operations

Recommendation: ★★★★★

Scenario: Modifying configuration files.

All actions are performed in Vim’s command mode (press Esc first):

:set nu               # show line numbers
:20                   # jump to line 20
:%s/aaa/bbb/g         # replace all "aaa" with "bbb"
ddp                   # swap current line with the next line
ci"                  # delete inside double quotes (use ci' for single quotes)

TOP‑3: Quickly return to the previous directory

Recommendation: ★★★★★

Scenario: Switching back and forth between two directories.

Command: cd - Running the command toggles between the current and the last visited directory.

TOP‑4: Cross‑server file copy without passwords

Recommendation: ★★★

Scenario: Copying files between servers when scp is unavailable.

Method 1 (using nc):

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

Method 2 (using Python’s 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 file creation and truncation

Recommendation: ★★★★★

Command: > a.log Redirecting nothing into a file clears its contents if it exists, or creates an empty file if it does not.

TOP‑6: Retrieve the machine’s internal IP address

Recommendation: ★★★★

Scenario: Quickly checking the local IP.

Command: hostname -i Note: Works only on hosts with DNS resolution; hostname changes the host name, while host queries DNS records.

TOP‑7: Connect to Redis without a client

Recommendation: ★★★★

Scenario: Temporary Redis access when the client is missing.

Command: telnet 127.0.0.1 6379 Use telnet <host> <port> to open a raw connection; for production, prefer a proper Redis client such as redis-cli.

TOP‑8: Send a running job to the background

Recommendation: ★★★★★

Scenario: Need to run a command while editing a file in Vim.

Press Ctrl+Z to suspend the foreground job, then execute other commands, and bring it back with fg.

TOP‑9: Locate the directory of a running process

Recommendation: ★★★★★

Scenario: Finding where a process’s executable resides.

Command (replace pid with the actual process ID): pwdx pid This prints the working directory of the specified process, useful after identifying a PID via top or ps.

TOP‑10: Save command output to a file while still seeing it

Recommendation: ★★★★★

Scenario: Logging script output and monitoring it live.

Command: your_command | tee output.log Alternatively, run python test.py > a.log in one terminal and tail -f a.log in another; tee combines both steps.

Enjoy experimenting with these Linux tricks and share your own tips in the comments.

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.

DevOpsLinuxproductivityVimcommand-line
Open Source Linux
Written by

Open Source Linux

Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.

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.