DEV Community

Clarice Bouwer
Clarice Bouwer

Posted on • Originally published at curiousprogrammer.dev on

Create a symlink for hidden files

I want to create a symlink for all hidden files excluding the hidden directories. I want to put my configuration files in my home directory into version control.

I need to exclude the hidden directories because they contain binaries and what not.

Using this one liner, I can create a symbolic link for every hidden file in my home directory to my working (or target) directory.

for f in .*; do if [[-f $f]]; then ln -s /home/me/$f /home/me/working/directory/$f; fi; done
Enter fullscreen mode Exit fullscreen mode

I execute this from my source directory.

I can verify that my symlinks exist in my target directory

cd /home/me/working/directory
ls -lah
Enter fullscreen mode Exit fullscreen mode

I should see a few lines that look like this:

lrwxrwxrwx. 1 me me 26 Jan 27 10:49 .zsh_history -> /home/me/.zsh_history
lrwxrwxrwx. 1 me me 20 Jan 27 10:49 .zshrc -> /home/me/.zshrc
Enter fullscreen mode Exit fullscreen mode

Image of Datadog

The Future of AI, LLMs, and Observability on Google Cloud

Datadog sat down with Google’s Director of AI to discuss the current and future states of AI, ML, and LLMs on Google Cloud. Discover 7 key insights for technical leaders, covering everything from upskilling teams to observability best practices

Learn More

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay