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
Jan 14, 2024 · Operations

Master Linux History Expansion: Powerful ‘!’ Operator Tricks

This guide explains the versatile Linux ‘!’ history‑expansion operator, showing how to repeat previous commands, substitute arguments, use wildcards, edit past entries, and apply safety tips, all with clear examples to boost command‑line efficiency.

Linuxhistory expansionshell
0 likes · 7 min read
Master Linux History Expansion: Powerful ‘!’ Operator Tricks
Liangxu Linux
Liangxu Linux
May 21, 2020 · Fundamentals

7 Bash History Shortcuts to Quickly Fix Mistyped Commands

This guide introduces seven Bash history‑expansion shortcuts—such as !$, !:n, !:1-$, !-n:$, !$:h, !#:1, and !!:gs—that let Linux users retrieve or modify parts of previous commands, dramatically reducing the effort required to correct long or complex command lines.

Linuxbashhistory expansion
0 likes · 8 min read
7 Bash History Shortcuts to Quickly Fix Mistyped Commands