Custom Commands in ZSH

With zsh you should edit ~/.zshrc (create it if it doesn't exist -> example template https://github.com/robbyrussell/oh-my-zsh/blob/master/templates/zshrc.zsh-template)

so:

nano ~/.zshrc

and add the alias you want, e.g.

alias my_project_runserver='cd my_project_path; . venv/bin/activate; ./manage.py runserver'

Using the alias above I go to my project folder, activate virtualenv and run django server

;

separates commands, so with one alias you can execute multiple commands

and for changes to take effect execute:

. ~/.zshrc


Edit the ~/.bashrc file. Find the alias section and add the following
alias desktop='cd /path/to/desktop'

Doing so, you'll declare some aliases. You can make any custom alias you want !
(ie. i have alias ne='emacs -nw' and everytime i run
ne "some file"
it opens the file in shell based emacs.)

Whenever you'll write desktop, it'll bring you there :-) (theoretically)

Tags:

Zsh