How to Create a Dotfiles Folder

Поділитися
Вставка
  • Опубліковано 22 сер 2024
  • In this video, I'll show you how you can create a dotfiles folder and move important configuration files there. We'll also learn how to set up symbolic links back to the original file locations so that your programs can find their configuration files. This prepares us to learn how to manage and share our dotfiles with Git in the next episode!
    Show notes: github.com/dav...
    Check out the previous video "The Basics of Dotfiles" if you haven't already: • The Basics of Dotfiles
    My Emacs configuration: github.com/dav...
    If you enjoy this series, please consider becoming a sponsor on GitHub or Patreon:
    - github.com/spo...
    - / systemcrafters
    You can also leave a tip via PayPal: paypal.me/daviwil
    Follow me on Twitter for more Emacs content!
    / systemcrafters
    Chat with the System Crafters community on Discord: / discord
    Intro music: Coriolis Effect by logos feat. stefsax, licensed CC-BY
    ccmixter.org/fi...

КОМЕНТАРІ • 55

  • @EricT43
    @EricT43 6 місяців тому +2

    It's surprised me how hard it has been to find a video that simply and clearly explains how to set up the dotfiles repo and get the files linked to the right places. Thanks!

  • @ste_ph_en9018
    @ste_ph_en9018 2 роки тому +1

    i'm glad i'm not the only one that keeps getting the order of symbolic links mixed up.

  • @agostinobarbetti3819
    @agostinobarbetti3819 3 роки тому +2

    That is the next step i need to do, this is very helpful. Two things that stop me are manage dotfiles and Git. Thank you for your videos about manage configuration and also your Emacs videos.

  • @vp275
    @vp275 3 роки тому +5

    Any plans on continuing the dot files series ? Would love to see how you manage gnu stow.

  • @Paxsali
    @Paxsali 3 роки тому +11

    When you use "$ ln -sf ~/path symlink", the "~/" part is being translated into a fully qualified / absolute path, e.g. /home/crafter/...
    IDK if you want that in every case though (chroots, backup&restore or copying to another system ... other niche use cases).
    It would be better to cd to $HOME first, then use relative symlinking, i.e.:
    $ ln -sf .dotfiles/.config/mpv .config/mpv
    and so forth... but it's a minor point, really. There's nothing "wrong" about the way you do it.
    But if you do it the "truely relative" way, nothing can go wrong in any case, no matter what.

    • @SystemCrafters
      @SystemCrafters  3 роки тому +4

      Good point, thanks for pointing that out!

    • @PoeLemic
      @PoeLemic 10 місяців тому

      @@SystemCrafters Yes, I was confused why he didn't put "/mpv" on the end of that command, because I sure would have. But, it looks like it worked -- like @Paxsali said.

  • @alexdelgado186
    @alexdelgado186 3 роки тому +1

    Thanks a lot man, being thinking of something like this for some weeks now

  • @ruijieyu9035
    @ruijieyu9035 2 роки тому +2

    10:00 linux version of ln supports -r flag that helps make relative symlinks; and -T flag for situations like the time stamp when linking should fail instead of creating a symlink at a wrong location.

  • @gksudolol
    @gksudolol 3 роки тому +8

    Hey David, the way I manage my dotfiles is by creating a git bare repository in my home folder and setting an alias like: alias config="/usr/bin/git --git-dir=$HOME/dotfiles/.git/ --work-tree=$HOME"
    And then add files to the repository with: config add filename.txt, commit with: config commit, etc. This eliminates the need to create symlinks of all the files

    • @SystemCrafters
      @SystemCrafters  3 роки тому +5

      Thanks! I'm planning to cover the bare repository approach in the future, so that was helpful.

    • @gksudolol
      @gksudolol 3 роки тому +1

      @@SystemCrafters You're welcome, loving the videos so far- thank you

    • @AndersJackson
      @AndersJackson 3 роки тому

      I was looking for this, so now I don't need to write this myself. :-)

    • @wackenalt878
      @wackenalt878 3 роки тому

      can you use the bare repository with magit somehow, i also use a bare one and could not yet figure out, who it should work

  • @MarkusGraf2
    @MarkusGraf2 3 роки тому +2

    The order of the arguments of "ln" used to confuse me, too. It helps me to think of them as "cp" and "mv" for the arguments to make sense. ymmv.

    • @AndersJackson
      @AndersJackson 3 роки тому +1

      That is how I remember the command arguments too. The source(es) are first and last is the destination. It there are many sources, the last must be a directory. Which make it all make sense in mv(1), cp(1) and ln(1).

    • @JeanNoelAvila
      @JeanNoelAvila 3 роки тому

      You have to remember that "ln" can create several links on the same file, so in order for the command to be extensible, the target comes first, then all the created links are listed after.

  • @edilmedeiros
    @edilmedeiros 3 роки тому +1

    Very instructive, there will be other videos on this series?

  • @diegonayalazo
    @diegonayalazo 2 роки тому

    Thanks David!

  • @user-ol4vs4ml8g
    @user-ol4vs4ml8g Рік тому

    Thanks! Very cool!

  • @satoristeve
    @satoristeve 3 роки тому +2

    Is there a reason you prefer to create a .dotfiles folder versus creating folders in .config? E.g., a .config/zsh for your .zshrc, etc. Or is it just personal preference?

    • @bunnysuitlewds126
      @bunnysuitlewds126 8 місяців тому +1

      it keeps your main directory cleaner because you will end up with a lot of dot files and its just basically continuity for every possible dot file you could have. its not a big deal just makes it more parsable for a human and easier to navigate through the CLI.
      Edit: i could show a pic of my ~/home/ directory but i'll just put into text the dot files I have, keep in mind im more of a gamer than programmer or practical user of linux.
      ".steam .minecraft .mozilla .java .local .config" you get the idea, it tends to make your home directory less parsable when you could just have a generalized dotfile folder for all of these.
      Edit2: you could also probably simplify your directories further at this point for your configs, so instead of going .config/alacritty/alacritty.yml you could probably just set it up to be .dotfiles/.config/alacritty.yml, but i dont know about that. im just imagining things.

    • @satoristeve
      @satoristeve 8 місяців тому

      @@bunnysuitlewds126 No, I get it! I just know that some programs already make an entry in ~/.config/ so I've leaned toward exactly as you and the video suggest with moving them, but instead of into a ~/.dotfiles/ folder I've been moving them into ~/.config//
      I guess what I was trying to figure out is if the goal is to keep it as clean as possible, if there was some benefit to a ~/.dotfiles/ versus the already-used ~/.config/ I'm assuming there's some reasoning I'm just missing.

  • @liftlinux9421
    @liftlinux9421 3 роки тому +2

    Is there any new video related to the topic?

  • @MrOlegrom
    @MrOlegrom 3 роки тому

    thank you! very useful! which is the next video?

  • @JeanNoelAvila
    @JeanNoelAvila 3 роки тому +1

    Why create symbolic links instead of hard links? We would expect that the home folder is contained on a single file system?

    • @SystemCrafters
      @SystemCrafters  3 роки тому

      That's just the way I've always done it. Are hard links necessary to link across storage devices? If so, I wasn't aware of that!

    • @JeanNoelAvila
      @JeanNoelAvila 3 роки тому

      @@SystemCrafters That the contrary. Hardlinks are basically names pointing to the same content in the file system, so they need to be in the same filesystem. Symlink can cross filesystem, because they are resolved.

    • @SystemCrafters
      @SystemCrafters  3 роки тому

      Gotcha, so you're saying for the purpose of linking the dotfiles, a hard link would be sufficient. Are there any other benefits? Faster? Don't have to call readlink to resolve?

    • @JeanNoelAvila
      @JeanNoelAvila 3 роки тому +1

      @@SystemCrafters All the hardlinks on a file *are* the file, there's no assymetry between them, so if you remove one hardlink the others stay valid: there's no such thing as dangling link. For emacs, I don't know if there's a benefit. One cool thing about Emacs, is that when trying to open a symlink, you are asked if you want to open the linked file in the original directory so that e.g. magit can handle it correctly. With hardlinks, you couldn't have such process.

  • @outragedline
    @outragedline Рік тому

    Saved me, thanks

  • @sach2372
    @sach2372 3 роки тому +1

    Creating symlink with dired package function is super easy

    • @SystemCrafters
      @SystemCrafters  3 роки тому

      I haven't tried it yet! What's the command?

    • @sach2372
      @sach2372 3 роки тому

      @@SystemCrafters M-x dired-do-symlink

    • @sach2372
      @sach2372 3 роки тому

      Adding details to describe the workflow:
      from dired buffer, put cursor on the item to create link for, and invoke dired-do-symlink, it'll ask for link path, navigate, type name for link, and enter. symlink is created.

  • @agataerminiapennisi5504
    @agataerminiapennisi5504 3 роки тому

    Thanks ... 😀

  • @skilled-person
    @skilled-person 2 роки тому

    why move everything? you could've init a git on $home with --bare flag

  • @thacalebful
    @thacalebful 3 роки тому

    Did my previous comment get deleted? :/

    • @SystemCrafters
      @SystemCrafters  3 роки тому

      I didn't see one come through! I get e-mails for every comment posted on a video and haven't received one for a previous comment of yours. I also checked the "held for review" section for comments and didn't see one there. Maybe UA-cam didn't succeed in posting it to begin with?

    • @thacalebful
      @thacalebful 3 роки тому

      @@SystemCrafters No problem. It just happened to me a few times lately in other channels so I began to wonder why. Keep up the good work :)

  • @undefinednull5749
    @undefinednull5749 3 роки тому

    please make video about Org BRAIN.

    • @SystemCrafters
      @SystemCrafters  3 роки тому +1

      I haven't heard of that before! I'll look into it. I will definitely make a video on org-roam which is used for a similar purpose but seemingly less complex

    • @wackenalt878
      @wackenalt878 3 роки тому

      I originally also used org brain, but if you use org-roam with org-roam-server you hav a great way of visualizing your points with a mind map and its connection, which was the main thing i wanted to use org BRAIN for, and org-roam has many other advantages. So i finnaly abandoned Org brain in favor of org-roam (I know its difficult to wrap your mind around org-roam at the beginning and that was the main reason that I did not take a closer look at org-roam for a while, but in the end its better in many ways)

    • @SystemCrafters
      @SystemCrafters  3 роки тому

      I haven't personally tried Org Brain, but Org Roam is great!

  • @richardbennett4365
    @richardbennett4365 7 місяців тому

    Well, then the man could have made this directory instead, and then it would not have sounded redundant to him:
    ~/.files
    There. It's perfecter than his way.