自如wi-fi管理密码_如何使您的Dotfile管理轻松自如

自如wi-fi管理密码

by Mohammed Ajmal Siddiqui

由Mohammed Ajmal Siddiqui

如何使您的Dotfile管理轻松自如 (How to make your Dotfile management a painless affair)

In the first article, I introduced dotfiles. In this one, we’ll cover their development and management.

第一篇文章中 ,我介绍了dotfiles。 在这一节中,我们将介绍它们的开发和管理。

Note: This is the second article in the series and discusses more advanced aspects of dotfile management. To learn about what dotfiles are and the very fundamentals of dotfile management, read the first article.

注意:这是该系列的第二篇文章,并讨论了点文件管理的更多高级方面。 要了解什么是点文件以及点文件管理的基础知识,请阅读第一篇文章

In the last article, we added a few aliases and functions to the .bash_profile and the .bashrc file. We also learned that those aren’t the only dotfiles available for us to customize.

在上一篇文章中,我们向.bash_profile.bashrc文件添加了一些别名和函数。 我们还了解到,这些并不是我们可以定制的仅有的点文件。

This article focuses on making our approach to dotfile management more sophisticated and scalable. At this point, there is one important thing you need to bear in mind from this point onwards. Dotfiles are a matter of personal preference, and so is their management. You should manage them your way. This article only provides general guidelines and common ways to deal with recurring tasks in dotfile management.

本文着重于使我们的点文件管理方法更加复杂和可扩展。 从这一点开始,您需要牢记一件事。 点文件是个人喜好问题,其管理也是如此。 您应该按照自己的方式进行管理。 本文仅提供处理点文件管理中的重复任务的一般准则和通用方法。

设置环境 (Setting Up Your Environment)

Start with creating a directory for your dotfiles and cd into it. I like to have mine in the Projects folder in my home directory, but this is up to you:

首先为您的dotfile创建目录并cd进入该目录。 我喜欢在我的主目录的Projects文件夹中找到我的文件夹,但这取决于您:

$ mkdir ~/Projects/dotfiles$ cd ~/Projects/dotfiles

This is where we’ll have all our dotfiles. Let’s start by making this a git repository.

这是我们所有点文件的地方。 让我们首先将其设为git存储库。

$ git init

Let’s start by moving the .bash_profile from the HOME directory to our new dotfiles directory.

首先,将.bash_profileHOME目录移动到新的dotfiles目录。

$ mv ~/.bash_profile ~/Projects/dotfiles/.bash_profile

Let’s commit this file.

让我们提交这个文件。

$ git commit -am "Added .bash_profile"

And there you have it! This is exactly how you’d work on any other project, and that’s exactly how you should manage your dotfiles.

在那里,您拥有了! 这就是您在任何其他项目上的工作方式,也是您管理点文件的方式。

Why version control, one might ask. People love committing their dotfiles to version control for a couple of reasons:

有人可能会问为什么要进行版本控制。 人们喜欢将其dotfile提交到版本控制有两个原因:

  • Pushing the dotfiles to a remote repo allows people to share their dotfiles with others or access them remotely when they need them. This is also a secure way to back your dotfiles up.

    将点文件推送到远程存储库中,使人们可以与他人共享其点文件或在需要时远程访问它们。 这也是备份点文件的安全方法。
  • Version control allows you to see how your dotfiles evolve over time.

    版本控制使您可以查看点文件随着时间的变化。

But if you start another terminal instance, you’ll notice that your setup is broken! The terminal doesn’t source your .bash_profile or .bashrc from a custom folder, as these files are expected to be found in the home directory.

但是,如果您启动另一个终端实例,则会注意到您的设置已损坏! 终端不会从自定义文件夹中获取.bash_profile.bashrc ,因为这些文件可能会在主目录中找到。

So we need a way to keep our dotfiles in the dotfiles directory in sync with our home directory. You can do this in any way you want, even if it is as simple as copying all the files in your dotfiles directory to the home directory with a script. But there are more elegant approaches. Let’s look at two of them.

因此,我们需要一种使dotfiles目录中的dotfiles与主目录保持同步的方法。 即使使用脚本将dotfiles目录中的所有文件复制到主目录一样简单,您也可以按照自己想要的方式进行操作。 但是还有更优雅的方法。 让我们看看其中两个。

rsync方法 (The rsync Approach)

One way to deal with the problem of having your dotfiles in a directory other than the home directory is to copy the files u

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值