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:

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

TOP-2: Vim Quick Operations

Recommendation: ★★★★★

Scenario: Editing configuration files.

All actions are performed in Vim's command mode (press Esc first if unsure).

: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)

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:

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

Method 2 – Using a simple Python HTTP server:

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

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 <redis_host> <port> 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.

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.

LinuxTips
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

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.