Merge remote-tracking branch 'LCTT/master'

This commit is contained in:
Xingyu Wang 2020-01-19 15:35:33 +08:00
commit 249444c3ea
7 changed files with 421 additions and 119 deletions

View File

@ -1,8 +1,8 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11797-1.html)
[#]: subject: (6 handy Bash scripts for Git)
[#]: via: (https://opensource.com/article/20/1/bash-scripts-git)
[#]: author: (Bob Peterson https://opensource.com/users/bobpeterson)
@ -12,9 +12,9 @@
> 当使用 Git 存储库时,这六个 Bash 脚本将使你的生活更轻松。
![Digital hand surrounding by objects, bike, light bulb, graphs][1]
![](https://img.linux.net.cn/data/attachment/album/202001/18/231713jegbk8fyek798gxb.jpg)
我编写了许多 Bash 脚本,这些脚本使我在使用 Git 存储库时工作更加轻松。我的许多同事说没有必要我所做的一切都可以用 Git 命令完成。虽然这可能是正确的,但我发现脚本远比尝试找出适当的 Git 命令来执行我想要的操作更加方便。
我编写了许多 Bash 脚本,这些脚本使我在使用 Git 存储库时工作更加轻松。我的许多同事说没有必要我所做的一切都可以用 Git 命令完成。虽然这可能是正确的,但我发现脚本远比尝试找出适当的 Git 命令来执行我想要的操作更加方便。
### 1、gitlog
@ -126,7 +126,7 @@ Compare script generated at: /tmp/compare_mismatches.sh
### 6、gitlog.find
最后,我有一个 `gitlog.find` 脚本,可以帮助我识别补丁程序的上游版本在哪里以及每个补丁程序的当前状态。它通过匹配补丁说明来实现。它还会生成一个比较脚本(再次使用了 Kompare以将当前补丁与上游对应补丁进行比较
最后,我有一个 `gitlog.find` 脚本,可以帮助我识别补丁程序的上游版本在哪里以及每个补丁的当前状态。它通过匹配补丁说明来实现。它还会生成一个比较脚本(再次使用了 Kompare以将当前补丁与上游对应补丁进行比较
```
$ gitlog.find
@ -498,7 +498,7 @@ via: https://opensource.com/article/20/1/bash-scripts-git
作者:[Bob Peterson][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -0,0 +1,97 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (7 things I learned from starting an open source project)
[#]: via: (https://opensource.com/article/20/1/open-source-project)
[#]: author: (Mike Bursell https://opensource.com/users/mikecamel)
7 things I learned from starting an open source project
======
It's not really about project mechanics at all.
![Stickers from all different open source projects and communities][1]
I'm currently involved—heavily involved—in [Enarx][2], an open source (of course!) project to support running sensitive workloads on untrusted hosts. I've had involvement in various open source projects over the years, but this is the first for which I'm one of the founders. We're at the stage now where we've got a fair amount of code, quite a lot of documentation, a logo, and (important!) stickers. The project will hopefully be included in a Linux Foundation group—the [Confidential Computing Consortium][3]—so things are going very well indeed.
I thought it might be useful to reflect on some of the things we did to get things going. To be clear, Enarx is a particular type of project, one that we believe has commercial and enterprise applications. It's also not mature yet, and we'll have hurdles and challenges along the way. What's more, the route we've taken won't be right for all projects, but hopefully, there's enough here to give a few pointers to other projects or people considering starting one up.
The first thing I'd say is that there's lots of help to be had out there. I'd start with Opensource.com, where you'll find [lots of guidance][4]. I'll follow up by saying that, however much of it you follow, you'll still get things wrong. That said, here's my list of things to consider when starting an open source project.
### 1\. Aim for critical mass
I'm very lucky to work at the amazing [Red Hat][5], where everything we do is open source and where we take open source and community very seriously. I've heard it called a "critical mass" company—in order to get something taken seriously, you need to get enough people interested in it that it's difficult to ignore. Enarx's two co-founders—Nathaniel McCallum and I—are both very enthusiastic about the project and have spent a lot of time gaining sponsors within the organisation (you know who you are, and we thank you—we also know we haven't done a good enough job with you on all occasions!) and "selling" it to engineers to get them interested enough that it was difficult to stop.
Some projects just bobble along with one or two contributors, but if you want to attract people and attention, getting a good set of people together who can get momentum going is a must.
### 2\. Create a demo
If you want to get people involved, a demo is great. It doesn't necessarily need to be polished, but it does need to show that what you're doing is possible and that you know what you're doing. For early demos, you may be talking about command-line output; that's fine if what you're providing isn't a user interface (UI) product. Being able to talk about what you're doing and convey both your passion and the importance of the project is a great boon. People like to be able to _see_ or _experience_ something, and it's much easier to communicate your enthusiasm if they have something real that expresses that.
### 3\. Choose a license
Once you have code and it's open source, you want other people to be able to contribute. This may seem like an unimportant step, but selecting an appropriate open source licence[1][6] will allow other people to contribute on well-understood and defined terms, making it easier for them to be involved—and for the organisations for which they work to allow them to do so.
### 4\. Get documentation
You might think that developer documentation is the most important to get out there—otherwise, how will other people get involved in coding? I disagree, at least to start with. For a small project, you can probably scale to a few more people just by explaining what the code does, what it should do, and what's missing. However, if there's no documentation available to explain what it's for and how it's going to help people, then why would anyone bother even looking at it?
This doesn't need to be polished marketing copy, and it doesn't need to be serious, but it does need to convey to people why they should care. It's also going to help you with the first point I mentioned, attaining critical mass, as being able to point to documentation, use cases, and the rest will help convince people that you've thought through the _point_ of your project. We've used a GitHub wiki as our main documentation hub, and we try to update it with new information as we generate it. This is an area, to be clear, where we could do better. But at least we know that.
### 5\. Be visible
People aren't going to find out about you unless you're visible. We were incredibly lucky in that the Confidential Computing Consortium was formed just as we were beginning to get to a level of critical mass, and we immediately had a platform to increase our exposure. We have a [Twitter account][7], I publish articles on [my blog][8], and at Opensource.com, we've been lucky enough to have the chance to publish on Red Hat's [now + Next][9] blog, I've done interviews with the press, and we speak at conferences wherever and whenever we can.
We're very lucky to have these opportunities, and it's clear that not all these approaches are appropriate for all projects, but make use of what you can: the more that people know about you, the more people can contribute.
### 6\. Be welcoming
Let's assume that people have found out about you: what's next? Well, they're hopefully going to want to get involved. If they don't feel welcome, then any involvement they have will taper off quickly. Yes, you need documentation (and, after a while, technical documentation, no matter what I said above), but you also need ways for contributors to talk to you and for them to feel that they are valued. We have [Gitter channels][10], and our daily standups are open to anyone who wants to join. Recently, someone opened an issue on our [issues database][11], and during the conversation on that thread, it transpired that our daily standup time doesn't work for them (given their time zone), so we're going to ensure that at least once a week it _does_, and we've assured them that we'll accommodate them.
### 7\. Work with people you like
I really, really enjoy meeting and working with the members of the Enarx project team. We get on well, we joke, we laugh, and we share a common aim: to make Enarx successful. I'm a firm believer in doing things you enjoy, where possible. Particularly in the early stages of a project, you need people who are enthusiastic and enjoy working closely together—even if they're geographically separated by thousands of kilometres.[2][12] If they don't get on, there's a decent chance that your and their enthusiasm for the project will falter, that the momentum will be lost, and that the project will end up failing. You won't always get the chance to choose those with whom you work, but if you can, then choose people you like and get on with.
### Conclusion: People
I didn't realise it when I started writing this article, but it's not really about project mechanics at all: it's about people. If you read back, you'll find the importance of people visible in every tip, even the one about choosing a license. Open source projects aren't really about code: they're about people, how they share, how they work together, and how they interact.
I'm certain that your experience of open source projects will vary, and I'd be very surprised if everyone agrees about the top seven things you should do for project success. Arguably, Enarx _isn't_ a success yet, and I shouldn't be giving advice at this stage of our maturity. But when I think back to all of the open source projects that I can think of that _are_ successful, people feature strongly, and I don't think that's a surprise at all.
* * *
1. Or "license," if you're from the US.
2. Or, in fact, miles.
* * *
_This article originally appeared on [Alice, Eve, and Bob a security blog][13] and is republished with permission._
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/1/open-source-project
作者:[Mike Bursell][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/mikecamel
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/stickers-osdc-lead.png?itok=2RNn132b (Stickers from all different open source projects and communities)
[2]: https://enarx.io/
[3]: https://confidentialcomputing.io/
[4]: https://opensource.com/article/20/1/getting-started-open-source
[5]: https://redhat.com/
[6]: tmp.3liT27tUaE#1
[7]: https://twitter.com/enarxproject
[8]: https://aliceevebob.com/
[9]: https://next.redhat.com/
[10]: https://gitter.im/enarx/
[11]: https://github.com/enarx/enarx/issues
[12]: tmp.3liT27tUaE#2
[13]: https://aliceevebob.com/2019/12/17/7-tips-for-kicking-off-an-open-source-project/

View File

@ -1,111 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Organize your email with Notmuch)
[#]: via: (https://opensource.com/article/20/1/organize-email-notmuch)
[#]: author: (Kevin Sonney https://opensource.com/users/ksonney)
Organize your email with Notmuch
======
Notmuch indexes, tags, and sorts your email. Learn how to use it in the
fourth article in our series on 20 ways to be more productive with open
source in 2020.
![Filing cabinet for organization][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.
### Index your email with Notmuch
Yesterday, I talked about how I use OfflineIMAP to [sync my mail][2] to my local machine. Today, I'll talk about how I preprocess all that mail before I read it.
![Notmuch][3]
[Maildir][4] is probably one of the most useful mail storage formats out there. And there are a LOT of tools to help with managing your mail. The one I keep coming back to is a little program called [Notmuch][5] that indexes, tags, and searches mail messages. And there are several programs that work with Notmuch to make it even easier to handle a large amount of mail.
Most Linux distributions include Notmuch, and you can also get it for MacOS. Windows users can access it through Windows Subsystem for Linux ([WSL][6]), but it may require some additional tweaks.
![Notmuch's first run][7]
On Notmuch's very first run, it will ask you some questions and create a **.notmuch-config** file in your home directory. Next, index and tag all your mail by running **notmuch new**. You can verify it with **notmuch search tag:new**; this will find all messages with the "new" tag. That's probably a lot of mail since Notmuch uses the "new" tag to indicate messages that are new to it, so you'll want to clean that up.
Run **notmuch search tag:unread** to find any unread messages; that should result in quite a lot less mail. To remove the "new" tag from messages you've already seen, run **notmuch tag -new not tag:unread**, which will search for all messages without the "unread" tag and remove the "new" tag from them. Now when you run **notmuch search tag:new**, it should show only the unread mail messages.
Tagging messages in bulk is probably more useful, though, since manually updating tags at every run can be really tedious. The **\--batch** command-line option tells Notmuch to read multiple lines of commands and execute them. There is also the **\--input=filename** option, which reads commands from a file and applies them. I have a file called **tagmail.notmuch** that I use to add tags to mail that is "new"; it looks something like this:
```
# Manage sent, spam, and trash folders
-unread -new folder:Trash
-unread -new folder:Spam
-unread -new folder:Sent
# Note mail sent specifically to me (excluding bug mail)
+to-me to:kevin at sonney.com and tag:new and not tag:to-me
# And note all mail sent from me
+sent from:kevin at sonney.com and tag:new and not tag:sent
# Remove the new tag from messages
-new tag:new
```
I can then run **notmuch tag --input=tagmail.notmuch** to bulk-process my mail messages after running **notmuch new**, and then I can search on those tags as well.
Notmuch also supports running pre- and post-new hooks. These scripts, stored in **Maildir/.notmuch/hooks**, define actions to run before (pre-new) and after (post-new) to index new mail with **notmuch new**. In yesterday's article, I talked about using [OfflineIMAP][8] to sync mail from my IMAP server. It's very easy to run it from the "pre-new" hook:
```
#!/bin/bash
# Remove the new tag from messages that are still tagged as new
notmuch tag -new tag:new
# Sync mail messages
offlineimap -a LocalSync -u quiet
```
You can also use the Python application [afew][9], which interfaces with the Notmuch database, to tag things like _Mailing List_ and _Spam_ for you. You can run afew from the post-new hook in a similar way:
```
#!/bin/bash
# tag with my custom tags
notmuch tag --input=~/tagmail.notmuch
# Run afew to tag new mail
afew -t -n
```
I recommend that when using afew to tag messages, you do NOT use the **[ListMailsFilter]** since some mail handlers add obscure or downright junk List-ID headers to mail messages (I'm looking at you, Google).
![alot email client][10]
At this point, any mail reader that supports Notmuch or Maildir can work with my email. I'll sometimes use [alot][11], a Notmuch-specific client, to read mail at the console, but it's not as fancy as some other mail readers.
In the coming days, I'll show you some other mail clients that will likely integrate with tools you already use. In the meantime, check out some of the other tools that work with Maildir mailboxes—you might find a hidden gem I've not tried yet.
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/1/organize-email-notmuch
作者:[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/files_documents_organize_letter.png?itok=GTtiiabr (Filing cabinet for organization)
[2]: https://opensource.com/article/20/1/sync-email-offlineimap
[3]: https://opensource.com/sites/default/files/uploads/productivity_4-1.png (Notmuch)
[4]: https://en.wikipedia.org/wiki/Maildir
[5]: https://notmuchmail.org/
[6]: https://docs.microsoft.com/en-us/windows/wsl/install-win10
[7]: https://opensource.com/sites/default/files/uploads/productivity_4-2.png (Notmuch's first run)
[8]: http://www.offlineimap.org/
[9]: https://afew.readthedocs.io/en/latest/index.html
[10]: https://opensource.com/sites/default/files/uploads/productivity_4-3.png (alot email client)
[11]: https://github.com/pazz/alot

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -0,0 +1,77 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Keep a journal of your activities with this Python program)
[#]: via: (https://opensource.com/article/20/1/python-journal)
[#]: author: (Kevin Sonney https://opensource.com/users/ksonney)
Keep a journal of your activities with this Python program
======
Jrnl creates a searchable, timestamped, exportable, and (if you want)
encrypted log of your daily activities. Learn more in the eighth in our
series on 20 ways to be more productive with open source in 2020.
![Writing in a notebook][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.
### Journaling with jrnl
At my workplace, many of us post an "end of day" status to Slack before we leave for the day. With a lot of projects going on and a global team, it is a pretty good way to share what you got done, what isn't done, and what you need help with. But some days are so busy, so hectic that I can't remember what I did. And this is where journaling comes in.
![jrnl][2]
It's pretty easy to keep a text editor open and just add a line when you do something. But it can be challenging to go back and figure out when you make a particular note or pull out related lines quickly and easily. Fortunately, [jrnl][3] is here to help.
Jrnl allows you to enter a quick entry from your command line, search past entries, and export to rich text formats like HTML and Markdown. You can have multiple journals, meaning you can keep your work entries separated from private ones. It stores entries as plain text, so even if jrnl stops working, you have your data.
Since jrnl is a Python program, the easiest way to install it is with **pip3 install jrnl**; this will make sure you get the latest and greatest version. On its first run, it will ask some questions, and then you are good to go.
![jrnl's first run][4]
Now, whenever you need to make a note or log work, simply type **jrnl <some text>,** and it will be logged with a timestamp to the default file. You can search for entries on a specific date with **jrnl -on YYYY-MM-DD**, entries since a date with **jrnl -from YYYY-MM-DD**, and entries up to a specific date with **jrnl -to YYYY-MM-DD**. Search terms can be combined with the **-and** parameter, allowing for searches like **jrnl -from 2019-01-01 -and -to 2019-12-31**.
You can also edit entries in the journal with the **\--edit** command-line flag. Before you do, set up your default editor for entries by editing the file **~/.config/jrnl/jrnl.yaml**. This is also where you can specify what files to use for journals, what special character to use for tags, and a few other options. Right now, the important thing is to set the editor. I use Vim, and jrnl's documentation has some [helpful hints][5] for using other editors like VSCode and Sublime Text.
![Example jrnl config file][6]
Jrnl can also encrypt journal files. By setting the global **encrypt** variable, you'll tell jrnl to encrypt all the journals you have defined. Encryption can also be set per file by adding **encrypt: true** to the definition in the configuration file.
```
journals:
  default: ~/journals/journal.txt
  work: ~/journals/work.txt
  private:
    journal: ~/journals/private.txt
    encrypt: true
```
If a journal isn't already encrypted, you will be prompted for the password on any actions for that journal. The journal file will be stored encrypted on disk and safe from prying eyes. [The jrnl documentation][7] has a lot more information on how it works, what ciphers it uses, and so on.
![Encrypted jrnl file][8]
Journaling helps me remember what I did when and find it later when I need it.
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/1/python-journal
作者:[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/notebook-writing-pen.jpg?itok=uA3dCfu_ (Writing in a notebook)
[2]: https://opensource.com/sites/default/files/uploads/productivity_8-1.png (jrnl)
[3]: https://jrnl.sh/
[4]: https://opensource.com/sites/default/files/uploads/productivity_8-2.png (jrnl's first run)
[5]: https://jrnl.sh/recipes/#external-editors
[6]: https://opensource.com/sites/default/files/uploads/productivity_8-3.png (Example jrnl config file)
[7]: https://jrnl.sh/encryption/
[8]: https://opensource.com/sites/default/files/uploads/productivity_8-4.png (Encrypted jrnl file)

View File

@ -0,0 +1,130 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to Set or Change Timezone in Ubuntu Linux [Beginners Tip])
[#]: via: (https://itsfoss.com/change-timezone-ubuntu/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
How to Set or Change Timezone in Ubuntu Linux [Beginners Tip]
======
[When you install Ubuntu][1], it asks you to set timezone. If you chose a wrong timezone or if you have moved to some other part of the world, you can easily change it later.
### How to change Timezone in Ubuntu and other Linux distributions
There are two ways to change the timezone in Ubuntu. You can use the graphical settings or use the timedatectl command in the terminal. You may also change the /etc/timezone file directly but I wont advise that.
Ill show you both graphical and terminal way in this beginners tutorial:
* [Change timezone in Ubuntu via GUI][2] (suitable for desktop users)
* [Change timezone in Ubuntu via command line][3] (works for both desktop and servers)
![][4]
#### Method 1: Change Ubuntu timezone via terminal
[Ubuntu][5] or any other distributions using systemd can use the timedatectl command to set timezone in Linux terminal.
You can check the current date and timezone setting using timedatectl command without any option:
```
[email protected]:~$ timedatectl
Local time: Sat 2020-01-18 17:39:52 IST
Universal time: Sat 2020-01-18 12:09:52 UTC
RTC time: Sat 2020-01-18 12:09:52
Time zone: Asia/Kolkata (IST, +0530)
System clock synchronized: yes
systemd-timesyncd.service active: yes
RTC in local TZ: no
```
As you can see in the output above, my system uses Asia/Kolkata. It also tells me that it is 5:30 hours ahead of GMT.
To set a timezone in Linux, you need to know the exact timezone. You must use the correct format of the timezone (which is Continent/City).
To get the timezone list, use the _list-timezones_ option of _timedatectl_ command:
```
timedatectl list-timezones
```
It will show you a huge list of the available time zones.
![Timezones List][6]
You can use the up and down arrow or PgUp and PgDown key to move between the pages.
You may also grep the output and search for your timezone. For example, if you are looking for time zones in Europe, you may use:
```
timedatectl list-timezones | grep -i europe
```
Lets say you want to set the timezone to Paris. The timezone value to be used here is Europe/Paris:
```
timedatectl set-timezone Europe/Paris
```
It wont show any success message but the timezone is changed instantly. You dont need to restart or log out.
Keep in mind that though you dont need to become root user and use sudo with the command but your account still need to have admin rights in order to change the timezone.
You can verify the changed time and timezone by using the [date command][7]:
```
[email protected]:~$ date
Sat Jan 18 13:56:26 CET 2020
```
#### Method 2: Change Ubuntu timezone via GUI
Press the super key (Windows key) and search for Settings:
![Applications Menu Settings][8]
Scroll down a little and look for Details in the left sidebar:
![Go to Settings -> Details][9]
In Details, youll fine Date & Time in the left sidebar. Here, you should turn off Automatic Time Zone option (if it is enabled) and then click on the Time Zone:
![In Details -> Date & Time, turn off the Automatic Time Zone][10]
When you click the Time Zone, it will open an interactive map and you can click on the geographical location of your choice and close the window.
![Select a timezone][11]
You dont have to do anything other than closing this map after selecting the new timezone. No need to logout or [shutdown Ubuntu][12].
I hope this quick tutorial helped you to change timezone in Ubuntu and other Linux distributions. If you have questions or suggestions, please let me know.
--------------------------------------------------------------------------------
via: https://itsfoss.com/change-timezone-ubuntu/
作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/install-ubuntu/
[2]: tmp.bHvVztzy6d#change-timezone-gui
[3]: tmp.bHvVztzy6d#change-timezone-command-line
[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/Ubuntu_Change-_Time_Zone.png?ssl=1
[5]: https://ubuntu.com/
[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/timezones_in_ubuntu.jpg?ssl=1
[7]: https://linuxhandbook.com/date-command/
[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/applications_menu_settings.jpg?ssl=1
[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/settings_detail_ubuntu.jpg?ssl=1
[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/change_timezone_in_ubuntu.jpg?ssl=1
[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/change_timezone_in_ubuntu_2.jpg?ssl=1
[12]: https://itsfoss.com/schedule-shutdown-ubuntu/

View File

@ -0,0 +1,109 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Organize your email with Notmuch)
[#]: via: (https://opensource.com/article/20/1/organize-email-notmuch)
[#]: author: (Kevin Sonney https://opensource.com/users/ksonney)
使用 Notmuch 组织你的邮件
======
Notmuch 索引、标记和排序电子邮件。在我们的 20 个使用开源提升生产力的系列的第四篇文章中了解该如何使用。
![Filing cabinet for organization][1]
去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。
### 用 Notmuch 为你的邮件建立索引
昨天,我谈到了如何使用 OfflineIMAP [将我的邮件同步][2]到本地计算机。今天,我将讨论如何在阅读之前预处理所有邮件。
![Notmuch][3]
[Maildir][4] 可能是最有用的邮件存储格式之一。有很多工具可以帮助你管理邮件。我经常使用一个名为 [Notmuch][5] 的小程序它能索引、标记和搜索邮件。Notmuch 配合其他几个程序一起使用可以使处理大量邮件更加容易。
大多数 Linux 发行版都包含 Notmuch你也可以在 MacOS 上获得它。Windows 用户可以通过 Linux 的 Windows 子系统([WSL][6])访问它,但可能需要进行一些其他调整。
![Notmuch's first run][7]
Notmuch 首次运行时,它将询问你一些问题,并在家目录中创建 **.notmuch-config** 文件。接下来,运行 **notmuch new** 来索引并标记所有邮件。你可以使用 **notmuch search tag:new** 进行验证,它会找到所有带有 “new” 标签的消息。这可能会有很多邮件,因为 Notmuch 使用 “new” 标签来指示新邮件,因此你需要对其进行清理。
运行 **notmuch search tag:unread** 来查找未读消息,这会减少很多邮件。要从你已阅读的消息中删除 “new” 标签,请运行 **notmuch tag -new not tag:unread**,它将搜索所有没有 “unread” 标签的消息,并从其中删除 “new” 标签。现在,当你运行 **notmuch search tag:new**时,它将仅显示未读邮件。
但是,批量标记消息可能更有用,因为在每次运行时手动更新标记可能非常繁琐。**\--batch** 命令行选项告诉 Notmuch 读取多行命令并执行它们。还有一个 **\--input=filename** 选项,该选项从文件中读取命令并应用它们。我有一个名为 **tagmail.notmuch** 的文件,用于给”新“邮件添加标签;它看起来像这样:
```
# Manage sent, spam, and trash folders
-unread -new folder:Trash
-unread -new folder:Spam
-unread -new folder:Sent
# Note mail sent specifically to me (excluding bug mail)
+to-me to:kevin at sonney.com and tag:new and not tag:to-me
# And note all mail sent from me
+sent from:kevin at sonney.com and tag:new and not tag:sent
# Remove the new tag from messages
-new tag:new
```
我可以在运行 **notmuch new** 后运行 **notmuch tag --input=tagmail.notmuch** 批量处理我的邮件,之后我也可以搜索这些标签。
Notmuch 还支持 pre-new 和 post-new 钩子。这些脚本存放在 **Maildir/.notmuch/hooks** 中,它们定义了在使用 **notmuch new** 索引新邮件之前pre-new和之后post-new要做的操作。在昨天的文章中我谈到了使用 [OfflineIMAP][8] 同步来自 IMAP 服务器的邮件。从 “pre-new” 钩子运行它非常容易:
```
#!/bin/bash
# Remove the new tag from messages that are still tagged as new
notmuch tag -new tag:new
# Sync mail messages
offlineimap -a LocalSync -u quiet
```
你还可以使用可以操作 Notmuch 数据库的 Python 应用 [afew][9]来为你标记_邮件列表_和_垃圾邮件_。你可以用类似的方法在 post-new 钩子中使用 afew
```
#!/bin/bash
# tag with my custom tags
notmuch tag --input=~/tagmail.notmuch
# Run afew to tag new mail
afew -t -n
```
我建议你在使用 afew 标记邮件时,不要使用 **[ListMailsFilter]**,因为某些邮件处理程序会在邮件中添加模糊或者完全的垃圾列表中的标头(我说的是你 Google
![alot email client][10]
此时,任何支持 Notmuch 或 Maildir 的邮件阅读器都可以读取我的邮件。有时,我会使用 [alot][11](一个 Notmuch 特定的客户端)在控制台中阅读邮件,但是它不像其他邮件阅读器那么美观。
在接下来的几天,我将向你展示其他一些邮件客户端,它们可能会与你在使用的工具集成在一起。同时,请查看可与 Maildir 邮箱一起使用的其他工具。你可能会发现我没发现的好东西。
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/1/organize-email-notmuch
作者:[Kevin Sonney][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者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/files_documents_organize_letter.png?itok=GTtiiabr (Filing cabinet for organization)
[2]: https://opensource.com/article/20/1/sync-email-offlineimap
[3]: https://opensource.com/sites/default/files/uploads/productivity_4-1.png (Notmuch)
[4]: https://en.wikipedia.org/wiki/Maildir
[5]: https://notmuchmail.org/
[6]: https://docs.microsoft.com/en-us/windows/wsl/install-win10
[7]: https://opensource.com/sites/default/files/uploads/productivity_4-2.png (Notmuch's first run)
[8]: http://www.offlineimap.org/
[9]: https://afew.readthedocs.io/en/latest/index.html
[10]: https://opensource.com/sites/default/files/uploads/productivity_4-3.png (alot email client)
[11]: https://github.com/pazz/alot