• Stars
    star
    1,567
  • Rank 29,877 (Top 0.6 %)
  • Language
    Shell
  • License
    MIT License
  • Created almost 13 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

My Ubuntu / OS X dotfiles.

Dotfiles

My OSX / Ubuntu dotfiles.

About this project

I've been using bash on-and-off for a long time (since Slackware Linux was distributed on 1.44MB floppy disks). In all that time, every time I've set up a new Linux or OS X machine, I've copied over my .bashrc file and my ~/bin folder to each machine manually. And I've never done a very good job of actually maintaining these files. It's been a total mess.

I finally decided that I wanted to be able to execute a single command to "bootstrap" a new system to pull down all of my dotfiles and configs, as well as install all the tools I commonly use. In addition, I wanted to be able to re-execute that command at any time to synchronize anything that might have changed. Finally, I wanted to make it easy to re-integrate changes back in, so that other machines could be updated.

That command is dotfiles, and this is my "dotfiles" Git repo.

How the "dotfiles" command works

When dotfiles is run for the first time, it does a few things:

  1. In Ubuntu, Git is installed if necessary via APT (it's already there in OSX).
  2. This repo is cloned into your user directory, under ~/.dotfiles.
  3. Files in /copy are copied into ~/. (read more)
  4. Files in /link are symlinked into ~/. (read more)
  5. You are prompted to choose scripts in /init to be executed. The installer attempts to only select relevant scripts, based on the detected OS and the script filename.
  6. Your chosen init scripts are executed (in alphanumeric order, hence the funky names). (read more)

On subsequent runs, step 1 is skipped, step 2 just updates the already-existing repo, and step 5 remembers what you selected the last time. The other steps are the same.

Other subdirectories

  • The /backups directory gets created when necessary. Any files in ~/ that would have been overwritten by files in /copy or /link get backed up there.
  • The /bin directory contains executable shell scripts (including the dotfiles script) and symlinks to executable shell scripts. This directory is added to the path.
  • The /caches directory contains cached files, used by some scripts or functions.
  • The /conf directory just exists. If a config file doesn't need to go in ~/, reference it from the /conf directory.
  • The /source directory contains files that are sourced whenever a new shell is opened (in alphanumeric order, hence the funky names).
  • The /test directory contains unit tests for especially complicated bash functions.
  • The /vendor directory contains third-party libraries.

The "copy" step

Any file in the /copy subdirectory will be copied into ~/. Any file that needs to be modified with personal information (like copy/.gitconfig which contains an email address and private key) should be copied into ~/. Because the file you'll be editing is no longer in ~/.dotfiles, it's less likely to be accidentally committed into your public dotfiles repo.

The "link" step

Any file in the /link subdirectory gets symlinked into ~/ with ln -s. Edit one or the other, and you change the file in both places. Don't link files containing sensitive data, or you might accidentally commit that data! If you're linking a directory that might contain sensitive data (like ~/.ssh) add the sensitive files to your .gitignore file!

The "init" step

Scripts in the /init subdirectory will be executed. A whole bunch of things will be installed, but only if they aren't already.

OS X

Ubuntu

Both

Hacking my dotfiles

Because the dotfiles script is completely self-contained, you should be able to delete everything else from your dotfiles repo fork, and it will still work. The only thing it really cares about are the /copy, /link and /init subdirectories, which will be ignored if they are empty or don't exist.

If you modify things and notice a bug or an improvement, file an issue or a pull request and let me know.

Also, before installing, be sure to read my gently-worded note.

Installation

OS X Notes

You need to have XCode or, at the very minimum, the XCode Command Line Tools, which are available as a much smaller download.

The easiest way to install the XCode Command Line Tools in OSX 10.9+ is to open up a terminal, type xcode-select --install and follow the prompts.

Tested in OSX 10.15

Ubuntu Notes

You might want to set up your ubuntu server like I do it, but then again, you might not.

Either way, you should at least update/upgrade APT with sudo apt-get -qq update && sudo apt-get -qq dist-upgrade first.

Tested in Ubuntu 14.04 LTS

Heed this critically important warning before you install

If you're not me, please do not install dotfiles directly from this repo!

Why? Because I often completely break this repo while updating. Which means that if I do that and you run the dotfiles command, your home directory will burst into flames, and you'll have to go buy a new computer. No, not really, but it will be very messy.

Actual installation (for you)

  1. Read my gently-worded note
  2. Fork this repo
  3. Open a terminal/shell and do this (change cowboy and master as appropriate):

Ubuntu

export DOTFILES_GH_USER=cowboy
export DOTFILES_GH_BRANCH=master
bash -c "$(wget -qO- https://raw.github.com/$DOTFILES_GH_USER/dotfiles/$DOTFILES_GH_BRANCH/bin/dotfiles)" && source ~/.bashrc

macOS

export DOTFILES_GH_USER=cowboy
export DOTFILES_GH_BRANCH=master
bash -c "$(curl -fsSL https://raw.github.com/$DOTFILES_GH_USER/dotfiles/$DOTFILES_GH_BRANCH/bin/dotfiles)" && source ~/.bashrc

Since you'll be using the dotfiles command on subsequent runs, you'll only have to set the DOTFILES_GH_USER variable for the initial install, but if you have a custom branch, you will need to export DOTFILES_GH_BRANCH for subsequent runs.

There's a lot of stuff that requires admin access via sudo, so be warned that you might need to enter your password here or there.

Actual installation (for me)

Ubuntu

bash -c "$(wget -qO- https://bit.ly/cowboy-dotfiles)" && source ~/.bashrc

macOS

bash -c "$(curl -fsSL https://bit.ly/cowboy-dotfiles)" && source ~/.bashrc

Aliases and Functions

To keep things easy, the ~/.bashrc and ~/.bash_profile files are extremely simple, and should never need to be modified. Instead, add your aliases, functions, settings, etc into one of the files in the source subdirectory, or add a new file. They're all automatically sourced when a new shell is opened. Take a look, I have a lot of aliases and functions. I even have a fancy prompt that shows the current directory, time and current git/svn repo status.

Scripts

In addition to the aforementioned dotfiles script, there are a few other bin scripts. This includes nave, which is a git submodule.

  • dotfiles - (re)initialize dotfiles. It might ask for your password (for sudo).
  • src - (re)source all files in /source directory
  • Look through the bin subdirectory for a few more.

Prompt

I think my bash prompt is awesome. It shows git and svn repo status, a timestamp, error exit codes, and even changes color depending on how you've logged in.

Git repos display as [branch:flags] where flags are:

? untracked files
! changed (but unstaged) files
+ staged files

SVN repos display as [rev1:rev2] where rev1 and rev2 are:

rev1 last changed revision
rev2 revision

Check it out:

My awesome bash prompt

Inspiration

https://github.com/gf3/dotfiles
https://github.com/mathiasbynens/dotfiles
(and 15+ years of accumulated crap)

License

Copyright (c) 2014 "Cowboy" Ben Alman
Licensed under the MIT license.
http://benalman.com/about/license/

More Repositories

1

jquery-hashchange

This jQuery plugin enables very basic bookmarkable #hash history via a cross-browser HTML5 window.onhashchange event.
JavaScript
1,214
star
2

jquery-bbq

jQuery BBQ: Back Button & Query Library
JavaScript
1,175
star
3

jquery-throttle-debounce

jQuery throttle / debounce: Sometimes, less is more!
JavaScript
1,125
star
4

jquery-tiny-pubsub

A really, really, REALLY tiny pub/sub implementation for jQuery.
JavaScript
961
star
5

jquery-resize

A resize event for ALL your jQueries!
JavaScript
549
star
6

php-simple-proxy

Simple PHP Proxy: Get external HTML, JSON and more!
JavaScript
538
star
7

javascript-debug

JavaScript Debug: A simple wrapper for console.log
JavaScript
434
star
8

jquery-postmessage

jQuery postMessage: Cross-domain scripting goodness
JavaScript
356
star
9

jquery-dotimeout

jQuery doTimeout: Like setTimeout, but better!
JavaScript
273
star
10

javascript-hooker

Monkey-patch (hook) functions for debugging and stuff.
JavaScript
243
star
11

jquery-outside-events

Why trigger an event on something, when you can trigger it on everything else?
JavaScript
229
star
12

javascript-linkify

JavaScript Linkify: Process links in text
JavaScript
135
star
13

synology-update-plex

Script to Auto Update Plex Media Server on Synology NAS
Shell
110
star
14

node-globule

An easy-to-use wildcard globbing library.
JavaScript
103
star
15

javascript-library-boilerplate

JavaScript Library Boilerplate: Roll your own
JavaScript
100
star
16

jquery-replacetext

String replace for your jQueries!
JavaScript
90
star
17

wesbos

WES BOS
JavaScript
87
star
18

javascript-route-matcher

A simple route matching / url building utility. Intended to be included as part of a larger routing library.
JavaScript
81
star
19

javascript-sync-async-foreach

An optionally-asynchronous forEach with an interesting interface.
JavaScript
76
star
20

jquery-misc

Miscellaneous small jQuery plugins and code fragments
JavaScript
75
star
21

talks

Slides (and more) from my talks
CSS
65
star
22

node-exit

A replacement for process.exit that ensures stdio are fully drained before exiting.
JavaScript
65
star
23

jquery-message-queuing

jQuery Message Queuing: Get all your JavaScript ducks in a row
JavaScript
61
star
24

jquery-urlinternal

jQuery urlInternal allows you to easily test internal-, external-, or fragment-ness for any relative or absolute URL. Includes element filtering methods and pseudo-selectors.
JavaScript
37
star
25

node-prolog

An event- and stream-aware logger for pros. Meaning, professionals.
JavaScript
34
star
26

jquery-equalizebottoms

jQuery equalizeBottoms
JavaScript
34
star
27

node-getobject

get.and.set.deep.objects.easily = true;
JavaScript
31
star
28

ed-rare-trade-route-generator

Elite: Dangerous Rare Trade Route Generator
Ruby
31
star
29

javascript-packify

Packify: Something like a JavaScript packer
JavaScript
28
star
30

js1k-organ1k

Organ1k: JS1k contest entry
JavaScript
24
star
31

javascript-emotify

JavaScript Emotify: Making the web a better place, one tiny image at a time...
JavaScript
23
star
32

node-toc

Linkify HTML headers and generate a TOC.
JavaScript
17
star
33

node-glob-whatev

A quick and dirty file globbing utility based on minimatch.
JavaScript
14
star
34

javascript-getclass

Get the [[Class]] of a value.
JavaScript
13
star
35

battlelog-hacks

Battlelog Hacks: EA's new Battlelog service is pretty awesome. Except when it isn't.
JavaScript
13
star
36

node-heredoc-tag

Heredoc helpers for ES2015 template strings
JavaScript
13
star
37

jquery-longurl

jQuery longUrl: Uniform Resource Elongator
JavaScript
13
star
38

jquery-getobject

jQuery getObject: get.and.set.deep.objects.easily = true;
JavaScript
12
star
39

jquery-starwipe

jQuery Star Wipe: Why eat hamburger when you can have steak?
JavaScript
9
star
40

grunt-jquery-example

This is example output generated by the "grunt init:jquery" task.
JavaScript
9
star
41

jquery-plugin

This "shell" plugin repo contains the directory structure and files that I use to create a new plugin. It exists only to make my life easier. Feel free to utilize anything here (customized for your needs, of course) if it helps you with your plugin development.
JavaScript
9
star
42

javascript-htmlslice

An HTML-aware String#slice.
JavaScript
9
star
43

node-linken

like "npm link" but maybe easier or something.
JavaScript
7
star
44

js-es6-es7-workflow-ideas

JS / ES6 / ES7 Workflow Ideas
JavaScript
6
star
45

Simplified.lnk2Style

A Linkinus Style
JavaScript
6
star
46

gaucho-old

Ruby + Git + Content = Gaucho
Ruby
6
star
47

textual-simplified-stealth

Simplified Stealth: a Textual IRC Style
JavaScript
6
star
48

grunt-node-example

This is example output generated by the "grunt init:node" task.
JavaScript
6
star
49

jquery-untils

jQuery Untils: nextUntil, prevUntil, parentsUntil
JavaScript
6
star
50

node-zombie-connect-socket

zombie <-> connect, without a physical port.
JavaScript
4
star
51

wow-cowboy

WoW miscellany
Lua
4
star
52

js-art

I call it "art"
CSS
4
star
53

Organ1k

Organ1k Screen Saver (OS X 10.5+)
Objective-C
4
star
54

state-of-grunt-fe-summit-2014-talk

The State of Grunt, August 2014
JavaScript
4
star
55

github-markdown-anchors

3
star
56

node-jqbuild

A command line build tool for jQuery plugins.
JavaScript
3
star
57

css-misc

Miscellaneous CSS Examples
JavaScript
3
star
58

personal-jira-tweaks

This extension is specific to my workplace's JIRA and will most likely not work for you
CSS
3
star
59

benalman.com-idea

An experiment.
JavaScript
3
star
60

grunt-commonjs-example

This is example output generated by the "grunt init:commonjs" task.
JavaScript
3
star
61

bash-misc

Miscellaneous bash scripts and configs
Shell
2
star
62

grunt-gruntfile-example

This is example output generated by the "grunt init:gruntfile" task.
JavaScript
2
star
63

grunt-testing123

Whatever
JavaScript
2
star
64

grunt-gruntplugin-example

This is example output generated by the "grunt init:gruntplugin" task.
JavaScript
2
star
65

REDACTED

Because I don't care if you find the name of this project offensive.
JavaScript
2
star
66

bots

Some bot stuff I'm fooling around with.
JavaScript
2
star
67

processingjs-pattern

A processing.js pattern
JavaScript
2
star
68

Linkinus.AdiumEmoticonset

Emoticons for Simplified
1
star
69

benalman.com-content-OLD

Movable Type + Gaucho + OCD = This is going to take a while...
Python
1
star
70

gaucho

Ruby + Git + Content = Gaucho
Ruby
1
star
71

move_follow_test

testing if followers are preserved with a move
1
star
72

node-stream-eachline

Like readline or split, but behaves more like ruby's .each_with_index method when streams lack trailing newlines.
JavaScript
1
star
73

philly-ete-talk

Building the โ€œFront Halfโ€ of Your App (With Grunt)
JavaScript
1
star
74

jsconf-grunt-test

A grunt test thing for JSConf
1
star
75

comment.aculo.us

Have you ever wanted to comment on mir.aculo.us blog posts? Me neither. But now, you can!
JavaScript
1
star