Sorry, no Windows instructions as I don’t use Windows. Use Google if that’s the OS you use.
I found a funny post on Reddit that highlights how we, as developers, can lose productivity over the small things, like typos:
I don’t have this set up, as I mostly use a GUI for Git (GitHub Desktop). But I use other aliases. Most notably
ll instead of
How do I set up an alias in the terminal?
I said macOS in the title, but this works also on Linux of course.
Here’s the syntax:
alias <newcommand>='<old command>'
Here’s the example I mentioned above:
alias ll='ls -al'
This works in Bash, Zsh, Fish shell and others too.
If you write this in your shell, from now on
ll will be a new available command in the console.
Note: this alias is going to be valid for the entire session, which means until you close the shell, or you restart the computer, whatever comes first.
To persist the aliase, so you can use them any time in the future, you need to add it to the configuration file for your shell.
If you use Bash, that’s the
.bash_profile in your home folder. It’s an invisible file, so you might need to open it with the terminal rather than the Finder:
~always points to your home folder path
(assuming you have Visual Studio Code installed, which provides the
~/.bash_profile does not exist, you can create it, and the shell will pick it up. You can also use the
~/.bashrc file, if present.
For licensing purposes, macOS Catalina comes with a new shell by default, called Zsh. In this case, the configuration file is in the
~/.zshrc file, still in your home folder.
The fish configuration is stored in
~/.config/fish/config.fish, but you’ll most likely configure it via the
Download my free books, and check out my premium React/Vue/Svelte/Node/Next.js courses!