5 Linux Commands — That Will Change Your Life as a Programmer

Babar Ali Jamali
2 min readDec 5, 2024

--

Boost your productivity with these powerful Linux commands for developers!

Photo by Mohammad Rahmani on Unsplash

The command-line interface (CLI) is an indispensable tool for developers and system administrators. Whether you’re scripting, configuring servers, or automating tasks, mastering Linux commands can save you hours of work and frustration.

This article explores five essential Linux command-line tricks that will supercharge your productivity as a programmer. These tricks aren’t just shortcuts — they’re tools that make the CLI your ultimate ally.

1. Effortlessly Create Multiple Folders with mkdir and Braces {}

Creating complex directory structures manually is tedious. Using mkdir with braces {} allows you to create multiple directories in one command.

Example:

mkdir -p {dev,test,prod}/{backend,frontend}

This creates:

dev/
backend/
frontend/
test/
backend/
frontend/
prod/
backend/
frontend/

Why It’s Useful: Saves time and reduces errors when setting up projects.

2. Jump Back Instantly with cd -

Instead of typing cd .. multiple times to navigate back up directories, use cd - to switch between your current and previous directories effortlessly.

Example:

cd /deep/nested/path
cd -

Returns you to the previous directory instantly.

Why It’s Useful: Speeds up navigation when working across multiple directories.

3. Generate Multiple Files Quickly with touch and Braces {}

Creating multiple files for testing or logging? Use touch with a number range.

Example:

touch test{1..100}.txt

Creates:

test1.txt, test2.txt, ..., test100.txt

Why It’s Useful: Ideal for generating placeholder files or test cases.

4. Monitor Logs in Real-Time with tail -f

Use tail -f to follow changes in a file, such as a log file, in real time.

Example:

tail -f /var/log/nginx/access.log

Displays new log entries as they’re added.

Bonus: Combine with grep to filter specific content:

tail -f error.log | grep "ERROR"

Why It’s Useful: Essential for debugging live systems or monitoring application behavior.

5. Review Recent Commands with history 5

Quickly recall the last few commands with history.

Example:

history 5

Displays the last five commands you ran.

Bonus: Re-execute a command using its number:

!125

Runs the 125th command from your history.

Why It’s Useful: Saves you from retyping long or complex commands.

Conclusion
Mastering these five Linux command tricks will revolutionize your programming workflow:

  1. mkdir with braces for efficient folder creation.
  2. cd - for quick directory navigation.
  3. touch with ranges for bulk file creation.
  4. tail -f for real-time log monitoring.
  5. history for recalling and reusing commands.

Incorporate these into your daily routine, and you’ll become a more efficient and productive programmer. The CLI is your ally — use it to its full potential!

--

--

Babar Ali Jamali
Babar Ali Jamali

Written by Babar Ali Jamali

I am IT Professional, Cyber Security Student, Ethical Hacker, Android, Web, Freelance Writer and Python Developer.

No responses yet