mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-25 23:11:02 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
bc355763ef
272
published/20201207 Add storage to your Fedora system with LVM.md
Normal file
272
published/20201207 Add storage to your Fedora system with LVM.md
Normal file
@ -0,0 +1,272 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12936-1.html)
|
||||
[#]: subject: (Add storage to your Fedora system with LVM)
|
||||
[#]: via: (https://fedoramagazine.org/add-storage-to-your-fedora-system-with-lvm/)
|
||||
[#]: author: (Tim Bosse https://fedoramagazine.org/author/maztaim/)
|
||||
|
||||
使用 LVM 为你的 Fedora 系统添加存储
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
有时需要在系统中添加另一块磁盘。这就是<ruby>逻辑卷管理<rt>Logical Volume Management</rt></ruby>(LVM)的用武之地。LVM 的好处之处在于它相当灵活。有几种方法可以添加一块磁盘。这篇文章介绍了一种方法。
|
||||
|
||||
### 注意!
|
||||
|
||||
这篇文章并不包括将新的磁盘物理地安装到系统中的过程。请查阅你的系统和磁盘文档,了解如何正确地进行安装。
|
||||
|
||||
**重要:** 一定要确保你已经备份重要数据。如果新磁盘已有数据,那么本文中描述的步骤将破坏数据。
|
||||
|
||||
### 最好了解
|
||||
|
||||
本文并没有深入介绍 LVM 的每一个功能,重点是添加磁盘。但基本上你要了解,LVM 有<ruby>卷组<rt>volume group</rt></ruby>(VG),它由一个或多个分区和/或磁盘组成。你把这些分区或磁盘以<ruby>物理卷<rt>physical volume</rt></ruby>(PV)的方式添加到卷组。一个卷组可以分成许多<ruby>逻辑卷<rt>logical volume</rt></ruby>(LV)。逻辑卷可以作为文件系统、ramdisk 等其他存储使用。更多信息可以在[这里][2]中找到。
|
||||
|
||||
可以看作是,把物理卷形成一个存储池(一个卷组),然后从这个存储池中划分出逻辑卷,供你的系统直接使用。
|
||||
|
||||
### 准备
|
||||
|
||||
确保你能看到你要添加的磁盘。在添加磁盘之前使用 `lsblk` 查看哪些存储空间已经可用或正在使用。
|
||||
|
||||
```
|
||||
$ lsblk
|
||||
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
|
||||
zram0 251:0 0 989M 0 disk [SWAP]
|
||||
vda 252:0 0 20G 0 disk
|
||||
├─vda1 252:1 0 1G 0 part /boot
|
||||
└─vda2 252:2 0 19G 0 part
|
||||
└─fedora_fedora-root 253:0 0 19G 0 lvm /
|
||||
```
|
||||
|
||||
本文使用的是带有虚拟存储的虚拟机,因此设备名称以 `vda` 开头代表第一个磁盘,`vdb` 代表第二个磁盘,以此类推。你的设备名称可能不同。许多系统会将 `sda` 作为第一个物理磁盘,`sdb` 代表第二个磁盘,以此类推。
|
||||
|
||||
当已连接新磁盘,并且你的系统已备份且正在运行,再次使用 `lsblk` 来查看新的块设备。
|
||||
|
||||
```
|
||||
$ lsblk
|
||||
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
|
||||
zram0 251:0 0 989M 0 disk [SWAP]
|
||||
vda 252:0 0 20G 0 disk
|
||||
├─vda1 252:1 0 1G 0 part /boot
|
||||
└─vda2 252:2 0 19G 0 part
|
||||
└─fedora_fedora-root 253:0 0 19G 0 lvm /
|
||||
vdb 252:16 0 10G 0 disk
|
||||
```
|
||||
|
||||
现在有一个名为 `vdb` 的新设备。该设备的位置是 `/dev/vdb`。
|
||||
|
||||
```
|
||||
$ ls -l /dev/vdb
|
||||
brw-rw----. 1 root disk 252, 16 Nov 24 12:56 /dev/vdb
|
||||
```
|
||||
|
||||
我们可以看到磁盘,但我们还不能用 LVM 来使用它。如果你运行 `blkid`,你应该不会看到它被列出。对于这个和之后的命令,你需要确保你的系统[已配置好,这样你可以使用 sudo][3]:
|
||||
|
||||
```
|
||||
$ sudo blkid
|
||||
/dev/vda1: UUID="4847cb4d-6666-47e3-9e3b-12d83b2d2448" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="830679b8-01"
|
||||
/dev/vda2: UUID="k5eWpP-6MXw-foh5-Vbgg-JMZ1-VEf9-ARaGNd" TYPE="LVM2_member" PARTUUID="830679b8-02"
|
||||
/dev/mapper/fedora_fedora-root: UUID="f8ab802f-8c5f-4766-af33-90e78573f3cc" BLOCK_SIZE="4096" TYPE="ext4"
|
||||
/dev/zram0: UUID="fc6d7a48-2bd5-4066-9bcf-f062b61f6a60" TYPE="swap"
|
||||
```
|
||||
|
||||
### 将磁盘添加到 LVM 中
|
||||
|
||||
使用 `pvcreate` 初始化磁盘。你需要传递设备的完整路径。在这个例子中,它是 `/dev/vdb`。在你的系统中,它可能是 `/dev/sdb` 或其他设备名。
|
||||
|
||||
```
|
||||
$ sudo pvcreate /dev/vdb
|
||||
Physical volume "/dev/vdb" successfully created.
|
||||
```
|
||||
|
||||
当你运行 `blkid` 时,你应该看到磁盘已经被初始化为一个 `LVM2_member`:
|
||||
|
||||
```
|
||||
$ sudo blkid
|
||||
/dev/vda1: UUID="4847cb4d-6666-47e3-9e3b-12d83b2d2448" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="830679b8-01"
|
||||
/dev/vda2: UUID="k5eWpP-6MXw-foh5-Vbgg-JMZ1-VEf9-ARaGNd" TYPE="LVM2_member" PARTUUID="830679b8-02"
|
||||
/dev/mapper/fedora_fedora-root: UUID="f8ab802f-8c5f-4766-af33-90e78573f3cc" BLOCK_SIZE="4096" TYPE="ext4"
|
||||
/dev/zram0: UUID="fc6d7a48-2bd5-4066-9bcf-f062b61f6a60" TYPE="swap"
|
||||
/dev/vdb: UUID="4uUUuI-lMQY-WyS5-lo0W-lqjW-Qvqw-RqeroE" TYPE="LVM2_member"
|
||||
```
|
||||
|
||||
你可以使用 `pvs` 列出当前所有可用的物理卷:
|
||||
|
||||
```
|
||||
$ sudo pvs
|
||||
PV VG Fmt Attr PSize PFree
|
||||
/dev/vda2 fedora_fedora lvm2 a-- <19.00g 0
|
||||
/dev/vdb lvm2 --- 10.00g 10.00g
|
||||
```
|
||||
|
||||
`/dev/vdb` 被列为一个 PV (物理卷),但还没有分配到一个 VG (卷组)。
|
||||
|
||||
### 将物理卷添加到一个卷组
|
||||
|
||||
你可以使用 `vgs` 找到可用的卷组列表:
|
||||
|
||||
```
|
||||
$ sudo vgs
|
||||
VG #PV #LV #SN Attr VSize VFree
|
||||
fedora_fedora 1 1 0 wz--n- 19.00g 0
|
||||
```
|
||||
|
||||
在本例中,只有一个卷组可用。接下来,将物理卷添加到 `fedora_fedora`:
|
||||
|
||||
```
|
||||
$ sudo vgextend fedora_fedora /dev/vdb
|
||||
Volume group "fedora_fedora" successfully extended
|
||||
```
|
||||
|
||||
你现在应该看到物理卷已被添加到卷组中:
|
||||
|
||||
```
|
||||
$ sudo pvs
|
||||
PV VG Fmt Attr PSize PFree
|
||||
/dev/vda2 fedora_fedora lvm2 a– <19.00g 0
|
||||
/dev/vdb fedora_fedora lvm2 a– <10.00g <10.00g
|
||||
```
|
||||
|
||||
看一下卷组:
|
||||
|
||||
```
|
||||
$ sudo vgs
|
||||
VG #PV #LV #SN Attr VSize VFree
|
||||
fedora_fedora 2 1 0 wz–n- 28.99g <10.00g
|
||||
```
|
||||
|
||||
你也可以获得具体卷组和物理卷的详细列表:
|
||||
|
||||
```
|
||||
$ sudo vgdisplay fedora_fedora
|
||||
--- Volume group ---
|
||||
VG Name fedora_fedora
|
||||
System ID
|
||||
Format lvm2
|
||||
Metadata Areas 2
|
||||
Metadata Sequence No 3
|
||||
VG Access read/write
|
||||
VG Status resizable
|
||||
MAX LV 0
|
||||
Cur LV 1
|
||||
Open LV 1
|
||||
Max PV 0
|
||||
Cur PV 2
|
||||
Act PV 2
|
||||
VG Size 28.99 GiB
|
||||
PE Size 4.00 MiB
|
||||
Total PE 7422
|
||||
Alloc PE / Size 4863 / 19.00 GiB
|
||||
Free PE / Size 2559 / 10.00 GiB
|
||||
VG UUID C5dL2s-dirA-SQ15-TfQU-T3yt-l83E-oI6pkp
|
||||
```
|
||||
|
||||
看下物理卷:
|
||||
|
||||
```
|
||||
$ sudo pvdisplay /dev/vdb
|
||||
--- Physical volume ---
|
||||
PV Name /dev/vdb
|
||||
VG Name fedora_fedora
|
||||
PV Size 10.00 GiB / not usable 4.00 MiB
|
||||
Allocatable yes
|
||||
PE Size 4.00 MiB
|
||||
Total PE 2559
|
||||
Free PE 2559
|
||||
Allocated PE 0
|
||||
PV UUID 4uUUuI-lMQY-WyS5-lo0W-lqjW-Qvqw-RqeroE
|
||||
```
|
||||
|
||||
现在我们已经添加了磁盘,我们可以为逻辑卷 (LV) 分配空间:
|
||||
|
||||
```
|
||||
$ sudo lvs
|
||||
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
|
||||
root fedora_fedora -wi-ao---- 19.00g
|
||||
```
|
||||
|
||||
看一下逻辑卷。下面是详细的逻辑卷信息:
|
||||
|
||||
```
|
||||
$ sudo lvdisplay fedora_fedora/root
|
||||
--- Logical volume ---
|
||||
LV Path /dev/fedora_fedora/root
|
||||
LV Name root
|
||||
VG Name fedora_fedora
|
||||
LV UUID yqc9cw-AvOw-G1Ni-bCT3-3HAa-qnw3-qUSHGM
|
||||
LV Write Access read/write
|
||||
LV Creation host, time fedora, 2020-11-24 11:44:36 -0500
|
||||
LV Status available
|
||||
LV Size 19.00 GiB
|
||||
Current LE 4863
|
||||
Segments 1
|
||||
Allocation inherit
|
||||
Read ahead sectors auto
|
||||
- currently set to 256
|
||||
Block device 253:0
|
||||
```
|
||||
|
||||
查看根文件系统(`/`)的大小,并将它与逻辑卷大小进行比较。
|
||||
|
||||
```
|
||||
$ df -h /
|
||||
Filesystem Size Used Avail Use% Mounted on
|
||||
/dev/mapper/fedora_fedora-root 19G 1.4G 17G 8% /
|
||||
```
|
||||
|
||||
逻辑卷和文件系统大小都为 19G。让我们给根逻辑卷(`root`)增加 5G。
|
||||
|
||||
```
|
||||
$ sudo lvresize -L +5G fedora_fedora/root
|
||||
Size of logical volume fedora_fedora/root changed from 19.00 GiB (4863 extents) to 24.00 GiB (6143 extents).
|
||||
Logical volume fedora_fedora/root successfully resized.
|
||||
```
|
||||
|
||||
我们现在有 24G 的逻辑卷可用。看看根文件系统(`/`)。
|
||||
|
||||
```
|
||||
$ df -h /
|
||||
Filesystem Size Used Avail Use% Mounted on
|
||||
/dev/mapper/fedora_fedora-root 19G 1.4G 17G 8% /
|
||||
```
|
||||
|
||||
我们仍然显示只有 19G 的空闲空间,这是因为逻辑卷与文件系统不一样。要使用增加到逻辑卷的新空间,请调整文件系统的大小。
|
||||
|
||||
```
|
||||
$ sudo resize2fs /dev/fedora_fedora/root
|
||||
resize2fs 1.45.6 (20-Mar-2020)
|
||||
Filesystem at /dev/fedora_fedora/root is mounted on /; on-line resizing required
|
||||
old_desc_blocks = 3, new_desc_blocks = 3
|
||||
The filesystem on /dev/fedora_fedora/root is now 6290432 (4k) blocks long.
|
||||
```
|
||||
|
||||
看看文件系统的大小。
|
||||
|
||||
```
|
||||
$ df -h /
|
||||
Filesystem Size Used Avail Use% Mounted on
|
||||
/dev/mapper/fedora_fedora-root 24G 1.4G 21G 7% /
|
||||
```
|
||||
|
||||
正如你所看到的,根文件系统(`/`)已经占用了逻辑卷上的所有可用空间,而且不需要重新启动。
|
||||
|
||||
现在你已经将一个磁盘初始化为物理卷,并使用新的物理卷扩展了卷组。之后,你增加了逻辑卷的大小,并调整了文件系统的大小,以使用逻辑卷的新空间。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/add-storage-to-your-fedora-system-with-lvm/
|
||||
|
||||
作者:[Tim Bosse][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://fedoramagazine.org/author/maztaim/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2020/11/lvm-add-disk-816x345.jpg
|
||||
[2]: https://en.wikipedia.org/wiki/Logical_Volume_Manager_(Linux)
|
||||
[3]: https://fedoramagazine.org/howto-use-sudo/
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (robsean)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,193 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How to View Images from the Linux Terminal)
|
||||
[#]: via: (https://www.2daygeek.com/how-to-view-display-images-from-linux-terminal/)
|
||||
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
|
||||
|
||||
How to View Images from the Linux Terminal
|
||||
======
|
||||
|
||||
Linux has many GUI applications for viewing images.
|
||||
|
||||
But I have never tried any CLI applications to see it.
|
||||
|
||||
Fortunately while working with the **[ImageMagick tool][1]** I got a command to view an image from the terminal.
|
||||
|
||||
The command name is **“display”**, which is part of the ImageMagick tool.
|
||||
|
||||
This is a great tool that allows NIX users to view images from the terminal.
|
||||
|
||||
Also, I got another great tool called FIM for this purpose.
|
||||
|
||||
We will show you how to install and use it to view images from the Linux terminal.
|
||||
|
||||
These commands use the system’s framebuffer to display images directly from the command line.
|
||||
|
||||
### How to View Images from Terminal Using display Command
|
||||
|
||||
[ImageMagick][2] is a free and open source, feature-rich, command-line based image manipulation tool.
|
||||
|
||||
It used to create, edit, compose, or convert bitmap images.
|
||||
|
||||
It can read and write images in a variety of formats (over 200) including PNG, JPEG, GIF, PDF, SVG and etc,.
|
||||
|
||||
It can resize, mirror, rotate, transform images, adjust image colors, apply various special effects, etc,.
|
||||
|
||||
It supports batch process, which allow you to processes all images at once.
|
||||
|
||||
### How to Install ImageMagick?
|
||||
|
||||
The ImageMagick package is included in the official repository of most Linux distributions. Use the distribution package manager to install it.
|
||||
|
||||
**Make a note:** Make sure you already have “**[Development Tools][3]**” installed on your Linux system as a prerequisite for this.
|
||||
|
||||
For **RHEL/CentOS 6/7** systems, use the **[yum command][4]** to install ImageMagick.
|
||||
|
||||
```
|
||||
$ sudo yum install -y ImageMagick ImageMagick-devel
|
||||
```
|
||||
|
||||
For **RHEL/CentOS 8** and **Fedora** systems, use the **[dnf command][5]** to install ImageMagick.
|
||||
|
||||
```
|
||||
$ sudo dnf install -y ImageMagick ImageMagick-devel
|
||||
```
|
||||
|
||||
For **Debian/Ubuntu** systems, use the **[apt command][6]** or **[apt-get command][7]** to install ImageMagick.
|
||||
|
||||
```
|
||||
$ sudo apt-get update
|
||||
$ sudo apt-get install imagemagick
|
||||
```
|
||||
|
||||
For **openSUSE** systems, use the **[zypper command][8]** to install ImageMagick
|
||||
|
||||
```
|
||||
$ sudo zypper install -y ImageMagick
|
||||
```
|
||||
|
||||
To view any image file, run display command as follows. You can close the image by pressing the **“Esc/q”** button.
|
||||
|
||||
```
|
||||
$ display bird.jpg
|
||||
```
|
||||
|
||||
![][9]
|
||||
|
||||
If you want to open the image with the specified size of the window, use the **“-geometry”** flag.
|
||||
|
||||
```
|
||||
$ display -geometry 1000x600 ~/Downloads/bird.jpg
|
||||
```
|
||||
|
||||
You can also input position information of the image with display command. The below command open your image 800 pixels from the top and 800 pixels from the top left corner of your desktop.
|
||||
|
||||
```
|
||||
$ display -geometry 1000x600+800+800 ~/Downloads/bird.jpg
|
||||
```
|
||||
|
||||
If you want to resize the image with the display command, use the following format.
|
||||
|
||||
```
|
||||
$ display -resize 600x400 ~/Downloads/bird.jp
|
||||
```
|
||||
|
||||
Alternatively, you can use percentage to resize the image.
|
||||
|
||||
```
|
||||
$ display -resize 50% ~/Downloads/bird.jpg
|
||||
```
|
||||
|
||||
### How to View Images from the Terminal Using fim Command
|
||||
|
||||
[FIM][10] is a lightweight global image viewer designed specifically for Linux.
|
||||
|
||||
But it is not limited to Linux and can be configured to run on other OS such as MS-Windows.
|
||||
|
||||
It’s highly customizable and scriptable image viewer for users who are familiar with software like the VIM text editor.
|
||||
|
||||
It displays the image in full screen and can be easily controlled using the keyboard shortcuts.
|
||||
|
||||
It is very lightweight tool because it only depends on certain libraries.
|
||||
|
||||
It can open many file formats and it can display images in the following video modes.
|
||||
|
||||
* Graphically, with the Linux framebuffer device
|
||||
* Graphically, under X/Xorg, using the SDL library
|
||||
* Graphically, under X/Xorg, using the Imlib2 library
|
||||
* Rendered as ASCII Art in any textual console, using the AAlib library
|
||||
|
||||
|
||||
|
||||
The right video mode gets auto-detected or selected at runtime, and may be opted in/out before build at configure time, if desired.
|
||||
|
||||
FIM stands for Fbi IMproved, which is the fork of the Fbi Image viewer.
|
||||
|
||||
FIM can be easily installed on Debian/Ubuntu based systems as the package is available in the distribution official repository. For other distributions, you may need to compile it from the source.
|
||||
|
||||
```
|
||||
$ sudo apt install fim
|
||||
```
|
||||
|
||||
Once installed, you can display an image using the following command.
|
||||
|
||||
```
|
||||
$ fim bird.jpg
|
||||
```
|
||||
|
||||
You can automatically zoom an image using the **“-a”** option.
|
||||
|
||||
```
|
||||
$ fim -a bird.jpg
|
||||
```
|
||||
|
||||
![][9]
|
||||
|
||||
If you want to open multiple image files in the current directory, use the wildcard to open them all. Use the **“Pageup/Down”** keyboard shortcuts to move to the next or previous image.
|
||||
|
||||
```
|
||||
$ fim -a *.jpg
|
||||
```
|
||||
|
||||
To view the image in ASCII format, you can use the **“-t”** flag.
|
||||
|
||||
```
|
||||
$ fim -t bird.jpg
|
||||
```
|
||||
|
||||
The below keyboard shortcuts allow you to control the images.
|
||||
|
||||
* PageUp/Down : Prev/Next image
|
||||
* +/- : Zoom in/out
|
||||
* a : Autoscale
|
||||
* w : Fit to width
|
||||
* ESC/q : Quit
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.2daygeek.com/how-to-view-display-images-from-linux-terminal/
|
||||
|
||||
作者:[Magesh Maruthamuthu][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://www.2daygeek.com/author/magesh/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.2daygeek.com/resize-convert-images-from-linux-command-line/
|
||||
[2]: https://imagemagick.org/
|
||||
[3]: https://www.2daygeek.com/install-development-tools-on-ubuntu-debian-arch-linux-mint-fedora-centos-rhel-opensuse/
|
||||
[4]: https://www.2daygeek.com/linux-yum-command-examples-manage-packages-rhel-centos-systems/
|
||||
[5]: https://www.2daygeek.com/linux-dnf-command-examples-manage-packages-fedora-centos-rhel-systems/
|
||||
[6]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/
|
||||
[7]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/
|
||||
[8]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/
|
||||
[9]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
||||
[10]: https://www.nongnu.org/fbi-improved/#docs
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -0,0 +1,84 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (6 ways this fullscreen text editor improves focus)
|
||||
[#]: via: (https://opensource.com/article/20/12/focuswriter)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
6 ways this fullscreen text editor improves focus
|
||||
======
|
||||
This fullscreen editor helps you set your writing goals and keeps
|
||||
distractions to a minimum so you can achieve them.
|
||||
![Typewriter with hands][1]
|
||||
|
||||
The great thing about computers is that they’re really good at multi-tasking.
|
||||
|
||||
The bad thing about computers is that they’re really good at multi-tasking.
|
||||
|
||||
Whether you consider yourself, as a human, good or bad at multi-tasking, sometimes you need a little help focusing. One of those times is when you’re trying to compose clear and concise communication. And that’s exactly why Focuswriter was developed.
|
||||
|
||||
### Install
|
||||
|
||||
On Linux, you can install Focuswriter as a Flatpak from [Flathub][2].
|
||||
|
||||
On Windows or Linux (if you don’t use Flatpak), you can [install Focuswriter from its website][3]. You can also install from source code, also available from the Focuswriter webpage.
|
||||
|
||||
### Using Focuswriter
|
||||
|
||||
Focuswriter is, admittedly, actually a cross between a text editor and a word processor. Its default format is the Open Document Text (.odt) format, so it allows you to style and align text, mark headers, and toggle smart quotes on and off. But that’s where its word processor features end because Focuswriter does mostly focus on _writing_, not on styling what you’ve written.
|
||||
|
||||
Focuswriter encourages focus in a few different ways.
|
||||
|
||||
#### Attractiveness
|
||||
|
||||
Focuswriter doesn’t look like your usual computer application, much less your usual text editor. When it launches, it loads a theme behind your document. The theme is generally benign—a writing desk is the default, but there’s also a starry sky, a faraway landscape, and so on. You’re not meant to become preoccupied with the theme, of course, but it does help you from getting distracted by some other application window or your computer desktop lingering behind your editor. Because it’s easy to customize, there’s little chance of you being left without a theme you like.
|
||||
|
||||
![Focuswriter white box with gray wording on wooden writing desk background theme][4]
|
||||
|
||||
#### Sound effects
|
||||
|
||||
Focuswriter is actually fun to use. Aside from its visual theme, it also has an _optional_ typewriter audio theme. Once enabled, every keypress makes the sound of a mechanical typewriter key. When you press **Return**, the satisfying sound of a carriage return is your reward for completing a paragraph (or a line, if you write one sentence per line to improve version control).
|
||||
|
||||
This audio theme is entirely opt-in, and it’s not on by default. You may doubt its efficacy, but you shouldn’t underestimate the satisfaction of making those sounds of productivity while also wielding the powers of modern text editing.
|
||||
|
||||
#### Fullscreen display
|
||||
|
||||
Focuswriter not only launches fullscreen by default, but it also hides its menus and other widgets from view. To access the main menu bar, you place your cursor to the top of your screen until it appears. There’s a scroll bar hidden on the right, a document switcher widget on the left, and a status bar at the bottom.
|
||||
|
||||
#### Minimalism
|
||||
|
||||
There isn’t much to Focuswriter’s editing capabilities. It doesn’t have advanced search options or specialized options for code formatting or syntax highlighting. It lets you write text, and little else, into a document, by design. Even the contextual right-click menu only offers basic editing functions (copy, cut, paste, and so on) or spell-checking options.
|
||||
|
||||
#### Line focus
|
||||
|
||||
Another optional feature of Focuswriter is its ability to "grey out" all lines of text but your current one. This helps your eyes lazily locate your current line of text, which can be especially helpful if you’re not a touch-typist or if you’re transcribing something you’ve handwritten on physical paper and must look away from the screen often.
|
||||
|
||||
#### Goal tracker
|
||||
|
||||
You can set a daily word count goal or a timed goal for yourself in Focuswriter’s preferences. Your progress is tracked as you work and displayed in the status bar at the bottom of the screen. It’s hidden from your view unless you hover your cursor over it, so you’re not compelled to obsess over it, but it’s convenient enough to help you stay on track.
|
||||
|
||||
### Try Focuswriter (even if you think it’s silly)
|
||||
|
||||
I’ve heard about fullscreen text editors before, and I’ve never felt it was important for me to try one. After all, nearly any application can be made fullscreen, and I don’t personally have trouble focusing anyway.
|
||||
|
||||
Having tried Focuswriter, though, I understand the appeal of a good fullscreen "focus first" text editor. It may not be necessary, but then again, open source is thriving. We have the luxury of redundant sets of applications that have minor differences in function but major differences in implementation. Focuswriter makes writing fun; it makes the work enjoyable. Download it, set a goal, and get writing!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/12/focuswriter
|
||||
|
||||
作者:[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/typewriter-hands.jpg?itok=oPugBzgv (Typewriter with hands)
|
||||
[2]: https://flathub.org/apps/details/org.gottcode.FocusWriter
|
||||
[3]: https://gottcode.org/focuswriter/
|
||||
[4]: https://opensource.com/sites/default/files/uploads/focuswriter-31_days_focuswriter-opensource.png (Focuswriter white box with gray wording on wooden writing desk background theme)
|
@ -0,0 +1,76 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How to use this KDE Plasma text editor)
|
||||
[#]: via: (https://opensource.com/article/20/12/kwrite-kde-plasma)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
How to use this KDE Plasma text editor
|
||||
======
|
||||
Part of the popular KDE Plasma desktop, KWrite hides a ton of useful
|
||||
features in a deceptively simple, easy-to-use interface.
|
||||
![Coding on a computer][1]
|
||||
|
||||
KWrite is a desktop text editor for KDE’s Plasma desktop. It’s meant to be a universal application that anyone can reasonably use when they need to jot down a quick note, write a school paper, do some programming, and/or anything else you can think to do with a text editor. It uses components of the [Kate editor][2] to create a simple interface but leverages those same components to provide a long list of useful features.
|
||||
|
||||
### Install
|
||||
|
||||
KWrite isn’t intended for general availability; it’s a component of the [Plasma desktop by KDE][3], so if you’re running Plasma, then you already have KWrite.
|
||||
|
||||
If you don’t run Plasma, then you can install Plasma, so you can either start using it along with KWrite or just use KWrite as needed. However, it’s intended as the default text editor for your Plasma desktop, so if you really want to use it as a standalone application, then it’s probably easier to just install Kate.
|
||||
|
||||
### Using KWrite
|
||||
|
||||
When you launch KWrite, you get what you’d expect from a text editor—a big empty field for typing, a menubar and toolbar at the top, and a status bar at the bottom. That’s all you really need to know before getting started. KWrite is an intuitive application, with toolbar buttons for the important activities such as opening and saving a file and a simple menu system for more advanced editing tasks.
|
||||
|
||||
![Kwrite terminal containing dark gray html code on white background][4]
|
||||
|
||||
Many of KWrite’s features are latent—they happen without you activating them yourself. For instance, should you open a file written in HTML, then KWrite highlights keywords (such as `class` and `id`) and recognizes code tags (such as `<p>` or `<div>`), and treats them differently than words of a natural language. The same happens when you load a file written in Python, and nothing happens for documents written primarily in a natural
|
||||
language.
|
||||
|
||||
Of course, you don’t have to choose between just HTML, Python, and your native tongue. KWrite has support for lots of languages and formats (and for many, it even has auto-completion options).
|
||||
|
||||
For users who want a text editor with more than just obvious auto-load features, there are options in the Edit, View, and Tools menus. For instance, you can activate dynamic spell checking, run scripts, bring up a command line, comment or uncomment a line, adjust indentation, display line numbers, and much more.
|
||||
|
||||
There are also some interesting options when launching KWrite from a terminal. For instance, if you know exactly what line you want to navigate to in a file, you can launch KWrite with a line number argument:
|
||||
|
||||
|
||||
```
|
||||
`$ kwrite --line 101 example.txt`
|
||||
```
|
||||
|
||||
You can also conveniently pipe the output of a command to KWrite using the `--stdin` (or just `-i` for short) option. For example, this command downloads the index page of [example.com][5] and displays the HTML in a new KWrite window:
|
||||
|
||||
|
||||
```
|
||||
`$ curl http://example.com | kwrite --stdin`
|
||||
```
|
||||
|
||||
### Try KWrite
|
||||
|
||||
I’ve always felt that one of KDE’s strengths is that its perceived complexity is flexible—if you want a simple desktop, you can essentially choose to ignore any feature you don’t want. KWrite is an example of how that flexibility can also apply to developers. Because Kate has been engineered with so many features, it’s possible for developers to reuse a subset of those features to create a cleaner and more focused version of an application.
|
||||
|
||||
KWrite is a single-document editor. It doesn’t have tabs, nor any awareness of a project. It’s intended for people who want to work on exactly one document at a time and who want the basics to be active by default, with a selection of powerful editing tools available when needed. Install the excellent Plasma desktop and try it today!
|
||||
|
||||
KDE originally stood for Kool Desktop Environment, but is now known by many as the K Desktop...
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/12/kwrite-kde-plasma
|
||||
|
||||
作者:[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/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer)
|
||||
[2]: https://opensource.com/article/20/12/kate-text-editor
|
||||
[3]: https://opensource.com/article/19/12/linux-kde-plasma
|
||||
[4]: https://opensource.com/sites/default/files/uploads/kwrite-31_days_kwrite-opensource.png (Kwrite terminal containing dark gray html code on white background)
|
||||
[5]: http://example.com
|
@ -1,272 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Add storage to your Fedora system with LVM)
|
||||
[#]: via: (https://fedoramagazine.org/add-storage-to-your-fedora-system-with-lvm/)
|
||||
[#]: author: (Tim Bosse https://fedoramagazine.org/author/maztaim/)
|
||||
|
||||
使用 LVM 为你的 Fedora 系统添加存储
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
有时需要在系统中添加另一块磁盘。这就是逻辑卷管理 (LVM) 的用武之地。LVM 的好处之处在于它相当灵活。有几种方法可以添加一块磁盘。这篇文章介绍了一种方法。
|
||||
|
||||
### 注意!
|
||||
|
||||
这篇文章并不包括将新的磁盘物理地安装到系统中的过程。请查阅你的系统和磁盘文档,了解如何正确地进行安装。
|
||||
|
||||
**重要:**一定要确保你已经备份重要数据。如果新磁盘已有数据,那么本文中描述的步骤将破坏数据。
|
||||
|
||||
### 最好了解
|
||||
|
||||
本文并没有深入介绍 LVM 的每一个功能,重点是添加磁盘。但基本上,LVM 有_卷组_,它由一个或多个分区和/或磁盘组成。你把这些分区或磁盘添加为_物理卷_。一个卷组可以分成许多_逻辑卷_。逻辑卷可以作为文件系统、ramdisk 等其他存储使用。更多信息可以在[这里][2]中找到。
|
||||
|
||||
把物理卷看作是形成一个存储池(一个卷组),然后从这个存储池中划分出逻辑卷,供你的系统直接使用。
|
||||
|
||||
### 准备
|
||||
|
||||
确保你能看到你要添加的磁盘。在添加磁盘之前使用 _lsblk_ 查看哪些存储空间已经可用或正在使用。
|
||||
|
||||
```
|
||||
$ lsblk
|
||||
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
|
||||
zram0 251:0 0 989M 0 disk [SWAP]
|
||||
vda 252:0 0 20G 0 disk
|
||||
├─vda1 252:1 0 1G 0 part /boot
|
||||
└─vda2 252:2 0 19G 0 part
|
||||
└─fedora_fedora-root 253:0 0 19G 0 lvm /
|
||||
```
|
||||
|
||||
本文使用的是带有虚拟存储的虚拟机,因此设备名称以 _vda_ 开头代表第一个磁盘,_vdb_ 代表第二个磁盘,以此类推。你的设备名称可能不同。许多系统会将 _sda_ 作为第一个物理磁盘,_sdb_ 代表第二个磁盘,以此类推。
|
||||
|
||||
当已连接新磁盘,并且你的系统已备份且正在运行,再次使用 _lsblk_ 来查看新的块设备。
|
||||
|
||||
```
|
||||
$ lsblk
|
||||
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
|
||||
zram0 251:0 0 989M 0 disk [SWAP]
|
||||
vda 252:0 0 20G 0 disk
|
||||
├─vda1 252:1 0 1G 0 part /boot
|
||||
└─vda2 252:2 0 19G 0 part
|
||||
└─fedora_fedora-root 253:0 0 19G 0 lvm /
|
||||
vdb 252:16 0 10G 0 disk
|
||||
```
|
||||
|
||||
现在有一个名为 _vdb_ 的新设备。该设备的位置是 _/dev/vdb_。
|
||||
|
||||
```
|
||||
$ ls -l /dev/vdb
|
||||
brw-rw----. 1 root disk 252, 16 Nov 24 12:56 /dev/vdb
|
||||
```
|
||||
|
||||
我们可以看到磁盘,但我们还不能用 LVM 来使用它。如果你运行 _blkid_,你应该不会看到它被列出。对于这个和之后的命令,你需要确保你的系统[已配置,这样你可以使用 _sudo_][3]:
|
||||
|
||||
```
|
||||
$ sudo blkid
|
||||
/dev/vda1: UUID="4847cb4d-6666-47e3-9e3b-12d83b2d2448" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="830679b8-01"
|
||||
/dev/vda2: UUID="k5eWpP-6MXw-foh5-Vbgg-JMZ1-VEf9-ARaGNd" TYPE="LVM2_member" PARTUUID="830679b8-02"
|
||||
/dev/mapper/fedora_fedora-root: UUID="f8ab802f-8c5f-4766-af33-90e78573f3cc" BLOCK_SIZE="4096" TYPE="ext4"
|
||||
/dev/zram0: UUID="fc6d7a48-2bd5-4066-9bcf-f062b61f6a60" TYPE="swap"
|
||||
```
|
||||
|
||||
### 将磁盘添加到 LVM 中
|
||||
|
||||
使用 _pvcreate_ 初始化磁盘。你需要传递设备的完整路径。在这个例子中,它是 _/dev/vdb_。在你的系统中,它可能是 _/dev/sdb_ 或其他设备名。
|
||||
|
||||
```
|
||||
$ sudo pvcreate /dev/vdb
|
||||
Physical volume "/dev/vdb" successfully created.
|
||||
```
|
||||
|
||||
当你运行 _blkid_ 时,你应该看到磁盘已经被初始化为一个 LVM2_member:
|
||||
|
||||
```
|
||||
$ sudo blkid
|
||||
/dev/vda1: UUID="4847cb4d-6666-47e3-9e3b-12d83b2d2448" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="830679b8-01"
|
||||
/dev/vda2: UUID="k5eWpP-6MXw-foh5-Vbgg-JMZ1-VEf9-ARaGNd" TYPE="LVM2_member" PARTUUID="830679b8-02"
|
||||
/dev/mapper/fedora_fedora-root: UUID="f8ab802f-8c5f-4766-af33-90e78573f3cc" BLOCK_SIZE="4096" TYPE="ext4"
|
||||
/dev/zram0: UUID="fc6d7a48-2bd5-4066-9bcf-f062b61f6a60" TYPE="swap"
|
||||
/dev/vdb: UUID="4uUUuI-lMQY-WyS5-lo0W-lqjW-Qvqw-RqeroE" TYPE="LVM2_member"
|
||||
```
|
||||
|
||||
你可以使用 _pvs_ 列出当前所有可用的物理卷:
|
||||
|
||||
```
|
||||
$ sudo pvs
|
||||
PV VG Fmt Attr PSize PFree
|
||||
/dev/vda2 fedora_fedora lvm2 a-- <19.00g 0
|
||||
/dev/vdb lvm2 --- 10.00g 10.00g
|
||||
```
|
||||
|
||||
_/dev/vdb_ 被列为一个 PV (物理卷),但还没有分配到一个 VG (卷组)。
|
||||
|
||||
### 将物理卷添加到一个卷组
|
||||
|
||||
你可以使用 _vgs_ 找到可用的卷组列表:
|
||||
|
||||
```
|
||||
$ sudo vgs
|
||||
VG #PV #LV #SN Attr VSize VFree
|
||||
fedora_fedora 1 1 0 wz--n- 19.00g 0
|
||||
```
|
||||
|
||||
在本例中,只有一个卷组可用。接下来,将物理卷添加到 _fedora_fedora_:
|
||||
|
||||
```
|
||||
$ sudo vgextend fedora_fedora /dev/vdb
|
||||
Volume group "fedora_fedora" successfully extended
|
||||
```
|
||||
|
||||
你现在应该看到物理卷已被添加到卷组中:
|
||||
|
||||
```
|
||||
$ sudo pvs
|
||||
PV VG Fmt Attr PSize PFree
|
||||
/dev/vda2 fedora_fedora lvm2 a– <19.00g 0
|
||||
/dev/vdb fedora_fedora lvm2 a– <10.00g <10.00g
|
||||
```
|
||||
|
||||
看一下卷组:
|
||||
|
||||
```
|
||||
$ sudo vgs
|
||||
VG #PV #LV #SN Attr VSize VFree
|
||||
fedora_fedora 2 1 0 wz–n- 28.99g <10.00g
|
||||
```
|
||||
|
||||
你也可以获得具体卷组和物理卷的详细列表:
|
||||
|
||||
```
|
||||
$ sudo vgdisplay fedora_fedora
|
||||
--- Volume group ---
|
||||
VG Name fedora_fedora
|
||||
System ID
|
||||
Format lvm2
|
||||
Metadata Areas 2
|
||||
Metadata Sequence No 3
|
||||
VG Access read/write
|
||||
VG Status resizable
|
||||
MAX LV 0
|
||||
Cur LV 1
|
||||
Open LV 1
|
||||
Max PV 0
|
||||
Cur PV 2
|
||||
Act PV 2
|
||||
VG Size 28.99 GiB
|
||||
PE Size 4.00 MiB
|
||||
Total PE 7422
|
||||
Alloc PE / Size 4863 / 19.00 GiB
|
||||
Free PE / Size 2559 / 10.00 GiB
|
||||
VG UUID C5dL2s-dirA-SQ15-TfQU-T3yt-l83E-oI6pkp
|
||||
```
|
||||
|
||||
看下物理卷:
|
||||
|
||||
```
|
||||
$ sudo pvdisplay /dev/vdb
|
||||
--- Physical volume ---
|
||||
PV Name /dev/vdb
|
||||
VG Name fedora_fedora
|
||||
PV Size 10.00 GiB / not usable 4.00 MiB
|
||||
Allocatable yes
|
||||
PE Size 4.00 MiB
|
||||
Total PE 2559
|
||||
Free PE 2559
|
||||
Allocated PE 0
|
||||
PV UUID 4uUUuI-lMQY-WyS5-lo0W-lqjW-Qvqw-RqeroE
|
||||
```
|
||||
|
||||
现在我们已经添加了磁盘,我们可以为逻辑卷 (LV) 分配空间:
|
||||
|
||||
```
|
||||
$ sudo lvs
|
||||
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
|
||||
root fedora_fedora -wi-ao---- 19.00g
|
||||
```
|
||||
|
||||
看一下逻辑卷。下面是详细的逻辑卷信息:
|
||||
|
||||
```
|
||||
$ sudo lvdisplay fedora_fedora/root
|
||||
--- Logical volume ---
|
||||
LV Path /dev/fedora_fedora/root
|
||||
LV Name root
|
||||
VG Name fedora_fedora
|
||||
LV UUID yqc9cw-AvOw-G1Ni-bCT3-3HAa-qnw3-qUSHGM
|
||||
LV Write Access read/write
|
||||
LV Creation host, time fedora, 2020-11-24 11:44:36 -0500
|
||||
LV Status available
|
||||
LV Size 19.00 GiB
|
||||
Current LE 4863
|
||||
Segments 1
|
||||
Allocation inherit
|
||||
Read ahead sectors auto
|
||||
- currently set to 256
|
||||
Block device 253:0
|
||||
```
|
||||
|
||||
查看根文件系统的大小,并将它与逻辑卷大小进行比较。
|
||||
|
||||
```
|
||||
$ df -h /
|
||||
Filesystem Size Used Avail Use% Mounted on
|
||||
/dev/mapper/fedora_fedora-root 19G 1.4G 17G 8% /
|
||||
```
|
||||
|
||||
逻辑卷和文件系统大小都为 19G。让我们给根逻辑卷增加 5G。
|
||||
|
||||
```
|
||||
$ sudo lvresize -L +5G fedora_fedora/root
|
||||
Size of logical volume fedora_fedora/root changed from 19.00 GiB (4863 extents) to 24.00 GiB (6143 extents).
|
||||
Logical volume fedora_fedora/root successfully resized.
|
||||
```
|
||||
|
||||
我们现在有 24G 的逻辑卷可用。看看 _/_ 文件系统。
|
||||
|
||||
```
|
||||
$ df -h /
|
||||
Filesystem Size Used Avail Use% Mounted on
|
||||
/dev/mapper/fedora_fedora-root 19G 1.4G 17G 8% /
|
||||
```
|
||||
|
||||
我们仍然显示只有 19G 的空闲空间,这是因为逻辑卷与文件系统不一样。要使用增加到逻辑卷的新空间,请调整文件系统的大小。
|
||||
|
||||
```
|
||||
$ sudo resize2fs /dev/fedora_fedora/root
|
||||
resize2fs 1.45.6 (20-Mar-2020)
|
||||
Filesystem at /dev/fedora_fedora/root is mounted on /; on-line resizing required
|
||||
old_desc_blocks = 3, new_desc_blocks = 3
|
||||
The filesystem on /dev/fedora_fedora/root is now 6290432 (4k) blocks long.
|
||||
```
|
||||
|
||||
看看文件系统的大小。
|
||||
|
||||
```
|
||||
$ df -h /
|
||||
Filesystem Size Used Avail Use% Mounted on
|
||||
/dev/mapper/fedora_fedora-root 24G 1.4G 21G 7% /
|
||||
```
|
||||
|
||||
正如你所看到的,根文件系统 _(/)_ 已经占用了逻辑卷上的所有可用空间,而且不需要重新启动。
|
||||
|
||||
现在你已经将一个磁盘初始化为物理卷,并使用新的物理卷扩展了卷组。之后,你增加了逻辑卷的大小,并调整了文件系统的大小,以使用逻辑卷的新空间。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/add-storage-to-your-fedora-system-with-lvm/
|
||||
|
||||
作者:[Tim Bosse][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://fedoramagazine.org/author/maztaim/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2020/11/lvm-add-disk-816x345.jpg
|
||||
[2]: https://en.wikipedia.org/wiki/Logical_Volume_Manager_(Linux)
|
||||
[3]: https://fedoramagazine.org/howto-use-sudo/
|
@ -0,0 +1,193 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How to View Images from the Linux Terminal)
|
||||
[#]: via: (https://www.2daygeek.com/how-to-view-display-images-from-linux-terminal/)
|
||||
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
|
||||
|
||||
如何从 Linux 终端查看图像
|
||||
======
|
||||
|
||||
Linux 有很多用于查看图像的 GUI 应用。
|
||||
|
||||
但我从来没有尝试过用任何命令行应用来查看它。
|
||||
|
||||
幸运的是,在使用 **[ImageMagick 工具][1]**时,我得到了一个从终端查看图像的命令。
|
||||
|
||||
命令名是 **“display”**,它是 ImageMagick 工具的一部分。
|
||||
|
||||
这是一个很好的工具,允许类 UNIX 用户从终端查看图像。
|
||||
|
||||
此外,我还为此得到了另一个很好的工具,叫做 FIM。
|
||||
|
||||
我们将向你展示如何安装并使用它从 Linux 终端查看图像。
|
||||
|
||||
这些命令使用系统的帧缓冲直接从命令行显示图像。
|
||||
|
||||
### 如何使用 display 命令从终端查看图像
|
||||
|
||||
[ImageMagick][2] 是一个免费开源、功能丰富、基于命令行的图像处理工具。
|
||||
|
||||
它用于创建、编辑、合成或转换位图图像。
|
||||
|
||||
它可以读取和写入各种格式(超过 200 种)的图像,包括 PNG、JPEG、GIF、PDF、SVG 等。
|
||||
|
||||
它可以调整图像的大小、镜像、旋转、转换图像、调整图像颜色、应用各种特殊效果等。
|
||||
|
||||
它支持批处理,允许你一次处理所有图像。
|
||||
|
||||
### 如何安装 ImageMagick?
|
||||
|
||||
ImageMagick 软件包包含在大多数 Linux 发行版的官方仓库中。使用发行版软件包管理器来安装它。
|
||||
|
||||
**需要注意的是:**确保你的 Linux 系统上已经安装了 “**[Development Tools][3]**” 包,这是安装的前提条件。
|
||||
|
||||
对于 **RHEL/CentOS 6/7** 系统,请使用 **[yum 命令][4]** 安装 ImageMagick。
|
||||
|
||||
```
|
||||
$ sudo yum install -y ImageMagick ImageMagick-devel
|
||||
```
|
||||
|
||||
在 **RHEL/CentOS 8** 和 **Fedora** 系统,使用 **[dnf 命令][5]** 安装 ImageMagick。
|
||||
|
||||
```
|
||||
$ sudo dnf install -y ImageMagick ImageMagick-devel
|
||||
```
|
||||
|
||||
对于 **Debian/Ubuntu** 系统,使用 **[apt 命令][6]** 或 **[apt-get 命令][7]** 安装 ImageMagick。
|
||||
|
||||
```
|
||||
$ sudo apt-get update
|
||||
$ sudo apt-get install imagemagick
|
||||
```
|
||||
|
||||
对于 **openSUSE** 系统,使用 **[zypper 命令][8]** 安装 ImageMagick。
|
||||
|
||||
```
|
||||
$ sudo zypper install -y ImageMagick
|
||||
```
|
||||
|
||||
要查看任何图像文件,请运行 display 命令,如下所示。你可以按下 **“Esc/q”** 按钮关闭图像。
|
||||
|
||||
```
|
||||
$ display bird.jpg
|
||||
```
|
||||
|
||||
![][9]
|
||||
|
||||
如果你想用指定的窗口大小打开图像,请使用 **“-geometry”** 标志。
|
||||
|
||||
```
|
||||
$ display -geometry 1000x600 ~/Downloads/bird.jpg
|
||||
```
|
||||
|
||||
你也可以通过 display 命令输入图像的位置信息。下面的命令可以从桌面的距顶部 800 像素和据左上角 800 像素处打开图像。
|
||||
|
||||
```
|
||||
$ display -geometry 1000x600+800+800 ~/Downloads/bird.jpg
|
||||
```
|
||||
|
||||
如果你想用 display 命令调整图像的大小,请使用以下格式。
|
||||
|
||||
```
|
||||
$ display -resize 600x400 ~/Downloads/bird.jp
|
||||
```
|
||||
|
||||
另外,你也可以使用百分比来调整图片的大小。
|
||||
|
||||
```
|
||||
$ display -resize 50% ~/Downloads/bird.jpg
|
||||
```
|
||||
|
||||
### 如何使用 fim 命令从终端查看图像。
|
||||
|
||||
[FIM][10] 是一个专门为 Linux 设计的轻量级全局图像查看器。
|
||||
|
||||
但它并不局限于 Linux,它也可配置在其他操作系统上运行,如 MS-Windows。
|
||||
|
||||
对于熟悉 VIM 文本编辑器等软件的用户来说,它是高度可定制和可脚本化的图像查看器。
|
||||
|
||||
它可以全屏显示图像,并且可以使用键盘快捷键轻松控制。
|
||||
|
||||
它是一款非常轻量级的工具,因为它只依赖于某些库。
|
||||
|
||||
它可以打开许多文件格式,它可以在以下视频模式下显示图像。
|
||||
|
||||
* 使用 Linux 帧缓冲设备图形化。
|
||||
* 在 X/Xorg 下,使用 SDL 库图形化
|
||||
* 在 X/Xorg 下,使用 Imlib2 库图形化。
|
||||
* 使用 AAlib 库,在任意文本控制台中以 ASCII 艺术形式呈现。
|
||||
|
||||
|
||||
|
||||
正确的视频模式会在运行时自动检测或选择,如果需要,可以在构建前配置时选择加入或去除。
|
||||
|
||||
FIM 是 Fbi IMproved 的缩写,是 Fbi Image Viewer 的分支。
|
||||
|
||||
FIM 可以很容易地安装在基于 Debian/Ubuntu 的系统上,因为该软件包在发行版的官方仓库中是可用的。对于其他发行版,你可能需要从源码编译它。
|
||||
|
||||
```
|
||||
$ sudo apt install fim
|
||||
```
|
||||
|
||||
安装完毕后,你可以使用以下命令显示图像。
|
||||
|
||||
```
|
||||
$ fim bird.jpg
|
||||
```
|
||||
|
||||
你可以使用 **“-a”** 选项自动缩放图像。
|
||||
|
||||
```
|
||||
$ fim -a bird.jpg
|
||||
```
|
||||
|
||||
![][9]
|
||||
|
||||
如果你要打开当前目录中的多个图像文件,请使用通配符将它们全部打开。使用 **“Pageup/Down”** 键盘快捷键移动到下一张或上一张图像。
|
||||
|
||||
```
|
||||
$ fim -a *.jpg
|
||||
```
|
||||
|
||||
要查看 ASCII 格式的图像,可以使用 **“-t”** 标志。
|
||||
|
||||
```
|
||||
$ fim -t bird.jpg
|
||||
```
|
||||
|
||||
下面的键盘快捷键可以让你控制图像。
|
||||
|
||||
* PageUp/Down:上一张/下一张图片。
|
||||
* +/-:放大/缩小
|
||||
* a:自动标度
|
||||
* w:适应宽度
|
||||
* ESC/q:退出
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.2daygeek.com/how-to-view-display-images-from-linux-terminal/
|
||||
|
||||
作者:[Magesh Maruthamuthu][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://www.2daygeek.com/author/magesh/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.2daygeek.com/resize-convert-images-from-linux-command-line/
|
||||
[2]: https://imagemagick.org/
|
||||
[3]: https://www.2daygeek.com/install-development-tools-on-ubuntu-debian-arch-linux-mint-fedora-centos-rhel-opensuse/
|
||||
[4]: https://www.2daygeek.com/linux-yum-command-examples-manage-packages-rhel-centos-systems/
|
||||
[5]: https://www.2daygeek.com/linux-dnf-command-examples-manage-packages-fedora-centos-rhel-systems/
|
||||
[6]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/
|
||||
[7]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/
|
||||
[8]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/
|
||||
[9]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
||||
[10]: https://www.nongnu.org/fbi-improved/#docs
|
Loading…
Reference in New Issue
Block a user