Before you begin, exit out of zsh
and then run the zsh
command. You should get a prompt that asks you to make a selection. Press 2. This will create a default ~/.zshrc
file.
Files with the "rc" suffix are called run-control files¹.
bash
uses a ~/.bashrc
file for configuring your bash session and zsh
uses a ~/.zshrc
file.
The ls
configuration in your bashrc
file uses "aliases". Run the following command to show all of your ls
aliases:
cat ~/.bashrc | grep "alias.*ls"
Now, to transfer those aliases to your ~/.zshrc
file, run the following commands:
cat ~/.bashrc | grep "alias.*ls" >> ~/.zshrc
. ~/.zshrc
Note: . ~/.zshrc
is the same as source ~/.zshrc
but with less typing.
You can do the same thing for grep
:
cat ~/.bashrc | grep "alias.*grep" >> ~/.zshrc
. ~/.zshrc
¹inherited from "rc file" used on older Unix systems
zshrc
setup. The rest of the answer will still work but you will need to restartzsh
to get rid of the jumbled up text.