Linux Tech Enthusiast
Linux Tech Enthusiast
Feb 14, 2026 · Operations

8 Surprising Ways to Use the ‘!’ Operator in Linux Commands

This article explores eight practical uses of the ‘!’ history‑expansion operator in Linux shells, covering numbered command recall, negative indexing, argument reuse, multi‑parameter handling, keyword‑based recall, repeat‑last‑command shortcuts, selective file deletion, and directory‑existence checks, each illustrated with concrete examples.

Command Linebang operatorbash
0 likes · 10 min read
8 Surprising Ways to Use the ‘!’ Operator in Linux Commands
Liangxu Linux
Liangxu Linux
Jul 4, 2023 · Fundamentals

Master Linux History Expansion: 8 Powerful ‘!’ Command Tricks

This guide explains eight practical uses of the ‘!’ operator in Linux shells, covering how to rerun commands by number, reference previous arguments, handle multiple parameters, search by keyword, repeat the last command, and perform conditional deletions and directory checks.

Linuxbang operatorcommand history
0 likes · 10 min read
Master Linux History Expansion: 8 Powerful ‘!’ Command Tricks