Creating Symlinks in OSX

Bryan Dugan1 min read

If you are just getting started with using the Terminal in OSX, you may have trouble getting to common things like your hosts file. It is possible to create a Symlink (symbolic link) or shortcut in Terminal to get to that specific folder extremely quickly.

Use the following formula to create a symlink

ln -s /any/file/on/the/disk shortcut-name

Example: Creating a symlink to your hosts file.

ln -s /etc/hosts hosts-shortcut

Now to quickly open your hosts file all you have to do is use the symlink you created. In this example, we are opening our hosts file with the vim text editor.

sudo vim hosts-shortcut

Note: You must run sudo to modify your hosts file.

Note: Any links leading you to products or services are most likely affiliate links that I will receive compensation from. I only promote products or services that I own/use myself and truly feel will deliver value to you. By purchasing products or service through these links, you will help support me to keep creating awesome ad-free content.