Sharing my shell dotfiles for developers using macOS, Linux, ZSH or Bash
My aim is make my configs easy to understand and manage - using functions to make the shell config lighter, if statements to turn on features when needed. I use aliases at the shell and git level to make it easy to reach for long or frequently-used commands.
If want to just see config files, skip ahead to Part 2.
What you'll discover in this post series
Click links to skip to that part of the series.
- What is a dotfile?
- My shell config setup
- My shell aliases
- My git config file (mostly git aliases)
- My global git ignore file
- How to write a shared config that gets loaded by both
.zshrc
and.bashrc
Background
Let me give you an idea of what development I do on a daily basis. You'll see the configs fit into these areas.
- Linux and macOS
- Bash and ZSH
- Git for version control
- Scripting using Python, JavaScript, NPM and NVM
- A bit of scripting using Deno, Go and Ruby
What is a dotfile?
A dotfile is a file or directory which has a name that starts with a "full-stop" or "dot".
On "Unix-like systems", such as Linux and macOS, a dotfile is hidden by default when viewing files in a folder browser and the shell. This makes it harder to see and edit but keeps them out of the way unless you are actually looking for them.
For example running ls
shows Documents
, Downloads
etc. but ls -a
will show all hidden files like .aliases
and .bashrc
and directories like .config/
and .ssh/
.
Config files are typically stored are dotfiles in the user home directory. Such as ~/.bashrc
.
You can open it for editing from the command-line using something like this:
$ edit ~/.bashrc
$ nano ~/.bashrc
$ vim ~/.bashrc
$ code ~/.bashrc # VS Code
$ subl ~/.bashrc # Sublime
My global dotfiles
The next few posts in this series cover content for files in user directory.
I provide links to files in my MichaelCurrin/dotfiles repo, which I created specifically for sharing in this blog post.
I also highlight and explain some of the content directly in the posts.
Dotfiles by other people
For further reading, see this dotfiles post by @helderburato
. It includes dotfiles by a few people.
I have heard of yadm
as a dotfile manager from comments on my post. I haven't used it before but its site has a couple of dotfile repos linked there.
Side note - the way I manage my dotfiles is actually through a private repo cloned locally. I have symlink in my home directory pointing to .bashrc
and others in the repo, so get the benefit of my repo code being used live and I get to regularly push and pull changes on GH to keep work and personal laptops in sync. I find it works well.
Next
Onto the configs! Go to Part 2 for my shell configs.
Top comments (4)
Hey Mike, not sure if you mention it down the line, but I HIGHLY recommend
yadm
to manage all of your dotfiles. Makes everything a cinch, even for the not so gritty hackers.Heya thanks for sharing. I've added a link to one of its pages in this post.
I am interested to see how it works. I added an explanation at the end above of how my setup works.
Very cool man. Just followed!
It sounds like your setup is exactly what yadm does, so looks like we're on the same page. I'm newly getting into customizing my dots and even caring about the level of customizability that brings, so for me as a beginner, it was simple enough.
Glad to hear.
I added a setup script in my repo which does this essentially. It adds the symlinks for me so it is easy to run across machines when I make changes.
The -f will overwrite existing symlinks in case they broke.
I also do a check to see if the files are text files to remind me to move their content out.