Operations 10 min read

10 Essential Linux Command-Line Tricks to Boost Your Productivity

This article compiles ten practical Linux command-line shortcuts—from cursor navigation and Vim editing tricks to quick directory switching, file transfer, process lookup, and output logging—each explained with usage scenarios, recommended rating, and exact commands to help developers and operators work faster and more efficiently.

Efficient Ops
Efficient Ops
Efficient Ops
10 Essential Linux Command-Line Tricks to Boost Your Productivity

As online systems become more complex, mastering common Linux commands can dramatically improve daily efficiency for developers and operations engineers.

TOP-1: Fast Cursor Movement Shortcuts

Recommendation: ★★★★★

Scenario: Editing long commands where quick navigation is needed.

Methods:

<code>Ctrl + a  // Move cursor to the beginning 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</code>

TOP-2: Vim Quick Operations

Recommendation: ★★★★★

Scenario: Editing configuration files.

All actions are performed in Vim's command mode (press

Esc

first if unsure).

<code>: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 content inside double quotes (use ci' for single quotes)</code>

TOP-3: Return to Previous Directory

Recommendation: ★★★★★

Scenario: Quickly toggle between two directories.

Command:

cd -

Running this command swaps the current directory with the last one you visited.

TOP-4: Cross‑Server File Transfer Without Password

Recommendation: ★★★☆☆

Scenario: Copy files between servers when you cannot use

scp

due to missing passwords.

Method 1 – Using

nc

:

<code># On source machine
nc -l 10017 < abc.sh
# On target machine
nc 1.1.1.1 10017 > abc.sh</code>

Method 2 – Using a simple Python HTTP server:

<code># On source machine
python -m SimpleHTTPServer 10010
# On target machine
wget http://1.1.1.1:10010/abc.sh</code>

TOP-5: Simplify Commands

Recommendation: ★★★★★

Scenario: Quickly clear a file or create an empty one.

Command:

> a.log

When

a.log

exists, this truncates the file; when it does not exist, it creates an empty file.

Quickly repeat the last command’s final argument (space‑separated) by pressing

Esc

followed by

.

.

TOP-6: Query Local Intranet IP

Recommendation: ★★★★☆

Scenario: Retrieve the machine’s internal IP address.

Command:

hostname -i

Note: Works only on machines with DNS resolution;

hostname

changes the host name, while

host

queries DNS records.

TOP-7: Quick Redis Connection via Telnet

Recommendation: ★★★★☆

Scenario: When no Redis client is installed.

Command:

telnet 127.0.0.1 6379

Use

telnet &lt;redis_host&gt; &lt;port&gt;

to connect, but for production prefer a proper Redis client such as

redis-cli

.

TOP-8: Send Current Task to Background

Recommendation: ★★★★★

Scenario: Temporarily suspend a foreground process (e.g., editing in Vim) to run another command.

Press

Ctrl+Z

to suspend, then run your command (e.g.,

python aaa.py

), and return with

fg

.

TOP-9: Locate Process Working Directory

Recommendation: ★★★★★

Scenario: Find the directory of a running process.

Command (replace

pid

with the actual process ID):

pwdx pid

Useful for identifying where a script like

python test.py

is executing from.

TOP-10: Save Command Output While Viewing It

Recommendation: ★★★★★

Scenario: Log script output and monitor it in real time.

Command:

python test.py | tee a.log

This streams output to the terminal and simultaneously writes it to

a.log

, eliminating the need for separate

tail -f

sessions.

These tips aim to make your Linux workflow smoother and more efficient.

Linuxproductivityshellcommand linetips
Efficient Ops
Written by

Efficient Ops

This public account is maintained by Xiaotianguo and friends, regularly publishing widely-read original technical articles. We focus on operations transformation and accompany you throughout your operations career, growing together happily.

0 followers
Reader feedback

How this landed with the community

login 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.