mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-28 23:20:10 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
011b8740e5
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (Starryi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,142 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Perform Common PDF Editing Tasks Like Merge, Split, Rotate With Free and Open Source PDF Mix Tool)
|
||||
[#]: via: (https://itsfoss.com/pdf-mix-tool/)
|
||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||
|
||||
Perform Common PDF Editing Tasks Like Merge, Split, Rotate With Free and Open Source PDF Mix Tool
|
||||
======
|
||||
|
||||
_**Brief: PDF Mix Tool is a simple, lightweight open-source PDF editing application that lets you extract pages from PDF, merge two PDFs, delete pages from PDF files among a few other things.**_
|
||||
|
||||
### PDF Mix Tool: A Simple Open Source PDF Editing Tool
|
||||
|
||||
![][1]
|
||||
|
||||
There are [several PDF editors available for Linux][2]. I usually categorize them in two categories:
|
||||
|
||||
* PDF editors that let you edit the content (annotate, highlight, change text, add/remove images etc)
|
||||
* PDF editors that let you modify the files by merging files, splitting files, extracting pages from files etc.
|
||||
|
||||
|
||||
|
||||
[PDF Mix Tool][3] falls in the second category. It is an open source software written in C++ and uses Qt5. It lets you merge two or more PDF files specifying a page set for each of them, rotate pages, add white pages, delete pages and extract pages from PDF files.
|
||||
|
||||
In this week’s open source software highlight, let’s take a look at using PDF Mix Tool.
|
||||
|
||||
### Using PDF Mix Tool for editing PDFs in Linux
|
||||
|
||||
![][4]
|
||||
|
||||
PDF Mix Tool does not boast a bunch of features but a handful of things that are incredibly important.
|
||||
|
||||
#### Merge PDF files
|
||||
|
||||
![][5]
|
||||
|
||||
You can easily merge multiple PDF files while specifying the exact pages as well. It gives you the ability to tweak the number of pages, rotation, and also the option to reverse the order of pages to merge with “**Alternate mix**“.
|
||||
|
||||
![][6]
|
||||
|
||||
You just need to click on “**Add PDF Fil**e” to add the files and then edit it with the options available (as shown in the image above) and finally generate the edited PDF.
|
||||
|
||||
#### Rotate pages
|
||||
|
||||
You can rotate pages of a PDF file while merging multiple files or when simply operating on a single PDF file.
|
||||
|
||||
For merging files, you can refer to the screenshots above — but when you select a single file, this is how it looks:
|
||||
|
||||
![][7]
|
||||
|
||||
You get a variety of options, but to rotate the pages, you need to select the “**Edit page layout**” option as shown in the screenshot above.
|
||||
|
||||
#### Add or delete pages
|
||||
|
||||
To add new pages from a different PDF file, it’s best to utilize the option.
|
||||
|
||||
But, if you want to add an empty page, you can do that when selecting a single file to process. Not just limited to the addition of empty pages — but you can delete specific pages as well. Here’s a screenshot that highlights the delete option:
|
||||
|
||||
![][8]
|
||||
|
||||
#### Extract pages from a PDF file
|
||||
|
||||
![][9]
|
||||
|
||||
In addition to all the other options, you can also extract a certain page (or all) from a given PDF file. You can then generate a new PDF file for all the extracted pages or make separate PDF files for every page you extract. It should come in handy in a lot of use-cases.
|
||||
|
||||
#### Other functionalities
|
||||
|
||||
With all the features mentioned above, you can generate an entirely new PDF of your choice, reverse the order, extract the pages, make separate PDF files, and so on.
|
||||
|
||||
It does not reduce size of the PDF file. You’ll have to use other tools for [compressing PDF files on Linux][10].
|
||||
|
||||
So, it’s a mixed bag of things when you combine and use the options available.
|
||||
|
||||
### Installing PDF Mix Tool on Linux
|
||||
|
||||
![PDF Mix Tool in Ubuntu Software Center][11]
|
||||
|
||||
PDF Mix Tool is available as Snap and [Flatpak packages][12]. This means _**you may find it in your distribution’s software manager**_ if it supports either of these packages.
|
||||
|
||||
Alternatively, if you have [Snap package support enabled][13], you can use the following command to install it:
|
||||
|
||||
```
|
||||
sudo snap install pdfmixtool
|
||||
```
|
||||
|
||||
If you want to [use Flatpak][14], you can use:
|
||||
|
||||
```
|
||||
flatpak install flathub eu.scarpetta.PDFMixTool
|
||||
```
|
||||
|
||||
In case you’re using Arch Linux, you can get it from the [community repository][15].
|
||||
|
||||
```
|
||||
sudo pacman -S pdfmixtool
|
||||
```
|
||||
|
||||
You can also choose to take a look at their [GitLab page][16] for its source code.
|
||||
|
||||
[Download Source Code for PDF Mix Tool][17]
|
||||
|
||||
**Wrapping Up**
|
||||
|
||||
It may not be the most feature-rich PDF editing tool — but considering it as a lightweight open-source tool, it is a very useful application to have installed. We have also covered a similar tool [PDF Arranger][18] in the past. You may want to take a look at that as well.
|
||||
|
||||
What do you think about it? Have you tried it yet? Let me know your thoughts in the comments below.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/pdf-mix-tool/
|
||||
|
||||
作者:[Ankush Das][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/ankush/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool.png?ssl=1
|
||||
[2]: https://itsfoss.com/pdf-editors-linux/
|
||||
[3]: https://scarpetta.eu/pdfmixtool/
|
||||
[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool-merge.png?ssl=1
|
||||
[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool-edit.png?ssl=1
|
||||
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool-merge-edit.png?ssl=1
|
||||
[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool-layout.png?ssl=1
|
||||
[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool-add-delete.png?ssl=1
|
||||
[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool-extract.png?ssl=1
|
||||
[10]: https://itsfoss.com/compress-pdf-linux/
|
||||
[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool-ubuntu.png?ssl=1
|
||||
[12]: https://flathub.org/apps/details/eu.scarpetta.PDFMixTool
|
||||
[13]: https://itsfoss.com/install-snap-linux/
|
||||
[14]: https://itsfoss.com/flatpak-guide/
|
||||
[15]: https://www.archlinux.org/packages/community/x86_64/pdfmixtool/
|
||||
[16]: https://gitlab.com/scarpetta/pdfmixtool
|
||||
[17]: https://www.scarpetta.eu/pdfmixtool/
|
||||
[18]: https://itsfoss.com/pdfarranger-app/
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,103 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Don't ignore .gitignore)
|
||||
[#]: via: (https://opensource.com/article/20/8/dont-ignore-gitignore)
|
||||
[#]: author: (Rajeev Bera https://opensource.com/users/acompiler)
|
||||
|
||||
Don't ignore .gitignore
|
||||
======
|
||||
Using a .gitignore file is a best practice for improving the quality of
|
||||
your code and Git repositories.
|
||||
![Business woman on laptop sitting in front of window][1]
|
||||
|
||||
I have noticed that many developers do not use a .gitignore file, even though it's a [best practice][2] to use one to designate files you don't want Git to track in version control. Because .gitignore can boost your code quality, you should not ignore [.gitignore][3] in your repositories.
|
||||
|
||||
### What is .gitignore?
|
||||
|
||||
Files in your working Git repository can be:
|
||||
|
||||
1. **Untracked:** Changes that have not been staged or committed
|
||||
2. **Tracked:** Changes that have been staged or committed
|
||||
3. **Ignored:** Files you tell Git to ignore
|
||||
|
||||
|
||||
|
||||
There are some files you want Git to ignore and not track in your repository. These include many that are auto-generated or platform-specific, as well as other local configuration files such as:
|
||||
|
||||
1. Files with sensitive information
|
||||
2. Compiled code, such as `.dll` or `.class`
|
||||
3. System files like `.DS_Store` or `Thumbs.db`
|
||||
4. Files with temporary information such as logs, caches, etc.
|
||||
5. Generated files such as `dist` folders
|
||||
|
||||
|
||||
|
||||
If you don't want Git to track certain files in your repository, there is no [Git command][4] you can use. (Although you can stop tracking a file with the `git rm` command, such as `git rm --cached`.) Instead, you need to use a .gitignore file, a text file that tells Git which files not to track.
|
||||
|
||||
It's easy to create a .gitignore file; just create a text file and name it .gitignore. Remember to add a single dot (`.`) at the beginning of the file name. That's it!
|
||||
|
||||
### Rules for writing a .gitignore file
|
||||
|
||||
According to the [documentation][3], "each line in a .gitignore file specifies a pattern."
|
||||
|
||||
In this context, a "pattern" can refer to a specific filename, or to some part of a filename combined with a wildcard character. In other words, **example.txt** is a valid pattern that matches a file called **example.txt**, while **ex*txt** is a valid pattern that matches a file called **example.txt** as well as a file called **export.txt**.
|
||||
|
||||
Here are some basic rules to help you to set up your .gitignore file correctly:
|
||||
|
||||
1. Any line that starts with a hash (`#`) is a comment.
|
||||
2. The `\` character escapes special characters.
|
||||
3. The `/` character means that the rule applies only to files and folders located in the same folder.
|
||||
4. An asterisk (`*`) means any number of characters (zero or more).
|
||||
5. Two asterisks (`**`) specify any number of subdirectories.
|
||||
6. A question mark (`?`) replaces zero or one character.
|
||||
7. An exclamation sign (`!`) designates the inversion rule (i.e., it includes any file that was excluded by a previous pattern).
|
||||
8. Blank lines are ignored, so you can use them to add space and make your file easier to read.
|
||||
9. Adding `/` on the end ignores entire directory paths.
|
||||
|
||||
|
||||
|
||||
### Local vs. global .gitignore files
|
||||
|
||||
There are two types of .gitignore files:
|
||||
|
||||
* **Local:** Placed in the root of your Git repository, works only on that repository, and must be committed to the repository
|
||||
* **Global:** Placed in the root of your home directory, affects every repository you use on your machine, does not need to be committed
|
||||
|
||||
|
||||
|
||||
Many developers use a local .gitignore file in their project repository, but very few use the global .gitignore file. The most significant advantages of using a global file are that you don't need to commit it to use it and making one change affects all your repositories.
|
||||
|
||||
### Advantages of Git ignore
|
||||
|
||||
There are other advantages to using a .gitignore file beyond ensuring specific files are not tracked by Git:
|
||||
|
||||
1. It helps you keep your code repository clean by ignoring unwanted files.
|
||||
2. It keeps your repository size under control, which is especially helpful if you are working on a big project.
|
||||
3. Every commit, push, and pull request you make will be clean.
|
||||
|
||||
|
||||
|
||||
### Conclusion
|
||||
|
||||
Git is powerful, but in the end, it's just another computer program. It's a team effort to use best practices and keep your code repo stable, and part of this is using a .gitignore file.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/8/dont-ignore-gitignore
|
||||
|
||||
作者:[Rajeev Bera][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/acompiler
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating)
|
||||
[2]: https://opensource.com/article/20/7/git-repos-best-practices
|
||||
[3]: https://git-scm.com/docs/gitignore
|
||||
[4]: https://acompiler.com/git-commands/
|
@ -0,0 +1,371 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Create a wifi hotspot with Raspberry Pi 3 and Fedora)
|
||||
[#]: via: (https://fedoramagazine.org/create-a-wifi-hotspot-with-raspberry-pi-3-and-fedora/)
|
||||
[#]: author: (Nick Hardiman https://fedoramagazine.org/author/nickhardiman/)
|
||||
|
||||
Create a wifi hotspot with Raspberry Pi 3 and Fedora
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
If you’re already [running Fedora on your Pi][2], you’re already most of the way to a wifi hotspot. A Raspberry Pi has a wifi interface that’s usually set up to join an existing wifi network. This interface can be reconfigured to provide a new wifi network. If a room has a good network cable and a bad wifi signal (a brick wall, foil-backed plasterboard, and even a window with a metal oxide coating are all obstacles), fix it with your Pi.
|
||||
|
||||
This article describes the procedure for setting up the hotspot. It was tested on third generation Pis – a [Model B v1.2][3], and a [Model B+][4] (the older [2][5] and the new [4][6] weren’t tested). These are the credit-card size Pis that have been around a few years.
|
||||
|
||||
This article also delves a little way into the network concepts behind the scenes. For instance, “hotspot” is the term that’s caught on in public places around the world, but it’s more accurate to use the term WLAN AP (Wireless Local Area Network Access Point).In fact, if you want to annoy your friendly neighborhood network administrator, call a hotspot a “wifi router”. The inaccuracy will make their eyes cross.
|
||||
|
||||
A few _nmcli_ commands configure the Raspberry Pi as a wifi AP. The _nmcli_ command-line tool controls the NetworkManager daemon. It’s not the only network configuration system available. More complex solutions are available for the adventurous. Check out the [hostapd][7] RPM package and the [OpenWRT distro][8]. Have a look at [Internet connection sharing with NetworkManager][9] for more ideas.
|
||||
|
||||
### A dive into network administration
|
||||
|
||||
The hotspot is a routed AP (Access Point). It sits between two networks, the current wired network and its new wireless network, and takes care of the post-office-style forwarding of IP packets between them.
|
||||
|
||||
#### Routing and interfaces
|
||||
|
||||
The wireless interface on the Raspberry Pi is named **wlan0** and the wired one is **eth0**. The new wireless network uses one range of IP addresses and the current wired network uses another. In this example, the current network range is 192.168.0.0/24 and the new network range is 10.42.0.0/24. If these numbers make no sense, that’s OK. You can carry on without getting to grips with IP subnets and netmasks. The Raspberry Pi’s two interfaces have IP addresses from these ranges.
|
||||
|
||||
Packets are sent to local computers or remote destinations based on their IP addresses. This is routing work, and it’s where the _routed_ part of _routed AP_ name comes from. If you’d like to build a more complex router with DHCP and DNS, pick up some tips from the article [How to use Fedora Server to create a router / gateway][10].
|
||||
|
||||
#### It’s not a bridged AP
|
||||
|
||||
Netowrk bridging is another way of extending a network, but it’s not how this Pi is set up. This routed AP is not a bridged AP. To understand the difference between routing and bridging, you have to know a little about the networking layers of the OSI network model. A good place to start is the [beginner’s guide to network troubleshooting in Linux][11]. Here’s the short answer.
|
||||
|
||||
* layer 3, network ← Yes, our routed AP is here.
|
||||
* layer 2, data link ← No, it’s not a bridged AP.
|
||||
* layer 1, physical ← Radio transmission is covered here.
|
||||
|
||||
|
||||
|
||||
A [bridge][12] works at a lower layer of the network stack – it uses ethernet MAC addresses to send data. If this was a bridged AP, it wouldn’t have two sets of IP addresses; the new wireless network and the current wired network would use the same IP subnet.
|
||||
|
||||
#### IP masquerading
|
||||
|
||||
You won’t find an IP address starting with _10._ anywhere on the Internet. It’s a private address, not a public address. To get an IP packet routed out of the wifi network and back in again, packet addresses have to be changed. **IP masquerading** is a way of making this routing work. The masquerade name is used because the packets’ real addresses are hidden. the wired network doesn’t see any addresses from the wireless network.
|
||||
|
||||
IP masquerading is set up automatically by NetworkManager. NetworkManager adds nftables rules to handle [IP masquerading][13].
|
||||
|
||||
#### The Pi’s network stack
|
||||
|
||||
A stack of network hardware and software makes wifi work.
|
||||
|
||||
* Network hardware
|
||||
* Kernel space software
|
||||
* User space software
|
||||
|
||||
|
||||
|
||||
You can see the network hardware. The Raspberry Pi has two main hardware components – a tiny antenna and Broadcom wifi chip. [MagPi magazine has some great photos][14].
|
||||
|
||||
Kernel software provides the plumbing. There’s no need to work on these directly – it’s all good to go in the Fedora distribution.
|
||||
|
||||
* [Broadcom driver modules][15] talk to the hardware. List these with the command _lsmod | grep brcm_.
|
||||
* A TCP/IP stack handles protocols.
|
||||
* The [netfilter framework][16] filters packets.
|
||||
* A network system ties these all together.
|
||||
|
||||
|
||||
|
||||
User space software customizes the system. It’s full of utilities that either help the user, talk to the kernel, or connect other utilities together. For instance, the [firewall-cmd][17] tool talks to the [firewalld service][18], firewalld talks to the [nftables][19] tool, and nftables talks to the netfilter framework in the kernel. The [nmcli][20] commands talk to [NetworkManager][21]. And NetworkManager talks to pretty much everything.
|
||||
|
||||
### Create the AP
|
||||
|
||||
That’s enough theory — let’s get practical. Fire up your Raspberry Pi running Fedora and run these commands.
|
||||
|
||||
#### Install software
|
||||
|
||||
Nearly all the required software is included with the Fedora Minimal image. The only thing missing is the _dnsmasq_ package. This handles the DHCP and IP address part of the new wifi network, automatically. Run this command [using sudo][22]:
|
||||
|
||||
```
|
||||
$ sudo dnf install dnsmasq
|
||||
```
|
||||
|
||||
#### Create a new NetworkManager connection
|
||||
|
||||
NetworkManager sets up one network connection automatically, _Wired connection 1_. Use the _nmcli_ tool to tell NetworkManager how to add a wifi connection. NetworkManager saves these settings, and a bunch more, in a new config file.
|
||||
|
||||
The new configuration file is created in the directory _/etc/sysconfig/network-scripts/_. At first, it’s empty; the image has no configuration files for network interfaces. If you want to find out more about how NetworkManager uses the _network-scripts_ directory, the gory details are in the [nm-settings-ifcfg-rh man page][23].
|
||||
|
||||
```
|
||||
[nick@raspi ~]$ ls /etc/sysconfig/network-scripts/
|
||||
[nick@raspi ~]$
|
||||
```
|
||||
|
||||
The first _nmcli_ command, to create a network connection, looks like this. There’s more to do — the Pi won’t work as a hotspot after running this.
|
||||
|
||||
```
|
||||
nmcli con add \
|
||||
type wifi \
|
||||
ifname wlan0 \
|
||||
con-name 'raspi hotspot' \
|
||||
autoconnect yes \
|
||||
ssid 'raspi wifi'
|
||||
```
|
||||
|
||||
The following commands complete several more steps:
|
||||
|
||||
* Create a new connection.
|
||||
* List the connections.
|
||||
* Take another look at the _network-scripts_ folder. NetworkManager added a config file.
|
||||
* List available APs to connect to.
|
||||
|
||||
|
||||
|
||||
This requires running several commands as root [using _sudo_][22]:
|
||||
|
||||
```
|
||||
$ sudo nmcli con add type wifi ifname wlan0 con-name 'raspi hotspot' autoconnect yes ssid 'raspi wifi'
|
||||
Connection 'raspi wifi' (13ea67a7-a8e6-480c-8a46-3171d9f96554) successfully added.
|
||||
$ sudo nmcli connection show
|
||||
NAME UUID TYPE DEVICE
|
||||
Wired connection 1 59b7f1b5-04e1-3ad8-bde8-386a97e5195d ethernet eth0
|
||||
raspi wifi 13ea67a7-a8e6-480c-8a46-3171d9f96554 wifi wlan0
|
||||
$ ls /etc/sysconfig/network-scripts/
|
||||
ifcfg-raspi_wifi
|
||||
$ sudo nmcli device wifi list
|
||||
IN-USE BSSID SSID MODE CHAN RATE SIGNAL BARS SECURITY
|
||||
01:0B:03:04:C6:50 APrivateAP Infra 6 195 Mbit/s 52 ▂▄__ WPA2
|
||||
02:B3:54:05:C8:51 SomePublicAP Infra 6 195 Mbit/s 52 ▂▄__ --
|
||||
```
|
||||
|
||||
You can remove the new config and start again with this command:
|
||||
|
||||
```
|
||||
$ sudo nmcli con delete 'raspi hotspot'
|
||||
```
|
||||
|
||||
#### Change the connection mode
|
||||
|
||||
A NetworkManager connection has many configuration settings. You can see these with the command _nmcli con show ‘raspi hotspot’_. Some of these settings start with the label _802-11-wireless_. This is to do with industry standards that make wifi work – the IEEE organization specified many protocols for wifi, named [802.11][24]. This new wifi connection is in _infrastructure_ mode, ready to connect to a wifi access point. The Pi isn’t supposed to connect to another AP; it’s supposed to be the AP that others connect to.
|
||||
|
||||
This command changes the mode from infrastructure to AP. It also sets a few other [wireless properties][25]. The **bg** value tells NetworkManager to follow two old IEEE standards – [802.11b][26] and [802.11g][27]. Basically it configures the radio to use the 2.4GHz frequency band, not the 5GHz band. **ipv4.method shared** means this connection will be shared with others.
|
||||
|
||||
* Change the connection to a hotspot by changing the mode to _ap_.
|
||||
|
||||
|
||||
|
||||
```
|
||||
sudo nmcli connection \
|
||||
modify "raspi hotspot" \
|
||||
802-11-wireless.mode ap \
|
||||
802-11-wireless.band bg \
|
||||
ipv4.method shared
|
||||
```
|
||||
|
||||
The connection starts automatically. The _dnsmasq_ application gives the wlan0 interface an IP address of 10.42.0.1. The manual commands to start and stop the hotspot are:
|
||||
|
||||
```
|
||||
$ sudo nmcli con up "raspi hotspot"
|
||||
$ sudo nmcli con down "raspi hotspot"
|
||||
```
|
||||
|
||||
#### Connect a device
|
||||
|
||||
The next steps are to:
|
||||
|
||||
* Watch the log.
|
||||
* Connect a smartphone.
|
||||
* When you’ve seen enough, type ^C ([control][c]) to stop watching the log.
|
||||
|
||||
|
||||
|
||||
```
|
||||
$ journalctl --follow
|
||||
-- Logs begin at Wed 2020-04-01 18:23:45 BST. --
|
||||
...
|
||||
```
|
||||
|
||||
Use a wifi-enabled device, like your phone. The phone can find the new _raspi wifi_ network.
|
||||
|
||||
Messages about an associating client appear in the activity log:
|
||||
|
||||
```
|
||||
Jun 10 18:08:05 raspi wpa_supplicant[662]: wlan0: AP-STA-CONNECTED 94:b0:1f:2e:d2:bd
|
||||
Jun 10 18:08:05 raspi wpa_supplicant[662]: wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
|
||||
Jun 10 18:08:05 raspi dnsmasq-dhcp[713]: DHCPREQUEST(wlan0) 10.42.0.125 94:b0:1f:2e:d2:bd
|
||||
Jun 10 18:08:05 raspi dnsmasq-dhcp[713]: DHCPACK(wlan0) 10.42.0.125 94:b0:1f:2e:d2:bd nick
|
||||
```
|
||||
|
||||
### Examine the firewall
|
||||
|
||||
A new security zone named _nm-shared_ has appeared. This is stopping some wifi access.
|
||||
|
||||
```
|
||||
$ sudo firewall-cmd --get-active-zones
|
||||
[sudo] password for nick:
|
||||
nm-shared
|
||||
interfaces: wlan0
|
||||
public
|
||||
interfaces: eth0
|
||||
```
|
||||
|
||||
The new zone is set up to accept everything because the target is _ACCEPT_. Clients are able to use web, mail and SSH to get to the Internet.
|
||||
|
||||
```
|
||||
$ sudo firewall-cmd --zone=nm-shared --list-all
|
||||
nm-shared (active)
|
||||
target: ACCEPT
|
||||
icmp-block-inversion: no
|
||||
interfaces: wlan0
|
||||
sources:
|
||||
services: dhcp dns ssh
|
||||
ports:
|
||||
protocols: icmp ipv6-icmp
|
||||
masquerade: no
|
||||
forward-ports:
|
||||
source-ports:
|
||||
icmp-blocks:
|
||||
rich rules:
|
||||
rule priority="32767" reject
|
||||
```
|
||||
|
||||
This big list of config settings takes a little examination.
|
||||
|
||||
The first line, the innocent-until-proven-guilty option _target: ACCEPT_ says all traffic is allowed through, unless a rule says otherwise. It’s the same as saying these types of traffic are all OK.
|
||||
|
||||
* inbound packets – requests sent from wifi clients to the Raspberry Pi
|
||||
* forwarded packets – requests from wifi clients to the Internet
|
||||
* outbound packets – requests sent by the PI to wifi clients
|
||||
|
||||
|
||||
|
||||
However, there’s a hidden gotcha: requests from wifi clients (like your workstation) to the Raspberry Pi may be rejected. The final line — the mysterious rule in the _rich rules_ section — refers to the [routing policy database][28]. The rule stops you from connecting from your workstation to your Pi with a command like this: _ssh 10.42.0.1_. This rule only affects traffic sent to to the Raspberry Pi, not traffic sent to the Internet, so browsing the web works fine.
|
||||
|
||||
If an inbound packet matches something in the _services_ and _protocols_ lists, it’s allowed through. NetworkManager automatically adds ICMP, DHCP and DNS (Internet infrastructure services and protocols). An SSH packet doesn’t match, gets as far as the [post-processing][29] stage, and is rejected — _priority=”32767″_ translates as “do this after all the processing is done.”
|
||||
|
||||
If you want to know what’s happening behind the scenes, that rich rule creates an nftables rule. The nftables rule looks like this.
|
||||
|
||||
```
|
||||
$ sudo nft list chain inet firewalld filter_IN_nm-shared_post
|
||||
table inet firewalld {
|
||||
chain filter_IN_nm-shared_post {
|
||||
reject
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Fix SSH login
|
||||
|
||||
Connect from your workstation to the Raspberry Pi using SSH.This won’t work because of the rich rule. A protocol that’s not on the list gets instantly rejected.
|
||||
|
||||
Check that SSH is blocked:
|
||||
|
||||
```
|
||||
$ ssh 10.42.0.1
|
||||
ssh: connect to host 10.42.0.1 port 22: Connection refused
|
||||
```
|
||||
|
||||
Next, add SSH to the list of allowed services. If you don’t remember what services are defined, list them all with _firewall-cmd ‐‐get-services_. For SSH, use option _‐‐add-service ssh_ or _‐‐remove-service ssh_. Don’t forget to make the change permanent.
|
||||
|
||||
```
|
||||
$ sudo firewall-cmd --add-service ssh --permanent --zone=nm-shared
|
||||
success
|
||||
```
|
||||
|
||||
Now test with SSH again.
|
||||
|
||||
```
|
||||
$ ssh 10.42.0.1
|
||||
The authenticity of host '10.42.0.1 (10.42.0.1)' can't be established.
|
||||
ECDSA key fingerprint is SHA256:dDdgJpDSMNKR5h0cnpiegyFGAwGD24Dgjg82/NUC3Bc.
|
||||
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
|
||||
Warning: Permanently added '10.42.0.1' (ECDSA) to the list of known hosts.
|
||||
Last login: Tue Jun 9 18:58:36 2020 from 10.0.1.35
|
||||
nick@10.42.0.1's password:
|
||||
```
|
||||
|
||||
SSH access is no longer blocked.
|
||||
|
||||
### Test as a headless computer
|
||||
|
||||
The raspberry pi runs fine as a [headless computer][30]. From here on, you can use SSH to work on your Pi.
|
||||
|
||||
* Power off.
|
||||
* Remove keyboard and video monitor.
|
||||
* Power on.
|
||||
* Wait a couple minutes.
|
||||
* Connect from your workstation to the Raspberry Pi using SSH. Use either the wired interface or the wireless one; both work.
|
||||
|
||||
|
||||
|
||||
### Increase security with WPA-PSK
|
||||
|
||||
The WPA-PSK (Wifi Protected Access with Pre-Shared Key) system is designed for home users and small offices. It is password protected. Use nmcli again to add WPA-PSK:
|
||||
|
||||
```
|
||||
$ sudo nmcli con modify "raspi hotspot" wifi-sec.key-mgmt wpa-psk
|
||||
$ sudo nmcli con modify "raspi hotspot" wifi-sec.psk "hotspot-password"
|
||||
```
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
Here are a couple recommendations:
|
||||
|
||||
* Mine journalctl, Google and forums.
|
||||
* Join the [Fedora ARM mailing list][31].
|
||||
|
||||
|
||||
|
||||
The bad news is, there are no troubleshooting tips here. There are so many things that can go wrong, there’s no way of covering them.
|
||||
|
||||
Troubleshooting a network stack is tricky. If one component goes wrong, it may all go wrong. And making changes like reloading firewall rules can upset services like NetworkManager and sshd. You know you’re in the weeds when you find yourself running [nftables commands][32] like _nft list ruleset_ and [firewalld commands][33] like _firewall-cmd ‐‐set-log-denied=all_.
|
||||
|
||||
### Play with your new platform
|
||||
|
||||
Add value to your new AP. Since you’re running a Pi, there are many hardware add-ons. Since it’s running Fedora, you have thousands of packages available. Try turning it into a mini-NAS, or adding battery back-up, or perhaps a music player.
|
||||
|
||||
* * *
|
||||
|
||||
_Photo by [Uriel SC][34] on [Unsplash][35]_.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/create-a-wifi-hotspot-with-raspberry-pi-3-and-fedora/
|
||||
|
||||
作者:[Nick Hardiman][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://fedoramagazine.org/author/nickhardiman/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2020/07/raspi3-wifi-816x345.jpg
|
||||
[2]: https://fedoramagazine.org/install-fedora-on-a-raspberry-pi/
|
||||
[3]: https://www.raspberrypi.org/products/raspberry-pi-3-model-b/
|
||||
[4]: https://www.raspberrypi.org/products/raspberry-pi-3-model-b-plus/
|
||||
[5]: https://www.raspberrypi.org/products/raspberry-pi-2-model-b/
|
||||
[6]: https://www.raspberrypi.org/products/raspberry-pi-4-model-b/
|
||||
[7]: http://w1.fi/hostapd/
|
||||
[8]: https://openwrt.org/toh/raspberry_pi_foundation/raspberry_pi
|
||||
[9]: https://fedoramagazine.org/internet-connection-sharing-networkmanager/
|
||||
[10]: https://fedoramagazine.org/use-fedora-server-create-router-gateway/
|
||||
[11]: https://www.redhat.com/sysadmin/beginners-guide-network-troubleshooting-linux
|
||||
[12]: https://wiki.linuxfoundation.org/networking/bridge
|
||||
[13]: https://en.wikipedia.org/wiki/Network_address_translation
|
||||
[14]: https://magpi.raspberrypi.org/articles/raspberry-pi-3-specs-benchmarks
|
||||
[15]: https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
|
||||
[16]: https://www.netfilter.org/
|
||||
[17]: https://firewalld.org/documentation/utilities/firewall-cmd.html
|
||||
[18]: https://firewalld.org/
|
||||
[19]: https://firewalld.org/2018/07/nftables-backend
|
||||
[20]: https://developer.gnome.org/NetworkManager/stable/nmcli.html
|
||||
[21]: https://wiki.gnome.org/Projects/NetworkManager
|
||||
[22]: https://fedoramagazine.org/howto-use-sudo/
|
||||
[23]: https://people.freedesktop.org/~lkundrak/nm-docs/nm-settings-ifcfg-rh.html
|
||||
[24]: https://en.wikipedia.org/wiki/IEEE_802.11
|
||||
[25]: https://developer.gnome.org/NetworkManager/stable/settings-802-11-wireless.html
|
||||
[26]: https://en.wikipedia.org/wiki/IEEE_802.11#802.11b
|
||||
[27]: https://en.wikipedia.org/wiki/IEEE_802.11#802.11g
|
||||
[28]: https://www.man7.org/linux/man-pages/man8/ip-rule.8.html
|
||||
[29]: https://firewalld.org/2018/12/rich-rule-priorities
|
||||
[30]: https://en.wikipedia.org/wiki/Headless_computer
|
||||
[31]: https://lists.fedoraproject.org/admin/lists/arm.lists.fedoraproject.org/
|
||||
[32]: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_networking/getting-started-with-nftables_configuring-and-managing-networking
|
||||
[33]: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_networking/using-and-configuring-firewalld_configuring-and-managing-networking
|
||||
[34]: https://unsplash.com/@urielsc26?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||
[35]: https://unsplash.com/s/photos/network?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
@ -0,0 +1,152 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Why I still love tcsh after all these years)
|
||||
[#]: via: (https://opensource.com/article/20/8/tcsh)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
Why I still love tcsh after all these years
|
||||
======
|
||||
Bash may be more popular, but tcsh has advantages that make it more
|
||||
appealing in certain cases.
|
||||
![Person programming on a laptop on a building][1]
|
||||
|
||||
I consider myself a happy [Bash][2] user. However, when I started exploring Unix, it was on a proprietary Unix system that provided [tcsh][3] by default, so my earliest shell experiences were on a modern version of the C shell (csh). That turned out to be a fortunate accident because tcsh was also the shell of choice at the film studio where I worked later in my career.
|
||||
|
||||
To this day, there are several tasks I associate with tcsh, even though there's no logical correlation there. I still use tcsh on at least one system, if only to stay in practice. I also keep it installed on all my systems to maintain compatibility with my own tcsh scripts and to ensure I can launch it when I need to write a script I prefer to have in tcsh.
|
||||
|
||||
### The difference between C shell and Bash
|
||||
|
||||
Tcsh is the modern continuation of csh. When the C shell was released way back in 1978, users were excited over its C-like syntax. C was a new programming language at the time, and more importantly, it was what Unix was written in, so most Unix users were more comfortable with C than an arbitrary scripting language. For instance, in Bash, this `if` loop makes a "secret" call to the `test` binary to evaluate the conditional statement (the part in brackets):
|
||||
|
||||
|
||||
```
|
||||
v=1
|
||||
|
||||
if [ $v -gt 0 ]
|
||||
then
|
||||
echo "verbose"
|
||||
fi
|
||||
```
|
||||
|
||||
Here's the same statement in csh or tcsh, without an external call to `test` because the conditional statement (the code in parentheses) uses csh's built-in evaluation:
|
||||
|
||||
|
||||
```
|
||||
set v=1
|
||||
|
||||
if ($v > 1) then
|
||||
echo "verbose"
|
||||
endif
|
||||
```
|
||||
|
||||
This demonstrates a few things, both good and bad. For instance, it's natural for a C programmer to type a conditional in parentheses, and it's desirable from a programmer's perspective to have math evaluation built into the executable. On the other hand, the `if` loop syntax has more in common with Lua than C, which uses braces as delimiters:
|
||||
|
||||
|
||||
```
|
||||
// this does not work in Csh
|
||||
if ( v>1 ) {
|
||||
[printf][4]("verbose");
|
||||
}
|
||||
```
|
||||
|
||||
In a way, this nicely sums up csh: it's clean, efficient, and familiar for some, but quirky and inconsistent.
|
||||
|
||||
So why use it?
|
||||
|
||||
### Tcsh for precision
|
||||
|
||||
I write more C++ and [Java][5] than C code, so my interest in tcsh shares little with its historical claim to fame. However, I enjoy [Lua][6], and in a way, I think of tcsh and other shells like I think of Lua and Python or even Markdown and [Docbook][7]. Both shells have merit, and it's easy to point to the one that's more popular, but there's strict clarity to the other. In fact, I feel tcsh has a precision that many other shells lack.
|
||||
|
||||
### Variables
|
||||
|
||||
You don't get the luxury of typed variables in shells, but with tcsh, you can at least declare them with a keyword. Strangely, there are several keywords you can use for the task, but the one I settled on was `set`:
|
||||
|
||||
|
||||
```
|
||||
> set var=foo
|
||||
> echo $var
|
||||
foo
|
||||
```
|
||||
|
||||
You can expand variables by typing the name of the variable (`var` in this example) and then pressing **Ctrl+X** followed by the **$** (dollar) key. The example above sets `var` to `foo`.
|
||||
|
||||
As with many other shells, you can list all set variables using `set` alone with no arguments:
|
||||
|
||||
|
||||
```
|
||||
> set
|
||||
term xterm
|
||||
tty pts/2
|
||||
uid 1000
|
||||
user seth
|
||||
var foo
|
||||
[...]
|
||||
```
|
||||
|
||||
You can unset a variable using the `unset` command:
|
||||
|
||||
|
||||
```
|
||||
> unset var
|
||||
> set | grep var
|
||||
>
|
||||
```
|
||||
|
||||
### Missing features is a feature
|
||||
|
||||
Maybe you've seen lines like this in a script:
|
||||
|
||||
|
||||
```
|
||||
var=GitLab
|
||||
${var,,}
|
||||
```
|
||||
|
||||
The second line is a built-in function to transform the contents of `var` into lowercase.
|
||||
|
||||
While extra functions like these are infinitely useful, I sometimes feel they're an invitation to obfuscation. Shell scripting is like the HTML of programming; it's one of the few serious languages you can teach yourself just by reading other people's code. That's not necessarily a great reason to give up useful functions, but it's the reason I try to avoid some of the cryptic shorthand popular in various languages. When writing in tcsh, I don't have the option to use as much shorthand, so complex string operations must be performed with basic Unix tools rather than by built-in shortcuts. I believe it results in code that's easier to read, and that makes a big difference to future contributors—and to future, forgetful _me_.
|
||||
|
||||
### Built-in math
|
||||
|
||||
One of the things I love about tcsh is its built-in **@** math shortcut. Like most self-taught Unix users, I stumbled upon [bc][8], and I've regretted it ever since. Through no fault of its own, bc is often taught to users as a command-line calculator when it's actually better suited as a calculation _language_. Workarounds include an amazing 300-line [calculator in pure Bash][9], or the **let** command in Bash, or the **@** command in tcsh.
|
||||
|
||||
|
||||
```
|
||||
> @ n = ( 1 + 1 / 2 )
|
||||
> echo $n
|
||||
1
|
||||
```
|
||||
|
||||
For very complex math, it may be worth [learning bc][10] or a good [Python mathematics library][11].
|
||||
|
||||
### All the essentials
|
||||
|
||||
For me, tcsh strikes a perfect balance between stark simplicity and essential features. It's not a shell for all users, or even for all purposes, but if you're looking to simplify your view of your text-based world, tcsh might provide an interesting alternative.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/8/tcsh
|
||||
|
||||
作者:[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/computer_code_programming_laptop.jpg?itok=ormv35tV (Person programming on a laptop on a building)
|
||||
[2]: https://opensource.com/resources/what-bash
|
||||
[3]: https://github.com/tcsh-org/tcsh
|
||||
[4]: http://www.opengroup.org/onlinepubs/009695399/functions/printf.html
|
||||
[5]: https://opensource.com/resources/java
|
||||
[6]: https://opensource.com/article/20/2/lua-cheat-sheet
|
||||
[7]: https://opensource.com/article/17/9/docbook
|
||||
[8]: https://www.gnu.org/software/bc/
|
||||
[9]: https://raw.githubusercontent.com/bluebat/.bash/master/bashbc.sh
|
||||
[10]: https://opensource.com/article/20/7/bc
|
||||
[11]: https://opensource.com/alternatives/matlab
|
@ -0,0 +1,143 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Perform Common PDF Editing Tasks Like Merge, Split, Rotate With Free and Open Source PDF Mix Tool)
|
||||
[#]: via: (https://itsfoss.com/pdf-mix-tool/)
|
||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||
|
||||
使用自由开源的 PDF Mix Tool 执行常见的 PDF 编辑任务如:合并、拆分、旋转
|
||||
======
|
||||
|
||||
_**简介:PDF Mix Tool 是一个简单、轻巧的开源 PDF 编辑应用,可让你从 PDF 中提取页面、合并两个 PDF、从 PDF 中删除页面等。**_
|
||||
|
||||
### PDF Mix Tool:一个简单的开源 PDF 编辑工具
|
||||
|
||||
![][1]
|
||||
|
||||
有[一些 Linux 中 PDF 编辑器][2]。我通常将它们分为两类:
|
||||
|
||||
|
||||
* 可让你编辑内容(注释、高亮、更改文本、添加/删除图像等)的 PDF 编辑器,
|
||||
* 可让你通过合并、分割、提取页面等来修改文件的 PDF 编辑器。
|
||||
|
||||
|
||||
|
||||
[PDF Mix Tool][3] 属于第二类。它是用 C++ 和 Qt5 编写的开源软件。它可让你合并两个或更多 PDF 文件,并为每个文件指定页面,还有旋转页面、添加空白页、删除页面以及从 PDF 文件提取页面。
|
||||
|
||||
在本周的开源软件亮点中,让我们看一下使用 PDF Mix Tool。
|
||||
|
||||
### 使用 PDF Mix Tool 在 Linux 中编辑 PDF
|
||||
|
||||
![][4]
|
||||
|
||||
PDF Mix Tool 并没有很多功能,但是有一些非常重要的功能。
|
||||
|
||||
#### 合并 PDF 文件
|
||||
|
||||
![][5]
|
||||
|
||||
你可以轻松合并多个 PDF 文件,同时指定确切的页面。它让你能够调整页面数、旋转,还能使用 “**Alternate mix**” 反转页面顺序合并。
|
||||
|
||||
![][6]
|
||||
|
||||
你只需要单击 “**Add PDF File**”添加文件,然后使用可用的选项对其进行编辑(如上图所示),最后生成编辑的 PDF。
|
||||
|
||||
#### 旋转页面
|
||||
|
||||
你可以在合并多个文件或仅对单个 PDF 文件进行操作时旋转 PDF 文件的页面。
|
||||
|
||||
对于合并文件,你可以参考上面的截图。但是当你选择一个文件时,它看上去像这样:
|
||||
|
||||
![][7]
|
||||
|
||||
你有多种选择,但是要旋转页面,需要选择 “**Edit page layout**” 选项,如上截图所示。
|
||||
|
||||
#### 添加或删除页面
|
||||
|
||||
要从其他 PDF 文件添加新页面,最好利用此选项。
|
||||
|
||||
但是,如果要添加空白页,你可以在选择一个文件时处理。不仅限于添加空白页面,还可以删除特定页面。下面的截图圈出了高亮选项:
|
||||
|
||||
![][8]
|
||||
|
||||
#### 从 PDF 文件提取页面
|
||||
|
||||
![][9]
|
||||
|
||||
除了所有其他选项之外,你还可以从给定的 PDF 文件中提取特定页面(或全部)。你还可以为所有提取的页面生成一个新的 PDF 文件,或者为提取的每个页面制作单独的 PDF 文件。在许多场景中,它应该派上用场。
|
||||
|
||||
#### 其他功能
|
||||
|
||||
利用上面所有功能,你可以生成自己选择的全新 PDF,颠倒顺序、提取页面、制作单独的 PDF 文件等等。
|
||||
|
||||
它不会减小 PDF 文件的大小。你必须使用其他工具[在 Linux 中压缩 PDF 文件][10]。
|
||||
|
||||
因此,当你组合使用可用选项时,它是功能丰富的工具。
|
||||
|
||||
### 在 Linux 上安装 PDF Mix Tool
|
||||
|
||||
![PDF Mix Tool in Ubuntu Software Center][11]
|
||||
|
||||
PDF Mix Tool 存在于 Snap 和 [Flatpak 软件包][12]中。这意味着如果发行版支持任意一种软件包,_**你都可以在软件管理器中找到它**_。
|
||||
|
||||
或者,如果你[启用了 Snap 软件包支持][13],那么可以使用以下命令进行安装:
|
||||
|
||||
```
|
||||
sudo snap install pdfmixtool
|
||||
```
|
||||
|
||||
如果你想[使用 Flatpak][14],那么使用:
|
||||
|
||||
```
|
||||
flatpak install flathub eu.scarpetta.PDFMixTool
|
||||
```
|
||||
|
||||
如果你使用的是 Arch Linux,那么可以从[社区仓库][15]中获取。
|
||||
|
||||
```
|
||||
sudo pacman -S pdfmixtool
|
||||
```
|
||||
|
||||
你也可以选择查看它的 [GitLab 页面][16]获取源码。
|
||||
|
||||
[下载 PDF Mix Tool 源码][17]
|
||||
|
||||
**总结**
|
||||
|
||||
它可能不是功能最丰富的 PDF 编辑工具,但考虑到它是轻量级的开源工具,因此它是已安装的应用中非常有用的。过去我们也介绍过类似的工具 [PDF Arranger][18]。你可能会想了解一下。
|
||||
|
||||
你如何看待它?你有尝试过么?在下面的评论中让我知道你的想法。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/pdf-mix-tool/
|
||||
|
||||
作者:[Ankush Das][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://itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool.png?ssl=1
|
||||
[2]: https://itsfoss.com/pdf-editors-linux/
|
||||
[3]: https://scarpetta.eu/pdfmixtool/
|
||||
[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool-merge.png?ssl=1
|
||||
[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool-edit.png?ssl=1
|
||||
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool-merge-edit.png?ssl=1
|
||||
[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool-layout.png?ssl=1
|
||||
[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool-add-delete.png?ssl=1
|
||||
[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool-extract.png?ssl=1
|
||||
[10]: https://itsfoss.com/compress-pdf-linux/
|
||||
[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool-ubuntu.png?ssl=1
|
||||
[12]: https://flathub.org/apps/details/eu.scarpetta.PDFMixTool
|
||||
[13]: https://itsfoss.com/install-snap-linux/
|
||||
[14]: https://itsfoss.com/flatpak-guide/
|
||||
[15]: https://www.archlinux.org/packages/community/x86_64/pdfmixtool/
|
||||
[16]: https://gitlab.com/scarpetta/pdfmixtool
|
||||
[17]: https://www.scarpetta.eu/pdfmixtool/
|
||||
[18]: https://itsfoss.com/pdfarranger-app/
|
94
translated/tech/20200811 Don-t ignore .gitignore.md
Normal file
94
translated/tech/20200811 Don-t ignore .gitignore.md
Normal file
@ -0,0 +1,94 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Don't ignore .gitignore)
|
||||
[#]: via: (https://opensource.com/article/20/8/dont-ignore-gitignore)
|
||||
[#]: author: (Rajeev Bera https://opensource.com/users/acompiler)
|
||||
|
||||
不要忽视 .gitignore
|
||||
======
|
||||
|
||||
> 使用 .gitignore 文件是提高代码和 Git 仓库质量的最佳实践之一。
|
||||
|
||||
![Business woman on laptop sitting in front of window][1]
|
||||
|
||||
我注意到很多开发者没有使用 `.gitignore` 文件,尽管使用 `.gitignore` 文件来指定你不希望 Git 在版本控制中跟踪的文件是[最佳实践][2]之一。`.gitignore` 可以提高代码质量,所以你不应该忽略版本库中的 [.gitignore][3]。
|
||||
|
||||
### 什么是 .gitignore?
|
||||
|
||||
Git 仓库中的文件可以是:
|
||||
|
||||
1. **未跟踪的**:未被暂存或提交的变更。
|
||||
2. **跟踪的**:已暂存或提交的变更。
|
||||
3. **忽略的**:你让 Git 忽略的文件。
|
||||
|
||||
有些文件你希望 Git 忽略,不要在你的版本库中跟踪它,这些文件包括许多自动生成的或特定于平台的文件,以及其他本地配置文件,如:
|
||||
|
||||
1. 含有敏感信息的文件
|
||||
2. 编译出的代码,如 `.dll` 或 `.class`。
|
||||
3. 系统文件,如 `.DS_Store` 或 `Thumbs.db`。
|
||||
4. 含有临时信息的文件,如日志、缓存等。
|
||||
5. 生成的文件,如 `dist` 文件夹。
|
||||
|
||||
如果你不想让 Git 跟踪版本库中的某些文件,这不是用 [Git 命令][4]做的。(虽然你可以用 `git rm` 命令停止跟踪一个文件,比如 `git rm --cached`。)相反,你需要使用 `.gitignore` 文件,这是一个告诉 Git 不要跟踪哪些文件的文本文件。
|
||||
|
||||
创建 `.gitignore` 文件很简单,只需创建一个文本文件并命名为 `.gitignore`。记得在文件名的开头有一个点(`.`)。就这样,就完成了。
|
||||
|
||||
### 编写 .gitignore 文件的规则
|
||||
|
||||
根据[文档][3],“`.gitignore` 文件中的每一行都指定了一个模式。”
|
||||
|
||||
在此上下文中,“模式”可以指一个特定的文件名,或者指文件名的某些部分结合上通配符。换句话说,`example.txt` 是匹配名为 `example.txt` 的文件的有效模式,而 `ex*txt` 是匹配名为 `example.txt` 以及 `export.txt` 的文件的有效模式。
|
||||
|
||||
以下是一些帮助你正确设置 `.gitignore` 文件的基本规则:
|
||||
|
||||
1. 任何以哈希(`#`)开头的行都是注释。
|
||||
2. `\` 字符可以转义特殊字符。
|
||||
3. `/` 字符表示该规则只适用于位于同一文件夹中的文件和文件夹。
|
||||
4. 星号(`*`)表示任意数量的字符(零个或更多)。
|
||||
5. 两个星号(`**`)表示任意数量的子目录。
|
||||
6. 一个问号(`?`)代替零个或一个字符。
|
||||
7. 一个感叹号(`!`)会反转特定的规则(即包括了任何被前一个模式排除的文件)。
|
||||
8. 空行会被忽略,所以你可以用它们来增加空间,使你的文件更容易阅读。
|
||||
9. 在末尾添加 `/` 会忽略整个目录路径。
|
||||
|
||||
### 本地与全局 .gitignore 文件的比较
|
||||
|
||||
有两种类型的 `.gitignore` 文件:
|
||||
|
||||
* **本地**:放在 Git 仓库的根目录下,只在该仓库中工作,并且必须提交到该仓库中。
|
||||
* **全局**:放在你的主目录根目录下,影响你在你的机器上使用的每个仓库,不需要提交。
|
||||
|
||||
很多开发者在项目仓库中使用本地的 `.gitignore` 文件,但很少有人使用全局的 `.gitignore` 文件。使用全局文件最显著的优势是,你不需要提交就可以使用它,而且做一个改动会影响你所有的版本库。
|
||||
|
||||
### Git 忽略的优势
|
||||
|
||||
除了确保特定的文件不被 Git 追踪之外,使用 `.gitignore` 文件还有其他好处。
|
||||
|
||||
1. 通过忽略不需要的文件,它可以帮助你保持代码库的干净。
|
||||
2. 它可以控制代码库的大小,这在你正在做一个大项目的时候特别有用。
|
||||
3. 你的每一次提交、推送和拉取请求都将是干净的。
|
||||
|
||||
### 结束语
|
||||
|
||||
Git 很强大,但归根结底,它只是一个计算机程序而已。使用最佳实践并保持你的代码仓库稳定是一个团队的努力,其中要做到一件事就是使用 `.gitignore` 文件。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/8/dont-ignore-gitignore
|
||||
|
||||
作者:[Rajeev Bera][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/acompiler
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating)
|
||||
[2]: https://opensource.com/article/20/7/git-repos-best-practices
|
||||
[3]: https://git-scm.com/docs/gitignore
|
||||
[4]: https://acompiler.com/git-commands/
|
Loading…
Reference in New Issue
Block a user