~/.dotfiles in 100 Seconds

Fireship · Beginner ·📰 AI News & Updates ·5y ago

Key Takeaways

The video discusses the concept of dotfiles and how to set up a dotfiles repository to automate the setup of a computer, using tools like zsh, git, and Homebrew. It covers the process of creating a git repository, customizing the shell experience, and using symbolic links to store copies of files in two places at once.

Full Transcript

dot files set up or restore a fully customized development environment by maintaining a repository of text-based config files as developers were trained to write dry code do not repeat yourself but this principle also applies to other areas of a developer's life like the configuration of a development environment imagine this you spent months fine tuning your top of the line intel mac but now need to throw it in the garbage because the new mac mini with an m1 chip will blow it out of the water are you going to reinstall and reconfigure everything from scratch hopefully not dot files are those little hidden files on your system that start with a period like bashprofile.env or git config just to name a few with a repository of these files you can chronicle the installation of your favorite applications and command line tools keep track of how all that software is configured and record all the various system preferences and changes that you've made to your computer these files already live on your system and when you harness their power you can replicate your perfect development environment on a new computer in a completely hands-off and automated way to get started you'll want to organize all of your configuration files in a git repository that will allow you to track changes and clone the repo on other machines its code will contain at least one script that applies or installs the configurations on a new system and that means weeks of hard manual labor can be reduced down to a git clone followed by an install script maintaining your own dot files repo will help you develop discipline for other important skills from command line use to get to the organization and inner workings of your machine wax on wax off read if you're ready to learn more and build your own dot files repo stay tuned today we're going beyond 100 seconds with special guest patrick mcdonald he's the instructor of a full dot files course and will teach you how to set up your own dot files repo step by step taking your developer productivity to the next level youtube meet patrick over the last 20 plus years i've set up enough computers to have acquired an appreciation of automating that process and i've gathered a few tricks i'd like to share with you hello everyone i'm patrick and i'll be your guide as we go beyond 100 seconds to learn how to back up a few typical dot files without disturbing your computer's ability to use those files to configure software if you've never heard of dot files you're probably familiar with a home directory that looks like this but as jeff mentioned mac os is littered with hidden files vs code is open to the same home directory and its file explorer shows several more items we can tell finder to show the same hidden files by entering the key combination command shift period most hidden files have a dot prefix hence the name dot files they can be folders as well as files and in special cases they can be hidden by the operating system even though they are missing the dot that's all we need to know about finder so let's look at vs code where we can see that our system uses dot files in our home directory software that comes pre-installed uses hidden files too and so does the custom software that we install on our own if you've been using your computer for a significant amount of time you likely have many more dot files here we are going to focus on these two at the bottom git config and zshrc when you started using git you probably issued a pair of commands to set your name and email address those settings ended up here in the git config file as you continue learning and using git this file can grow with more configurations before we move on let me recommend using the no reply email address available with your github account when you publish your dot files repo for the world to see this lets you keep your personal email address a secret zsh is the new default shell on mac os and the zshrc file is what you use to customize the shell experience so far we are only using this to customize the prompt but like we saw with the git config file we can add to this file in many ways we already have two files that are going to change over time what does this mean yes it means we're going to need a git repository to start tracking these files along with the changes we make to them let's open the integrated terminal where we can see our super fancy custom prompt in action and where we can see that we start off in the home directory i've already set up a repository on github so i'll start a git clone command and paste in the ssh url now we need to tell it the directory to create and since everybody else is doing it let's make a hidden folder by prefixing our dot files repo with a period our new directory has a readme that we will look at shortly but let's start by moving these two dot files into the repo so we can back them up of course the act of moving them isn't enough and these two files are still untracked so we will cd into the dot files directory where we can add the two files to the repository and then we will commit them but is this all we have to do will we be done after entering this command let's try it and it looks like we have a problem instead of using the user information that we just saw in our git config the output says that git automatically configured this committer information based on the username and hostname remember that software likes to use our home directory so by moving this file to a different location we've broken the configuration every time we make a commit git will remind us of this problem let's copy this suggested command about resetting the author and amending the commit and we will try to fix this in a few minutes what about our zsh configurations i think we can assume that these are broken as well keep an eye on the file explorer to the left as i kill this terminal when a shell session ends its command history is written out and as software continues to add files to our home directory we have to decide whether to move these files to our repository zsh history is not the type of file we want to track in our repo so we will leave it here in the home directory we just saw that zsh writes to our home directory but it tries to read from it as well if we open a new shell we see that we've lost our custom prompt because zsh could not find the zshrc file instead we see the default prompt which happens to have a similar default to the one we just saw for git using the same username and hostname combination how do we fix these broken configurations we don't want to duplicate these files store their copies in the home directory and manually keep them in sync luckily there's a way that a file can be in two places at the same time which is called a symbolic link or symlink for short to create one we will use the ln or link command then we will add the s option which stands for symbolic link now we'll pass in the full path to the real file in our dot files directory and lastly we'll pass in the path to the original location where the zshrc file is expected to live the file explorer now shows that the zshrc file is back in the home directory but it has an arrow to the right which signifies that this is a sim link if that arrow does not show up for you reload the window and it should appear now i'll kill the terminal again and open the new simlink version from the home directory to the right of the zshrc file in our dot files directory they both look like normal files don't they but if i add a comment to the real file and save it we can see that changes to the real file at the left will show up in the symlink version at the right of course we can delete these lines from the right and after another save those changes are reflected at the left since vs code can follow the sim link to the real file and treat it as a real file i bet zsh can too if we open a new shell we see our custom prompt has returned when a shell loads it looks for the zshrc file in the home directory which follows the sim link to the real file and the customization makes it into the shell not only did the shell load the zshrc file it also loaded the zsh history file which is still in the home directory this means we have access to previous commands i can press up to retrieve the most recent command from the history and then alter it to create a sim link for the git config file which we see appear in the explorer with another arrow icon we've seen enough of the home directory so before testing our git config fix let's open only the dot files directory the key combo we used in finder to show hidden files command shift period works here as well of course the arrows here on the file icons mean the same thing they do in the file explorer after opening the dot files directory we have less clutter to look at since we have the dot files directory open in vs code the integrated terminal will start at the same location when we fire up a new shell a git log command will remind us that our last commit has the wrong author which happened because we moved the git config file we can check to see if our second sim link is working by checking the global git config for the email address which shows the correct no reply email address that we saw before now i'll paste in the command that i copied a bit ago if you issue this command as is you'll end up editing the commit in vim because it is the default editor and if you're like me it will take you half an hour to figure out how to exit them changing the default editor perhaps to nano or vs code is the type of configuration you could make to your git config file and the change would be tracked in your repo but in this case we don't actually want to edit the contents of the commit so we can add the no edit option another look at the git log shows that the author information has been corrected we have successfully backed up our configurations while preserving the ability to use them but that won't do a lot of good if our software is not installed we need an automated way of installing software and for that we will use a package manager called homebrew it just so happens that i used homebrew to install vs code along with some other software we don't have time to learn much about it but homebrew keeps track of what it has installed and can output a list of software with this command after brew bundle dump i'll add the describe option for a little more info this command will create a file in your current directory so it's important that we are already in our dot files repo our new brew file has a list of software that can be reinstalled at a later date taps are the repositories where homebrew keeps its own software along with the information about the other software it can install brews are tools you typically use in your shell these top two are new tools i've added to improve my shell experience while these bottom two are upgraded versions of pre-installed software so homebrew helps keep everything up to date and the casks at the bottom are full-blown applications that you probably recognize let's start one last shell add the brew file to start tracking it and do another commit note that this time we did not get the warning message that we saw before about automatically configuring the author that's another sign that our git config sim link is working so we will push our changes to the remote repository now we've saved our software along with some configurations but we haven't recorded the process when the time comes to bootstrap a new computer using our dot files repository we are likely to forget some steps instead of researching and relearning these things we can keep a list in the readme we haven't seen this first step yet before we can use git and homebrew we would need to install the command line tools after that we would clone the repository to our new machine ssh is preferred but you might want to start with https and switch remotes after you've had a chance to set up ssh with our configuration files on our machine we would then repeat our sim linking steps you can probably see that this would be unwieldy if we had a dozen sim links and the more manual steps we have the more error prone our process there are better ways to do this and this is the type of thing you'd eventually work into an install script finally we would install homebrew and then point it to our brew file to reinstall all of our software i really wish we had the time to see this step in action because it is very satisfying just like we saw in the git config and zshrc files here we have another list of ideas regarding improving our dot files process we haven't looked at saving system preferences organizing this repo into separate files building that install script or automating any of the steps we did there are 11 billion possibilities which we can't cover in 10 minutes let alone 100 seconds but as jeff mentioned i have a growing course that thoroughly covers this material and for the next 30 days i'll keep the price as low as the course platform allows enroll now and your next computer setup will be no match for your dot file skills thank you for watching and since there's no way i could possibly thank jeff enough for sharing his stage with me please thank him on my behalf by liking and sharing his videos subscribing to this channel and going pro at fire ship io thanks for watching and i will see you in the next one

