Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to manage Hidden Files with rcm in linux

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how linux uses rcm to manage hidden files. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

Start using

By default, rcm uses ~ / .dotfiles to store all hidden files it manages. A managed hidden file is actually saved in the ~ / .dotfiles directory, and its symbolic links are placed in the original location of the file. For example, if ~ / .bashrc is managed by rcm, the detailed list would be as follows.

[link@localhost] $ls-l ~ / .bashrclrwxrwxrwx. 1 link link 27 Dec 16 05:19. Bashrc-> / home/link/.dotfiles/bashrc [link@localhost ~] $

Rcm contains four commands:

Mkrc-converts a file to a hidden file managed by rcm

Lsrc-lists files managed by rcm

Rcup-synchronize hidden files managed by rcm

Rcdn-removes all symbolic links managed by rcm

Share bashrc on two computers

It is not uncommon for users to have shell accounts on multiple computers these days. Synchronizing hidden files between these computers can be a challenge. A possible solution is provided here, using only rcm and git.

First use mkrc to convert files into files managed by rcm.

[link@localhost] $mkrc-v ~ / .bashrcMoving.' / home/link/.bashrc'->'/ home/link/.dotfiles/bashrc'Linking...'/home/link/.dotfiles/bashrc'->'/ home/link/.bashrc' [link@localhost] $

Next, use lsrc to verify that the list is correct.

[link@localhost ~] $lsrc/home/link/.bashrc:/home/link/.dotfiles/bashrc [link@localhost ~] $

Now create a git repository in ~ / .dotfiles and set up a remote repository using the git repository hosting of your choice. Submit the bashrc file and push a new branch.

[link@localhost ~] $cd ~ / .dotfiles [link@localhost .dotfiles] $git initInitialized empty Git repository in / home/link/.dotfiles/.git/ [link@localhost .dotfiles] $git remote add origin git@github.com:linkdupont/dotfiles.git [link@localhost .dotfiles] $git add bashrc [link@localhost .dotfiles] $git commit-m "initial commit" [master (root-commit) b54406b] initial commit1 file changed 15 insertions (+) create mode 100644 bashrc [link@localhost .dotfiles] $git push-u origin master... [link@localhost .dotfiles] $

On the second machine, clone the repository into ~ / .dotfiles.

[link@remotehost ~] $git clone git@github.com:linkdupont/dotfiles.git ~ / .dotFiles... [link@remotehost ~] $

Now use rcup to update symbolic links managed by rcm.

[link@remotehost ~] $rcup-vreplacing identical but unlinked / home/link/.bashrcremoved'/ home/link/.bashrc''/home/link/.dotfiles/bashrc'->'/ home/link/.bashrc' [link@remotehost ~] $

Overwrite the existing ~ / .bashrc (if present) and restart shell.

That's it! Specifying the host option (- o) is a useful complement to the above situation. As usual, please read the man page. They contain many sample commands.

This is the end of this article on "how linux uses rcm to manage hidden files". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report