after closing the terminal, the alias created in the session are not recorded.
➜ ~ git:(master) ✗ alias -g devpath='cd /Users/User/Documents/develop'
➜ ~ git:(master) ✗ devpath
➜ develop git:(master) ✗
Last login: Tue Nov 11 13:04:26 on ttys000
➜ ~ git:(master) ✗ devpath
zsh: command not found: devpath
➜ ~ git:(master) ✗
but when I do:
Last login: Tue Nov 11 13:11:15 on ttys000
➜ ~ git:(master) ✗ zsh_stats
1 69 30% git
2 31 13,4783% alias
3 23 10% ls
4 22 9,56522% devpath
5 19 8,26087% cd
6 12 5,21739% gulp
7 9 3,91304% gp
8 6 2,6087% sudo
9 6 2,6087% cl
10 4 1,73913% gc
11 3 1,30435% chsh
12 3 1,30435% cat
13 2 0,869565% source
14 2 0,869565% pod
15 2 0,869565% mkdir
16 2 0,869565% lc
17 2 0,869565% find
18 2 0,869565% dstore
19 1 0,434783% vim
20 1 0,434783% startserver
➜ ~ git:(master) ✗ devpath
zsh: command not found: devpath
The alias
command per default remains in effect only during the current login session!
To make permanent aliases store them at ~/.zshrc
like this:
# Aliases
alias cle=clear
alias cl=clear
alias lc=clear
Save it and then source the file:
$ source ~/.zshrc
Voilà, enjoy your aliases. :beers:
Feature, not bug. Please close
Sorry I don't mean to open this again, but thought I'd add for people running into this via Google. As OSX Catalina & Oh My Zsh don't appear to work with the above solution out the box.
1.) Go to the folder $ cd ~/.oh-my-zsh/custom
2.) Create a new .zsh file. You can name it what ever you’d like, but for testing, I created aliases.zsh
3.) Add you new aliases to your new file. You can do this by opening the file with your preferred text editor. For example:
#An alias to naviage up one directory level
alias up='cd ..'
4.) Save and quit the editor
5.) Restart your terminal or use $ source ~/.zshrc
Most helpful comment
The
alias
command per default remains in effect only during the current login session!To make permanent aliases store them at
~/.zshrc
like this:Save it and then source the file:
Voilà, enjoy your aliases. :beers: