This is a walk-with-me-while-I-do-things series, I'm going to tell you what I learned while I'm learning
You might remember about my ordeal with bash and Catalina and zshell and iTerm. I bit the bullet and switched to zshell.
I have an alias for starting the postgres server that on bash resides on .bashrc
(by the way, did you know that rc
stands for run commands
?). With zshell, you can use .zshrc
for the same purpose.
zshell at startup reads these files for the user in the following order:
-
.zshenv
- always read when launching the shell, no matter from where. you want the important stuff here. -
.zshprofile
- read at login. don't use, use.zshlogin
instead. the purpose is the same. -
.zshrc
- read when interactive. this is where you should put aliases, key bindings, coloring, etc. -
.zshlogin
- read at login, use it for things needed once the shell is set up, to execute external commands. -
.zshlogout
- read when the login shell exits, it should be used to release resources acquired during login.
Before each of these, zshell runs the matching files that can be found in /etc/
for all users on the machine.
More info here (official documentation), here on StackOverflow, and here (switching to zshell because of Catalina).
Top comments (3)
I have this in my .bashrc, .bash_profile and .zshrc:
That way I keep my aliases in a common file. Sure, some are shell specific but more likely they're OS specific, so inceptionally inside the .aliases file, I have stuff like this:
oh this is so simple and yet so great!
I'll steal your idea :D
at first I was also thinking that, but then the “remote” part was really not fitting... why remote if this is running on my machine? 🤔
I looked for it and ta-da! TIL inception!