Original Description

What are dotfiles? Take to take your developer productivity to the next level 🥋👊 by automating the setup of your computer. Go beyond 100 seconds with special guest Patrick McDonald to setup your own dotfiles repo from scratch http://dotfiles.eieio.xyz/ What are dotfiles? https://wiki.archlinux.org/index.php/Dotfiles Example repo https://github.com/eieioxyz/Beyond-Dotfiles-in-100-Seconds Full Dotfiles Course http://dotfiles.eieio.xyz/ #dev #learntocode#100SecondsOfCode Install the quiz app 🤓 iOS https://itunes.apple.com/us/app/fireship/id1462592372?mt=8 Android https://play.google.com/store/apps/details?id=io.fireship.quizapp Upgrade to Fireship PRO at https://fireship.io/pro Use code lORhwXd2 for 25% off your first payment. My VS Code Theme - Atom One Dark - vscode-icons - Fira Code Font
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Fireship · Fireship · 0 of 60

← Previous Next →
1 Angular 4 Development and Production Environments with Firebase
Angular 4 Development and Production Environments with Firebase
Fireship
2 OAuth with Angular and Firebase Tutorial
OAuth with Angular and Firebase Tutorial
Fireship
3 Anonymous Authentication with Angular and Firebase - Lazy Registration
Anonymous Authentication with Angular and Firebase - Lazy Registration
Fireship
4 Angular Router Guards for Firebase Users
Angular Router Guards for Firebase Users
Fireship
5 Angular Firebase CRUD App with NoSQL Database Tutorial
Angular Firebase CRUD App with NoSQL Database Tutorial
Fireship
6 Upload Files from Angular to Firebase Storage
Upload Files from Angular to Firebase Storage
Fireship
7 How to Deploy an Angular App to Firebase Hosting
How to Deploy an Angular App to Firebase Hosting
Fireship
8 Sharing Data between Components in Angular
Sharing Data between Components in Angular
Fireship
9 Loading Spinners for Asynchronous Firebase Data
Loading Spinners for Asynchronous Firebase Data
Fireship
10 Angular 4 Transactional Email with Google Firebase Cloud Functions
Angular 4 Transactional Email with Google Firebase Cloud Functions
Fireship
11 Firebase Database Rules Tutorial
Firebase Database Rules Tutorial
Fireship
12 Autocomplete Search with Angular4 and Firebase
Autocomplete Search with Angular4 and Firebase
Fireship
13 Reddit Inspired Upvoting System with Angular and Firebase NoSQL
Reddit Inspired Upvoting System with Angular and Firebase NoSQL
Fireship
14 Angular Drag-and-Drop File Uploads to Firebase Storage
Angular Drag-and-Drop File Uploads to Firebase Storage
Fireship
15 Text Translation with Firebase Cloud Functions onWrite and Angular 4
Text Translation with Firebase Cloud Functions onWrite and Angular 4
Fireship
16 Custom Usernames with Firebase Authentication
Custom Usernames with Firebase Authentication
Fireship
17 Twitter-Inspired Follow Unfollow Feature with Firebase and Angular 4
Twitter-Inspired Follow Unfollow Feature with Firebase and Angular 4
Fireship
18 Simple Pagination with Firebase and Angular 4
Simple Pagination with Firebase and Angular 4
Fireship
19 How to Connect Firebase Users to their Data - 3 Methods
How to Connect Firebase Users to their Data - 3 Methods
Fireship
20 Add Toast Message Notifications to your Angular App
Add Toast Message Notifications to your Angular App
Fireship
21 Facebook-Inspired Reactions System with Angular and Firebase
Facebook-Inspired Reactions System with Angular and Firebase
Fireship
22 Learn NgModule in Angular with Examples
Learn NgModule in Angular with Examples
Fireship
23 Lazy Loading Components in Angular 4
Lazy Loading Components in Angular 4
Fireship
24 Stripe Checkout Payments with Angular and Firebase - Part 1
Stripe Checkout Payments with Angular and Firebase - Part 1
Fireship
25 Process Stripe Payments with Firebase Cloud Functions - Part 2
Process Stripe Payments with Firebase Cloud Functions - Part 2
Fireship
26 Selling Digital Content in Angular with Stripe Payments - Part 3
Selling Digital Content in Angular with Stripe Payments - Part 3
Fireship
27 Angular 4 Full Text Search with Algolia - Part 1
Angular 4 Full Text Search with Algolia - Part 1
Fireship
28 Algolia with Firebase Cloud Functions - Part 2
Algolia with Firebase Cloud Functions - Part 2
Fireship
29 Firebase Phone Authentication in Angular 4
Firebase Phone Authentication in Angular 4
Fireship
30 Top 7 RxJS Concepts for Angular Developers
Top 7 RxJS Concepts for Angular Developers
Fireship
31 Learn Angular Animations with 5 Examples
Learn Angular Animations with 5 Examples
Fireship
32 Advanced Firebase Data Filtering (Multi-Property)
Advanced Firebase Data Filtering (Multi-Property)
Fireship
33 Realtime Maps with Mapbox + Firebase + Angular
Realtime Maps with Mapbox + Firebase + Angular
Fireship
34 Angular Reactive Forms with Firebase Database Backend
Angular Reactive Forms with Firebase Database Backend
Fireship
35 Send Push Notifications in Angular with Firebase Cloud Messaging
Send Push Notifications in Angular with Firebase Cloud Messaging
Fireship
36 Top 7 Ways to Debug Angular 4 Apps
Top 7 Ways to Debug Angular 4 Apps
Fireship
37 Infinite Scroll with Angular and Firebase
Infinite Scroll with Angular and Firebase
Fireship
38 Use TypeScript with Firebase Cloud Functions
Use TypeScript with Firebase Cloud Functions
Fireship
39 Realtime Graphs and Charts with Plotly and Firebase
Realtime Graphs and Charts with Plotly and Firebase
Fireship
40 Role-Based User Permissions in Firebase
Role-Based User Permissions in Firebase
Fireship
41 User Presence System in Realtime - Online, Offline, Away
User Presence System in Realtime - Online, Offline, Away
Fireship
42 Location-based Queries with GeoFire and Angular Google Maps
Location-based Queries with GeoFire and Angular Google Maps
Fireship
43 Angular ngrx Redux Quick Start Tutorial
Angular ngrx Redux Quick Start Tutorial
Fireship
44 Angular Ngrx Effects with Firebase Database
Angular Ngrx Effects with Firebase Database
Fireship
45 Progressive Web Apps with Angular
Progressive Web Apps with Angular
Fireship
46 Angular Ngrx with Firebase Google OAuth User Authentication
Angular Ngrx with Firebase Google OAuth User Authentication
Fireship
47 RxJS Quick Start with Practical Examples
RxJS Quick Start with Practical Examples
Fireship
48 Send SMS Text Messages with Twilio and Firebase
Send SMS Text Messages with Twilio and Firebase
Fireship
49 Firebase Database Performance Profiling
Firebase Database Performance Profiling
Fireship
50 Native Desktop Apps with Angular and Electron
Native Desktop Apps with Angular and Electron
Fireship
51 Subscription Payments with Stripe, Angular, and Firebase
Subscription Payments with Stripe, Angular, and Firebase
Fireship
52 Firestore with AngularFire5 Quick Start Tutorial
Firestore with AngularFire5 Quick Start Tutorial
Fireship
53 Angular HTTP Client Quick Start Tutorial
Angular HTTP Client Quick Start Tutorial
Fireship
54 Google Sign-In with Firestore Custom User Data
Google Sign-In with Firestore Custom User Data
Fireship
55 Star Review System from Scratch with Firestore + Angular
Star Review System from Scratch with Firestore + Angular
Fireship
56 Angular Chatbot with Dialogflow (API.ai)
Angular Chatbot with Dialogflow (API.ai)
Fireship
57 Learn @ngrx/entity and Feature Modules
Learn @ngrx/entity and Feature Modules
Fireship
58 Infinite Scroll Pagination with Firestore
Infinite Scroll Pagination with Firestore
Fireship
59 Faster Firestore via Data Aggregation
Faster Firestore via Data Aggregation
Fireship
60 Contentful - CMS for Angular Progressive Web Apps
Contentful - CMS for Angular Progressive Web Apps
Fireship

