26

I've heard great things about zmv in zsh, and would love to really learn to use it. However, I am still relatively unexperienced in zsh, and have some basic questions:

  • Is there is a man page for zmv in zsh (man zsh outputs "No manual entry for zmv")
  • Does zmv natively allow for dry runs?
  • If the answer to the above is no, how would you test or do a dry run with zmv ?
26

Offline solutions

The zmv manual is in the zshcontrib man page. You can reach it directly with

LESS="$LESS +/^ *zmv *\\[" man zshcontrib

(or LESS="$LESS +/zmv" man zshcontrib which takes you a few lines further up because zmv is mentioned in the description of zcp). You can use man zshall instead of man zshcontrib if the zshall man page is available on your system.

If you use Info, you can reach it by running info zsh and typing i then entering zmv.

info --index-search=zmv zsh

Online help

The zsh guide has a fairly detailed section on zmv.
Searching for zmv on this stackexchange will turn up several usage examples of varying complexity.

Tips

You can perform a dry run with zmv -n (-n is a common way of requesting a dry run).

To benefit from zmv and friends, it helps to have code like the following in your ~/.zshrc:

autoload zmv
alias zmv='noglob zmv'
alias zcp='noglob zmv -C'
alias zln='noglob zmv -L'
alias zsy='noglob zmv -Ls'
2
  • man zshcontrib, man zshall and info zsh all give empty results for me on Ubuntu with zsh installed. How do I get them?
    – xeruf
    Oct 6 '18 at 9:28
  • 2
    @Xerus If you install zsh with the Ubuntu package, you have the man pages. For the info manual, make sure the zsh-doc package is installed. If you have the Ubuntu package but not the man pages, there's something wrong with your installation, but it's impossible to know why without way more information. If you'd like help with that, you can ask a question on this site and provide all relevant information: what version of Ubuntu you have, how you installed zsh, what customizations you've made, etc. Oct 6 '18 at 22:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.