{
  "id": 246729,
  "title": "A shell exclamation mark is not for yelling. Be lazy",
  "url": "https://urgent.news/2026/08/07/a-shell-exclamation-mark-is-not-for-yelling-be-lazy",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-07T01:18:25.000Z",
  "source": {
    "name": "Lobsters",
    "slug": "lobsters",
    "url": "https://refp.se/articles/your-shell-and-the-lazy-exclamation-mark"
  },
  "original_language": "en",
  "account": "You and I have one thing in common: we are all lazy. This article is primarily aimed at bash, csh, tcsh, and zsh shells. It introduces an easy way to avoid repeating commands by referring to previous commands and their arguments directly. This method is not meant for use in shell scripts.\n\nThe magic lies in the exclamation mark, which allows you to save time and effort. Event designators follow a simple pattern, and understanding them can significantly reduce the number of keystrokes required. Event designators always follow the same pattern, and once you understand them, you can rerun commands and modify parts of previous commands without having to retype them.\n\nModifiers allow you to extract or modify specific parts of a line, making it easier to customize commands. The fc command is particularly useful, as it allows you to edit commands in your preferred editor rather than in the shell. It can be used to repeat the previous command, and many shells fall back to using the default editor if no specific editor is specified.\n\nEvent designators and the fc command belong to the User Portability Utilities of POSIX. They may not change your life, but they can save you a considerable amount of time over time. By memorizing a few of these techniques, you can significantly improve your productivity. Remember, exclamation marks are not for shouting in your shell.\n\nTo further customize this behavior, you can use shopt -s histverify for bash or setopt HIST_VERIFY in zsh. These configurations expand commands in-place when you press enter, allowing you to edit or discard the result if it's not what you intended. You may also use the :p-modifier to print what would run without actually running it, which can be helpful for testing changes.\n\nIf you prefer not to use the default exclamation mark, you can configure your shell to use any other character of your choice. Remember to set this configuration in the appropriate dot-rc file to ensure it persists across sessions. This flexibility allows you to tailor the behavior to your preferences without cluttering your history with unwanted entries.",
  "summary": null,
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}