« Back to Index

[Symlinking]

View original Gist on GitHub

Tags: #terminal #command #symlink

Symlinking.bash

# ln -s <real_path> <fake_path>

# for example, if we want ./lib to point to the real directory in ../../lib/go
ln -s ../../lib/go ./lib

# IMPORTANT!
#
# Don't add trailing / to the fake_path 
# otherwise the shell will tell you fake_path doesn't exist.

# REAL EXAMPLE
#
# I have the directory ~/Code/Go in which I've created a directory called "go-flags"
# Any time someone goes to lookup ~/go/src/github.com/integralist/go-flags (such as when go code imports a package!)
# Then I want them to be directed to ~/Code/Go/go-flags
cd ~/go/src/github.com/integralist
ln -s ~/Code/Go/go-flags ./go-flags
ls -laGpFHh

# go-flags@ -> /Users/markmcdonnell/Code/