1

I'm currently trying to clean up my Mac. I hate it when my home directory (~) is full with config files and stuff I don't want to see all the time (.bash_history, .bash_sessions, etc.).

My idea about it was to create one folder .dotfiles and one folder .other which should contain all these files (.bash_profile, .vimrc in subdirectories of .dotfiles - less important files in .other).

I'm currently trying to find a way to achieve this. Symlinks came to my mind, but I'm not really sure if they are meant for something like this or whether there is a better way. How can I even create a symlink for files that already exists in place A and doesn't exist in place B yet and I want the system to see them at play B instead of place A?

Any clean-up tips in general are more than welcome!

PS: Just deleting and creating an empty file at place B doesn't work. My .bash_history didn't work with a symlink to an empty file.

3

Programs using dot files for configuration expect them to live directly in your home directory. Symlinks can indeed help with this. What you want to do can be achieved by moving your dot file to the required sub-directory (.dotfiles or .other in your example) and then symlinking the file you just moved into your home directory.

Example (code to run from inside your home directory):

$ mkdir .dotfiles
$ mv .vimrc .dotftiles
$ ln -s .dotfiles/.vimrc .
  • if you understood youre a smarter man than i. have a vote. – mikeserv Jan 25 '16 at 3:53
  • 1
    I don't think this cleans it up really, it will still be filled with symlinks instead of the files. – DisplayName Jan 25 '16 at 22:32
  • @DisplayName True but it makes it easier to maintain – Joseph R. Jan 25 '16 at 22:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.