If you want to execute the last command that you ran in your Zsh shell, the easiest way would be by pressing the up arrow key on your keyboard, the last command is pulled up your on your prompt and you press enter. But do you know there is another way in which you can run the previous command using a command? Simply type to exclamation marks !! - this will execute the last executed command on your Zsh shell. Let's see some examples,

Zsh command to execute previous command
As you can see, when I typed !! the pervious command that was clear was executed again. In the next example it was the who command. Also notice that when you run the double exclamation command it displays the command as text in the first line outputted and then the result of the command,
code2care@mac ~ % !!
ls -ltrh
total 0
drwxr-xr-x+ 4 code2care staff 128B Jan 2 23:03 Public
drwx------+ 4 code2care staff 128B Jan 2 23:28 Pictures
drwxr-xr-x 4 code2care staff 128B Jan 17 16:16 ClassRoom
drwx------@ 75 code2care staff 2.3K Feb 13 16:04 Library
drwx------@ 3 code2care staff 96B Feb 13 16:04 Applications
drwxr-xr-x 5 code2care staff 160B Feb 15 22:32 IdeaProjects
drwx------@ 13 code2care staff 416B Mar 6 18:01 Documents
drwx------+ 7 code2care staff 224B Mar 13 22:42 Music
drwx------ 6 code2care staff 192B Mar 20 16:54 Movies
drwx------+ 18 code2care staff 576B Apr 3 12:41 Downloads
drwx------@ 8 code2care staff 256B Apr 3 13:27 Desktop
code2care@mac ~ %
More Posts related to HowTos,
- Brew Error - This command updates brew itself and does not take formula names
- Add X days from today in Command Line
- How to find someone on Instagram
- cURL HTTP GET request command examples
- Free Unlimited Calls from MTNL & BSNL Landlines from 1st May 2015
- Why I see Download pre-built shared indexes in IntelliJ
- How to display line numbers in Terminal while displaying content of a file
- How to install Postman natively on a Mac
- Display bookmarks bar Safari
- [Error] zsh: command not found: mvn
- How to rerun last command in Zsh shell
- How to identify the version of IntelliJ
- How to convert byte array to String [Kotlin]
- How to install Zsh shell
- How to stop or quit cat command?
- [Fix] Steam: Friends Network Unreachable Error
- How to Kill service running on port using terminal command
- How to Generate Self-Signed OpenSSL certificate in three easy steps
- How to enable line numbers in IntelliJ
- Copy all .vcf Mobile Contacts files into one .vcf
- How to write hello world different languages syntax
- What is HTTP 500 Internal Server Error Code on web browsers
- How to get an embed code from Vimeo?
- [Error] There was an error connecting to the apple id server
- Unzip a Zip file from Terminal Command
More Posts:
- JavaScript : redirect page to other url - Android
- Launch Notepad++ html document in any web browser - NotepadPlusPlus
- Turn on off volume change button sounds Mac OS X - Mac-OS-X
- Comprehensive 256 Ascii code table with Html Hex IBM Microsoft Key - Html
- How to create Custom RatingBar Android Programming Tutorial - Android
- Cmd command get current directory location - Windows
- Enable and reduce background noise in Microsoft Teams with AI-based noise suppression - Teams
- Google translate in spreadsheet - Google