Snabbreferens

Zsh Snabbguide: Historikexpansion, processubstitution och globbing

En snabbguide för Z shell (zsh): historikexpansion, processubstitution, globbing-modifierare och shell-konfiguration.

· Publicerad

History & Glob Expressions

Expression Example Description
!! sudo !! Re-run the previous command
!* vim !* All arguments from the previous command
!^ First argument from the previous command
!$ Last argument from the previous command
!?ls <tab> sudo !?mv <tab> Previous command matching ls and its arguments
!?ls?:* <tab> Arguments from previous command matching ls
*(m0) rm *(m0) Modified today
*(m-4) Modified within the last 4 days

Changing Default Shell

chsh -s $(which zsh)

Process Substitution

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

See Also

Zsh is largely backwards compatible with Bash, so most Bash commands and syntax apply directly.

Relaterade ämnen