You’ll need the direct path to your learn directory.
for example: /Users/[you]/Development/code
if you don’t know what it is you can always open atom and right click on the directory and click on “copy full path” then make sure to paste this somewhere where you can use later.
Open your terminal and create a bash_aliases file vi ~/.bash_aliases
This will open up the file in the vi editor which is not how we want to edit this file. Type in :wq (this will save the file and bring you back to the terminal.
Next, let’s open up the same file with our default text editor open -e ~/.bash_aliases
Type in any alias that you want with the alias syntax alias [name_of_alias]=[command]
for example alias home=“cd ~”
To chain alias commands together we need to create a function. To cd into a learn directory AND open atom, we will do this:
cd 'enter your full path to learn directory including the single quotes'
} for example:
command+s to save and exit the text editor.
Now let’s tell your bash profile to load this file every time you open terminal. This tells your computer that you can use these aliases any time in your terminal as long as you’re signed into bash.
In the terminal: open -e ~/.bash_profile
Copy and paste the below code into your bash profile in the very top
if [ -f ~/.bash_aliases ]; then
command + s to save, exit the text editor.
Restart your terminal and exit Atom completely so we can test this out.
Type in the name of your function inside your terminal and atom should open up with your learn directory!