The video teaches how to set up a dotfiles repository to automate the setup of a computer, covering the process of creating a git repository, customizing the shell experience, and using symbolic links. It provides a step-by-step guide on how to improve developer productivity by automating the setup of a computer.

Key Takeaways
  1. Clone a repository on github
  2. Create a hidden folder for dot files
  3. Move dot files into the repository
  4. Add dot files to the repository
  5. Commit changes to the repository
  6. Create a sim link to the zshrc file in the dot files directory
  7. Add a comment to the real file and save it to see changes reflected in the symlink version
💡 Using a dotfiles repository can significantly improve developer productivity by automating the setup of a computer, allowing for easy customization and version control of shell configurations and other settings.

Related Reads

📰
Most Americans don’t want an AI data centre next door. Virginia shows why some say yes
Most Americans oppose having an AI data centre near their homes, despite the economic benefits, highlighting the need for education and awareness about AI infrastructure
The Next Web AI
📰
Arcee, a US open source AI lab, says Chinese models are not inherently dangerous
Arcee, a US open source AI lab, claims Chinese AI models are not inherently dangerous, sparking debate on their use among US companies
TechCrunch AI
📰
Substack’s new tool tells you who’s been writing their newsletters with AI
Substack introduces a tool to estimate AI-written content in newsletters, promoting transparency in AI-assisted writing
TechCrunch AI
📰
HEMN Technologies
Learn how HEMN Technologies is redefining the approach to AI adoption in businesses, focusing on a more proactive and innovative strategy rather than just adapting to AI.
Medium · AI
Up next
The Most Important Conversation in AI Right Now
Matthew Berman
Watch →