Linux Training Academy

Helping you level-up your career.

  • About
  • Products
  • Books
  • Linux for Beginners
  • Resources
  • Video Training Courses

Rerun a Command That Starts with a given String

Share
Facebook0
Google+0
LinkedIn0
Twitter0
Pinterest0

To run the most recent command that begins with a given string, use an exclamation mark followed by that string. For example, to run the last command that started with a “d”, type “!d.” Specify as much of the string to make it unique. If you have several commands in your recent history that begin with “d”, you can add additional characters like “!du” or “!df”.

I find myself using this technique to get a status, perform some work that might affect that status, and to recheck the status again. Here is an example where data is being copied to a file system and where the disk usage is being checked.

Syntax:

!

Examples:

!d
!du
!df

Stringphoto credit: workshoppe cc

Related posts:

  • Vim Cheat Sheet
  • Want to Quickly Recall the Last Word or Last Argument from the Previous Command Line? Here’s How.
  • Linux tar Command Tutorial
  • Linux ip Command Networking Cheat Sheet

Filed Under: blog Tagged With: Command Line, Server, Ubuntu, Video

Most Popular

  • Linux Commands Cheat Sheet
  • Linux ip Command Networking Cheat Sheet
  • Vim Cheat Sheet
  • Linux System Administrator Projects
  • 1,500 Coding Project Ideas

Recent Linux Articles

  • Which Distro Should I Choose?
  • Linux Logical Volume Manager Tutorial
  • How to Find Any File or Command on a Linux System
  • Linux tar Command Tutorial
  • How to Prepare for (and Ace) Your Next Technical Interview

Topics

Arch Linux careers CentOS cheat sheet Cloud Command Line Debian Desktop Fedora File System FTP Gentoo Installation jobs Linux Linux Mint Mageia MySQL Nginx OpenSuse Programming Python RedHat SCP Server Shell Scripting Slackware SSH text editor Ubuntu Vagrant Video vim VirtualBox Web Hosting Windows
Linux Cheat Sheet Download
Enter your email address below to download this Linux command line cheat sheet in an easy-to-read and ready-to-print format.

© 2018 · Linux Training Academy

  • Privacy Policy
✕
Free Linux Command Line Cheat Sheet ->