DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป

DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป is a community of 968,547 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Lรขm
Lรขm

Posted on

Zsh Cheat Sheet

Also see

Zsh is mostly compatible with Bash, so most everything in Bash's cheatsheet also applies.

Process Substitution

Expression Example Description
<(COMMAND) grep "needle" <(curl "https://haystack.io") Replace argument with named pipe/FIFO (read-only) with command output
=(COMMAND) vim =(curl "https://haystack.io") Replace argument with file (writable) containing command output

{: .-headers}

Change default shell

chsh -s `which zsh`
Enter fullscreen mode Exit fullscreen mode

Expressions

Expression Example Description
!! sudo !! Last command (sudo !!)
--- --- ---
!* vim !* Last command's parameters (vim !*)
!^ Last command's first parameter
!$ Last command's last parameter
--- --- ---
!?ls <tab> sudo !?mv <tab> Command and params of last ls command
!?ls?:* <tab> Params of last ls command
--- --- ---
*(m0) rm *(m0) Last modified today
*(m-4) Last modified <4 days ago

Reference

Top comments (0)

Find what you were looking for? Sign up so you can:

๐ŸŒš Enable dark mode
๐Ÿ”  Change your default font
๐Ÿ“š Adjust your experience level to see more relevant content