mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-23 21:20:42 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
857ec00dfd
@ -1,32 +1,33 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-11834-1.html)
|
||||
[#]: subject: (3 open source tools to manage your contacts)
|
||||
[#]: via: (https://opensource.com/article/20/1/sync-contacts-locally)
|
||||
[#]: author: (Kevin Sonney https://opensource.com/users/ksonney)
|
||||
|
||||
用于联系人管理的开源工具
|
||||
用于联系人管理的三个开源工具
|
||||
======
|
||||
通过将联系人同步到本地从而更快访问它。在我们的 20 个使用开源提升生产力的系列的第六篇文章中了解该如何做。
|
||||
![Team communication, chat][1]
|
||||
|
||||
> 通过将联系人同步到本地从而更快访问它。在我们的 20 个使用开源提升生产力的系列的第六篇文章中了解该如何做。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202001/30/194811bbtt449zfr9zppb3.jpg)
|
||||
|
||||
去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。
|
||||
|
||||
### 用于联系人管理的开源工具
|
||||
|
||||
在本系列之前的文章中,我解释了如何在本地同步你的[邮件][2]和[日历][3]。希望这些加速了你访问邮件和日历。现在,我将讨论联系人同步,你可以使用这些发送邮件和日历邀请。
|
||||
在本系列之前的文章中,我解释了如何在本地同步你的[邮件][2]和[日历][3]。希望这些加速了你访问邮件和日历。现在,我将讨论联系人同步,你可以给他们发送邮件和日历邀请。
|
||||
|
||||
![abook][4]
|
||||
|
||||
我目前收集了很多邮件地址。管理这些数据可能有点麻烦。有基于 Web 的服务,但它们不如本地副本快。
|
||||
|
||||
几天前,我谈到了用于管理日历的 [vdirsyncer][5]。vdirsyncer 还使用 CardDAV 协议处理联系人。vdirsyncer 除了可以使用**文件系统**存储日历外,还支持 **google_contacts** 和 **carddav** 进行联系人同步,但 **fileext** 设置将更改,因此你无法在日历文件中存储联系人。
|
||||
几天前,我谈到了用于管理日历的 [vdirsyncer][5]。vdirsyncer 还使用 CardDAV 协议处理联系人。vdirsyncer 除了可以使用**文件系统**存储日历外,还支持通过 **google_contacts** 和 **carddav** 进行联系人同步,但 `fileext` 设置会被更改,因此你无法在日历文件中存储联系人。
|
||||
|
||||
我在配置文件添加了一块配置,并从 Google 镜像了我的联系人。设置它需要额外的步骤。从 Google 镜像完成后,配置非常简单:
|
||||
|
||||
|
||||
```
|
||||
[pair address_sync]
|
||||
a = "googlecard"
|
||||
@ -46,12 +47,11 @@ path = "~/.calendars/Addresses/"
|
||||
fileext = ".vcf"
|
||||
```
|
||||
|
||||
现在,当我运行 **vdirsyncer discover** 时,它会找到我的 Google 联系人,并且 **vdirsyncer sync** 将它们复制到我的本地计算机。但同样,这只进行到一半。现在我想查看和使用联系人。输入 [khard][6] 和 [abook][7]。
|
||||
现在,当我运行 `vdirsyncer discover` 时,它会找到我的 Google 联系人,并且 `vdirsyncer sync` 将它们复制到我的本地计算机。但同样,这只进行到一半。现在我想查看和使用联系人。需要 [khard][6] 和 [abook][7]。
|
||||
|
||||
![khard search][8]
|
||||
|
||||
为什么选择两个应用?因为每个都有它自己的使用场景,在这里,越多越好。khard 用于管理地址,类似于 [khal][9] 用于管理日历条目。如果你的发行版附带了旧版本,你可能需要通过 pip 安装最新版本。安装 khard 后,你需要创建 **~/.config/khard/khard.conf**,因为 khard 没有与 khal 那样漂亮的配置向导。我的看起来像这样:
|
||||
|
||||
为什么选择两个应用?因为每个都有它自己的使用场景,在这里,越多越好。khard 用于管理地址,类似于 [khal][9] 用于管理日历条目。如果你的发行版附带了旧版本,你可能需要通过 `pip` 安装最新版本。安装 khard 后,你需要创建 `~/.config/khard/khard.conf`,因为 khard 没有与 khal 那样漂亮的配置向导。我的看起来像这样:
|
||||
|
||||
```
|
||||
[addressbooks]
|
||||
@ -79,36 +79,34 @@ search_in_source_files = yes
|
||||
skip_unparsable = no
|
||||
```
|
||||
|
||||
这会定义源通讯簿(并给它一个友好的名称)、显示内容和联系人编辑程序。运行 **khard list** 将列出所有条目,**khard list <[some@email.adr][10]>** 可以搜索特定条目。如果要添加或编辑条目,**add** 和 **edit** 命令将使用相同的基本模板打开配置的编辑器,唯一的区别是 **add** 命令的模板将为空。
|
||||
这会定义源通讯簿(并给它一个友好的名称)、显示内容和联系人编辑程序。运行 `khard list` 将列出所有条目,`khard list <some@email.adr>` 可以搜索特定条目。如果要添加或编辑条目,`add` 和 `edit` 命令将使用相同的基本模板打开配置的编辑器,唯一的区别是 `add` 命令的模板将为空。
|
||||
|
||||
![editing in khard][11]
|
||||
|
||||
abook 需要你导入和导出 VCF 文件,但它为查找提供了一些不错的功能。要将文件转换为 abook 格式,请先安装 abook 并创建 **~/.abook** 默认目录。然后让 abook 解析所有文件,并将它们放入 **~/.abook/addresses** 文件中:
|
||||
|
||||
abook 需要你导入和导出 VCF 文件,但它为查找提供了一些不错的功能。要将文件转换为 abook 格式,请先安装 abook 并创建 `~/.abook` 默认目录。然后让 abook 解析所有文件,并将它们放入 `~/.abook/addresses` 文件中:
|
||||
|
||||
```
|
||||
apt install abook
|
||||
ls ~/.calendars/Addresses/default/* | xargs cat | abook --convert --informat vcard --outformat abook > ~/.abook/addresses
|
||||
ls ~/.calendars/Addresses/default/* | xargs cat | abook --convert --informat vcard --outformat abook > ~/.abook/addresses
|
||||
```
|
||||
|
||||
现在运行 **abook**,你将有一个非常好的 UI 来浏览、搜索和编辑条目。将它们导出到单个文件有点痛苦,所以我用 khard 进行大部分编辑,并有一个 cron 任务将它们导入到 abook 中。
|
||||
|
||||
abook 还可在命令行中搜索,并有大量有关将其与邮件客户端集成的文档。例如,你可以在 **.config/alot/config** 文件中添加一些信息,从而在 [Nmuch][12] 的邮件客户端 [alot][13] 中使用 abook 查询联系人:
|
||||
现在运行 `abook`,你将有一个非常漂亮的 UI 来浏览、搜索和编辑条目。将它们导出到单个文件有点痛苦,所以我用 khard 进行大部分编辑,并有一个 cron 任务将它们导入到 abook 中。
|
||||
|
||||
abook 还可在命令行中搜索,并有大量有关将其与邮件客户端集成的文档。例如,你可以在 `.config/alot/config` 文件中添加一些信息,从而在 [Nmuch][12] 的邮件客户端 [alot][13] 中使用 abook 查询联系人:
|
||||
|
||||
```
|
||||
[accounts]
|
||||
[[Personal]]
|
||||
realname = Kevin Sonney
|
||||
address = [kevin@sonney.com][14]
|
||||
alias_regexp = kevin\[+.+@sonney.com][15]
|
||||
gpg_key = 7BB612C9
|
||||
sendmail_command = msmtp --account=Personal -t
|
||||
# ~ expansion works
|
||||
sent_box = maildir://~/Maildir/Sent
|
||||
draft_box = maildir://~/Maildir/Drafts
|
||||
[[[abook]]]
|
||||
type = abook
|
||||
[[Personal]]
|
||||
realname = Kevin Sonney
|
||||
address = kevin@sonney.com
|
||||
alias_regexp = kevin\+.+@sonney.com
|
||||
gpg_key = 7BB612C9
|
||||
sendmail_command = msmtp --account=Personal -t
|
||||
# ~ expansion works
|
||||
sent_box = maildir://~/Maildir/Sent
|
||||
draft_box = maildir://~/Maildir/Drafts
|
||||
[[[abook]]]
|
||||
type = abook
|
||||
```
|
||||
|
||||
这样你就可以在邮件和日历中快速查找联系人了!
|
||||
@ -120,15 +118,15 @@ via: https://opensource.com/article/20/1/sync-contacts-locally
|
||||
作者:[Kevin Sonney][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/ksonney
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/talk_chat_team_mobile_desktop.png?itok=d7sRtKfQ (Team communication, chat)
|
||||
[2]: https://opensource.com/article/20/1/sync-email-offlineimap
|
||||
[3]: https://opensource.com/article/20/1/open-source-calendar
|
||||
[2]: https://linux.cn/article-11804-1.html
|
||||
[3]: https://linux.cn/article-11812-1.html
|
||||
[4]: https://opensource.com/sites/default/files/uploads/productivity_6-1.png (abook)
|
||||
[5]: https://github.com/pimutils/vdirsyncer
|
||||
[6]: https://github.com/scheibler/khard
|
@ -1,142 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (My favorite Bash hacks)
|
||||
[#]: via: (https://opensource.com/article/20/1/bash-scripts-aliases)
|
||||
[#]: author: (Katie McLaughlin https://opensource.com/users/glasnt)
|
||||
|
||||
My favorite Bash hacks
|
||||
======
|
||||
Improve your productivity with aliases and other shortcuts for the
|
||||
things you forget too often.
|
||||
![bash logo on green background][1]
|
||||
|
||||
When you work with computers all day, it's fantastic to find repeatable commands and tag them for easy use later on. They all sit there, tucked away in **~/.bashrc** (or ~/.zshrc for [Zsh users][2]), waiting to help improve your day!
|
||||
|
||||
In this article, I share some of my favorite of these helper commands for things I forget a lot, in hopes that they will save you, too, some heartache over time.
|
||||
|
||||
### Say when it's over
|
||||
|
||||
When I'm using longer-running commands, I often multitask and then have to go back and check if the action has completed. But not anymore, with this helpful invocation of **say** (this is on MacOS; change for your local equivalent):
|
||||
|
||||
|
||||
```
|
||||
function looooooooong {
|
||||
START=$(date +%s.%N)
|
||||
$*
|
||||
EXIT_CODE=$?
|
||||
END=$(date +%s.%N)
|
||||
DIFF=$(echo "$END - $START" | bc)
|
||||
RES=$(python -c "diff = $DIFF; min = int(diff / 60); print('%s min' % min)")
|
||||
result="$1 completed in $RES, exit code $EXIT_CODE."
|
||||
echo -e "\n⏰ $result"
|
||||
( say -r 250 $result 2>&1 > /dev/null & )
|
||||
}
|
||||
```
|
||||
|
||||
This command marks the start and end time of a command, calculates the minutes it takes, and speaks the command invoked, the time taken, and the exit code. I find this super helpful when a simple console bell just won't do.
|
||||
|
||||
### Install helpers
|
||||
|
||||
I started using Ubuntu back in the Lucid days, and one of the first things I needed to learn was how to install packages. And one of the first aliases I ever added was a helper for this (named based on the memes of the day):
|
||||
|
||||
|
||||
```
|
||||
`alias canhas="sudo apt-get install -y"`
|
||||
```
|
||||
|
||||
### GNU Privacy Guard (GPG) signing
|
||||
|
||||
On the off chance I have to sign a [GPG][3] email without having an extension or application to do it for me, I drop down into the command line and use these terribly dorky aliases:
|
||||
|
||||
|
||||
```
|
||||
alias gibson="gpg --encrypt --sign --armor"
|
||||
alias ungibson="gpg --decrypt"
|
||||
```
|
||||
|
||||
### Docker
|
||||
|
||||
There are many Docker commands, but there are even more **docker compose** commands. I used to forget the **\--rm** flags, but not anymore with these useful aliases:
|
||||
|
||||
|
||||
```
|
||||
alias dc="docker-compose"
|
||||
alias dcr="docker-compose run --rm"
|
||||
alias dcb="docker-compose run --rm --build"
|
||||
```
|
||||
|
||||
### gcurl helper for Google Cloud
|
||||
|
||||
This one is relatively new to me, but it's [heavily documented][4]. gcurl is an alias to ensure you get all the correct flags when using local curl commands with authentication headers when working with Google Cloud APIs.
|
||||
|
||||
### Git and ~/.gitignore
|
||||
|
||||
I work a lot in Git, so I have a special section dedicated to Git helpers.
|
||||
|
||||
One of my most useful helpers is one I use to clone GitHub repos. Instead of having to run:
|
||||
|
||||
|
||||
```
|
||||
`git clone git@github.com:org/repo /Users/glasnt/git/org/repo`
|
||||
```
|
||||
|
||||
I set up a clone function:
|
||||
|
||||
|
||||
```
|
||||
clone(){
|
||||
echo Cloning $1 to ~/git/$1
|
||||
cd ~/git
|
||||
git clone [git@github.com][5]:$1 $1
|
||||
cd $1
|
||||
}
|
||||
```
|
||||
|
||||
Even though I always forget and giggle any time I'm diving into my **~/.bashrc** file, I also have my "refresh upstream" command:
|
||||
|
||||
|
||||
```
|
||||
`alias yoink="git checkout master && git fetch upstream master && git merge upstream/master"`
|
||||
```
|
||||
|
||||
Another helper for Git-ville is a global ignore file. In your **git config --global --list** you should see a **core.excludesfile**. If not, [create one][6], and fill it full of things that you always put into your individual **.gitignore** files. As a Python developer on MacOS, for me this is:
|
||||
|
||||
|
||||
```
|
||||
.DS_Store # macOS clutter
|
||||
venv/ # I never want to commit my virtualenv
|
||||
*.egg-info/* # ... nor any locally compiled packages
|
||||
__pycache__ # ... or source
|
||||
*.swp # ... nor any files open in vim
|
||||
```
|
||||
|
||||
You can find other suggestions over on [Gitignore.io][7] or on the [Gitignore repo][8] on GitHub.
|
||||
|
||||
### Your turn
|
||||
|
||||
What are your favorite helper commands? Please share them in the comments.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/1/bash-scripts-aliases
|
||||
|
||||
作者:[Katie McLaughlin][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/glasnt
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bash_command_line.png?itok=k4z94W2U (bash logo on green background)
|
||||
[2]: https://opensource.com/article/19/9/getting-started-zsh
|
||||
[3]: https://gnupg.org/
|
||||
[4]: https://cloud.google.com/service-infrastructure/docs/service-control/getting-started
|
||||
[5]: mailto:git@github.com
|
||||
[6]: https://help.github.com/en/github/using-git/ignoring-files#create-a-global-gitignore
|
||||
[7]: https://www.gitignore.io/
|
||||
[8]: https://github.com/github/gitignore
|
@ -0,0 +1,76 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (4 open source productivity tools on my wishlist)
|
||||
[#]: via: (https://opensource.com/article/20/1/open-source-productivity-tools)
|
||||
[#]: author: (Kevin Sonney https://opensource.com/users/ksonney)
|
||||
|
||||
4 open source productivity tools on my wishlist
|
||||
======
|
||||
Find out what the open source world needs to work on in the final
|
||||
article in our series on 20 ways to be more productive with open source
|
||||
in 2020.
|
||||
![Two diverse hands holding a globe][1]
|
||||
|
||||
Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using.
|
||||
|
||||
### But what about…
|
||||
|
||||
When searching for productivity apps, I never find everything I want, and I almost always miss something great that my readers share with me. So, as I bring this series to a close, it's time [again][2] to talk about some of the topics I failed to cover in this year's series.
|
||||
|
||||
![Desktop with Joplin, Emacs, and Firefox][3]
|
||||
|
||||
#### Chatting in Vim
|
||||
|
||||
I tried. I really, _really_ tried to get chat to work in Vim, but it was not to be. The one package I was able to find, [VimIRC.vim][4], never did work for me, and I tried for a few days to no avail. The other option I explored was [Irc it][5], which requires a lot more [effort to set up][6] than I could fit into my available space or time. I tried, I really did, and for the Vim users out there, I'm sorry I wasn't able to get something workable for you.
|
||||
|
||||
#### Org mode
|
||||
|
||||
![Org Mode in Emacs][7]
|
||||
|
||||
I love [Org Mode][8], and I use it daily. I could spend several days _just_ talking about Org. It provides basic [task tracking][9]; Google [calendar][10] sync and [CalFW][11] integration; rich text documents, websites, and presentations; linking to all the things; and; and; and…
|
||||
|
||||
I expect you will hear more from me about Org in 2020 because it really is pretty cool.
|
||||
|
||||
#### GUI programs
|
||||
|
||||
In 2019's productivity series, I shared a lot of programs with a graphical user interface (GUI), and this year almost all are command-line applications. There are some great graphical programs to help with some of the things I talked about this year—[mail][12] programs to talk to Maildir mailboxes, calendar programs to read local calendar files, [weather][13] apps, and so on. I even tried several new-to-me things to see if they would fit with the overall theme. With the exception of [twin][14], I didn't feel that there were any GUI programs that were new (to me) or notable (again, to me) to write about this year. And that brings me to…
|
||||
|
||||
#### Mobile
|
||||
|
||||
More and more people are using tablets (sometimes in conjunction with a laptop) as their primary device. I use my phone for most of my social media and instant messaging, and, more often than not, I use my tablet (OK, let's be honest, _tablets_) to read or browse the web. It isn't that open source mobile apps aren't out there, that's for sure, but they didn't fit with my themes this year. There is a lot going on with open source and mobile apps, and I'm watching carefully for things that can help me be more productive on my phone and tablet.
|
||||
|
||||
### Your turn
|
||||
|
||||
Thank you very much for reading the series this year. Please comment with what you think I missed or need to look at for 2021. And as I say on the [Productivity Alchemy][15] podcast: "Remember folks: Stay productive!"
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/1/open-source-productivity-tools
|
||||
|
||||
作者:[Kevin Sonney][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/ksonney
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/world_hands_diversity.png?itok=zm4EDxgE (Two diverse hands holding a globe)
|
||||
[2]: https://opensource.com/article/19/1/productivity-tool-wish-list
|
||||
[3]: https://opensource.com/sites/default/files/uploads/productivity_20-1.png (Desktop with Joplin, Emacs, and Firefox)
|
||||
[4]: https://github.com/vim-scripts/VimIRC.vim
|
||||
[5]: https://tools.suckless.org/ii/
|
||||
[6]: https://www.reddit.com/r/vim/comments/48t7ws/vim_ii_irc_client_xpost_runixporn/d0macnl/
|
||||
[7]: https://opensource.com/sites/default/files/uploads/productivity_20-2.png (Org Mode in Emacs)
|
||||
[8]: https://orgmode.org/
|
||||
[9]: https://opensource.com/article/20/1/open-source-to-do-list
|
||||
[10]: https://opensource.com/article/20/1/open-source-calendar
|
||||
[11]: https://github.com/kiwanami/emacs-calfw
|
||||
[12]: https://opensource.com/article/20/1/organize-email-notmuch
|
||||
[13]: https://opensource.com/article/20/1/open-source-weather-forecast
|
||||
[14]: https://github.com/cosmos72/twin
|
||||
[15]: https://productivityalchemy.com
|
@ -0,0 +1,105 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Run your network with open source software)
|
||||
[#]: via: (https://opensource.com/article/20/1/open-source-networking)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
Run your network with open source software
|
||||
======
|
||||
VyOS is an easy-to-install open source router and firewall solution
|
||||
![Multi-colored and directional network computer cables][1]
|
||||
|
||||
Way back in 2005, a company called Vyatta was founded by Allan Leinwand. It offered the first commercially supported, open source router and firewall solution. Named after the ancient Sanskrit for "open," the company's goal of bringing open source networking products to the market was so successful that it was purchased by competitor Brocade. This effectively killed Vyatta, but because Vyatta's product was open source, it didn't stop it. As it turns out, Vyatta's software-defined networking capabilities have been continued and developed as [VyOS][2].
|
||||
|
||||
The VyOS distribution is based on Debian Linux, with source code available from a [Git repository][3] and a [rolling release ISO][4]. For mission-critical applications, there are [long-term support releases and support contracts][5].
|
||||
|
||||
### Building a network
|
||||
|
||||
Networking has changed since 2005, and thanks to the VyOS project, so has the software that drives it. After learning that VyOS was continuing the work of Vyatta, I downloaded the ISO to try it out. The installation process was easier for me than the normal Debian install, which is a simple task. VyOS doesn't boot into a graphical interface, but to a text console. It's just you and a bunch of configuration files, just like you might expect from a serious router.
|
||||
|
||||
The default install of VyOS provides no default configuration. It's entirely up to you to build the network you want to run. Depending on your point of view, that's either refreshing or frustrating, but it gives you an idea of the intended audience: VyOS is built for network engineers who've mapped out their desired topography and are capable of creating it with some subnet calculations and text definitions.
|
||||
|
||||
### The VyOS configure command
|
||||
|
||||
That said, VyOS isn't just a re-branded Debian release. One of its key features is its **configure** command, an interactive tool for defining network definitions that are applied only after you commit them. In addition to feeling familiar to users accustomed to IOS and similar toolchains, this allows you to configure your network even as the router continues its normal operations. Nothing is final until you type **commit**.
|
||||
|
||||
Once you've tested a committed network change, you can use the **save** command to permanently store your configuration files for backup or migration to other VyOS machines.
|
||||
|
||||
You enter configuration mode with the **configure** command. There are too many possible network configurations to go over **configure** or basic networking tasks here, but the syntax is generally intuitive and predictable. For instance, to enable SSH management over port 22212 of your router:
|
||||
|
||||
|
||||
```
|
||||
`# set service ssh port '22212'`
|
||||
```
|
||||
|
||||
To set the network interface card (NIC) **eth1** to an internal IP address and to create a description identifying it as the default gateway:
|
||||
|
||||
|
||||
```
|
||||
# set interfaces ethernet eth1 address '10.1.0.1/24'
|
||||
# set interfaces ethernet eth1 description 'INSIDE'
|
||||
```
|
||||
|
||||
To set the public IP of NIC **eth0** and describe it as the world-facing interface:
|
||||
|
||||
|
||||
```
|
||||
# set interfaces ethernet eth0 address dhcp
|
||||
# set interfaces ethernet eth0 description 'OUTSIDE'
|
||||
```
|
||||
|
||||
To activate network address translation (NAT), it's the same structure:
|
||||
|
||||
|
||||
```
|
||||
set nat source rule 100 outbound-interface 'eth0'
|
||||
set nat source rule 100 source address '10.1.0.0/24'
|
||||
set nat source rule 100 translation address masquerade
|
||||
```
|
||||
|
||||
Assuming those are the only tasks you have for now, commit and save:
|
||||
|
||||
|
||||
```
|
||||
# commit
|
||||
# save && exit
|
||||
Saving configuration to '/config/config.boot'...
|
||||
Done
|
||||
$
|
||||
```
|
||||
|
||||
Although that's probably not everything you need to do in real life, it gives you an idea of the direct simplicity that VyOS provides. You don't have to deal with "reverse engineering" confusing graphical interfaces nor scrubbing through verbose configuration files for a poorly named key. You have a unified interface for every task, whether it's setting up a firewall, implementing DHCP, DNS, quality of service, VPN gateways, IPv6, or whatever else.
|
||||
|
||||
### Professional networking appliance
|
||||
|
||||
VyOS might not be a beginner-level router distribution, but it's a great tool to have on hand even if you're just starting out. There's no better way to learn the basics of networking than to have an open source router available for manipulation and testing. It's the 21st century, after all; you can set up a computer lab consisting of virtual clients networked to one another through a virtual VyOS instance entirely within [GNOME Boxes][6] for $0. You can learn advanced networking concepts and solutions armed with little more than a Linux computer and the excellent [VyOS documentation][7].
|
||||
|
||||
If you're already a networking professional, then take a look at VyOS. You'll find its philosophy on configuration simple and its configure tool efficient.
|
||||
|
||||
Connecting your Linux computer to a network is pretty straightforward, except when it is not. In...
|
||||
|
||||
Jay Turner gives tips for attracting and maintaining an open source community around networking.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/1/open-source-networking
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/connections_wires_sysadmin_cable.png?itok=d5WqHmnJ (Multi-colored and directional network computer cables)
|
||||
[2]: http://vyos.io
|
||||
[3]: https://github.com/vyos/
|
||||
[4]: https://www.vyos.io/rolling-release/
|
||||
[5]: https://vyos.io/subscriptions/
|
||||
[6]: https://opensource.com/article/19/5/getting-started-gnome-boxes-virtualization
|
||||
[7]: https://vyos.readthedocs.io/en/latest/index.html
|
136
translated/tech/20200109 My favorite Bash hacks.md
Normal file
136
translated/tech/20200109 My favorite Bash hacks.md
Normal file
@ -0,0 +1,136 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (My favorite Bash hacks)
|
||||
[#]: via: (https://opensource.com/article/20/1/bash-scripts-aliases)
|
||||
[#]: author: (Katie McLaughlin https://opensource.com/users/glasnt)
|
||||
|
||||
我珍藏的 Bash 秘籍
|
||||
======
|
||||
|
||||
> 通过别名和其他捷径来提高你经常忘记的那些事情的效率。
|
||||
|
||||
![bash logo on green background][1]
|
||||
|
||||
要是你整天使用计算机,如果能找到可重复的命令并标记它们,以便以后轻松使用那就太棒了。它们全都在那里,藏在 `~/.bashrc` 中(或 [zsh 用户][2]的 `~/.zshrc` 中),等待着改善你的生活!
|
||||
|
||||
在本文中,我分享了我最喜欢的这些辅助命令,它们可以帮助我避免一些遗忘的事情,也希望可以帮助到你,以及为你解决一些越来越头疼的问题。
|
||||
|
||||
### 完事说一声
|
||||
|
||||
当我执行一个需要长时间运行的命令时,我经常采用多任务的方式,然后必须回过去检查该操作是否已完成。 然而通过有用的 `say`,现在就不用再这样了(这是在 MacOS 上;更改为本地环境等效的方式):
|
||||
|
||||
```
|
||||
function looooooooong {
|
||||
START=$(date +%s.%N)
|
||||
$*
|
||||
EXIT_CODE=$?
|
||||
END=$(date +%s.%N)
|
||||
DIFF=$(echo "$END - $START" | bc)
|
||||
RES=$(python -c "diff = $DIFF; min = int(diff / 60); print('%s min' % min)")
|
||||
result="$1 completed in $RES, exit code $EXIT_CODE."
|
||||
echo -e "\n⏰ $result"
|
||||
( say -r 250 $result 2>&1 > /dev/null & )
|
||||
}
|
||||
```
|
||||
|
||||
这个命令会标记命令的开始和结束时间,计算所需的分钟数,并说出调用的命令、花费的时间和退出码。当简单的控制台铃声无法使用时,我发现这个超级有用。
|
||||
|
||||
### 安装小助手
|
||||
|
||||
我在小的时候就开始使用 Ubuntu,而我需要学习的第一件事是如何安装软件包。我曾经添加的第一个别名之一是它的助手(根据当天的流行梗命名的):
|
||||
|
||||
```
|
||||
alias canhas="sudo apt-get install -y"
|
||||
```
|
||||
|
||||
### GPG 签名
|
||||
|
||||
有时候,我必须在没有扩展程序或应用程序的情况下给电子邮件签署 [GPG][3] 签名,我会跳到命令行并使用以下令人讨厌的别名:
|
||||
|
||||
```
|
||||
alias gibson="gpg --encrypt --sign --armor"
|
||||
alias ungibson="gpg --decrypt"
|
||||
```
|
||||
|
||||
### Docker
|
||||
|
||||
Docker 命令很多,但是 Docker compose 命令更多。我曾经使用这些别名来忘记 `--rm` 标志,但是现在不再使用这些有用的别名了:
|
||||
|
||||
```
|
||||
alias dc="docker-compose"
|
||||
alias dcr="docker-compose run --rm"
|
||||
alias dcb="docker-compose run --rm --build"
|
||||
```
|
||||
|
||||
### Google Cloud 的 gcurl 辅助程序
|
||||
|
||||
对于我来说,Google Cloud 是一个相对较新的东西,而它有[极多的文档][4]。gcurl 是一个别名,可确保在用带有身份验证标头的本地 curl 命令连接 Google Cloud API 时,可以获得所有正确的标头。
|
||||
|
||||
### Git 和 ~/.gitignore
|
||||
|
||||
我工作中用 Git 很多,因此我有一个专门的部分来介绍 Git 的辅助程序。
|
||||
|
||||
我最有用的辅助程序之一是我用来克隆 GitHub 存储库的助手。你不必运行:
|
||||
|
||||
```
|
||||
git clone git@github.com:org/repo /Users/glasnt/git/org/repo
|
||||
```
|
||||
|
||||
我设置了一个克隆函数:
|
||||
|
||||
```
|
||||
clone(){
|
||||
echo Cloning $1 to ~/git/$1
|
||||
cd ~/git
|
||||
git clone git@github.com:$1 $1
|
||||
cd $1
|
||||
}
|
||||
```
|
||||
|
||||
即使每次进入 `~/.bashrc` 文件时,我总是会忘记和傻笑,我也有一个“刷新上游”命令:
|
||||
|
||||
```
|
||||
alias yoink="git checkout master && git fetch upstream master && git merge upstream/master"
|
||||
```
|
||||
|
||||
给 Git 人的另一个辅助程序是全局忽略文件。在你的 `git config --global --list` 中,你应该看到一个 `core.excludesfile`。如果没有,请[创建一个][6],然后将你总是放到各个 `.gitignore` 文件中的内容填满它。作为 MacOS 上的 Python 开发人员,对我来说,这写内容是:
|
||||
|
||||
|
||||
```
|
||||
.DS_Store # macOS clutter
|
||||
venv/ # I never want to commit my virtualenv
|
||||
*.egg-info/* # ... nor any locally compiled packages
|
||||
__pycache__ # ... or source
|
||||
*.swp # ... nor any files open in vim
|
||||
```
|
||||
|
||||
你可以在 [Gitignore.io][7] 或 GitHub 上的 [Gitignore 存储库][8]上找到其他建议。
|
||||
|
||||
### 轮到你了
|
||||
|
||||
你最喜欢的辅助程序命令是什么?请在评论中分享。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/1/bash-scripts-aliases
|
||||
|
||||
作者:[Katie McLaughlin][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/glasnt
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bash_command_line.png?itok=k4z94W2U (bash logo on green background)
|
||||
[2]: https://opensource.com/article/19/9/getting-started-zsh
|
||||
[3]: https://gnupg.org/
|
||||
[4]: https://cloud.google.com/service-infrastructure/docs/service-control/getting-started
|
||||
[5]: mailto:git@github.com
|
||||
[6]: https://help.github.com/en/github/using-git/ignoring-files#create-a-global-gitignore
|
||||
[7]: https://www.gitignore.io/
|
||||
[8]: https://github.com/github/gitignore
|
Loading…
Reference in New Issue
Block a user