You can use aliases to set shortcuts to complex terminal commands. This is how:
- In Terminal, run
cd && open -e .bash_profile
- In the opened file, add your alias. For this example, I’ll make a command
zephthat opens this website in a browser:
alias zeph="open 'https://zeph.co'"
Save the file.
- Now you can run your command.
&& to chain commands
You can use
&& to chain commands. However, pay attention to blocking operations:
# incorrect jekyll serve && code .
This won’t open VS Code until you stop the server. You’ll need to reverse them:
# correct code . && jekyll serve
&&, you could set an alias that opens VS Code to your working directory, opens your browser to localhost:3000, and spins up an npm server when you type
work. The possibilities are limitless.