10

Tip #837   Move a file and link to the new location

Use the one liner below to relocate a file or directory, but keep it accessible on the old location through a symlink.

lmv() { [ -e "$1" -a -d "$2" ] && mv "$1" "$2"/ && ln -s "$2"/"$(basename "$1")" "$(dirname "$1")"; }