Skip to content

Instantly share code, notes, and snippets.

Last active January 17, 2018 21:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save corinneling/ae3ce3885495115c9d39f0ef802af435 to your computer and use it in GitHub Desktop.
Save corinneling/ae3ce3885495115c9d39f0ef802af435 to your computer and use it in GitHub Desktop.
Dotfiles: Understanding & setting them up

Dotfiles: Understand their purpose and how to set them up

One thing I had trouble grasping at first were dotfiles, and I know that is pretty basic, but all the articles I read skipped the initial, what and went into customization details. So, I am documenting the basics of what dotfiles are, how to see them, access them, set them up etc.

The Environment I'm working in

Mac, Bash,, Git

What are they:

  • Dotfiles start with a '.' and are followed by their name
    • Ex) .bash_prompt
  • They hold configurations for files
    • I've only set up dotfiles to be used for bash, so that's all I'm really going to talk about right now.
  • They are originally hidden
    • You might even have to create them like I did.

Beginner set up:

  1. Before you can do anything, you need to see your dotfiles
    • Open your terminal
    • Paste in $ defaults write AppleShowAllFiles YES
    • Then you'll have to restart your Finder, the command $ killall Finder is kind of scary, but it's just telling Finder to restart
  2. Create some if you don't have any
    • Now I thought I was stupid because I still couldn't find my dotfiles, and that's because for some reason, I didn't have any of the bash ones
    • To create your bash dotfiles navigate to your home directory $ cd ~
    • Then use the touch command $ touch <file name>
    • The first two I created were .bashrc and .bash_profile
  3. I started off by creating aliases because those are pretty easy and you can have a lot of fun with them.
    • Create an alias with this structure alias <aliasName>="<original command"
    • Here's a link to my dotfiles. I would suggest looking at this handy dandy list GitHub put together a list of some of the best dotfiles people have created
    • I put my aliases in a dotfiles I created called .aliases, if you do that make sure to call that file in your main bash dotfile
    • Also, everytime you add a new alias to the dotfile, or anything for that matter, just saving the file will not be enough for your changes to show up in the terminal
    • You need to restart the terminal everytime with source ~/.bashrc << that's a good one to create an alias for!
    • Mine is alias rbash="source ~/.bashrc"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment