id
int64
2.05k
16.6k
title
stringlengths
5
75
fromurl
stringlengths
19
185
date
timestamp[s]
tags
sequencelengths
0
11
permalink
stringlengths
20
37
content
stringlengths
342
82.2k
fromurl_status
int64
200
526
status_msg
stringclasses
339 values
from_content
stringlengths
0
229k
16,528
Gentoo Linux 现在提供用于快速软件安装的二进制包
https://news.itsfoss.com/gentoo-binary-packages/
2024-01-03T14:24:00
[ "Gentoo" ]
https://linux.cn/article-16528-1.html
![](/data/attachment/album/202401/03/142406n5k61kq3xddmu8mk.jpg) > > Gentoo 为硬件速度慢的用户准备了一份年终大礼。 > > > 如果你不觉得这有什么大不了,那就说明你不了解 Gentoo。 Debian 有 deb 软件包,Fedora 有 RPM 软件包。甚至 Arch Linux 也提供了通过 Pacman 命令安装的二进制包。基本上,这些发行版从源代码构建这些包并将其提供给你。你可以使用发行版的包管理系统来获取这些二进制文件并将它们安装在你的系统上。 但进入 Gentoo 领域,情况就完全不同了。想要安装任何软件吗? 你必须从源代码编译它。 是的,你没看错。这就是围绕编译和 Gentoo 产生了如此多的表情包的原因。 ![A blend of Gentoo and dad joke](/data/attachment/album/202401/03/142449upg62zr2ipvri3ur.png) 从源代码编译软件的问题意味着它将需要更多的计算能力。当你编译软件时,你的 CPU 将非常繁忙。 ![](/data/attachment/album/202401/03/142450fb7hphemnakp7gyt.png) 当然,编译一个软件需要一些时间。 ![Image source: r/linuxmemes](/data/attachment/album/202401/03/142520q3xv285zywvbxbb3.jpg) ### 现在你可以在 Gentoo 中“安装”软件包而不是编译它们 Gentoo 的包管理器 Portage 多年来一直支持二进制包。只是没有预编译二进制包的集中仓库。 现在这种情况正在改变,因为 Gentoo 现在提供二进制包供下载和直接安装。 对于大多数架构,它将仅限于核心系统和每周更新。然而,对于 [amd64 和 arm64](https://itsfoss.com/arm-aarch64-x86_64/),有一个为 LibreOffice、Docker、Plasma、GNOME 等流行软件提供二进制文件的巨大仓库。 这对于使用低端硬件或不希望一直手动编译的 Gentoo 用户来说非常方便。 我知道你对在 Gentoo 中使用二进制包有很多疑问。查看 [Gentoo 的官方公告](https://www.gentoo.org/news/2023/12/29/Gentoo-binary.html),其中包含详细内容。 ![](/data/attachment/album/202401/03/142451xf7eaznwpn7g52ah.png) ### 基于源代码的安装不会消失 先别生气,我的 Gentoo 伙计!你仍然可以享受从源代码编译的乐趣。这个选项不会消失。你仍然可以像以前一样享受编译的乐趣。二进制软件包是可选的。它们不会强迫你使用。 编译每一个包有其好处。软件针对其运行的系统进行了优化。这就是 Gentoo 用户所夸耀的性能提升。 ![](/data/attachment/album/202401/03/142452um3gggdmydofrvxy.png) 由于系统资源有限,低端计算机需要更长的编译时间,但它也可以通过为机器构建每个软件来获得性能优化。如果你问我的话,这有点像第 22 条军规的情况。 ### 你用 Gentoo 吗? 我坚信这不仅会为现有的 Gentoo 用户群带来便利,而且还将有助于扩大其用户群。毕竟,一个发行版用户在安装 Arch 之后会做什么呢? 我在这里的新闻报道中使用了很多表情包,因为现在是快乐的季节 ☃️ 也许你可以利用寒假安装(但不编译)Gentoo ? 享受节日和假期! *(题图:DA/389d8213-29fd-4149-b591-45e6cc9b0bb0)* --- via: <https://news.itsfoss.com/gentoo-binary-packages/> 作者:[Abhishek](https://news.itsfoss.com/author/root/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![](/assets/images/pikapods-banner-v3.webp) ![](/assets/images/pikapods-banner-v3.webp) If you don't see the big deal with it, you don't know Gentoo. Debian has deb packages, Fedora has RPM packages. Even Arch Linux provides binary packages that are installed via the Pacman commands. Basically, these distributions build these packages from the source code and make them available to you. You use the package management system of your distro to get those binaries and install them on your system. But enter into the Gentoo realm and things are entirely different here. Want to install any piece of software? You have to compile it from the source code. Yes, you read that right. That's the reason so many memes exist on compiling and Gentoo. ![Gentoo if it moves, compile it.](https://news.itsfoss.com/content/images/2023/12/gentoo-ifi-it-moves-compile-it.png) The problem with compiling a software from its source code means it will take more computational power. Your CPU is going to be super busy when you compile software. ![Gentoo compile meme](https://news.itsfoss.com/content/images/2023/12/gentoo-compile-meme.png) And, of course, it takes some time to compile a software. ![Gentoo compile time meme](https://news.itsfoss.com/content/images/2023/12/gentoo-compile-time-meme.webp) [r/linuxmemes](https://www.reddit.com/r/linuxmemes/comments/yq0on5/this_is_gentoo/?ref=news.itsfoss.com) ## Now you can 'install' packages in Gentoo instead of compiling them Gentoo's package manager, Portage, has had support for binary packages for years. It's just that there were no centralized repository with pre-compiled binary packages. This is changing now as Gentoo is now offering binary packages for download and direct installation. For most architectures, it will be limited to core system and weekly updates. However, for [amd64 and arm64](https://itsfoss.com/arm-aarch64-x86_64/?ref=news.itsfoss.com), there is a huge library providing binaries for popular software like LibreOffice, Docker, Plasma, GNOME and more. This will be really convenient for Gentoo users who are on low-end hardware or who don't want the manual compilation all the time. I know you would rather have a lot of questions about using the binary packages in Gentoo. Check out the [official announcement from Gentoo](https://www.gentoo.org/news/2023/12/29/Gentoo-binary.html?ref=news.itsfoss.com) that covers things in detail. [Gentoo goes Binary! – Gentoo LinuxNews and information from Gentoo Linux](https://www.gentoo.org/news/2023/12/29/Gentoo-binary.html?ref=news.itsfoss.com)![](https://www.gentoo.org/assets/img/logo/gentoo-g.png) ![](https://www.gentoo.org/assets/img/logo/gentoo-g.png) ## Source based installation is not going anywhere Don't outrage just yet my Gentoo comrade! You can still enjoy compiling from the source. That option is not going anywhere. You can still enjoy compiling like you used to. The binary packages are optional. They are not forced upon you. Compiling each package has its benefits. The software is optimized for the system it runs on. That's the performance boost Gentoo users boast of. ![Gentoo meme](https://news.itsfoss.com/content/images/2023/12/gentoo-faster-meme.png) A low end computer takes longer to compile due to limited system resources but it also gets the performance optimization by building each software for the machine. Kind of a catch-22 scenario, if you ask me. ## Will you Gentoo? I strongly believe that this will not only be convenient for the existing Gentoo users set but it will also help grow its user base. After all, what will a distrohopper do after installing Arch? I used numerous memes in the news story here because it's the season to be jolly ☃️ Maybe you can spend your winter break installing (but not compiling) Gentoo 😜 Enjoy the festivities and the holidays! ## More from It's FOSS... - Support us by opting for [It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our [community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our [weekly Newsletter](https://itsfoss.com/newsletter/).
16,529
你可能错过的 2023 年 9 个值得关注的 Linux 发行版
https://news.itsfoss.com/interesting-distros-missed-in-2023/
2024-01-03T15:33:45
[ "Linux 发行版" ]
https://linux.cn/article-16529-1.html
![](/data/attachment/album/202401/03/153319iohvnv1bpddphnnz.jpg) > > 你在 2023 年发现了哪些新的发布版本?有没有哪个发行版让你眼前一亮? > > > 在 2023 年我们看到许多现有的 Linux 发行版得到了进步,同时还出现了一些全新的、对不变性等特性有着特殊关注的发行版。 虽然有许多为 [高级用户设计的发行版](https://itsfoss.com/advanced-linux-distros/),以及一些 [对初学者十分友好的发行版](https://itsfoss.com/best-linux-beginners/),但在 2023 年仍有一些发行版没有得到广泛关注。这些发行版各有特色,不同寻常。 下面,就让我来介绍下**你可能漏掉的 9 个有趣的 Linux 发行版**。 ### 1、Zinc ![](/data/attachment/album/202401/03/153346neccucf9lmt97f95.jpg) [Zinc](https://news.itsfoss.com/zinc-distro/) 是一个基于 Ubuntu 的干净利落的发行版,它配备了 XFCE 和 Nemo 文件管理器,是一个新推出的产品,致力于提供无需过多配置就能顺利使用的体验。 > > **[Zinc](https://teejeetech.com/tag/zinc/)** > > > ### 2、Bazzite ![](/data/attachment/album/202401/03/153347t377xxxrooekfegg.jpg) 你是否想过一款**专为游戏打造的 Linux 发行版**呢?[Bazzite](https://news.itsfoss.com/bazzite/) 就是如此,它是一个基于 Fedora 的,专为 Linux 游戏制定的发行版。 它提供了**预装的英伟达专有驱动程序**,用来**运行安卓应用**的 [Waydroid](https://waydro.id/) 系统,甚至有为 [Steam Deck](https://store.steampowered.com/steamdeck) **专门定制的 ISO**。 > > **[Bazzite](https://github.com/ublue-os/bazzite/releases)** > > > ### 3、Exodia OS ![](/data/attachment/album/202401/03/153348j50e705crurn78or.jpg) [Exodia OS](https://news.itsfoss.com/exodia-os/) 是一个基于 Arch Linux,**专门为网络安全爱好者设计的 Linux 发行版**。这个操作系统可以做到高度的扩展性,由一支网络安全专家团队开发,而且**预装了许多网络安全工具**,还**支持与微软 PowerShell 的整合**等功能。 Exodia OS 也很可能成为一个不错的 Kali Linux 替代品! > > **[Exodia OS](https://github.com/Exodia-OS/exodia-home-ISO/releases)** > > > ### 4、risiOS ![](/data/attachment/album/202401/03/153348qabnsa661967oqoo.jpg) [risiOS](https://news.itsfoss.com/risi-os/) 是另一款基于 Fedora 的优秀发行版,被 [认为](https://itsfoss.com/best-fedora-linux-distributions/) 是当前最好的发行版之一。它的目标是提供简单易用的用户体验,同时整合了一些引人注目的图形界面工具。 它**内置多款实用应用程序**。你还可以添加 “*网络应用*”,让你无需打开浏览器就能直接从桌面访问网站。 > > **[risiOS](https://risi.io/)** > > > ### 5、EasyOS ![](/data/attachment/album/202401/03/153348d3b6bt63dkdbm3lt.jpg) [EasyOS](https://news.itsfoss.com/easyos/) 的开发者将其描述为一种 “*新范式*”。这对一个 Linux 发行版来说,似乎是一个相当大的口号。然而,这个宣称似乎相当可靠。 它是一款**对容器友好,且主要使用内存来处理存储操作的发行版**,这也导致了应用和容器的启动速度非常快。 > > **[EasyOS](https://distro.ibiblio.org/easyos/amd64/releases/kirkstone/)** > > > ### 6、CachyOS [CachyOS](https://news.itsfoss.com/cachyos/) 是一款**基于 Arch 的发行版**,适合大多数用户,提供了诸如多重桌面环境、优化过的 Linux 内核版本、及基于 GUI/CLI 的安装方式等特性。 整体的设计和感觉也较为出色,上述链接中的评论中有更多细节。 > > **[CachyOS](https://cachyos.org/)** > > > ### 7、rlxOS ![](/data/attachment/album/202401/03/153349vez3pv9n4hh3hvqx.jpg) 是时候介绍一款 [不可变的 Linux 发行版](https://itsfoss.com/immutable-linux-distros/) 了。[rlxOS](https://news.itsfoss.com/rlxos/) 是一款独立发行版,着重于对操作系统的核心和工作部件提供更强控制。 它采用了一种滚动式的 [发布策略](https://itsfoss.com/rolling-release/),让你在有重大更新时,无需重新安装它。rlxOS 也**积极关注隐私,原生支持 Flatpaks**。 > > **[rlxOS](https://rlxos.dev/downloads/)** > > > ### 8、carbonOS ![](/data/attachment/album/202401/03/153349ssmmixxp4g8wk5so.jpg) [carbonOS](https://news.itsfoss.com/carbonos/) 是另一款 [独立 Linux 发行版](https://itsfoss.com/independent-linux-distros/),重点是提供直观的用户体验。它搭载了 GNOME 桌面环境,包含一些引人注目的特性,如**原子式的更新**、**对 Flatpak/容器的优先支持**,以及**优秀的使用体验**等。 > > **[carbonOS](https://carbon.sh/)** > > > ### 9、blendOS 最后,我们讲述 [blendOS](https://news.itsfoss.com/blendos/)。这款发行版的目标宏大:**一个致力于替代现有的所有 Linux 发行版的发行版**,具有不可变的特性。 为了实现这样的目标,blendOS **支持大多数流行的包管理器**,如 `apt`、`dnf`、`pacman`、`yum`、`yay`,支持**多种桌面环境**,并且在桌面上**整合了** [Flathub 应用商店](https://flathub.org/en)。 > > **[blendOS](https://blendos.co/)** > > > 至此,这个列表就介绍完了。**2023 年对新的发行版来说,是个丰富而忙碌的一年**,我已经迫不及待地想看看 2024 年会涌现出怎样的创新。 ? 那么你呢,你打算试试这份列表中的哪条?或者,我有没有漏掉其他值得关注的发行版呢? *(题图:DA/5c42ce07-80d6-4a9e-9bde-e9519d709cc0)* --- via: <https://news.itsfoss.com/interesting-distros-missed-in-2023/> 作者:[Sourav Rudra](https://news.itsfoss.com/author/sourav/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[ChatGPT](https://linux.cn/lctt/ChatGPT) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![](/assets/images/pikapods-banner-v3.webp) ![](/assets/images/pikapods-banner-v3.webp) We saw many existing Linux distributions become better in 2023, and some new ones joining the club with a focus on immutability, among other things. Even though there are plenty of [distros for advanced users](https://itsfoss.com/advanced-linux-distros/?ref=news.itsfoss.com), and quite a few [beginner-friendly distros](https://itsfoss.com/best-linux-beginners/?ref=news.itsfoss.com), there were a handful that flew under the radar in 2023. These are quite different in their own right. So, join me as I take you through** nine interesting Linux distributions** that you may have missed in 2023. ## 1. Asmi ![a screenshot of zinc](https://news.itsfoss.com/content/images/2023/12/Zinc.jpg) Asmi (formerly [Zinc](https://news.itsfoss.com/zinc-distro/)) is a neat** Ubuntu-based distro** that features XFCE and the Nemo File Manager, it is a relatively new offering that focuses on providing a good out-of-the box experience without the need to fiddle around much. ## 2. Bazzite ![a screenshot of bazzite with a neofetch output](https://news.itsfoss.com/content/images/2023/12/Bazzite.jpg) How about **a Linux distribution tailored for gaming**?, [Bazzite](https://news.itsfoss.com/bazzite/) is a Fedora-based distro that has been built for gaming on Linux. It offers things like **preinstalled proprietary Nvidia drivers**, a [Waydroid](https://waydro.id/?ref=news.itsfoss.com) implementation for **running Android apps** and even has **a dedicated ISO for the **[Steam Deck](https://store.steampowered.com/steamdeck?ref=news.itsfoss.com). **Suggested Read **📖 [Bazzite: A Distro for Linux Gaming on Steam Deck and PCsGear up for gaming on Linux desktop or the Steam Deck. That sounds exciting!](https://news.itsfoss.com/bazzite/)![](https://news.itsfoss.com/content/images/2023/09/bazzite-first-look-ft.png) ![](https://news.itsfoss.com/content/images/2023/09/bazzite-first-look-ft.png) ## 3. Exodia OS ![a screenshot of exodia os](https://news.itsfoss.com/content/images/2023/12/Exodia.jpg) [Exodia OS](https://news.itsfoss.com/exodia-os/) is **a Linux distro for cybersecurity enthusiasts **based on Arch Linux** **that is highly extensible. Developed by a team of cybersecurity experts, this distro **features many preinstalled Cybersecurity tools**, **integration for Microsoft PowerShell**, and more. This can be a nice alternative to Kali Linux too! ![Follow It's FOSS on Google News](https://news.itsfoss.com/content/images/2023/04/Follow-us-on-Google-News.png) ![Follow It's FOSS on Google News](https://news.itsfoss.com/content/images/2023/04/Follow-us-on-Google-News.png) ## 4. risiOS ![a screenshot of risios](https://news.itsfoss.com/content/images/2023/12/risiOS.jpg) [risiOS](https://news.itsfoss.com/risi-os/) is yet another **Fedora-based distro** that [is counted](https://itsfoss.com/best-fedora-linux-distributions/?ref=news.itsfoss.com) among the best ones out there. It focuses on providing an easy-to-use user experience while also integrating some impressive GUI tools. It also **comes loaded with plenty of useful applications**. You can also add** **“*Web Apps*”, which let you access websites directly from the desktop without the need of a browser. ## 5. EasyOS ![a screenshot of easyos](https://news.itsfoss.com/content/images/2023/12/EasyOS.jpg) The creator of [EasyOS](https://news.itsfoss.com/easyos/) calls it as the “*new paradigm*”. For a Linux distro this is a pretty big claim. However, this claim seems to hold up pretty well. It is** a container-friendly distro that uses RAM to handle most storage operations**, which also results in very fast app and container launches. **Suggested Read **📖 [EasyOS: An Experimental Distro With Unique QualitiesEasyOS may not be for everyone, but it is an exciting distro to check out.](https://news.itsfoss.com/easyos/)![](https://news.itsfoss.com/content/images/2023/08/easy-os-first-look.jpg) ![](https://news.itsfoss.com/content/images/2023/08/easy-os-first-look.jpg) ## 6. CachyOS [CachyOS](https://news.itsfoss.com/cachyos/) is **an Arch-based distro** which is a good fit for most and offers things like **multiple desktop environments**, **an optimized version of the Linux kernel**, **GUI/CLI-based installation options** and more. The overall look and feel is polished too, our review linked above has more details. ## 7. rlxOS ![a screenshot of rlxos](https://news.itsfoss.com/content/images/2023/12/rlxos.jpg) It's time for an [immutable Linux distribution](https://itsfoss.com/immutable-linux-distros/?ref=news.itsfoss.com). [rlxOS](https://news.itsfoss.com/rlxos/) is an independent distro that focuses on providing better control over the core and working parts of the operating system. It follows a [rolling release](https://itsfoss.com/rolling-release/?ref=news.itsfoss.com) approach that eliminates the need to reinstall it whenever there is a major update. rlxOS also **focuses on privacy**, and has** native support for Flatpaks**. ## 8. carbonOS ![a screenshot of carbonos](https://news.itsfoss.com/content/images/2023/12/carbonOS.jpg) [carbonOS](https://news.itsfoss.com/carbonos/) is also an [independent Linux distribution](https://itsfoss.com/independent-linux-distros/?ref=news.itsfoss.com) that focuses on providing an intuitive user experience. It features the GNOME desktop environment with features such as **atomic updates**, **being flatpak/container-first**, **providing a polished experience** and more. **Suggested Read **📖 [carbonOS: This Upcoming Independent Distro is All About UX and Robust ExperiencecarbonOS is a new upcoming distro on the radar. Explore more about it here.](https://news.itsfoss.com/carbonos/)![](https://news.itsfoss.com/content/images/2023/03/carbon-os-first-look.png) ![](https://news.itsfoss.com/content/images/2023/03/carbon-os-first-look.png) ## 9. blendOS Finally, we have [blendOS](https://news.itsfoss.com/blendos/). It is **a Linux distribution that aims to replace all Linux distributions **with its immutable nature. To achieve such a big aim, it **supports most popular package managers** such as *apt*,* dnf*, *pacman*, *yum*, *yay*, has **support for multiple desktop environments**, and f**eatures the ****Flathub Store**** as a desktop app**. Well, that was it for this list, **2023 has been a busy year for new distro releases**, I can't wait to see what kind of innovation we will be seeing in 2024. *💬 What about you, which one will you be trying from this list? Did I miss any other interesting distros?* ## More from It's FOSS... - Support us by opting for [It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our [community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our [weekly Newsletter](https://itsfoss.com/newsletter/).
16,531
如何在 Ubuntu 上安装 Docker
https://itsfoss.com/install-docker-ubuntu/
2024-01-03T22:45:37
[ "Docker" ]
https://linux.cn/article-16531-1.html
![](/data/attachment/album/202401/03/224510gfpbdwbdvbmverbg.jpg) > > 了解在 Ubuntu 上安装 Docker 的两种官方方法。一种很简单,但可能会给你一个稍旧的版本。另一种方法稍显复杂,但能提供最新的稳定版本。 > > > 使用 Docker 意味着开启一个新的计算领域,但如果你刚刚开始使用 Docker,安装可能看起来是一项艰巨的任务。 在 Ubuntu 上安装 Docker 有两种推荐的方法: * **从 Ubuntu 的仓库安装 Docker**:简单的单行命令,但提供旧版本 * **使用 Docker 的官方仓库**:工作量稍多,但提供了最新的稳定版本 我将在本教程中讨论它们。 ### 方法 1:使用 Ubuntu 的仓库安装 Docker 如果你不在意旧版本,并且不想设置和管理仓库,那么这是最适合你的方法。 从更新仓库索引开始: ``` sudo apt update ``` 现在,你可以使用以下命令在 Ubuntu 中安装 Docker 以及 [Docker Compose](https://linuxhandbook.com/docker-compose-quick-start/): ``` sudo apt install docker.io docker-compose ``` > > ? Docker 包被命名为 `docker.io`,因为在 Docker 出现之前就已经存在一个名为 docker(用于 Dockerlet 应用)的过渡包。因此,Docker 包必须被命名为其他名称。 > > > 安装完成后,你可以使用以下命令检查安装的版本: ``` docker -v ``` ![](/data/attachment/album/202401/03/224537c58e85lc5aear1ki.png) 如你所见,它给了我 Docker 24.0.5。 ### 方法 2:在 Ubuntu 中安装最新稳定版本的 Docker 如果你想要 Docker 的最新稳定版本,那么你可以从其官方仓库安装 Docker。 #### 步骤 1:删除任何现有的 Docker 包 但在跳到安装部分之前,有必要删除所有以前安装的 Docker。 要 [卸载以前的 Docker](https://learnubuntu.com/uninstall-docker/),请使用以下命令。 ``` sudo apt remove docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc ``` #### 步骤 2:安装依赖项 第一步是安装一些必要的软件包,这些软件包将用于在本教程后面安装 Docker: ``` sudo apt install ca-certificates curl gnupg lsb-release ``` 你可能已经安装了部分或全部这些软件包,但确认安装没有什么坏处。上面的命令不会伤害你。 #### 步骤 3:添加 Docker 仓库的 GPG 密钥并将其添加到 sources.list 现在,通过 `apt` 包管理器创建一个具有特殊权限的目录,用于存储加密密钥以进行包验证: ``` sudo install -m 0755 -d /etc/apt/keyrings ``` 接下来,如下所示 [使用 curl 命令](https://learnubuntu.com/install-curl/) 下载并导入 Docker 的 GPG 密钥环: ``` curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg ``` 下载 GPG 密钥后,[使用 chmod 命令更改文件权限](https://learnubuntu.com/chmod-command/),以便系统上的每个用户都可以读取 GPG 密钥: ``` sudo chmod a+r /etc/apt/keyrings/docker.gpg ``` 最后,将 Docker 仓库添加到 `sources.list.d` 文件中: ``` echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null ``` 就是这样! #### 步骤 4:安装 Docker 和 Docker Compose 现在,要使你对系统所做的更改生效,请更新系统仓库: ``` sudo apt update ``` 使用以下命令获取最新版本的 Docker 以及其他 Docker 组件和依赖项: ``` sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin ``` > > ? 虽然 [docker.io](http://docker.io) 包安装了大部分必需的 Docker 组件,但你需要在此处单独进行安装。 > > > 要检查已安装的版本,请使用以下命令: ``` docker -v ``` ![](/data/attachment/album/202401/03/224537zmozl44mjhtjr069.png) 测试安装的另一个方法是在 Docker 中使用 “Hello World” 镜像。 让我告诉你如何做。 ### 使用 hello-world 镜像来验证 Docker 安装 运行 “Hello World” 程序是我们启动任何编程之旅时都遵循的标准做法,Docker 也是如此。 Docker 为你提供了一个 “Hello World” 镜像,你可以使用它来测试安装。 要安装并运行 “Hello World” 镜像,只需使用以下命令: ``` sudo docker run hello-world ``` ![](/data/attachment/album/202401/03/224538r2tddfunnaaau6zn.png) 某些用户在执行上述命令时可能会收到错误消息“无法连接到 Docker 守护进程”: ![](/data/attachment/album/202401/03/224538tnwvx234nv2vo554.png) 在这种情况下,**重新启动系统**并再次尝试安装 Docker Hello World 镜像,它将正常工作。 ### ? 额外提示:在 Ubuntu 中使用 Docker 而无需 sudo 如果你注意到了,我使用 sudo 来拉取 Docker 镜像,这并不是使用 Docker 最方便的方式。 如果你尝试在不使用 sudo 的情况下使用 Docker,则会出现错误: ![](/data/attachment/album/202401/03/224538pex5b58wggegsc5b.png) 好吧,在本节中,我将向你展示如何在没有 sudo 的情况下使用 Docker。 > > ? 要执行所示步骤,必须具有超级用户权限! > > > 第一步是使用以下命令 [创建一个名为 docker 的新组](https://learnubuntu.com/add-group/): ``` sudo groupadd docker ``` 完成后,使用以下命令将用户添加到 `docker` 组: ``` sudo usermod -aG docker <用户名> ``` > > ? 确保你只添加具有超级用户权限的用户。 > > > 现在,注销并重新登录以使更改生效。但如果你使用的是虚拟机,那么必须重新启动。 就是这样!从现在开始,你可以使用 `docker` 命令而不需要 sudo,就像我运行 Docker Hello World 镜像一样: ![](/data/attachment/album/202401/03/224538ppv7jqvlz5v75qrf.png) 就这样吧。 ### 这是安装 Docker 后要做的事情 如果你刚刚开始,请参阅每个用户都必须了解的 [基本 Docker 命令列表](https://linuxhandbook.com/essential-docker-commands/): > > **[21 个基本 Docker 命令](https://linuxhandbook.com/essential-docker-commands/)** > > > 我希望你觉得会有帮助。 *(题图:DA/759e483b-0be8-409e-bc58-ed19d99cbdd4)* --- via: <https://itsfoss.com/install-docker-ubuntu/> 作者:[Sagar Sharma](https://itsfoss.com/author/sagar/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![Warp Terminal](/assets/images/warp-terminal.webp) ![Warp Terminal](/assets/images/warp-terminal.webp) Using Docker means opening a new realm of computing but if you are just getting started with Docker, the installation may seem a huge task. There are two recommended ways of installing Docker on Ubuntu: **Installing Docker from Ubuntu's repository**: Easy, single line command but gives a little old version**Using Docker's official repository:**Slightly more work but gives the most recent stable release And I will be discussing both of them in this tutorial. ## Method 1: Install Docker using Ubuntu's repository If you don't care about having a little older version and don't want to get into setting and managing repositories, then this is the best method for you. Start with updating the repository index: `sudo apt update ` Now, you can use the following command to install Docker as well as [Docker Compose](https://linuxhandbook.com/docker-compose-quick-start/) in Ubuntu: `sudo apt install docker.io docker-compose` Once you are done with the installation, you can check the installed version using the following command: `docker -v` ![Check the installed version of docker in Ubuntu](https://itsfoss.com/content/images/2023/12/Check-the-installed-version-of-docker-in-Ubuntu.png) As you can see, it gave me Docker version 24.0.5. ## Method 2: Install the latest stable version of Docker in Ubuntu If you want the most recent stable version of Docker, then you can install Docker from their official repository. ### Step 1: Remove any existing Docker packages But before you jump to the installation part, it is necessary to remove any old installation of Docker. To [uninstall the old Docker installation](https://learnubuntu.com/uninstall-docker/), use the following command. `sudo apt remove docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc` ### Step 2: Install dependencies The first step is to install some essential packages which will be used to install Docker later in this tutorial: `sudo apt install ca-certificates curl gnupg lsb-release` You may already have some or all of these packages installed but no harm in ensuring that. The above command won't harm you. ### Step 3: Add GPG key of Docker repository and add it to sources.list Now, create a directory with special permissions suitable for storing cryptographic keyrings by the apt package manager for package verification: `sudo install -m 0755 -d /etc/apt/keyrings` Next, [use the curl command](https://learnubuntu.com/install-curl/) as shown below to download and import GPG keyring for Docker: `curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg` After downloading the GPG keyring, [change the file permissions using the chmod command](https://learnubuntu.com/chmod-command/) so every user on the system can read the GPG keyring: `sudo chmod a+r /etc/apt/keyrings/docker.gpg` Finally, add the Docker repository to the `sources.list.d` file: ``` echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null ``` That's it! ### Step 4: Installing Docker and Docker Compose Now, to take effect from the changes you've made to the system, update the system repository: `sudo apt update` Grab the latest version of Docker along with other Docker components and dependencies using the following command: `sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin` To check the installed version, use the following command: `docker -v` ![Install the latest version of Docker in Ubuntu using Docker's official repository](https://itsfoss.com/content/images/2023/12/Install-the-latest-version-of-Docker-in-Ubuntu-using-Docker-s-official-repository.png) Another great way to test the installation is to use the Hello World image in Docker. Lemme show you how to do it. ## Use a hello-world image to verify the Docker installation Running a Hello World program is a standard practice that we all follow to kick-start any programming journey and the same goes for Docker. Docker provides you with a Hello World image that you can use to test the installation. To install and run the Hello World image, simply use the following: `sudo docker run hello-world` ![Run hello world docker image in Ubuntu](https://itsfoss.com/content/images/2023/12/Run-hello-world-docker-image-in-Ubuntu.png) Some users may get an error while executing the above command saying "Cannot connect to the Docker daemon": ![docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?](https://itsfoss.com/content/images/2023/12/Docker-error.png) In that case, **reboot your system** and try again to install the Docker Hello World image and it'll work just fine. ## 💡Bonus Tip: Use docker without sudo in Ubuntu If you noticed, I used sudo to pull the docker image which is not the most convenient way to use the Docker. If you try to use Docker without sudo, it will give you an error: ![Docker sudo error in Ubuntu](https://itsfoss.com/content/images/2023/12/Docker-sudo-error-in-Ubuntu.png) Well, in this section, I will show you how you can use Docker without sudo. The first step is to [create a new group](https://learnubuntu.com/add-group/) named `Docker` using the following: `sudo groupadd docker` Once done, add the user to the Docker group using the following: `sudo usermod -aG docker <username>` Now, log out and log back in to take effect from the changes. But if you are using a VM then reboot is a must. That's it! From now on, you can use the docker commands without sudo like I did to run the Docker Hello World image: ![Use docker without sudo in Ubuntu](https://itsfoss.com/content/images/2023/12/Use-docker-without-sudo-in-Ubuntu.png) There you go. ## Here's what to do after installing Docker If you are just getting started, then refer to the [list of essential Docker commands](https://linuxhandbook.com/essential-docker-commands/) that every user must know: [21 Essential Docker Commands [Explained With Examples]A compilation of 21 executable and informative Docker commands for your quick reference.](https://linuxhandbook.com/essential-docker-commands/)![](https://linuxhandbook.com/content/images/2021/05/Essential-Docker-Commands.png) ![](https://linuxhandbook.com/content/images/2021/05/Essential-Docker-Commands.png) I hope you will find this helpful.
16,532
2023 年崭露头角的 7 款不为人知的 Linux 发行版
https://news.itsfoss.com/lesser-known-distros-2023/
2024-01-04T18:08:30
[ "Linux 发行版" ]
https://linux.cn/article-16532-1.html
![](/data/attachment/album/202401/04/180754ivw278u2clqz2ia2.jpg) > > 这些发行版在 2023 年引起了人们的关注! > > > 每年我们都会推出一些令人兴奋的新发行版,它们尝试以不同的方式工作,或者提供一些有意义的东西,而不仅仅是“又一个发行版”。 同样,在 2023 年,我们也有一些引起了大家关注的发行版,即使它们不像一些 [最佳 Linux 发行版](https://itsfoss.com/best-linux-distributions/) 那样流行。 如果你一直关注我们,你可能知道今年也有一些新的 [不可变 Linux 发行版](https://itsfoss.com/immutable-linux-distros/)。不过,并不是所有的新版都成为了今年的赢家。 那么,今年有哪些成功的发行版发布呢? 让我重点介绍最好的几个: ### 1、Vanilla OS [Vanilla OS](https://vanillaos.org/) 是一个基于 Ubuntu 的不可变发行版。 它与其他基于 Ubuntu 的发行版不同。你可以选择在它上面玩游戏、创建开发工作环境,或者只是把它作为可靠的日常使用的操作系统。 你可以根据自己的意愿配置系统,而不会破坏体验。 尽管不可变性对许多人来说可能是一个新概念,但 Vanilla OS 提供了易于使用的用户体验,同时在幕后尝试有趣的事情。 ### 2、XeroLinux [XeroLinux](https://xerolinux.xyz/) 可以让新手轻松拥有一个漂亮的 Arch Linux 系统。 当然,如果你从未使用过 Linux 发行版,那么它可能不是你合适的起始选择。然而,如果你知道在系统上使用 Arch Linux 时需要一些帮助,XeroLinux 可以让你完美地做到这一点。 它不仅具有开箱即用的出众外观,而且还提供了精细定制的体验。 ### 3、Ubuntu Unity ![](/data/attachment/album/202401/04/180831lzcooo6f5cbfo68e.jpg) [Ubuntu Unity](https://ubuntuunity.org/) 最初是一个非官方的提供 Unity 的 Ubuntu 重混版,旨在促进 Unity7 桌面环境的复兴,如今已成为 Ubuntu 的官方派生版本之一。 它在 2023 年大放异彩,一些 Linux 用户体验了 Unity 桌面环境(这是 17.10 之前 Ubuntu 的默认环境)。 ### 4、Crystal Linux ![](/data/attachment/album/202401/04/180832xufosq6ogqt5uebv.png) [Crystal Linux](https://getcryst.al/site) 是一个基于 Arch 的发行版,内置 GNOME 桌面。它旨在利用最新技术,同时提供熟悉的用户界面。 如果你想在 Arch 发行版之上体验定制的 GNOME 体验,Crystal Linux 就是答案。在撰写本文时,它仍处于测试阶段。 但是,它包含了帮助你开始日常体验的所有要素(尽管我建议你不要在生产中使用它)。 ### 5、Bazzite ![](/data/attachment/album/202401/04/180833v4wjejcww8sg5wxy.jpg) [Bazzite](https://github.com/ublue-os/bazzite/) 是一个基于 Fedora 的 Linux 发行版,可让你更轻松地在桌面或 Steam Deck 上玩游戏。 通过包含专有的图形驱动程序和预装的应用(例如 Mission Center 和 Discover Overlay),它使其成为一种有趣的入门体验。 你可以根据你的用途(流媒体、游戏等)选择要安装的应用集。 与其他 Linux 发行版相比,它支持各种游戏硬件,例如 Xbox 控制器、Razer 设备等。 ### 6、Fedora Asahi Remix 我们每个人都关注 Asahi Linux 项目,它让 Linux 在苹果芯片上成为可能。 而且,从他们的旗舰发行版 [Fedora Asahi Remix](https://asahilinux.org/fedora/) 开始,他们已经成功做到了这一点。如果你想在最新的苹果芯片设备上使用 Linux,你可以安装 Fedora Asahi Remix。 它配备了 KDE Plasma 桌面,可以选择使用 GNOME 45,以及其他可帮助你入门的自定义选项。 不要忘记,你将获得只有 Wayland 的体验,并且支持使用 XWayland 的 X11 应用。 ### 7、CachyOS 是的,许多基于 Arch 的发行版确实在 2023 年成功地引起了人们的关注。 CachyOS 就是其中的又一个。 与其他发行版不同,它主要专注于为你提供快速、优化过的 Linux 体验以及安全性改进。CachyOS 利用[高级 BORE 调度程序](https://wiki.archlinux.org/title/improving_performance) 和使用优化指令和 LTO 编译的内核,为你提供最佳性能。 它可能不是一个适合初学者的发行版,但你可以通过选择各种桌面环境来开始,包括一些 [窗口管理器](https://itsfoss.com/best-window-managers/)。 ### 总结 通常是那些被低估的发行版,成功地为 Linux 用户带来了令人兴奋和有用的东西。而这些发行版可能是你从来所不知道的。 当然,对于大多数人来说,坚持使用热门的 Linux 发行版会更安全。然而,如果你想尝试一些不同的东西来改变,鲜为人知的发行版可能会给你带来新鲜空气。 ? 你会从列表中选择哪一个?你认为我们错过了你最喜欢的发行版了吗? *(题图:DA/fdcd86f1-3f72-4ee8-81fd-0fc67e1c2a48)* --- via: <https://news.itsfoss.com/lesser-known-distros-2023/> 作者:[Ankush Das](https://news.itsfoss.com/author/ankush/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![](/assets/images/pikapods-banner-v3.webp) ![](/assets/images/pikapods-banner-v3.webp) Every year we have some exciting new distributions that try to do things differently, or offer something meaningful, than being “just another distro”. Similarly, in 2023, we have had distributions that got everyone's attention even if they are not as popular as some of the [best Linux distributions](https://itsfoss.com/best-linux-distributions/?ref=news.itsfoss.com). If you have been following us, you probably know that there were a bunch of new [immutable Linux distributions](https://itsfoss.com/immutable-linux-distros/?ref=news.itsfoss.com) as well. Unfortunately, not all of them emerged as winners for the year. So, what were some successful distro reveals this year? Let me highlight the best ones: ## 1. Vanilla OS [Vanilla OS](https://vanillaos.org/?ref=news.itsfoss.com) is an immutable distribution based on Ubuntu. It is not like any other Ubuntu-based distribution. You can choose to game on it, create development work environments, or just use it as a daily driver for work with good reliability. You can configure your system to your heart's desire, and not break the experience. Even though immutability can be a new concept for many, Vanilla OS presents an easy-to-use user experience while trying interesting things under-the-hood. ## 2. XeroLinux [XeroLinux](https://xerolinux.xyz/?ref=news.itsfoss.com) gives newbies a good chance to have a beautiful Arch Linux system without any hassle. Sure, if you have never used Linux distributions, it may not a suitable starting choice for you. However, if you know that you need some help with using Arch Linux on your system, XeroLinux lets you do that beautifully. Not just having a good out-of-the-box look, but also giving you the fine grain ability to customize the experience. ![Follow It's FOSS on Google News](https://news.itsfoss.com/content/images/2023/04/Follow-us-on-Google-News.png) ![Follow It's FOSS on Google News](https://news.itsfoss.com/content/images/2023/04/Follow-us-on-Google-News.png) ## 3. Ubuntu Unity ![ubuntu unity](https://news.itsfoss.com/content/images/2023/12/ubuntu-unity-2023.jpg) Started as an unofficial Unity-powered Ubuntu remix to promote the revival of Unity7 desktop environment, [Ubuntu Unity](https://ubuntuunity.org/?ref=news.itsfoss.com) is now one of the official Ubuntu flavors. It shined through in 2023 where some Linux users got a taste of the Unity desktop environment (which was the default for Ubuntu years before 17.10). ## 4. Crystal Linux ![crystal linux](https://news.itsfoss.com/content/images/2023/12/crystal-onyx-dark.png) An Arch-based distribution that packs in the GNOME desktop. [Crystal Linux](https://getcryst.al/site?ref=news.itsfoss.com) aims to utilize the latest technologies while providing a familiar user interface. If you are someone who wants to experience a customized GNOME experience on top of an Arch distribution, Crystal Linux is the answer. At the time of writing, it is still in its beta phase. However, it includes all the essentials to help you get started for a daily driver experience (though I would recommend you not to use it in production). ## 5. Bazzite ![bazzite](https://news.itsfoss.com/content/images/2023/12/Bazzite-1.jpg) [Bazzite](https://github.com/ublue-os/bazzite/?ref=news.itsfoss.com) is a Fedora-based Linux distribution that makes it easier for you to game on your desktop or Steam Deck. With the inclusion of proprietary graphics drivers and pre-installed apps like Mission Center and Discover Overlay, it makes it an interesting experience to get started. You can choose the set of apps to install as per your purpose (streaming, gaming, etc). In contrast to other Linux distributions, it comes with support for various gaming hardware like Xbox Controller, Razer devices, and more. [Bazzite: A Distro for Linux Gaming on Steam Deck and PCsGear up for gaming on Linux desktop or the Steam Deck. That sounds exciting!](https://news.itsfoss.com/bazzite/)![](https://news.itsfoss.com/content/images/2023/09/bazzite-first-look-ft.png) ![](https://news.itsfoss.com/content/images/2023/09/bazzite-first-look-ft.png) ## 6. Fedora Asahi Remix Every one of us has had our eyes on the Asahi Linux project to make Linux possible on Apple Silicon. And, they have managed to do it, starting with [Fedora Asahi Remix](https://asahilinux.org/fedora/?ref=news.itsfoss.com) as their flagship distribution. If you want to use Linux on top of your latest Apple Silicon device, you can install Fedora Asahi Remix. It comes packed with KDE Plasma desktop, with an option to use GNOME 45, and other customization options to get you started. Not to forget, you get a Wayland-only experience with support for X11 apps using XWayland. ## 7. CachyOS I know right? A lot of Arch-based distros did succeed getting the attention in 2023. And, CachyOS is yet another one. Unlike others, it purely focuses on providing you a fast, optimized Linux experience, along with security improvements. CachyOS utilizes the [advanced BORE Scheduler](https://wiki.archlinux.org/title/improving_performance?ref=news.itsfoss.com) and kernels compiled with optimized instructions and LTO for giving you the best performance. It may not be a beginner-friendly distro, but you can get started by choosing various desktop environments, including some [window managers](https://itsfoss.com/best-window-managers/?ref=news.itsfoss.com) as well. **Suggested Read **📖 [Xplorer: Not Just a Pretty Open-Source File Manager!For a change, do you want to a try a new file manager? Xplorer is an interesting project to look at!](https://news.itsfoss.com/xplorer/)![](https://news.itsfoss.com/content/images/2023/12/xplorer-first-look.png) ![](https://news.itsfoss.com/content/images/2023/12/xplorer-first-look.png) ## Wrapping Up It if often the underrated distribution that manages to present something exciting and useful for Linux users. You never know, right? Sure, for the majority, it is safer to stick with popular Linux distributions. However, if you are looking to try something different for a change, lesser-known distros could give you a breath of fresh air. * *💬* What will be your pick among the list? Do you think we missed any of your favorites?* ## More from It's FOSS... - Support us by opting for [It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our [community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our [weekly Newsletter](https://itsfoss.com/newsletter/).
16,534
这些剪贴板管理器使得 Linux 下的复制粘贴更上一层楼
https://itsfoss.com/linux-clipboard-managers/
2024-01-05T00:09:37
[ "剪贴板" ]
https://linux.cn/article-16534-1.html
![](/data/attachment/album/202401/05/000900dhjue9onjmn66j99.jpg) > > 配备高效的剪贴板管理器,让你告别复制粘贴的烦恼,节省时间和精力。 > > > 无论你何时复制内容,它都会被保存在系统剪贴板中,这是一种特殊的短期存储区,用于保留你复制的文字。 毫无疑问,我们都利用神奇的 `Ctrl+C` 和 `Ctrl+V` 快捷键来复制粘贴,对吧? 但是,想象一下,你正打算粘贴刚刚复制的内容,却不小心又按了 `Ctrl+C` 而不是 `Ctrl+V`,糟糕!你得再复制一次原来的文字。 **这就是你需要一个剪贴板管理器的缘由**。它会记录下你复制文字的历史,因此,无论何时,你都可以获取到你曾经复制的文本,以及在此期间复制的所有其他内容。 有许多剪贴板工具供你选择。我要向 Linux 用户推荐 7 款优秀的剪贴板管理器。 这里列出的有一些功能强大的剪贴板管理器,也有一些非常简单易用的。你可以根据自己的需求来选择使用哪款。 ### 1、CopyQ ![](/data/attachment/album/202401/05/000937lzrrm2mmrz4b41n8.png) [CopyQ](https://github.com/hluk/CopyQ) 是 Linux 上功能最齐全的剪贴板管理器之一。 但这丝毫不影响它的易用性。它的用户界面简洁明了,可以对复制的文字添加标签,或者你可以把它们固定下来。 以下是 CopyQ 提供的一些引人注目的特性: * 对复制的条目执行搜索和修改 * 支持重启后保留复制的项目 * 根据复制的项目指定操作 * 可以固定重要的项目以便快速访问 * 使用不同的标签以便快速识别内容 如果你对此有兴趣,我们曾在一篇独立的文章中详细介绍了 [CopyQ](https://itsfoss.com/copyq-clipboard-manager/) 的所有功能以及如何安装它: 在 Ubuntu 上安装 CopyQ,只需运行以下命令: ``` sudo apt install copyq ``` 在 Fedora Linux 上安装: ``` sudo dnf install copyq ``` 或者你也可以运行下面的命令将 CopyQ 以 flatpak 形式安装: ``` flatpak install --user --from https://flathub.org/repo/appstream/com.github.hluk.copyq.flatpakref ``` ### 2、GPaste ![](/data/attachment/album/202401/05/000937epraqrixia7ppsza.png) [GPaste](https://github.com/Keruspe/GPaste) 因其能够完美融合 GNOME shell 的风格,被广泛认为是 GNOME 桌面管理器上的佼佼者。 当然,并不仅仅如此!这款工具拥有众多你所期待的现代、先进剪贴板管理器的功能: * 支持图片 * 可自定义的快捷键,以提升你的工作效率 * 支持 GNOME 扩展,使你操作更便捷 * 允许自定义历史和容量 在 Ubuntu 上安装 GPaste,只需执行以下的命令: ``` sudo apt install gpaste-2 ``` 在 Fedora Linux 上安装: ``` sudo dnf install gpaste ``` 在 Arch Linux 上安装: ``` sudo pacman -S gpaste ``` GNOME 扩展已不再维护,所以你不能在官方网站上安装它,但如果你还是想要使用,可以在 Ubuntu 上使用以下的方式安装: ``` sudo apt install gnome-shell-extension-gpaste ``` ### 3、Diodon ![](/data/attachment/album/202401/05/000938hrz99novvsg9o00d.png) [Diodon](https://github.com/diodon-dev/diodon) 的目标是成为 Unity 桌面管理器最好的剪贴板管理器,但在我的 GNOME 和 KDE 上的测试中,它表现也很出色。 Diodon 直接了当,只提供了大多数用户从剪贴板管理器中期望得到的基础功能。 以下是 Diodon 的一些特色功能: * 默认提供了托盘图标支持 * 能够同步剪贴板 * 自动粘贴选中的项目 * 支持图片 在 Ubuntu 上安装 Diodon,只需执行下面的命令: ``` sudo apt install diodon ``` 在 Fedora Linux 上安装: ``` sudo dnf install diodon ``` 在 Arch Linux 上安装: ``` sudo pacman -S diodon ``` ### 4、Parcellite ![](/data/attachment/album/202401/05/000938irjts7jbacj886jy.png) [Parcellite](https://github.com/rickyrockrat/parcellite) 是一款看上去极其简洁,但深挖下去时却相当先进的工具。 从输入即搜索剪贴板,到创建操作以更好地控制,它几乎提供了你对剪贴板的一切期望。 以下是你在使用 Parcellite 时可以获得的一些有趣的功能: * 持久化历史记录 * 与其他剪贴板同步 * 输入即搜索 * 修剪空格和新行 要在 Ubuntu 上安装 Parcellite,只需执行以下命令: ``` sudo apt install parcellite ``` 在 Fedora Linux 上安装: ``` sudo dnf install parcellite ``` 在 Arch Linux 上安装: ``` sudo pacman -S parcellite ``` ### 5、Keepboard ![](/data/attachment/album/202401/05/000939x8qrpqq0or4c8zh8.png) [Keepboard](https://draganbozanovic.blogspot.com/2020/05/keepboard-clipboard-manager.html) 的显著特性就是其对复制的项目进行分组。此外,也可以保存你的喜爱项目以便将来使用。 但是,Keepboard 其他的特性还包括: * 当你从 Keepboard 对复制的项目双击或按回车时,会自动粘贴。 * 为你喜欢的项和分组自定义名称。 * 可以搜索项目。 * 自定义快捷方式。 尽管 UI 看上去有些过时,但如果能有一个更现代化的界面,无疑将对其大有裨益。如果你对此无所谓,可以试一试。 糟糕的是,安装 Kepboard 的唯一途径是作为 Snap 包进行安装: ``` sudo snap install keepboard ``` ### 6、Qclipper ![](/data/attachment/album/202401/05/000940ij7iiulytfyqqqjj.png) 如果你在寻找一款轻量级的剪贴板管理器,其只有一个功能:保存你复制的文本,那么 [Qlipper](https://github.com/pvanek/qlipper) 就是你最好的选择。 除了作为最轻量级的剪贴板管理器之一,它还有别的一些特性: * 能够更改系统图标 * 支持扩展 * 指定储存的项目数 * 从复制的行中修剪空格 看起来很有趣?要在 Ubuntu 上安装 Qclipper,只需执行以下的命令: ``` sudo apt install qlipper ``` 在 Fedora Linux 上安装: ``` sudo dnf install qlipper ``` 在 Arch Linux 上安装: ``` sudo pacman -S qlipper ``` ### 7、Pano(GNOME 扩展) ![Pano 是 Linux 下的一个剪贴板管理器](/data/attachment/album/202401/05/000940xwxyw3v37gvd3vdt.png) 颇为亮眼,对吧?这是因为 [Pano](https://github.com/oae/gnome-shell-pano) 具备独特的剪贴板展现方式,更像是展示复制项目的预览。 正因为如此,作为 GNOME 扩展的 Pano 才得以跻身此列表(这是列表中唯一的扩展)。但除此之外,它还有很多其他丰富的功能: * 剪贴板能显示复制项目的预览,利用适当的标签把它们分开,增强了可读性。 * 隐身模式,不会把复制的项目保存至剪贴板 * 可以限制剪贴板历史长度。 * 排除敏感的应用,比如密码管理器。 * 可以为特定文件类型定制预览。 在你安装 Pano 之前,确认你已经安装了 libgda 和 gsound,这样才能保证此工具的正常工作。以下是你如何安装这些库的指南。 在 Ubuntu 下: ``` sudo apt install gir1.2-gda-5.0 gir1.2-gsound-1.0 ``` 在 Fedora 下: ``` sudo dnf install libgda libgda-sqlite ``` 在 Arch Linux 下: ``` sudo pacman -S libgda ``` 当你完成安装后,就可以访问 Pano 的官方扩展页面并安装它了: > > **[获取 Pano](https://extensions.gnome.org/extension/5278/pano/)** > > > ### 附加:Clipboard(专为终端打造) ![](/data/attachment/album/202401/05/000941d17ssxxx5x57ymy4.gif) 你有没有想过在 Linux 下你会需要一个剪贴板功能?以往,我习惯使用 `cp` 命令在 Linux 中复制文件,但现在,[剪贴板工具](https://github.com/Slackadays/Clipboard) 却极大地简化了这个过程。 别把它与 `cp` 命令混淆,因为它是专为终端用户精心打造的全功能剪贴板,下面是你可以享受到的一些强大功能: * 与 Linux 上现有的 GUI 剪贴板集成 * 炫酷的设计 * 运行速度飞快 * 无需配置,使用简便 获取这款工具的最直接方式是通过 Flatpak 或 Snap 包,因为大多数 Linux 发行版的默认仓库并未提供。 对于 Flatpak: ``` flatpak install app.getclipboard.Clipboard alias cb='flatpak run app.getclipboard.Clipboard' ``` 对于 Snap 包: ``` sudo snap install clipboard alias cb='snap run clipboard' ``` 上述每种方法都需要你设置一个别名以使其正常工作,但我提到的这些命令只会临时添加别名。 为了永久地设置别名,你可以参考这篇详尽的 [指南](https://linuxhandbook.com/linux-alias-command/)。 ### 我对剪贴板管理器的个人看法 如果你问我的话,我更喜欢的是那些简洁、高效的工具。如果你和我有类似的审美,你应该会喜欢 CopyQ —— 功能强大,但它极简的设计使你不会觉得困扰。 当然,你可能会有不同的看法,这也正是我在这篇文章中介绍其它的选择的原因。 ? 现在,该轮到你了。你使用或打算使用上述提到的哪一款剪贴板管理器?或者你知道哪款工具应该被添加到这个列表中?请在评论中告诉我们。 *(题图:DA/e3d56085-02f5-4b47-bf6e-db847cb6cf05)* --- via: <https://itsfoss.com/linux-clipboard-managers/> 作者:[Sagar Sharma](https://itsfoss.com/author/sagar/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[ChatGPT](https://linux.cn/lctt/ChatGPT) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![Warp Terminal](/assets/images/warp-terminal.webp) ![Warp Terminal](/assets/images/warp-terminal.webp) Whenever you copy something, it gets stored in the system clipboard, a special short-term memory where your system stores the copied text. I mean we all used those magical Ctrl+C and Ctrl+V shortcuts for copy pasting, right? But imagine, that you copied something and when you were about to paste, you used Ctrl+C again instead of Ctrl+V. What a bummer! Now you have to copy the intended text again. **This is why you need a clipboard manager**. It keeps a history of the text you copied. This way, you can access the text that you copied hours ago and everything else copied in between. There are several such clipboard tools available. I will share share 7 clipboard managers for Linux users. This list contains some advanced clipboard managers as well as some super simple ones so you can choose what fits the best for your use. ## 1. CopyQ ![CopyQ clipboard manager for Linux](https://itsfoss.com/content/images/2023/12/CopyQ-clipboard-manager-in-Linux.png) The [CopyQ](https://github.com/hluk/CopyQ) is one of the most feature-rich clipboard managers available on Linux. But that does not compromise the usability. The user interface is simple and you can use tags for copied text or you can pin them. Here are some more interesting features of CopyQ: - Ability to search and modify the copied items - Preserves copied items on reboot - You can specify actions based on copied items - Pin important items for ease of reachability - Use different tags for better identification If you are interested, we have covered CopyQ in a separate article exploring all the features and installation: [CopyQ for Keeping a Track of Clipboard History in LinuxCtrl+C and Ctrl+V work even better if you can access what you had copied earlier by accessing the clipboard history. CopyQ gives you that feature in Linux.](https://itsfoss.com/copyq-clipboard-manager/)![](https://itsfoss.com/content/images/wordpress/2020/05/clipboard-linux.png) ![](https://itsfoss.com/content/images/wordpress/2020/05/clipboard-linux.png) To install CopyQ on Ubuntu, use the given command: `sudo apt install copyq` For Fedora Linux: `sudo dnf install copyq` Get CopyQ as a flatpak using the following: `flatpak install --user --from https://flathub.org/repo/appstream/com.github.hluk.copyq.flatpakref` ## 2. GPaste ![GPaste clipboard manager in Linux](https://itsfoss.com/content/images/2023/12/GPaste-clipboard-manager-in-Linux.png) The [GPaste](https://github.com/Keruspe/GPaste) is considered one of the best clipboard managers for the GNOME desktop manager as it blends well with the GNOME shell styling. But that's not it! You get tonnes of features that you expect from any modern and advanced clipboard manager: - Support for images - Customizable shortcuts for better productivity - Support for GNOME extension for better reach - Ability to customize the history and size To install GPaste on Ubuntu, use the following command: `sudo apt install gpaste-2` For Fedora Linux: `sudo dnf install gpaste` For Arch Linux: `sudo pacman -S gpaste` The GNOME extension is no longer maintained so you can not install it from the official site but if you want to have it, here's how you do it on Ubuntu: `sudo apt install gnome-shell-extension-gpaste` ## 3. Diodon ![diodon clipboard manager in Linux](https://itsfoss.com/content/images/2023/12/diodon-clipboard-manager-in-Linux.png) The [Diodon](https://github.com/diodon-dev/diodon) aims to be the best clipboard manager for Unity desktop manager but when I tested it on GNOME and KDE, it worked just fine. Diodon is simple and only gets you the basic feature that most users would want from a clipboard manager. Here are some interesting features of Diodon: - Support for tray icon support by default - Ability to sync clipboards - Pastes selected items automatically - Image support To install Diodon in Ubuntu, use the following: `sudo apt install diodon` For Fedora Linux: `sudo dnf install diodon` For Arch Linux: `sudo pacman -S diodon` ## 4. Parcellite ![Parcellite clipboard manager in Linux](https://itsfoss.com/content/images/2023/12/Parcellite-clipboard-manager-in-Linux.png) [Parcellite](https://github.com/rickyrockrat/parcellite) is one of those utilities that look super simple from the front and when you dig in, you get a taste of advancement. From typing to searching in the clipboard to creating actions for better control, it offers almost everything you can expect from the clipboard. Here are some interesting features you get with Paecellite: - Persistent history - Synchronize with other clipboards - Type to search - Trim whitespace and newlines To install Parcellite on Ubuntu, use the given command: `sudo apt install parcellite` For Fedora Linux: `sudo dnf install parcellite` For Arch Linux: `sudo pacman -S parcellite` ## 5. Keepboard ![Keepboard clipboard manager in Linux](https://itsfoss.com/content/images/2023/12/clipboard-manager-in-Linux.png) The most prominent feature of the [Keepboard](https://draganbozanovic.blogspot.com/2020/05/keepboard-clipboard-manager.html) is how it groups the copied items. Apart from that, you can also save your favorites for future use as well. But here are some other features of Keepboard: - Auto-paste when you double-click or enter the copied item from Keepboard. - Give custom names for your favorite items and groups. - Ability to search items. - Customizable shortcuts. The UI looks dated to me. It could surely benefit with a more modern interface. If you don't have any issues with that, you can surely give it a try. The sad part is the only way to install Kepboard is to install it as a snap package: ``` sudo snap install keepboard ``` ## 6. Qclipper ![Qlipper clipboard manager in Linux](https://itsfoss.com/content/images/2023/12/Qlipper-clipboard-manager-in-Linux.png) If you are looking for a lightweight option that does only one thing: saves your copied text then [Qlipper](https://github.com/pvanek/qlipper) is the perfect option for you. Apart from being one of the most lightweight keyboard managers, it has some other features too: - Ability to change the system icon - Extension support - Specify the number of items to store - Trim whitespace from the copied line Looks interesting? Here's how you install Qclipper on Ubuntu: `sudo apt install qlipper` For Fedora Linux: `sudo dnf install qlipper` For Arch Linux: `sudo pacman -S qlipper` ## 7. Pano (GNOME extension) ![Pano clipboard manager for Linux](https://itsfoss.com/content/images/2023/12/Using-the-pano-clipboard-manager-in-Linux-1-.png) That looks amazing. Right? That's because [Pano](https://github.com/oae/gnome-shell-pano) has a unique approach to presenting you the clipboard which is more like showing the preview of copied items. This is why Pano being a GNOME extension made it to the list (the only extension in this list). But not just that, you have a plethora of other features as well: - The clipboard shows the preview of copied items and separates them with appropriate tags for better readability. - Incognito mode (won't save copied items to clipboard) - Ability to limit the clipboard history - Exclude sensitive apps such as password managers - Ability to customize preview for given filetypes Before you install Pano, make sure you install `libgda` and `gsound` to make this utility work. Here's how you install them. For Ubuntu: `sudo apt install gir1.2-gda-5.0 gir1.2-gsound-1.0` For Fedora: `sudo dnf install libgda libgda-sqlite` For Arch Linux: `sudo pacman -S libgda` Once you are done with the installation, [visit the official extension page for Pano](https://extensions.gnome.org/extension/5278/pano/) and install it: ## Bonus: Clipboard (for terminal use only) ![copy and paste items in Linux terminal using cb command](https://itsfoss.com/content/images/2023/12/copy-and-paste-using-clipboard.gif) Ever thought you'd ever need a clipboard in Linux? Well, I used to use the cp command to copy files in Linux but [the Clipboard utility](https://github.com/Slackadays/Clipboard) has made things pretty easy for me. Don't confuse it with the cp command as it is a full-fledged clipboard crafted for the terminal users and here are some great features you get: - Integration with the existing GUI clipboard on Linux - Eye candy design - Blazing fast - No configuration is required and easy to use The easiest way to get this utility is to use the Flatpak or snap package as it is not available in the default repository of most Linux distributions. For Flatpak: ``` flatpak install app.getclipboard.Clipboard alias cb='flatpak run app.getclipboard.Clipboard' ``` For Snap package: ``` sudo snap install clipboard alias cb='snap run clipboard' ``` Each of these methods requires you to set up an alias to make it work and the command which I mentioned will only add alias temporarily. To [create an alias permanently](https://linuxhandbook.com/linux-alias-command/), you can refer to this detailed guide: [Linux Alias Command: Set, Create and Remove AliasesAlias command in Linux saves a lot of your time and improves your efficiency. Learn how to use this command properly and see some of the common aliases I use.](https://linuxhandbook.com/linux-alias-command/)![](https://linuxhandbook.com/content/images/2020/06/alias-command-linux.png) ![](https://linuxhandbook.com/content/images/2020/06/alias-command-linux.png) ## My take on clipboard managers If you ask me, I love using tools that are not super fancy and get the job done and if your ideology aligns with mine, you should use CopyQ which has amazing features but is minimal enough that does not crips me out. Sure, you may not agree with me and this is why I wrote this article with other such options. *💬 Now, it's your turn. Which of the above mentioned clipboard managers you use or willing to use? Do you know any other such tool that should be added to the list here? Share it in the comments please.*
16,535
2023 年开源和 Linux 世界的 8 个决定性时刻
https://news.itsfoss.com/best-open-source-linux-stories-2023/
2024-01-05T16:28:00
[ "Linux", "开源" ]
https://linux.cn/article-16535-1.html
![](/data/attachment/album/202401/05/162812w2d1sk1jink91rki.jpg) > > 回顾 2023 年的过山车之旅。 > > > 对于 Linux 和开源,每年都会带来一些惊喜和冲击。 可能有的 Linux 发行版改变其基础,也可能某个独立项目被大型科技巨头接管,以及其他各种情况。在整个 2023 年,我们将竭尽所能,为你带来过山车般的体验。 如今,这一年已经结束了。现在是时候回顾一下 2023 年发生的一些重大事件了。 ### 1、Ubuntu 首次推出 “Flutter” 商店 ⭐ ![](/data/attachment/album/202401/05/162844w2np2ek6z8bllede.jpg) Ubuntu 的“<ruby> 软件中心 <rt> software center </rt></ruby>”因其变化和改进而始终成为热门话题。 今年,Ubuntu 加大了力度,在 Ubuntu 23.10 中引入了新的基于 Flutter 的 “<ruby> Ubuntu 商店 <rt> Ubuntu Store </rt></ruby>”,提供了现代而流畅的用户体验。 它最终将取代 Ubuntu 多年来的软件中心,在我看来这是一件好事。 ### 2、印度防卫服务转向 Linux ![](/data/attachment/album/202401/05/162845nohia5il8h88lwj9.png) 印度国防部决定用内部开发的名为 “**Maya**” 的 Linux 发行版取代 Windows。 当然,这并不是政府机构第一次决定使用 Linux 来提高安全性和隐私性。 然而,在像印度这样的国家,在政府机构的某个部门使用 Linux 的一个简单选择可能会对其他系统产生巨大的影响。而且,这对于 Linux 来说通常是一件非常好的事情。 ### 3、红帽的源代码锁定 ? 最大的开源公司红帽决定将红帽企业 Linux(RHEL)的源代码锁定在付费墙后面。 虽然他们仍然允许个人开发人员通过免费订阅访问源代码,但不再像以前那样向所有人公开访问。 这一变化波及了所有基于 RHEL 的发行版和分叉: > > **[红帽的源代码封锁给 CentOS 替代品带来灾难: Rocky Linux 和 AlmaLinux 面临困境?](https://news.itsfoss.com/red-hat-restricts-source-code/)** > > > 从 SUSE、甲骨文和其它竞争对手联手开发 RHEL 分支,到 Rocky Linux 和 AlmaLinux 等项目的各种其他更改。 对我来说,这是 2023 年最大的新闻,并将在 2024 年继续产生影响。 > > **[为打击 IBM,SUSE 将分叉 RHEL](https://news.itsfoss.com/suse-rhel-fork/)** > > > ### 4、Linux 内核 LTS 支持周期的变更 ![](/data/attachment/album/202401/05/162940zoy81cqnz1qyp897.jpg) 为了减轻 Linux 维护人员的负担,LTS 内核的支持周期从六年降至**两年**。 据评估,使用较旧的 Linux 内核版本的人并不多,而且许多 LTS 版本的内核已经维护多年,这对于维护人员来说是一项艰巨而繁琐的任务。 作为用户,你不必担心它,除非你依赖较新的 Linux 内核上不再存在的特定硬件支持。 ### 5、Ubuntu 不再支持所有版本的 Flatpak ? 毫不奇怪,Canonical 的 Ubuntu 更青睐 Snap 软件包。 然而,Ubuntu 的各个版本确实有提供 Flatpak 支持的自由,比如 Ubuntu MATE。 不幸的是,[Ubuntu 取消了默认的 Flatpak 支持](https://news.itsfoss.com/ubuntu-flavor-drops-flatpak/),理由是一致的用户体验。 当然,你可以手动添加 Flatpak 支持,但这不再是开箱即用的便利。 这个改变会影响你吗? 好吧,如果你知道 [Flatpak 与 Snap](https://itsfoss.com/flatpak-vs-snap/) 之间的选择,你就已经知道答案了。 ### 6、出现了一个滚动发布的 Ubuntu 发行版 ? 在所有其他有趣的发行版本中,Rhino Linux 发布了稳定版本。它的目标是在 Ubuntu 之上提供滚动发布体验。 你可以在我们的报道中探索有关该版本的更多信息: > > **[基于 Ubuntu 的 Rhino Linux 滚动发行版已发布](/article-16110-1.html)** > > > ### 7、Vim 创建者去世了? ![](/data/attachment/album/202401/05/162846aqj6eooe3lqhxbz6.jpg) 今年,我们失去了 Linux 领域的一位杰出创造者,**Bram Moolenar**,他是 [Vim](https://www.vim.org/) 文本编辑器背后的传奇人物。 他的目标是改进最初是为 Unix 创建的 [vi](https://en.wikipedia.org/wiki/Vi) 文本编辑器。 然后,Bram 在 vi 及其克隆的源代码的基础上构建,通过添加新功能对其进行改进,最后发布了第一个版本 “**Vi IMitation**”,由此得到了“**Vim**”的首字母缩写。 ### 8、Linux 游戏统计数据超越 macOS 作为 Linux 用户,我们对统计数据非常重视,并在达成里程碑时庆祝。例如,每月都会监测 [Linux 桌面市场份额](https://itsfoss.com/linux-market-share/)。 今年,在 Steam 的统计报告中,Linux 使用率统计数据高于 macOS。你可以在这里获取详细信息: > > **[Linux 崛起:Steam 的游戏使用率超过 macOS](https://news.itsfoss.com/linux-steam-macos/)** > > > ### 总结 2023 年发生了很多事情 ? 例如,我们发现了各种令人兴奋的应用: > > **[2023 年深受 Linux 用户喜爱的 8 个令人兴奋的开源应用程序](https://news.itsfoss.com/exciting-apps-2023/)** > > > 不要忘记,发行版领域中的一些新成员引起了人们的关注: > > **[2023 年崭露头角的 7 款不为人知的 Linux 发行版](/article-16532-1.html)** > > > ? 对你来说,2023 年最大的震惊(快乐/悲伤)是什么? 请在下面的评论中告诉我们。 *(题图:DA/61d67a24-c9af-4045-b255-9ef384cbaf5d)* --- via: <https://news.itsfoss.com/best-open-source-linux-stories-2023/> 作者:[Ankush Das](https://news.itsfoss.com/author/ankush/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![](/assets/images/pikapods-banner-v3.webp) ![](/assets/images/pikapods-banner-v3.webp) With Linux and open-source, every year brings some good surprises, and shockers. There could be a Linux distribution that changes its base, an independent project taken over by a big tech giant, and various other things. And, throughout 2023, we tried our best to get you a dose of the rollercoaster ride. Now that the year has come to an end. It is time to look back at some of the biggest stories that happened in 2023. ## 1. Ubuntu Debuts the "Flutter" Store ⭐ ![a screenshot of ubuntu's new flutter-based software center](https://news.itsfoss.com/content/images/2023/08/2.jpg) Ubuntu's software center is always the talk of the hour for its changes, and improvements. This year around, Ubuntu stepped up their game by introducing a new "Ubuntu Store" with Ubuntu 23.10 based on Flutter, providing a modern and sleek user experience. It will eventually replace the software center Ubuntu's had for years now, which is a good thing in my opinion. ## 2. Indian Defense Services Switch to Linux ![indian govt linux](https://news.itsfoss.com/content/images/size/w1304/2023/08/indian-govt-switched-to-linux.png) The Defense Ministry of India has decided to replace Windows with an in-house developed Linux distro dubbed "**Maya**". Of course, this is not the first time a government body has decided to use Linux to improve security and privacy. However, in a country like India, a simple choice to use Linux in one part of the government body could have a massive influence over other systems. And, that would be a really nice thing for Linux in general. ## 3. Red Hat's Source Code Locking 🔒 Red Hat, the biggest open-source company, decided to lock the source code for Red Hat Enterprise Linux behind a paywall. While they still allowed individual developers to access the source code with a free subscription, but it is no longer publicly accessible to all, as it was earlier. This change sent waves to all the RHEL-based distributions, and forks: [Red Hat’s Source Code Lockout Spells Disaster for CentOS Alternatives: Rocky Linux and AlmaLinux in Trouble?Red Hat’s new move means that RHEL-source code is only accessible to users with subscriptions. What do you think about this?](https://news.itsfoss.com/red-hat-restricts-source-code/)![](https://news.itsfoss.com/content/images/2023/06/redhat-limited-centos-stream.png) ![](https://news.itsfoss.com/content/images/2023/06/redhat-limited-centos-stream.png) From competitors like SUSE, Oracle, and others teaming up to work on an RHEL-fork, to various other changes to projects like Rocky Linux, and AlmaLinux. For me, it was the biggest story of 2023, which will continue to have after-effects in 2024. [In a Blow to IBM, SUSE is Forking Red Hat Enterprise LinuxIs SUSE initiating more competition against RHEL? Find out what’s cooking.](https://news.itsfoss.com/suse-rhel-fork/)![](https://news.itsfoss.com/content/images/2023/07/suse-rhel-distro.png) ![](https://news.itsfoss.com/content/images/2023/07/suse-rhel-distro.png) ## 4. A Change to Linux Kernel LTS Support Cycle ![linux kernel](https://news.itsfoss.com/content/images/size/w1304/2023/09/big-change-lts-kernel.png) To reduce the burden of Linux maintainers, the support cycle for an LTS kernel was dropped down to **two years** instead of six. It was evaluated that not many people use the older Linux Kernel versions, and with many LTS versions of the kernel being maintained for years, it becomes a difficult and tiresome task for the maintainers. As a user, you should not have to worry about it, unless you rely on specific hardware support that no longer exists on newer Linux kernels. ## 5. Ubuntu Drops Flatpak Support for all its Flavours 🔨 It is no surprise that Canonical's Ubuntu favors Snap packages over anything else. However, Ubuntu flavours did have the freedom to offer Flatpak support, like Ubuntu MATE. Unfortunately, [Ubuntu axed the default Flatpak support](https://news.itsfoss.com/ubuntu-flavor-drops-flatpak/) for the flavors, citing a consistent user experience as the reason. [Snapped! Ubuntu Cracks Down on Default Flatpak Support for its FlavorsUbuntu flavors will no longer include Flatpak support out-of-the-box. Why is that? Let’s find out.](https://news.itsfoss.com/ubuntu-flavor-drops-flatpak/)![](https://news.itsfoss.com/content/images/2023/02/ubuntu-removes-default-flatpak-support.png) ![](https://news.itsfoss.com/content/images/2023/02/ubuntu-removes-default-flatpak-support.png) Of course, you can add Flatpak support manually, but it's not an out-of-the-box convenience anymore. Would this change affect you? Well, if you know your pick between [Flatpak vs Snap](https://itsfoss.com/flatpak-vs-snap/?ref=news.itsfoss.com), you already know the answer. ## 6. A Rolling-Release Ubuntu Distro Appears 🎲 Among all the other interesting disto releases, Rhino Linux hit the stable release. It aims to offer a rolling-release experience on top of Ubuntu. You can explore more about the release in our coverage: [Rolling-Release Ubuntu-based Rhino Linux Has LandedRhino Linux is an interesting option to have!](https://news.itsfoss.com/rhino-linux-release/)![](https://news.itsfoss.com/content/images/2023/04/rhino-linux-release.jpg) ![](https://news.itsfoss.com/content/images/2023/04/rhino-linux-release.jpg) ## 7. Vim Creator Passed Away🥺 ![a photo of bram moolenar holding a beer](https://news.itsfoss.com/content/images/2023/08/Bram_Moolenar.jpg) This year, we lost a notable creator in the Linux space, **Bram Moolenaar**, the legend behind [Vim](https://www.vim.org/?ref=news.itsfoss.com) text editor. He aimed to improve upon the existing [vi](https://en.wikipedia.org/wiki/Vi?ref=news.itsfoss.com) text editor, initially created for Unix. Bram then built upon the source code of vi and its clones, improving them by adding new features, and finally releasing the first version as “**Vi IMitation**”, where it got the “**Vim**” acronym. ## 8. Linux Rising Above macOS Gaming Stats As Linux users, we take our statistics seriously and celebrate when there's a milestone. Like, monitoring the [Linux desktop market share](https://itsfoss.com/linux-market-share/?ref=news.itsfoss.com) every month. This year, Linux usage stats stood higher than macOS in Steam's stat report. You can get the details here: [Linux Rising: Steam Usage Surpasses macOS for GamingSteam users on Linux take the lead over macOS! Sounds great!](https://news.itsfoss.com/linux-steam-macos/)![](https://news.itsfoss.com/content/images/2023/08/linux-surpasses-macos-steam.png) ![](https://news.itsfoss.com/content/images/2023/08/linux-surpasses-macos-steam.png) ## Wrapping Up Plenty of things happened in 2023 😲 For instance, there were various exciting applications that we uncovered: [8 Exciting Open Source Apps Linux Users Loved Exploring in 2023The best underrated apps that we discovered in 2023.](https://news.itsfoss.com/exciting-apps-2023/)![](https://news.itsfoss.com/content/images/2023/12/x-exciting-apps-2023.png) ![](https://news.itsfoss.com/content/images/2023/12/x-exciting-apps-2023.png) Not to forget, some new names in the distro space made it to the spotlight: [7 Unknown Linux Distros that Emerged Winner in 2023Distributions that caught your attention in 2023!](https://news.itsfoss.com/lesser-known-distros-2023/)![](https://news.itsfoss.com/content/images/2023/12/x-small-distros-winner-2023.png) ![](https://news.itsfoss.com/content/images/2023/12/x-small-distros-winner-2023.png) *💬 For you, what was the biggest shocker (happy/sad) in 2023? Let us know in the comments below.* ## More from It's FOSS... - Support us by opting for [It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our [community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our [weekly Newsletter](https://itsfoss.com/newsletter/).
16,536
2024 开年,LLUG 和你相约在武汉
https://jinshuju.net/f/zFsdwP
2024-01-12T16:59:00
[ "LLUG" ]
https://linux.cn/article-16536-1.html
![](/data/attachment/album/202401/11/142906hqjhrlywqjyr4zmz.jpg) Hi,Linuxer,2024 新年伊始,不知道你是否已经准备好迎接新的一年~ 2024 年,Linux 爱好者沙龙重新起航,这次,我们从黄鹤楼畔,大美武汉开始我们新的一年线下相见! 2024 年 1 月 20 日,我们在武汉未来科技城,一起相约在统信软件武汉分公司,聊聊新的一年,你对于 Linux 的期待、对于开源、开发等一切问题的想法和探索。 本次活动由 Linux 中国、龙蜥社区(OpenAnolis)、deepin(深度)社区、WHLUG、华中科技大学网安学院开源俱乐部联合主办,统信软件技术有限公司提供场地支持。 > 龙蜥社区(OpenAnolis)是国内的顶尖 Linux 发行版社区,我们希望在普及 Linux 知识的同时,也能让中国的 Linux 发行版,为更多人知晓,推动国产发行版的发展和进步。 | 议题 | 分享简介 | 分享内容 | 分享者 | | --- | --- | --- | --- | | 14:00~14:20 | 签到 | | 14:20~14:30 | 《玲珑-容器技术在桌面程序分发中的应用》 | 简单介绍 Linux 内核提供的容器相关特性的用户态接口使用方法、非 root 用户使用 Linux 容器的限制,以及其他有趣的 Linux 容器技术细节,并以玲珑为例介绍容器技术在桌面应用程序分发和治理等方面的实际应用。 | 陈麟轩 / 统信软件技术有限公司高级研发工程师 | | 14:30~15:00 | 《华科内核贡献团队开源实践分享》 | 在本次演讲中将分享如何带领开放华科原子开源俱乐部中的内核贡献团队,挖掘并修复 Linux 内核漏洞,并通过内部审核机制保障内核补丁正确性。 | 慕冬亮 / 华科开放原子开源俱乐部 | | 15:00~15:45 | 《开源之旅:从学生到核心贡献者》 | 一名学生从零开始参与开源社区,到成为核心贡献者的经历与心得,探讨开源的意义,还有给开源新人的一些小建议 | 朱俊星 / 华中科技大学学生,开源爱好者,RustSBI、KCL Maintainer | | 15:45~16:20 | 《Anolis OS 优化 Virtio 协议增强网络性能实践分享》 | 作为云计算重要组成部分的虚拟网卡正面临着性能和功能的双重挑战。针对实际业务需求,我们制定了新的 virtio 标准,包括 Inner Hash、Virtio Checksum修复、NetDIM、Device Stats 等技术,在阿里云软硬件融合的智能网卡上进行了实践,将来会为用户提供更好的虚拟网卡使用体验。 | 衡琪 / 阿里云计算有限公司研发工程师,龙蜥社区高性能网络 SIG 成员 | | 16:20~17:00 | 闪电演讲(短分享) | | 17:00~18:00 | 线下交流 | ### 主题演讲:《玲珑-容器技术在桌面程序分发中的应用》 ![](/data/attachment/album/202401/05/164752mxj5gfyzjxhvuuv0.jpg) *陈麟轩 /统信软件技术有限公司高级研发工程师* 简单介绍 Linux 内核提供的容器相关特性的用户态接口使用方法、非 root 用户使用 Linux 容器的限制,以及其他有趣的 Linux 容器技术细节,并以玲珑为例介绍容器技术在桌面应用程序分发和治理等方面的实际应用。 ### 主题演讲:《华科内核贡献团队开源实践分享》 ![](/data/attachment/album/202401/05/180922j62k369d36sh6h5h.jpg) *慕冬亮 / 华科开放原子开源俱乐部* 在本次演讲中,将分享如何带领开放华科原子开源俱乐部中的内核贡献团队,挖掘并修复 Linux 内核漏洞,并通过内部审核机制保障内核补丁正确性。 ### 主题演讲:《开源之旅:从学生到核心贡献者》 ![](/data/attachment/album/202401/05/164826ar90ttnbbbtap0en.jpg) *朱俊星 / 华中科技大学学生,开源爱好者,RustSBI、KCL Maintainer* 一名学生从零开始参与开源社区,到成为核心贡献者的经历与心得,探讨开源的意义,还有给开源新人的一些小建议。 ### 主题演讲:《Anolis OS 优化 Virtio 协议增强网络性能实践分享》 ![](/data/attachment/album/202401/11/140210ku5ku0afna856kfe.jpg) *衡琪 / 阿里云计算有限公司研发工程师,龙蜥社区高性能网络 SIG 成员* 作为云计算重要组成部分的虚拟网卡正面临着性能和功能的双重挑战。针对实际业务需求,我们制定了新的 virtio 标准,包括 Inner Hash、Virtio Checksum修复、NetDIM、Device Stats 等技术,在阿里云软硬件融合的智能网卡上进行了实践,将来会为用户提供更好的虚拟网卡使用体验。 ### 闪电演讲 本次线下活动依旧保留闪电演讲环节,作为最受欢迎的线下活动,本次活动依旧继续举办闪电演讲。每位演讲者有 5 分钟时间参与现场活动,可以提前报名,也可即兴上台演讲。时间一满,马上结束~强制大家控制自己的分享时间,用最短的时间,向大家发出你的声音~ ![李伟光现场介绍 neovim 的使用](/data/attachment/album/202311/20/172932pvpi8b3xsbtq3ppz.jpg "李伟光现场介绍 neovim 的使用") *李伟光现场介绍 neovim 的使用* ![](/data/attachment/album/202312/22/114432gzffzit22kiffekf.jpg) *丰雷同学为大家分享了他对开源、编程方面的感悟* ### 活动地点及到达信息 活动地点:**武汉市江夏区高新大道999号未来科技城B3栋9楼-A901(琴台大剧院会议厅)** ![](/data/attachment/album/202401/05/164915nb36dbw31w1bl03d.jpg) 抵达方式: * 自驾:导航到「武汉市江夏区高新大道999号未来科技城 B3 栋」,按指引停车入园即可。 * 公共交通:地铁:乘坐轨道交通 11 号线,「光谷七路」D口出站,步行 600 米到。 如果你因为有事,没办法来到线下,那也没问题,我们的活动也会在 Linux 中国视频号、Linux 中国 B 站、龙蜥 B 站、龙蜥钉钉群等开启同步直播。 当然,我们更希望你能亲自来到线下,和我们一起聊聊开源,聊聊技术~ 活动报名地址: ![](/data/attachment/album/202401/05/165942u3dfbf8gqfp4f333.png)
302
Found
null
16,539
假如 Windows XP 有 2024 版
https://www.theregister.com/2024/01/04/windows_xp_reimagined/
2024-01-06T22:57:10
[ "Windows XP" ]
https://linux.cn/article-16539-1.html
![](/data/attachment/album/202401/06/225516cgwziuwy2q334rrj.jpg) > > 现代生活就像垃圾一样。如果你最喜欢的科技巨头停止重新发明轮子,会是什么景象呢? > > > 有一位勇者带给我们一个全新的视界,描绘了一个微软依旧运用 Windows XP 设计语言的平行宇宙。这难道不比打造 Copilot 键更有用吗? 2001 年,Windows XP 问世,并在 2009 年 4 月 14 日结束了主流支持。它以某种形式坚持到 2019 年,然后最终连嵌入式版本都被彻底放弃。随着 2007 年深度集成了 Aero 桌面效果的 Windows Vista,以及两年后的 Windows 7,都让许多用户做出了放弃 XP 的选择。 但倘若微软决定持续发展 Windows XP 的用户界面,而不是在开始菜单变得一团糟后向我们 [道歉](https://www.theregister.com/2024/01/03/windows_11_start_great_again/),会怎么样?要是当前我们用的不是 Windows 10 或 11,而是 2024 年版的 Windows XP 呢? 不用猜想了,一位叫作 AR 4789 的 YouTube 创作者为我们带来了长达 9 分钟的对 XP 的 [全新想象](https://youtu.be/YLFUl9MW_Ks?si=lYwS5GZ5JuYaZT68)。这位作者对操作系统概念有着独特见解,他的频道中包括了对传闻中的 Windows 12 的多个设想。 然而,这个 XP 的设想让我们忍不住掀起“如果……”的思绪,唤起了对操作系统视觉效果的优缺点的看法。我们想,到 2024 年,微软应该已经解决了“瑞士乳酪”般的各种内部问题吧。 贴心的设计愈发丰富,从任务栏,到开始菜单和对话框,引入了近期版本的微软操作系统的分页设计。我们尤其欣赏那个在视频 07:20 时标记选中深色模式那一刻,熟悉的 Bliss 背景瞬间转变成了星空。 这个视频逼真地还原了一些 Windows XP 设计语言的部分元素,一些令人苦笑的设计。窗口控制按钮看起来过时,因为实际上,它们确实有些年头了,有些 3D 效果对现代审美来说也略显陈旧。 然而,这些都只是个人看法。在作者看来,Windows 11 看上去还不错,或许只是因为我们早已习以为常了。然而,这份充满怀旧之情的概念视频向我们展示了一种可能性,那就是如果微软停止一再尝试的步伐,我们的操作系统会呈现什么样的特色。 --- via: <https://www.theregister.com/2024/01/04/windows_xp_reimagined/> 作者:[Richard Speed](https://www.theregister.com/Author/Richard-Speed) 译者:[ChatGPT](https://linux.cn/lctt/ChatGPT) 校对:[wxy](https://github.com/wxy)
200
OK
# What if Microsoft had given us Windows XP 2024? ## Modern life is rubbish. What if your favorite tech giant had stopped trying to reinvent the wheel? A brave hero has given us a glimpse at an alternative universe, where Microsoft evolved the Windows XP design language. And isn't that a better use of time than coming up with the Copilot key? Windows XP arrived in 2001 and drew its last breath – at least in terms of mainstream support – on April 14, 2009. It chugged along in one form or another until 2019 when the plug was finally pulled on an embedded version once and for all. However, the arrival of Windows Vista in 2007 with all its Aero fripperies, followed by Windows 7 in 2009, ensured the demise of Windows XP for many users. But what if Microsoft had opted to stick with the Windows XP user interface rather than [issue apologies](https://www.theregister.com/2024/01/03/windows_11_start_great_again/) for the mess the Start Menu has become? What if, rather than Windows 10 or 11, we were using Windows XP 2024? Wonder no more, thanks to just over nine minutes of XP [re-imagined](https://youtu.be/YLFUl9MW_Ks?si=lYwS5GZ5JuYaZT68) courtesy of YouTube creator AR 4789. The author has form when it comes to operating system concepts, and a glimpse at the channel shows multiple ideas, including an imagining of what might be in store in the rumored Windows 12. However, it is the XP render that got the old "What If?" juices flowing, highlighting what was both subjectively good and bad about the operating system's visuals. We assume that by 2024, Microsoft would have sorted the Swiss cheese internals. Thoughtful touches abound, from the taskbar through the Start Menu and dialogs utilizing some of the paged approaches found in recent versions of Microsoft's operating system. We particularly liked the moment dark mode was selected at the 07:20 mark, and the familiar Bliss backdrop transformed into a starry scene. [Windows boss takes on taskbar turmoil, pledges to 'make Start menu great again'](https://www.theregister.com/2024/01/03/windows_11_start_great_again/)[Doom is 30, and so is Windows NT. How far we](https://www.theregister.com/2023/12/19/windows_nt_30_years_on/)*haven't*come[Veteran editors Notepad++ and Geany hit milestone versions](https://www.theregister.com/2023/12/06/veteran_editors_notepad_and_geany/)[Nostalgia for XP sells out Microsoft's 2023 'Windows Ugly Sweater'](https://www.theregister.com/2023/11/30/windows_ugly_sweater_2023/) Other elements of the Windows XP design language that the video helped us recall are wince-inducing. The window control buttons look like they're from another era because, well, they are, and some of the 3D effects look distinctly dated to modern eyes. However, these are all subjective complaints. To this writer, Windows 11 looks okay – perhaps it's just familiarity. However, the nostalgic concept video is an insight into what might have been if Microsoft had taken its finger off the reinvent button. ® 108
16,540
Archcraft:定制的轻量级 Linux 发行版
https://news.itsfoss.com/archcraft/
2024-01-07T14:37:00
[ "Arch Linux", "Archcraft" ]
https://linux.cn/article-16540-1.html
![](/data/attachment/album/202401/07/143715rdxwiazzoxka2xox.jpg) > > Archcraft 是一个令人印象深刻的发行版,具有定制的开箱即用体验。 > > > 我们告别了 2023 年,这一年充满了令人兴奋的发行版和应用发布。就连**人工智能也席卷了世界**,大型科技公司争先恐后地想要分得一杯羹。 尽管如此,我们现在必须向前看。? 我们以一个有趣的、基于 Arch 的 Linux 发行版 “Archcraft” 开启这一年,它号称“*只是又一个 Linux 发行版*”,但**只需要 500 MB 内存就能运行**。 那么,让我们深入看看它能提供什么。 ### Archcraft:概述 ⭐ ![](/data/attachment/album/202401/07/143800byd58hdhd8k5ikce.jpg) 作为一个 [轻量级 Linux 发行版](https://itsfoss.com/lightweight-linux-beginners/),Archcraft **基于 Arch Linux 构建**,为用户提供了**直接的发行版体验**,不需要太多配置。 大多数东西都是预先配置好的,用户只需安装,然后可以随心所欲地使用他们的系统。这要归功于 Archcraft 的以下**主要功能**: * 滚动发布周期 * 对 AUR 的内置支持 * 预安装的窗口管理器 #### 初步印象 ?‍? 为了体验 Archcraft,我 [使用 VirtualBox](https://itsfoss.com/install-arch-linux-virtualbox/) 将其加载到 [虚拟机](https://itsfoss.com/virtual-machine/) 上,它能够立即检测到它是一个 Arch Linux(64 位)操作系统。 启动后,**出现一个“欢迎”应用**,其中包含访问用户指南或运行安装的选项,使用 Archcraft 的 **两个安装程序之一进行安装**。 ![](/data/attachment/album/202401/07/143801xivknw7kxskn7rsk.jpg) 一个是我们都知道和喜爱的传统 [Calamares](https://calamares.io/) 安装程序,另一个是 [ABIF](https://github.com/midfingr/abif)(Arch 基本安装框架),这是**基于命令行的安装程序**,推荐更高级的用户使用。 我使用 Calamares 进行安装,在安装过程中,我看到了一个菜单,**让我选择窗口管理器**。我选择了 “*Both*”,这样就安装了 [Openbox](http://openbox.org/wiki/Main_Page) 和 [bspwm](https://github.com/baskerville/bspwm)。 > > ? 我选择了 Calamares,因为一只猫跑过我的键盘,让我选择了它。? > > > ![](/data/attachment/album/202401/07/143801h5pqiaihwzalphh5.jpg) **安装进行得很顺利**,我能够毫无问题地启动 Archcraft。然后我就开始探索它。 如下所示,**桌面屏幕非常简洁**,顶部有一个状态栏,底部有一个**方便的停靠栏**,用于启动应用。 ![](/data/attachment/album/202401/07/143802akhkhtungthk0xz7.png) **状态栏**也有一些非常简洁的选项;从左到右,你将找到带有 Archcraft 徽标的 **应用启动器**、**工作区切换器**、一些**系统使用信息**、**时间/日期**、**音乐播放器控件**、**音量滑块**、**网络使用信息**和**电源按钮**。 ![Status Bar on Archcraft](/data/attachment/album/202401/07/143802tm96mk99dmd66x9d.jpg) 当我单击系统使用信息时,我看到了 [Alacritty](https://github.com/alacritty/alacritty),它是 [Linux 顶级终端模拟器](https://itsfoss.com/linux-terminal-emulators/) 之一,它向我显示了所有活动进程,以及它们正在使用哪些资源。 ![](/data/attachment/album/202401/07/143803zpkw9dlohkl4ljlk.jpg) 然后我查看了 Archcraft 上的**预装壁纸**,令我惊讶的是,[Rick](https://rickandmorty.fandom.com/wiki/Rick_Sanchez) 向我竖起了中指。 我必须说,我对此笑得很开心。我现在知道 Morty 的感受了。? ![](/data/attachment/album/202401/07/143803bivn1ciiivpgcp1p.jpg) 然后,我查看了**应用程序启动器**,里面装了很多有用的应用。在如此简约的发行版中看到这些令人印象深刻。 ![](/data/attachment/album/202401/07/143804qy2fi9ylf18oyu28.jpg) 我还可以**搜索命令**,甚至**浏览不同目录中的文件**。 ![](/data/attachment/album/202401/07/143804gtvtve7kydkpc1cz.jpg) **“设置”应用易于使用**,并将所有重要选项集中在一处。还能想要什么呢? ![](/data/attachment/album/202401/07/143804ijmpgmbm18feezdd.jpg) 因此,总而言之,我想说 Archcraft 是一个非常 [用户友好的基于 Arch 的发行版](https://itsfoss.com/arch-based-linux-distros/),很容易上手。随着开发的进展,它应该会像好酒一样随着时间越来越好。 如果你愿意,你还可以通过访问其 [GitHub 仓库](https://github.com/archcraft-os/archcraft) 为 Archcraft 的开发做出贡献。 ### ? 下载 Archcraft 除了其旗舰版本(使用 openbox/bspwm),还提供了两种其他口味,“*Archcraft XFCE*” 和 “*Archcraft LXDE*”。在其 [官方网站](https://archcraft.io/download.html) 上探索它们。 > > **[Archcraft](https://archcraft.io/download.html)** > > > 你也可以参考 [官方维基](https://wiki.archcraft.io/) 了解更多关于 Archcraft 的信息。 ? 你认为这对于想要尝试 Arch Linux 的人来说是一个可行的选择吗? *(题图:DA/2fb8d78b-6352-4455-9e6b-f3fcbae6d847)* --- via: <https://news.itsfoss.com/archcraft/> 作者:[Sourav Rudra](https://news.itsfoss.com/author/sourav/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![](/assets/images/pikapods-banner-v3.webp) ![](/assets/images/pikapods-banner-v3.webp) We bid goodbye to 2023, a year filled with exciting distro and app releases. Even **AI took the world by storm**, with big tech scampering to get a piece of the coveted pie. Nevertheless, we must now look ahead. 😃 We kick this year off with an interesting Arch-based Linux distribution called “**Archcraft**” that claims to be “*just another Linux distribution*” but **can run with only 500 MB of RAM**. So, let's dive in and see what it has to offer. ## Archcraft: Overview ⭐ ![a screenshot of archcraft neofetch output and about info](https://news.itsfoss.com/content/images/2023/12/Archraft_1.jpg) Being a [lightweight Linux distribution](https://itsfoss.com/lightweight-linux-beginners/?ref=news.itsfoss.com), Archcraft has been **built using Arch Linux as its base** to provide users with a **straight-to-the-point distro experience** that doesn't need much configuring. Most things are pre-configured, the user just has to install it and get on with whatever they want to do with their system. This has been made possible thanks to the following **key features** of Archcraft: **A Rolling-Release Cycle****In-Built Support for AUR****Pre-Installed Window Managers** ![Follow It's FOSS on Google News](https://news.itsfoss.com/content/images/2023/04/Follow-us-on-Google-News.png) ![Follow It's FOSS on Google News](https://news.itsfoss.com/content/images/2023/04/Follow-us-on-Google-News.png) **Suggested Read **📖 [What is a Rolling Release Distribution?What is rolling release? What is a rolling release distribution? How is it different from the point release distributions? All your questions answered.](https://itsfoss.com/rolling-release/?ref=news.itsfoss.com)![](https://itsfoss.com/content/images/wordpress/2020/09/what-is-rolling-release-distribution.png) ![](https://itsfoss.com/content/images/wordpress/2020/09/what-is-rolling-release-distribution.png) ### Initial Impressions 👨💻 To get started with Archcraft, I loaded it up on a [Virtual Machine](https://itsfoss.com/virtual-machine/?ref=news.itsfoss.com) by [using VirtualBox](https://itsfoss.com/install-arch-linux-virtualbox/?ref=news.itsfoss.com), which was able to detect that it was an Arch Linux (64-bit) operating system right away. After it booted, **a welcome app** showed up with options to access the user guide or run the installation, by using one of the **two installer options with Archcraft**. ![a screenshot of archcraft installer](https://news.itsfoss.com/content/images/2023/12/Archraft_2.jpg) One was the conventional [Calamares](https://calamares.io/?ref=news.itsfoss.com) installer that we all know and love, the other was [ABIF](https://github.com/midfingr/abif?ref=news.itsfoss.com) (Arch Base Installation Framework), which is **a command line-based installer** that is recommended for more advanced users. I went about installing it using Calamares, and at some point I was **shown a menu to pick the window manager**. I went with “*Both*”, which would then install [Openbox](http://openbox.org/wiki/Main_Page?ref=news.itsfoss.com) and [bspwm](https://github.com/baskerville/bspwm?ref=news.itsfoss.com). ![a screenshot of the archcraft desktop selection screen while installing](https://news.itsfoss.com/content/images/2023/12/Archraft_3.jpg) The **installation went smoothly**, and I was able to boot into Archcraft without any issues. I then began to explore it. As you can see below, **the desktop screen is extremely minimal** with a status bar at the top, and **a handy dock** at the bottom to launch apps with. ![a screenshot of archcraft desktop screen](https://news.itsfoss.com/content/images/2023/12/Archraft_4.png) The **status bar** has some really neat options too; from left to right, you will find the **application launcher** with the Archcraft logo, **a workspace switcher**, some **system usage info**, **the time/date**, **music player controls**, **volume slider**, **network usage info**, and **power buttons**. ![a screenshot of archcraft status bar](https://news.itsfoss.com/content/images/2023/12/Archraft_5.jpg) When I clicked on the system usage info, I was shown [Alacritty](https://github.com/alacritty/alacritty?ref=news.itsfoss.com), one of the [top terminal emulators for Linux](https://itsfoss.com/linux-terminal-emulators/?ref=news.itsfoss.com), which showed me all the active processes, and what kind of resources they were using up. **Suggested Read **📖 [8 Best Window Managers for LinuxWant to organize your windows and use all the screen space you have? These window managers for Linux should come in handy!](https://itsfoss.com/best-window-managers/?ref=news.itsfoss.com)![](https://itsfoss.com/content/images/2023/01/best-wms-for-limux.png) ![](https://itsfoss.com/content/images/2023/01/best-wms-for-limux.png) ![a screenshot of archcraft running alacritty](https://news.itsfoss.com/content/images/2023/12/Archraft_6.jpg) I then moved over to check out the **pre-installed wallpapers** on Archcraft, and, to my surprise, [Rick](https://rickandmorty.fandom.com/wiki/Rick_Sanchez?ref=news.itsfoss.com) giving me the good ol' finger. I must say, I had a nice giggle over this. I now know what Morty feels like. 😂 ![a screenshot of archcraft wallpaper selection menu with the rick sanchez wallpaper in the background](https://news.itsfoss.com/content/images/2023/12/Archraft_7.jpg) I then checked out **the app launcher**, which was loaded quite well with useful apps. It was impressive to see this in such a minimal distro. ![a screenshot of the archcraft app launcher](https://news.itsfoss.com/content/images/2023/12/Archraft_10.jpg) I could also **search for commands** and even **browse files** in different directories. ![a screenshot of the archcraft app launcher](https://news.itsfoss.com/content/images/2023/12/Archraft_9.jpg) The **settings app was easy to use** and had all the important options in one place. What more could you want? ![a screenshot of the archcraft settings app](https://news.itsfoss.com/content/images/2023/12/Archraft_11.jpg) So, to conclude this first look, I would say that Archcraft is a very [user-friendly Arch-based distribution](https://itsfoss.com/arch-based-linux-distros/?ref=news.itsfoss.com) that is straightforward to get into. This should age like fine wine as development progresses. Should you choose to, you could also contribute to the development of Archcraft by visiting its [GitHub repo](https://github.com/archcraft-os/archcraft?ref=news.itsfoss.com). **Suggested Read **📖 [Top 10 User-friendly Arch-Based Linux Distributions [2023]Want to experience Arch Linux without the hassle of the complicated installation and setup? Here are a few user-friendly Arch-based Linux distributions.](https://itsfoss.com/arch-based-linux-distros/?ref=news.itsfoss.com)![](https://itsfoss.com/content/images/2023/03/arch-distros.png) ![](https://itsfoss.com/content/images/2023/03/arch-distros.png) ## 📥 Download Archcraft It is being offered in **two othrr flavors**, “*Archcraft XFCE*” and “*Archcraft LXDE*” along with its flagship edition with openbox/bspwm. Explore them on its [official website](https://archcraft.io/download.html?ref=news.itsfoss.com). You can also refer to the [official wiki](https://wiki.archcraft.io/?ref=news.itsfoss.com) for more information on Archcraft. *💬 Do you think this is a viable option for people who want to try Arch Linux?* ## More from It's FOSS... - Support us by opting for [It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our [community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our [weekly Newsletter](https://itsfoss.com/newsletter/).
16,542
使用 NFS 将 Git 提交记录显示成文件目录
https://jvns.ca/blog/2023/12/04/mounting-git-commits-as-folders-with-nfs/
2024-01-08T16:43:21
[ "Git" ]
https://linux.cn/article-16542-1.html
![](/data/attachment/album/202401/08/164228vsaxcd4ssjs2d6z4.jpg) 大家好!某天,我突发奇想 —— 是否能把 Git 存储库制作成一个 FUSE 文件系统,然后把所有的提交记录做成文件夹呢?答案是肯定的!有 [giblefs](https://github.com/fanzeyi/giblefs)、 [GitMounter](https://belkadan.com/blog/2023/11/GitMounter/) 和用于 Plan 9 号的 [git9](https://orib.dev/git9.html)。 但在 Mac 上使用 FUSE 实在很烦人 —— 你需要安装一个内核扩展,但由于安全的原因,Mac OS 上安装内核扩展看起来越来越难了。此外,我还有一些想法,希望能用与这些项目不同的方式来组织文件系统。 因此,我想在 Mac OS 上尝试 FUSE 以外的挂载文件系统的方法会很有趣,因此我创建了一个名为 [git-commit-folders](https://github.com/jvns/git-commit-folders) 的项目来做这个事。它可以同时使用 FUSE 和 NFS(至少在我的电脑上),WebDav 的实现起来还有点问题。 这个项目很有实验性(我不确定这究竟是一个有用的软件,还是一个思考 Git 如何工作的有趣玩具),但写起来很有趣,我自己也很喜欢在小型存储库中使用它,下面是我在写这个项目时遇到的一些问题。 ### 目标:像文件夹一样显示提交记录 我做这个事的主要目的是给大家一些启发:Git 核心是如何运行的。总结来说,Git 提交记录实际上和文件夹非常类似 —— 每个 Git 提交都包含一个目录,其中 [列出了文件](https://jvns.ca/blog/2023/09/14/in-a-git-repository--where-do-your-files-live-/#commit-step-2-look-at-the-tree),这个目录也可以有子目录,依此类推。 只是为了节省磁盘空间,Git 提交实际上并不是以文件夹的形式实现的。 而在 `git-commit-folders`,所有的提交记录实际上看起来就是一个文件夹,如果你想浏览历史提交记录,你可以像浏览文件系统一样浏览它们!例如如果你像查看我的博客的初始提交记录,你可以如下操作: ``` $ ls commits/8d/8dc0/8dc0cb0b4b0de3c6f40674198cb2bd44aeee9b86/ README ``` 其他之后的提交记录,如下: ``` $ ls /tmp/git-homepage/commits/c9/c94e/c94e6f531d02e658d96a3b6255bbf424367765e9/ _config.yml config.rb Rakefile rubypants.rb source ``` ### 分支是符号链接 通过 `git-commit-folders` 挂载的文件系统中,提交是唯一真正的文件夹 —— 其他一切(分支、标签等)都是提交记录的符号链接。这反映了 Git 底层的工作方式。 ``` $ ls -l branches/ lr-xr-xr-x 59 bork bazil-fuse -> ../commits/ff/ff56/ff563b089f9d952cd21ac4d68d8f13c94183dcd8 lr-xr-xr-x 59 bork follow-symlink -> ../commits/7f/7f73/7f73779a8ff79a2a1e21553c6c9cd5d195f33030 lr-xr-xr-x 59 bork go-mod-branch -> ../commits/91/912d/912da3150d9cfa74523b42fae028bbb320b6804f lr-xr-xr-x 59 bork mac-version -> ../commits/30/3008/30082dcd702b59435f71969cf453828f60753e67 lr-xr-xr-x 59 bork mac-version-debugging -> ../commits/18/18c0/18c0db074ec9b70cb7a28ad9d3f9850082129ce0 lr-xr-xr-x 59 bork main -> ../commits/04/043e/043e90debbeb0fc6b4e28cf8776e874aa5b6e673 $ ls -l tags/ lr-xr-xr-x - bork 31 Dec 1969 test-tag -> ../commits/16/16a3/16a3d776dc163aa8286fb89fde51183ed90c71d0 ``` 这个并不能完全呈现 Git 的所有工作机理(相比简单的类似文件夹的提交,还有很多复杂的细节),但是我希望大家对“每个提交如同一个文件夹,里面有你的旧版本代码”有一个直观的认识。 ### 这么做有什么好处呢? 在我深入介绍它的实现之前,我想说下为什么把 Git 提交记录变成拥有文件夹的文件系统很有用。我的很多项目最终都没有真正使用过(比如 [dnspeep](https://github.com/jvns/dnspeep)),但我发现自己在做这个项目的时候确实使用到了一些。 目前为止我发现主要用处是: * 查找已经删除的函数 - 可以用 `grep someFunction branch_histories/main/*/commit.go` 查找它的旧版本 * 快速查看其他分支的一个文件并从其拷贝一行,如 `vim branches/other-branch/go.mod` * 在每个分支中搜索某个函数,如 `grep someFunction branches/*/commit.go` 所有这些操作都通过提交记录的符号链接,来替代提交记录的直接引用。 这些都不是最有效的方法(你可以用 `git show` 和 `git log -S` 或者 `git grep` 来完成类似操作),但是对我个人来说,我经常忘记 Git 语法,而浏览文件系统对我来说更简单。`git worktree` 还允许你同时签出多个分支,但对我来说,为了看一个文件而设置整个工作树感觉很奇怪。 接下来我想谈谈我遇到的一些问题。 ### 问题 1: 用 WebDav 还是 NFS? Mac OS 原生支持的两个文件系统是 WebDav 和 NFS。我说不出那个更新容易实现,所以我就索性尝试两个都支持。 起初,WebDav 的实现看起来更容易一些,在 [golang.org/x/net](http://golang.org/x/net) 上有一个 [WebDav 实现](https://pkg.go.dev/golang.org/x/net/webdav),这个很好配置。 但这个实现不支持符号链接,我想可能原因是它用的是 `io/fs` 接口,而 `io/fs` 还不支持 [符号链接](https://github.com/golang/go/issues/49580)。不过看起来正在进行中。所以我放弃了 WebDav,而决定重点放在 NFS 实现上了,用 [go-nfs](https://github.com/willscott/go-nfs/) NFSv3 的库文件来实现。 有人也提到了 Mac 上的 [FileProvider](https://developer.apple.com/documentation/fileprovider/),我还没有深入了解这个。 ### 问题 2: 如何确保所有的实现保持一致? 我已经实现了三个不同的文件系统(FUSE、NFS 和 WebDav),但对我来说还是没搞清楚如何避免大量的重复代码。 我的朋友 Dave 建议写一个核心实现,然后写一个适配器(如 `fuse2nfs` 和 `fuse2dav`)来转换成 NFS 和 WebDav 版本。这个看起来需要我着手实现三个文件系统的接口: * 对应 FUSE 的 `fs.FS` * 对应 NFS 的 `billy.Filesystem` * 对应 WebDav 的 `webdav.Filesystem` 因此我把所有的核心逻辑放到 `fs.FS` 接口上,然后写两个函数: * `func Fuse2Dav(fs fs.FS) webdav.FileSystem` * `func Fuse2NFS(fs fs.FS) billy.Filesystem` 所有的文件系统都比较类似,因此转换起来不是很难,但就是有大量的烦人的问题需要修复。 ### 问题 3: 我不想罗列所有的提交记录怎么办 一些 Git 存储库有成千上万的提交记录。我的第一个想法是如何让 `commits/` 看起来是空的,这样就可以如下展示: ``` $ ls commits/ $ ls commits/80210c25a86f75440110e4bc280e388b2c098fbd/ fuse fuse2nfs go.mod go.sum main.go README.md ``` 因此所有的提交记录可以直接查看,但是又不能罗列它们。这个对文件系统是一个奇怪的事情,实际上 FUSE 可以做到。但我在 NFS 上无法实现。我认为这里的原因是,如果你告诉 NFS 某个目录是空的,它就会认为该目录实际上是空的,这是合理的。 我们最终是这样处理的: * 按照 `.git/objects` 的方式,以前两个字符组织管理提交记录(因此 `ls commits` 会显示 `0b 03 05 06 07 09 1b 1e 3e 4a`),但这样做会分为两层,这样 `18d46e76d7c2eedd8577fae67e3f1d4db25018b0` 则为 `commits/18/18df/18d46e76d7c2eedd8577fae67e3f1d4db25018b0` * 开始只罗列一次所有的已经打包的提交哈希,将它们缓存在内存中,然后后面仅更新稀疏对象。主要思路是版本库中几乎所有的提交都应该打包,而且 Git 不会经常重新打包提交 这个看起来在拥有百万提交记录的 Linux 内核的 Git 存储库上似乎效果不错。在我的机器上实测它初始化大概需要一分钟,之后只需快速增量更新即可。 每个提交哈希只有 20 个字节,因此缓存 1 百万个提交哈希也不是很大,大约 20MB。 我认为更聪明的做法是延迟加载提交列表 —— Git 会按提交 ID 对其打包文件进行排序,所以你可以很容易地进行二叉树搜索,找到所有以 `1b` 或 `1b8c` 开始的提交。我用的 [Git 库](https://github.com/go-git/go-git) 对此并不支持,因为罗列出来 Git 存储库所有的提交记录确实一个奇怪的事情。我花了 [几天时间](https://github.com/jvns/git-commit-folders/tree/fast-commits) 尝试实现它,但没有达到我想要的性能,所以就放弃了。 ### 问题 4: 不是目录 我常遇到下面这个错误: ``` "/tmp/mnt2/commits/59/59167d7d09fd7a1d64aa1d5be73bc484f6621894/": Not a directory (os error 20) ``` 这起初真的把我吓了一跳,但事实证明,这只是表示在列出目录时出现了错误,而 NFS 库处理该错误的方式就是显示 “Not a directory”(不是目录)。这个错误遇到了很多次,我需要每次跟踪这个错误的根源。 有很多类似错误。我也遇到 `cd: system call interrupted`,令人沮丧的是,但最终也只是程序中的其他错误。 我意识到终极大法是用 Wireshark 查看 NFS 发送和接受的数据包,很多问题便可迎刃而解。 ### 问题 5: inode 编号 在开始的时候我不小心将所有的文件夹的 inode 设为 0。这很糟糕,因为如果在每个目录的 inode 都为 0 的目录上运行查找,它就会抱怨文件系统循环并放弃,这个也是符合逻辑的。 我通过定义一个 `inode(string)` 来修复这个问题,通过散列字符串来获取 inode 编号,并使用树 ID / blob ID 作为散列字符串。 ### 问题 6: 过期文件句柄 我一直遇到这个“Stale NFS file handle”(过期文件句柄)错误。问题是,我需要获取未知的 64 字节 NFS “文件句柄”,并将其映射到正确的目录。 我使用的 NFS 库的工作方式是为每个文件生成一个文件句柄,并通过固定大小的缓存来缓存这些引用。这对小型存储库来说没问题,但是如果对于拥有海量的文件的存储库来说,由于缓存就会溢出,就会导致“stale file handle” 错误。 这仍然是个问题,我不知道如何解决。我不明白真正的 NFS 服务器是如何做到这一点的,也许它们只是有一个非常大的缓存? NFS 文件句柄占用 64 个字节(不是比特),确实很大,所以很多时候似乎可以将整个文件路径编码到句柄中,根本不需要缓存。也许我会在某个时候尝试实现这一点。 ### 问题 7: 分支历史 `branch_histories/` 目录目前仅罗列对应分支的最近 100 个提交记录。我不知道该怎么做,如果能以某种方式列出分支的全部历史就更好了。也许我可以使用 `commits/` 目录中类似的子文件夹技巧。 ### 问题 8: 子模块 Git 存储库有时包含了子模块。由于目前我对子模块的理解还不深入,我先忽略它吧。因此这个算是一个问题。 ### 问题 9: NFSv4 是否更好? 我构建这个项目使用的是 NFSv3 库,因为我当时只能找到一个 NFSv3 的 Go 库文件。可当我搞完的时候才发现了一个名叫 buildbarn 的项目里有 [NFSv4 服务器](https://github.com/buildbarn/bb-adrs/blob/master/0009-nfsv4.md)。有没有可能用它会更好一些? 我不知道这样做有什么问题,或者用 NFSv4 有哪些优点?我还有点不确定是否要使用 buildbarn NFS 库,因为不清楚他们是否希望其他人使用它。 ### 就这些吧 之前已经解决了很多问题我都忘记了,这是我目前能回想起来的。我未来有可能解决或根本解决不了 NFS 的“过期文件句柄” 错误,或者“在 Linux 内核的存储库上启动需要 1 分钟”的问题,就这样吧。 感谢我的朋友 [vasi](https://github.com/vasi),他给我了很多文件系统方面的帮助。 *(题图:DA/d22b1c01-e80a-4529-b88a-419ceef74b5e)* --- via: <https://jvns.ca/blog/2023/12/04/mounting-git-commits-as-folders-with-nfs/> 作者:[Julia Evans](https://jvns.ca/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[guevaraya](https://github.com/guevaraya) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
Hello! The other day, I started wondering – has anyone ever made a FUSE filesystem for a git repository where all every commit is a folder? It turns out the answer is yes! There’s [giblefs](https://github.com/fanzeyi/giblefs), [GitMounter](https://belkadan.com/blog/2023/11/GitMounter/), and [git9](https://orib.dev/git9.html) for Plan 9. But FUSE is pretty annoying to use on Mac – you need to install a kernel extension, and Mac OS seems to be making it harder and harder to install kernel extensions for security reasons. Also I had a few ideas for how to organize the filesystem differently than those projects. So I thought it would be fun to experiment with ways to mount filesystems on Mac OS other than FUSE, so I built a project that does that called [git-commit-folders](https://github.com/jvns/git-commit-folders). It works (at least on my computer) with both FUSE and NFS, and there’s a broken WebDav implementation too. It’s pretty experimental (I’m not sure if this is actually a useful piece of software to have or just a fun toy to think about how git works) but it was fun to write and I’ve enjoyed using it myself on small repositories so here are some of the problems I ran into while writing it. ### goal: show how commits are like folders The main reason I wanted to make this was to give folks some intuition for how git works under the hood. After all, git commits really *are* very similar to folders – every Git commit [contains a directory listing](https://jvns.ca/blog/2023/09/14/in-a-git-repository--where-do-your-files-live-/#commit-step-2-look-at-the-tree) of the files in it, and that directory can have subdirectories, etc. It’s just that git commits aren’t *actually* implemented as folders to save disk space. So in `git-commit-folders` , every commit is actually a folder, and if you want to explore your old commits, you can do it just by exploring the filesystem! For example, if I look at the initial commit for my blog, it looks like this: ``` $ ls commits/8d/8dc0/8dc0cb0b4b0de3c6f40674198cb2bd44aeee9b86/ README ``` and a few commits later, it looks like this: ``` $ ls /tmp/git-homepage/commits/c9/c94e/c94e6f531d02e658d96a3b6255bbf424367765e9/ _config.yml config.rb Rakefile rubypants.rb source ``` ### branches are symlinks In the filesystem mounted by `git-commit-folders` , commits are the only real folders – everything else (branches, tags, etc) is a symlink to a commit. This mirrors how git works under the hood. ``` $ ls -l branches/ lr-xr-xr-x 59 bork bazil-fuse -> ../commits/ff/ff56/ff563b089f9d952cd21ac4d68d8f13c94183dcd8 lr-xr-xr-x 59 bork follow-symlink -> ../commits/7f/7f73/7f73779a8ff79a2a1e21553c6c9cd5d195f33030 lr-xr-xr-x 59 bork go-mod-branch -> ../commits/91/912d/912da3150d9cfa74523b42fae028bbb320b6804f lr-xr-xr-x 59 bork mac-version -> ../commits/30/3008/30082dcd702b59435f71969cf453828f60753e67 lr-xr-xr-x 59 bork mac-version-debugging -> ../commits/18/18c0/18c0db074ec9b70cb7a28ad9d3f9850082129ce0 lr-xr-xr-x 59 bork main -> ../commits/04/043e/043e90debbeb0fc6b4e28cf8776e874aa5b6e673 $ ls -l tags/ lr-xr-xr-x - bork 31 Dec 1969 test-tag -> ../commits/16/16a3/16a3d776dc163aa8286fb89fde51183ed90c71d0 ``` This definitely doesn’t completely explain how git works (there’s a lot more to it than just “a commit is like a folder!”), but my hope is that it makes thie idea that every commit is like a folder with an old version of your code" feel a little more concrete. ### why might this be useful? Before I get into the implementation, I want to talk about why having a filesystem with a folder for every git commit in it might be useful. A lot of my projects I end up never really using at all (like [dnspeep](https://github.com/jvns/dnspeep)) but I did find myself using this project a little bit while I was working on it. The main uses I’ve found so far are: - searching for a function I deleted – I can run `grep someFunction branch_histories/main/*/commit.go` to find an old version of it - quickly looking at a file on another branch to copy a line from it, like `vim branches/other-branch/go.mod` - searching every branch for a function, like `grep someFunction branches/*/commit.go` All of these are through symlinks to commits instead of referencing commits directly. None of these are the most efficient way to do this (you can use `git show` and `git log -S` or maybe `git grep` to accomplish something similar), but personally I always forget the syntax and navigating a filesystem feels easier to me. `git worktree` also lets you have multiple branches checked out at the same time, but to me it feels weird to set up an entire worktree just to look at 1 file. Next I want to talk about some problems I ran into. ### problem 1: webdav or NFS? The two filesystems I could that were natively supported by Mac OS were WebDav and NFS. I couldn’t tell which would be easier to implement so I just tried both. At first webdav seemed easier and it turns out that golang.org/x/net has a [webdav implementation](https://pkg.go.dev/golang.org/x/net/webdav), which was pretty easy to set up. But that implementation doesn’t support symlinks, I think because it uses the `io/fs` interface and `io/fs` doesn’t [support symlinks yet](https://github.com/golang/go/issues/49580). Looks like that’s in progress though. So I gave up on webdav and decided to focus on the NFS implementation, using this [go-nfs](https://github.com/willscott/go-nfs/) NFSv3 library. Someone also mentioned that there’s [FileProvider](https://developer.apple.com/documentation/fileprovider/) on Mac but I didn’t look into that. ### problem 2: how to keep all the implementations in sync? I was implementing 3 different filesystems (FUSE, NFS, and WebDav), and it wasn’t clear to me how to avoid a lot of duplicated code. My friend Dave suggested writing one core implementation and then writing adapters (like `fuse2nfs` and `fuse2dav` ) to translate it into the NFS and WebDav verions. What this looked like in practice is that I needed to implement 3 filesystem interfaces: `fs.FS` for FUSE`billy.Filesystem` for NFS`webdav.Filesystem` for webdav So I put all the core logic in the `fs.FS` interface, and then wrote two functions: `func Fuse2Dav(fs fs.FS) webdav.FileSystem` `func Fuse2NFS(fs fs.FS) billy.Filesystem` All of the filesystems were kind of similar so the translation wasn’t too hard, there were just 1 million annoying bugs to fix. ### problem 3: I didn’t want to list every commit Some git repositories have thousands or millions of commits. My first idea for how to address this was to make `commits/` appear empty, so that it works like this: ``` $ ls commits/ $ ls commits/80210c25a86f75440110e4bc280e388b2c098fbd/ fuse fuse2nfs go.mod go.sum main.go README.md ``` So every commit would be available if you reference it directly, but you can’t list them. This is a weird thing for a filesystem to do but it actually works fine in FUSE. I couldn’t get it to work in NFS though. I assume what’s going on here is that if you tell NFS that a directory is empty, it’ll interpret that the directory is actually empty, which is fair. I ended up handling this by: - organizing the commits by their 2-character prefix the way `.git/objects` does (so that`ls commits` shows`0b 03 05 06 07 09 1b 1e 3e 4a` ), but doing 2 levels of this so that a`18d46e76d7c2eedd8577fae67e3f1d4db25018b0` is at`commits/18/18df/18d46e76d7c2eedd8577fae67e3f1d4db25018b0` - listing all the packed commits hashes only once at the beginning, caching them in memory, and then only updating the loose objects afterwards. The idea is that almost all of the commits in the repo should be packed and git doesn’t repack its commits very often. This seems to work okay on the Linux kernel which has ~1 million commits. It takes maybe a minute to do the initial load on my machine and then after that it just needs to do fast incremental updates. Each commit hash is only 20 bytes so caching 1 million commit hashes isn’t a big deal, it’s just 20MB. I think a smarter way to do this would be to load the commit listings lazily – Git sorts its packfiles by commit ID, so you can pretty easily do a binary search to find all commits starting with `1b` or `1b8c` . The [git library](https://github.com/go-git/go-git) I was using doesn’t have great support for this though, because listing all commits in a Git repository is a really weird thing to do. I spent maybe a couple of days [trying to implement it](https://github.com/jvns/git-commit-folders/tree/fast-commits) but I didn’t manage to get the performance I wanted so I gave up. ### problem 4: “not a directory” I kept getting this error: ``` "/tmp/mnt2/commits/59/59167d7d09fd7a1d64aa1d5be73bc484f6621894/": Not a directory (os error 20) ``` This really threw me off at first but it turns out that this just means that there was an error while listing the directory, and the way the NFS library handles that error is with “Not a directory”. This happened a bunch of times and I just needed to track the bug down every time. There were a lot of weird errors like this. I also got `cd: system call interrupted` which was pretty upsetting but ultimately was just some other bug in my program. Eventually I realized that I could use Wireshark to look at all the NFS packets being sent back and forth, which made some of this stuff easier to debug. ### problem 5: inode numbers At first I was accidentally setting all my directory inode numbers to 0. This was bad because if if you run `find` on a directory where the inode number of every directory is 0, it’ll complain about filesystem loops and give up, which is very fair. I fixed this by defining an `inode(string)` function which hashed a string to get the inode number, and using the tree ID / blob ID as the string to hash. ### problem 6: stale file handles I kept getting this “Stale NFS file handle” error. The problem is that I need to be able to take an opaque 64-byte NFS “file handle” and map it to the right directory. The way the NFS library I’m using works is that it generates a file handle for every file and caches those references with a fixed size cache. This works fine for small repositories, but if there are too many files then it’ll overflow the cache and you’ll start getting stale file handle errors. This is still a problem and I’m not sure how to fix it. I don’t understand how real NFS servers do this, maybe they just have a really big cache? The NFS file handle is 64 bytes (64 bytes! not bits!) which is pretty big, so it does seem like you could just encode the entire file path in the handle a lot of the time and not cache it at all. Maybe I’ll try to implement that at some point. ### problem 7: branch histories The `branch_histories/` directory only lists the latest 100 commits for each branch right now. Not sure what the right move is there – it would be nice to be able to list the full history of the branch somehow. Maybe I could use a similar subfolder trick to the `commits/` directory. ### problem 8: submodules Git repositories sometimes have submodules. I don’t understand anything about submodules so right now I’m just ignoring them. So that’s a bug. ### problem 9: is NFSv4 better? I built this with NFSv3 because the only Go library I could find at the time was an NFSv3 library. After I was done I discovered that the buildbarn project has an [NFSv4 server](https://github.com/buildbarn/bb-adrs/blob/master/0009-nfsv4.md) in it. Would it be better to use that? I don’t know if this is actually a problem or how big of an advantage it would be to use NFSv4. I’m also a little unsure about using the buildbarn NFS library because it’s not clear if they expect other people to use it or not. ### that’s all! There are probably more problems I forgot but that’s all I can think of for now. I may or may not fix the NFS stale file handle problem or the “it takes 1 minute to start up on the linux kernel” problem, who knows! Thanks to my friend [vasi](https://github.com/vasi) who explained one million things about filesystems to me.
16,544
2024 年 Linux 和开源的六大趋势预测
https://news.itsfoss.com/predictions-linux-open-source-2024/
2024-01-09T07:42:35
[ "Linux", "开源" ]
https://linux.cn/article-16544-1.html
![](/data/attachment/album/202401/09/074157ikp0y0qmr20rr0ye.jpg) > > 让我们尝试预测未来吧! > > > 新的一年快乐,朋友们 ✨ 2024 年的钟声已经敲过,我们有必要去预见一下将塑造本年度的各种潮流。 我们不能预见未来,所以无法精确预知将会发生什么,但根据目前观察到的动向,我们可以进行一些预测。 以下是我们对 Linux 和开源发展方向的预测。 ### 1、开源 AI 的兴起 ![](/data/attachment/album/202401/09/074236m0bs1ynbjsjbne79.png) 2023 年初,Mozilla 成为了最早投身于开源 AI 的团队之一,研发类似于 ChatGPT 的解决方案。[Hugging Face](https://huggingface.co/) 紧随其后,**崭露头角,发展成为备受赞誉的 AI 社区之一**,激发了全球范围内的协作。 我们也见证了 [AI 联盟](https://news.itsfoss.com/ai-alliance/) 的成立,这个联盟由超过 50 个创始成员组成,包括一些大名鼎鼎的公司如 Meta、英特尔、甲骨文和 CERN 等重量级大佬。他们的目标清晰明了:推进 AI 的开放式创新和科学发展。 更有一款名为 [GuardRail](https://news.itsfoss.com/guardrail/) 的开源项目,它**积极倡导负责任的 AI 开发**,提供了相应的框架来监控 AI 的行为。 所有的开源 AI 开发可能致力于与发行版或开源工具的更深度整合。当然,不像其他商业成就卓著的桌面操作系统,Linux 发行版可能不会大力市场化 AI 功能,但谁知道呢? 总的来讲,如果你问我们,对于开源 AI 来说,2024 年将是举足轻重的一年,我们都等不及看到更多的惊喜了!? ### 2、Linux 游戏市场扩张 ![](/data/attachment/album/202401/09/074236gc0xzcf047jqo5oz.png) 过去的 Linux [游戏](https://itsfoss.com/linux-gaming-guide/) 市场的发展可谓好坏皆有。尽管平台上有一些原生游戏,和 Wine、Lutris、Bottles 等实用工具。但在 Valve 的 [Steam Deck](https://www.steamdeck.com/) 掌机发布之前,Linux 并未真正受到大部分游戏开发者的关注。 这款设备由基于 Arch 的 [SteamOS](https://itsfoss.com/steamos/) 提供驱动,为众多游戏在 Linux 上的运行铺平了道路,并将游戏开发商的目光吸引到这个平台上。 在 2023 年,我们已经看到了大量 [原生兼容](https://store.steampowered.com/linux) Linux 的游戏发布,我们预测 2024 年也将如此。 别忘了,像 [Bottles](https://news.itsfoss.com/bottles-next-linux-gaming/) 这样的开源游戏工具也将致力于提升用户体验。因此,那些从 Windows 切换过来的用户,将会发现这个平台更加符合其游戏需求。 > > ? 我们非常期待看到新的 [AAA 级大作](https://en.wikipedia.org/wiki/AAA_(video_game_industry)) 在发布时就已经支持 Linux! > > > ### 3、更多的不可变 Linux 发行版 ![](/data/attachment/album/202401/09/074237qcquw5a1am6uaq1m.png) 没错,预计 2024 年将有更多 [不可变 Linux 发行版](https://itsfoss.com/immutable-linux-distros/) 面世,Ubuntu 将走在前列。早在 2023 年初,他们就宣布了在即将发布的 Ubuntu 24.04 LTS 发行版中提供基于 [Snap 的不可变 Ubuntu 桌面](https://news.itsfoss.com/ubuntu-all-snap-desktop/) 的计划。 > > ? 这可能会让一些人不适,但毫无疑问,这样的变革正在路上。 > > > 除了 Fedora 早已推出了配备 GNOME 桌面的不可变版本 Silverblue 之外,他们还增加了一款新品。在 [Fedora 39 的发布](https://news.itsfoss.com/fedora-39-release/) 中,一款带着 Budgie 桌面的名为 “[Fedora Onyx](https://fedoraproject.org/onyx/)” 的新版首次登场就吸引了眼球。 鉴于此,我们预计 2024 年将会出现更多新的不可变发行版,现有的不可变发行版如 blendOS 和 Vanilla OS 也将有所进步。 ### 4、RISC-V 服务器的亮相 随着美国在 2023 年加大了他们与中国的 [AI 芯片竞争](https://www.wired.com/story/the-us-just-escalated-its-ai-chip-war-with-china/),我们可能在 2024 年看到 RISC-V 服务器成为热点,因为各国纷纷在芯片制造领域努力实现更大的自主性。 中国已经开始部署他们自称为 “*首个商业版的云端 RISC-V 集群*”,那是在山东大学建立的一个由 [SOPHON SG2042](https://en.sophgo.com/product/introduce/sg2042.html) 驱动的集群。 ### 5、Linux 发行版 UI/UX 将进一步提升 ![](/data/attachment/album/202401/09/074237kr9obm0gbbj1gm2n.png) 如果以 2023 年为标志,我们大可以预言,2024 年将是 Linux 发行版在用户界面和用户体验方面不断创新的一年。 看看 [GNOME 45 的发布](https://news.itsfoss.com/gnome-45-release/) 所做的事情,它放弃了“*活动*”按钮,改为药丸形的工作区切换器,彻底改变了用户与工作区的交互方式。 再看看 Zorin OS 17,它通过实施一个“*空间桌面*”,在 Linux 发行版中重新定义了视觉体验,以便用户在与桌面交互时获得更好的环境感知。 而且,首次在 2024 年,我们将在 Linux 中看到蓝屏死机现象,多亏了 systemd,它**将在启动失败时提供有用的错误消息**。 像 Vanilla OS 2(Orchid)这样的新发行版发布,像 [KDE Plasma 6](https://community.kde.org/Plasma/Plasma_6) 这样的桌面升级,以及基于 Rust 的 **COSMIC** 等可能会带来更高的水平,我们倾向于这样期待! 别忘了,许多 Linux 发行版也在大力推广 **默认采用 Wayland 的未来**! ### 6、软件项目的源码可见 ![](/data/attachment/album/202401/09/074238c57xqvfk14wf4qt8.png) 虽然某些软件项目并未完全遵循开源原则,但有些在限制商业分发的前提下,已经走上了公开源代码的道路。 这成为可能,多亏了 **CC BY-NC-SA 4.0(创作共享署名-非商业-相同方式共享 4.0)** 等许可证。 有人可能会争辩,企业应该全面拥抱其产品的开源。然而,我们坚信,这种做法将相比传统封闭源产品,**提升彼此之间的信任并推广透明度**。 ### 2024是 Linux 桌面之年吗?? 我们知道,自 Linux 桌面在用户友好性和普及性上大踏步前进以来,我们一直在期待这个。 看着 Linux 的 [市场份额](https://itsfoss.com/linux-market-share/),你可能觉得数据太低了。但我们还是不能放弃希望。 也许这正是你现在的反应。 尽管我们可能距离 Linux 桌面元年还有些距离,但我们比以往任何时候都要接近了。你看,Linux 桌面的接纳率在 2023 年稳定增长,而 2024 年可能就是见证其更大涨幅的一年。 ? 你对 2024 年有何预测?欢迎在下方评论中分享你的观点! *(题图:DA/d1246dc6-583c-4ff8-8c2d-b3808e9ec460)* --- via: <https://news.itsfoss.com/predictions-linux-open-source-2024/> 作者:[Sourav Rudra](https://news.itsfoss.com/author/sourav/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[ChatGPT](https://linux.cn/lctt/ChatGPT) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![](/assets/images/pikapods-banner-v3.webp) ![](/assets/images/pikapods-banner-v3.webp) Happy New Year, folks ✨ Year 2024 is here, and it is time to look forward to the trends that will shape the year. We are not fortune-tellers, so we cannot tell exactly what will happen. However, we could surely make some predictions based on what we've seen so far. And here are our predictions on how things will move for Linux and Open Source. ## 1. Rise of Open-Source AI ![open source ai](https://news.itsfoss.com/content/images/2024/01/open-source-ai.png) Mozilla was among the first ones to kick 2023 off with [plans to work](https://news.itsfoss.com/mozilla-open-source-ai/) on open-source AI and to develop solutions like ChatGPT. That was followed by [Hugging Face](https://huggingface.co/?ref=news.itsfoss.com) stepping up their game and **becoming one of the most popular AI communities out there**, facilitating collaboration on a global scale. We also saw [the birth of The AI Alliance](https://news.itsfoss.com/ai-alliance/), formed with over 50 founding members that include some big names such as Meta, Intel, Oracle, CERN, etc. with a simple goal; to support open innovation and science in AI. There was even an open-source project called [GuardRail](https://news.itsfoss.com/guardrail/) that** aims to promote Responsible AI development** by providing a framework for keeping AI in check. All the open-source AI development might translate into integrations with distributions or open-source tools. Sure, unlike other commercially successful desktop operating systems, Linux distros may not “market” the AI-powered features, but you never know? All in all, if you ask us, the year 2024 will be a crucial year for open-source AI, and we can't wait to see what's in store! 😃 ## 2. More Games for Linux ![linux gaming](https://news.itsfoss.com/content/images/2024/01/linux-gaming-2024.png) [Gaming on Linux](https://itsfoss.com/linux-gaming-guide/?ref=news.itsfoss.com) has been something of a hit or miss in the past, even though we had some native games, and useful tools such as Wine, Lutris, Bottles, etc. Linux was not really the focus of many game developers, until Valve's [Steam Deck](https://www.steamdeck.com/?ref=news.itsfoss.com) handheld arrived. Powered by the Arch-based [SteamOS](https://itsfoss.com/steamos/?ref=news.itsfoss.com), this device has paved the way for many games to run on Linux, while also turning the attention of game devs towards the platform. In 2023, we already saw plenty of game releases that [work natively](https://store.steampowered.com/linux?ref=news.itsfoss.com) on Linux, and 2024 should be no different. Not to forget, the open-source gaming tools like [Bottles](https://news.itsfoss.com/bottles-next-linux-gaming/) will also work on improving the user experience. So, a user who switched from Windows should find the platform more convenient for gaming. [AAA titles](https://en.wikipedia.org/wiki/AAA_(video_game_industry)?ref=news.itsfoss.com)working on Linux at launch! **Suggested Read **📖 [Linux Gaming’s Next Big Secret Weapon: Bottles Next-Gen Upgrade 🔥Exciting development plans for ‘Bottles’ as a better tool to run Windows apps and games on Linux.](https://news.itsfoss.com/bottles-next-linux-gaming/)![](https://news.itsfoss.com/content/images/2023/10/bottles-next-upgrade-gaming.png) ![](https://news.itsfoss.com/content/images/2023/10/bottles-next-upgrade-gaming.png) ## 3. More Immutable Linux Distros ![immutable distro benefits](https://news.itsfoss.com/content/images/2024/01/immutable-benefits.png) Yes, the range of [immutable Linux distros](https://itsfoss.com/immutable-linux-distros/?ref=news.itsfoss.com) is all set to expand in 2024 with Ubuntu taking the center stage by announcing earlier in 2023 that they will be offering [a Snap-based immutable Ubuntu Desktop](https://news.itsfoss.com/ubuntu-all-snap-desktop/) with the upcoming Ubuntu 24.04 LTS release. While Fedora already had an immutable variant (Silverblue) with GNOME desktop, they have added one more to their offerings. With the [Fedora 39 release](https://news.itsfoss.com/fedora-39-release/) a new variant, “[Fedora Onyx](https://fedoraproject.org/onyx/?ref=news.itsfoss.com)” debuted with the Budgie desktop. Seeing that, we also expect other new immutable offerings in 2024, with existing immutable distros such as blendOS and Vanilla OS becoming better. ## 4. Introduction of RISC-V Servers With the United States [escalating their AI Chip war](https://www.wired.com/story/the-us-just-escalated-its-ai-chip-war-with-china/?ref=news.itsfoss.com) with China in 2023, we may see [RISC-V](https://en.wikipedia.org/wiki/RISC-V?ref=news.itsfoss.com) powered servers being one of the hot takes of 2024 as the country scrambles to become more independent in the field of chip manufacturing. They have [already begun](https://www.hpcwire.com/2023/11/08/china-deploys-massive-risc-v-server-in-commercial-cloud/?ref=news.itsfoss.com) by deploying what they claim to be the “*first commercial implementation of RISC-V cluster in the cloud*”, which is a [SOPHON SG2042](https://en.sophgo.com/product/introduce/sg2042.html?ref=news.itsfoss.com) powered cluster set up at Shandong University. ## 5. Better UI/UX on Linux Distros ![better user experience distro](https://news.itsfoss.com/content/images/2024/01/user-experience-distro.png) If we were to take 2023 as an indicator, we can confidently say that 2024 will be a year when **we will see many innovations being made for the user interface and user experience side of things** on a Linux distro. Take for instance what the [GNOME 45 release](https://news.itsfoss.com/gnome-45-release/) did, it ditched the “*Activities*” button for a pill-shaped workspace switcher that changed the way users interacted with workspaces. Then there's Zorin OS 17, which [redefined the visual experience](https://news.itsfoss.com/zorin-os-17-beta/) in a Linux distro by implementing a “*Spatial Desktop*” so that users get better contextual awareness while interacting with the desktop. And, as a first, in 2024, we will be seeing a [blue screen of death in Linux](https://news.itsfoss.com/bsod-linux/), thanks to systemd that **will serve up helpful error messages in the event of a boot failure**. Exciting distribution releases like Vanilla OS 2 (Orchid), desktop upgrades like [ KDE Plasma 6](https://community.kde.org/Plasma/Plasma_6?ref=news.itsfoss.com), Rust-based **COSMIC**by Pop!_OS might take this all up a notch, or so we hope! Not to forget that there has been** a considerable push towards a Wayland by default future** for many Linux distros too! ## 6. Source-Available for Software Projects ![source available illustration](https://news.itsfoss.com/content/images/2024/01/source-available.png) Even though some software projects do not entirely adhere to open-source principles, some have taken the route to make the source-code publicly available (with the restriction to distribute it commercially). This is made possible by licenses like **CC BY-NC-SA 4.0 (Creative Commons Attribution-NonCommercial-ShareAlike 4.0)**. Some may argue that companies should embrace open-source definition for their products. However, we believe, this approach will **improve the trust and promote transparency **compared to any traditional closed-source product. ## Year of the Linux Desktop? 😛 We know that this is something that we have been hoping for ever since the Linux desktop started making big strides in terms of user-friendliness and being accessible to more users. And looking at the [market share for Linux](https://itsfoss.com/linux-market-share/?ref=news.itsfoss.com), you may think that the numbers are too low. But, we can't lose hope just yet. This is probably your reaction right now. Even though we may be far from the year of the Linux desktop, we will still be closer to it than ever before. You see, there has been a steady increase in the adoption rates for Linux desktop in 2023, and 2024 might just be the year we see a more meaningful uptick. *💬 What are your predictions for the year of 2024? Share yours in the comments below!* ## More from It's FOSS... - Support us by opting for [It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our [community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our [weekly Newsletter](https://itsfoss.com/newsletter/).
16,546
Deepin 成为第一个为照片和 IDE 集成 AI 功能的 Linux 发行版
https://news.itsfoss.com/deepin-linux-distro-ai/
2024-01-10T15:25:00
[ "Deepin" ]
https://linux.cn/article-16546-1.html
![](/data/attachment/album/202401/10/152525uri8jabrraf8iyni.jpg) > > Deepin Linux 抢占 AI 创新权? 看起来是这样。 > > > Deepin 是一个神秘而美丽的发行版。 当然,我们都在等待他们的 [Deepin 23](https://news.itsfoss.com/deepin-23/) 稳定版。 在那之前,我们继续期待 ? 但是,等等,还有一些有趣的东西正在开发中,我认为,这值得等待... Deepin Linux 即将推出 AI 功能。你现在可以通过现有安装(deepin V20.9 及更高版本)访问它。不过,它应该会让未来的发布体验更加精彩。 那么,那又怎样呢? 让我在这里告诉你更多。 ### AI 混合深度体验 我们已经提到整合 AI 功能是我们的 [2024 年预测](https://news.itsfoss.com/predictions-linux-open-source-2024/) 之一。 我想,我们可以看到未来吗? ? 嗯,看来 Deepin Linux 在 2024 年拉开了序幕,推出了一款新的 IDE,其中包含 **AI 编程助手**。 ![](/data/attachment/album/202401/10/152640jjhnz8h8mx8m45p3.jpg) 你可以在深度应用商店中找到它。我们还没有尝试过,但这听起来很有趣。 不仅限于此,他们还开始通过 “**看图 AI 插件**” 将 AI 功能集成到图像查看器应用中。 ![](/data/attachment/album/202401/10/152555gw9qn0q999b0f9bn.jpg) 你可以通过图像查看器使用插件重新修饰或增强现有图像。 ![](/data/attachment/album/202401/10/152556gvz26vkeqvxw99h6.jpg) 你可以使用它执行的一些功能包括: * 背景模糊:降低图像背景的清晰度,使主体更加突出 * 删除背景:删除图像背景,使主体独立或替换新背景 * 手绘:将真实图像转换为手绘漫画风格 * 2D 漫画:将真实图像转换为 2D 漫画风格 * 3D 漫画:将真实图像转变成 3D 漫画风格 * 素描:将真实图像转换为素描风格 这是 2D 转换图像的另一个示例: ![](/data/attachment/album/202401/10/152556mqz0jqv06j0nn0w0.jpg) 而且,所有这一切都发生在你本地的计算机上。它不需要互联网连接。 除此之外,开发人员正在探索更多方法来整合和增强该发行版的 AI 功能。 ?你对此有何看法? 请在下面的评论中告诉我你的想法。 --- via: <https://news.itsfoss.com/deepin-linux-distro-ai/> 作者:[Ankush Das](https://news.itsfoss.com/author/ankush/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![](/assets/images/pikapods-banner-v3.webp) ![](/assets/images/pikapods-banner-v3.webp) Deepin is a mysteriously beautiful distribution. Sure, we are all waiting for the time when they make [Deepin 23](https://news.itsfoss.com/deepin-23/) available as a stable release. Until then, we hold on to our anticipation 😔 But, wait, there's something interesting in the works, and I think, this would make it worth the wait... AI features coming to Deepin Linux. You can access it now (deepin V20.9 and above), with an existing installation. However, it should make the future release experience more exciting. So, what about it? Let me tell you more here. ## AI Mix to the Deepin Experience We already mentioned the integration of AI features as one of our [predictions for 2024](https://news.itsfoss.com/predictions-linux-open-source-2024/). I guess, we can see the future? 😉 Well, it looks like Deepin Linux kicked off 2024 introducing a new IDE, featuring an **AI programming assistant**. ![deepin ide](https://news.itsfoss.com/content/images/2024/01/deepin-ide.jpg) You can find it listed in the deepin app store. We haven't tried that yet, but that sounds fascinating. Not just limited to this, they have also started integrating AI features to the photo viewer app via the "**Image Viewer AI**" plugin. ![deepin ai image plugin](https://news.itsfoss.com/content/images/2024/01/deepin-ai-plugin.jpg) You can re-touch or enhance an existing image with the plugin through the image viewer app. ![picture coloring deepin](https://news.itsfoss.com/content/images/2024/01/picture-coloring-deepin.jpg) Some of the functions that you can do with it include: - Blurred background: reduce the clarity of the image background and make the subject more prominent - Delete background: Remove the image background, make the subject independent or replace the new background - Hand painting: convert real images into hand-painted comic style - 2D Comics: Transform real images into 2D comic style - 3D Comics: Transform real images into 3D comic style - Sketch: Transform real images into sketch style ![Follow It's FOSS on Google News](https://news.itsfoss.com/content/images/2023/04/Follow-us-on-Google-News.png) ![Follow It's FOSS on Google News](https://news.itsfoss.com/content/images/2023/04/Follow-us-on-Google-News.png) Here's another example of a 2D conversion image: ![2d converted image deepin](https://news.itsfoss.com/content/images/2024/01/deepin-2-d-comics.jpg) And, all of this happens locally, on your machine. It does not require active internet connection. Beyond this, the developers are exploring more ways to incorporate and enhance AI features with the distribution. 💬 *What do you think of this? Let me know your thoughts in the comments below.* **Suggested Read **📖 [Here are the Most Beautiful Linux Distributions in 2024Aesthetically pleasing? Customized out of the box? You get the best of both worlds in this list.](https://itsfoss.com/beautiful-linux-distributions/?ref=news.itsfoss.com)![](https://itsfoss.com/content/images/2023/08/most-beautiful-linux-distros.png) ![](https://itsfoss.com/content/images/2023/08/most-beautiful-linux-distros.png) ## More from It's FOSS... - Support us by opting for [It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our [community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our [weekly Newsletter](https://itsfoss.com/newsletter/).
16,547
Linux 内核 6.7 发布,包含众多修复和新的文件系统
https://news.itsfoss.com/linux-kernel-6-7-release/
2024-01-10T16:09:27
[ "Linux", "内核" ]
https://linux.cn/article-16547-1.html
![](/data/attachment/album/202401/10/160848zkf7awqrclul7m7f.jpg) > > 这是历来重大的 Linux 内核发布之一,集大量修复和新增功能于一身。 > > > 新年伊始,全新 Linux 内核发布! ? 我们在 2024 年以 **Linux 内核 6.7 版本** 的推出开启了新的篇章,这一版本具备许多显著改进,其中包括上一版本遗漏的部分内容。 Linus Torvalds 在 [公告](https://lore.kernel.org/lkml/CAHk-=widprp4XoHUcsDe7e16YZjLYJWra-dK0hE1MnfPMf6C3Q@mail.gmail.com/T/#u) 中解释了假期引发的小幅延误: > > 实际上,我们上周的工作量稍比假期前一周多些,但这不会让我觉得我们需要再进一步推迟发布。 > > > 最后的结果:6.7 版本基于提交数量(超过 17k 的非合并提交,以及 1k+ 的合并提交)来看,已经是我们有史以来发布的最大规模的内核版本之一。然而,额外的第 8 个 rc 版本主要是由于圣诞节假期的时间安排,并非大规模发布所引发的。 > > > ### ? Linux 内核 6.7:新的变化 由于 6.7 是**非长期支持版本**,你没有必须要升级到 Linux 内核 6.7 的压力,除非你急于体验 Linux 的尖端技术。 有鉴于此,我们来看看这个版本**关键的亮点**包括了哪些内容: * **英特尔的优化** * **增强的 RISC-V 支持** * **针对 AMD 的特别增强** * **众多存储功能的优化** #### 英特尔的优化 ![](/data/attachment/album/202401/10/160929e8z016ic3cpc3a3e.png) 首先要讲的是英特尔的 [Meteor Lake](https://en.wikipedia.org/wiki/Meteor_Lake) 处理器。**Linux 内核 6.7 对于英特尔 Meteor Lake 图形提供了原生支持**。在此之前,此项支持还处在 *实验性* 阶段。但现在,你可以在装备有第一代 [Core Ultra](https://www.intel.com/content/www/us/en/products/details/processors/core-ultra.html) 处理器的笔记本上全面享受到它的优势了。 另外,英特尔即将发布的 [Arrow Lake](https://en.wikipedia.org/wiki/Arrow_Lake) 和 Lunar Lake 芯片在 [Turbostat](https://www.linux.org/docs/man8/turbostat.html)(一个用于监测处理器频率、空闲统计等信息的命令行工具)中也做好了规划。 不过,也有一些支持功能被删除。 在 Linux 内核 6.7 中,**不再支持英特尔安腾 IA-64 架构**。这已经计划了好一段时间,现在,终于实现了。 #### 增强的 RISC-V 支持 ![](/data/attachment/album/202401/10/160930ldzqmmu92d9x0rvc.png) RISC-V 的一大亮点是 **引入了软件阴影调用堆栈**,这旨在保护 CPU 架构免受意外和恶意操作的影响。 此外,**在用户空间对 cbo.zero,以及在基于 ACPI 系统中对** CBO 的支持,还有许多其他杂项修复也同样进行了。这个 [合并请求](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d46392bbf5c6ce594669f00b8177f0b34e983f90) 中有更多信息。 你还可以阅读关于 <ruby> <a href="https://en.wikipedia.org/wiki/Shadow_stack"> 阴影堆栈 </a> <rt> Shadow Stack </rt></ruby> 的文章,以了解它更多的应用。 #### 针对 AMD 的特别增强 AMD 的 **无缝启动功能已经扩展到支持 Display Core Next 3.0 及以后版本的 GPU**。包括 Radeon RDNA2/RDNA3,以及未来发布的任何 GPU。 此功能使得系统 **平滑过渡,避免了通常随着电源按钮压下后会出现的屏幕闪烁现象**。之前,这个功能仅对 AMD 的 Van Gogh 系列 APU 开放。 接下来是 **错误检测和纠正**([EDAC](https://en.wikipedia.org/wiki/Error_detection_and_correction))在 [Versal](https://www.xilinx.com/products/silicon-devices/acap/versal.html) SoC 系列中的引入,它添加了一个 EDAC 驱动,支持在集成的 Xilinx DDR 内存控制器上进行 RAS 功能。 在这个 [提交信息](https://git.kernel.org/pub/scm/linux/kernel/git/ras/ras.git/commit/?h=edac-drivers&id=0fd934580ea3ea91052b999ff75017c3f08b9783) 中,你能了解到关于它如何实施的更多信息,我们在此对 [Phoronix](https://www.phoronix.com/news/AMD-Xilinx-Versal-EDAC-Linux-67) 的发现表示感谢。 #### 众多存储功能的升级 ![](/data/attachment/album/202401/10/160931ephd5h1vh1op9ahh.png) 我们终于在 Linux 内核 6.7 中迎来了 [Bcachefs](https://bcachefs.org/) 文件系统的引入。如果你对它不熟悉,简单来说,它是一种**写时复制(COW)文件系统**,其重点放在可靠性和稳健表现上。 此外,Btrfs 引入了 **新的三项特性**,F2FS 现在 **支持更大的页面尺寸**,甚至 **IBM 的日志文件系统(JFS)也有所增强**。 #### ?️ 其它变化及优化 最后,还有其他一些值得注意的变化包括: * 停止对 [MIPS AR7](https://en.wikipedia.org/wiki/Texas_Instruments_AR7) 平台的支持。 * **x86 CPU 微码加载过程** 的改进。 * 在 [EROFS](https://en.wikipedia.org/wiki/EROFS) 上,**MicroLZMA 压缩** 现在被认为是稳定的。 * 更好地支持 **采用 RISC-V 的** [Milk-V Pioneer](https://milkv.io/pioneer) 板。 * 引入 **Nouveau GPU 系统处理器(GSP)**,它为英伟达的 “Turing” 及更新的 GPU 开启了更好的体验途径。 你可以通过阅读 [短日志](https://lore.kernel.org/lkml/CAHk-=widprp4XoHUcsDe7e16YZjLYJWra-dK0hE1MnfPMf6C3Q@mail.gmail.com/T/#u) 或等待在 [内核档案](https://www.kernel.org/) 上发布的更新日志,以了解更多的技术更新。 ### 安装 Linux 内核 6.7 如果你在使用如 Arch 或 Fedora 这样的滚动版本发行版,可以期待在发行版开发者的一番测试后,就能收到升级。 对于其他用户,你可以安静等待,或者按照我们的简明教程, **在 Ubuntu 上升级到最新的主线 Linux 内核**: > > ? 我们并不建议你手动升级 Linux 内核,除非你的确有某些问题需要解决。 > > > 你可以从 [官方网站](https://www.kernel.org/) 获取最新 Linux 内核版本的 tarball。但是请记住,新版本发布后需要一些时间才能下载得到。 > > **[Linux 内核 6.7](https://www.kernel.org/)** > > > ? 你打算升级到 Linux 内核 6.7 吗?你对这个版本有何评价? *(题图:DA/0e329f2b-a118-4a00-9d90-da036172c271)* --- via: <https://news.itsfoss.com/linux-kernel-6-7-release/> 作者:[Sourav Rudra](https://news.itsfoss.com/author/sourav/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[ChatGPT](https://linux.cn/lctt/ChatGPT) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![](/assets/images/pikapods-banner-v3.webp) ![](/assets/images/pikapods-banner-v3.webp) A new year, a new Linux Kernel release!🎉 We start 2024 with the **Linux kernel 6.7 release** that sees the introduction of many improvements, including some that were left out with the previous release. Linus Torvalds mentions the little delay because of holidays in the [announcement](https://lore.kernel.org/lkml/CAHk-=widprp4XoHUcsDe7e16YZjLYJWra-dK0hE1MnfPMf6C3Q@mail.gmail.com/T/?ref=news.itsfoss.com#u): So we had a little bit more going on last week compared to the holiday week before that, but certainly not enough to make me think we'd want to delay this any further. End result: 6.7 is (in number of commits: over 17k non-merge commits, with 1k+ merges) one of the largest kernel releases we've ever had, but the extra rc8 week was purely due to timing with the holidays, not about any difficulties with the larger release. **Suggested Read **📖 [Linux Kernel 6.6 Arrives With Numerous RefinementsImproved laptop support, server improvements, and more.](https://news.itsfoss.com/linux-kernel-6-6-release/)![](https://news.itsfoss.com/content/images/2023/10/linux-kernel-6-6-release.png) ![](https://news.itsfoss.com/content/images/2023/10/linux-kernel-6-6-release.png) ## 🆕 Linux Kernel 6.7: What's New? Being **a non-LTS release**, you don't have to upgrade to Linux Kernel 6.7, unless you are chasing the bleeding edge of what Linux has to offer. So, keeping that in mind, let's take a look at the **key highlights** of this release: **Intel Improvements****Better RISC-V Support****AMD-specific Enhancements****Many Storage Improvements** ### Intel Improvements ![intel linux kernel](https://news.itsfoss.com/content/images/2024/01/linux-kernel-6-7-chip.png) We start off with Intel's [Meteor Lake](https://en.wikipedia.org/wiki/Meteor_Lake?ref=news.itsfoss.com) processors. **Linux Kernel 6.7 has native support for Intel Meteor Lake Graphics**. Earlier, the support was behind the *experimental* curtain. But now, you can take advantage of it properly on laptops equipped with first generation [Core Ultra](https://www.intel.com/content/www/us/en/products/details/processors/core-ultra.html?ref=news.itsfoss.com) processors. Initial groundwork was also laid for Intel's upcoming [Arrow Lake](https://en.wikipedia.org/wiki/Arrow_Lake?ref=news.itsfoss.com) and Lunar Lake chips in [Turbostat](https://www.linux.org/docs/man8/turbostat.html?ref=news.itsfoss.com), a CLI utility for monitoring processor frequency, idle statistics, and more. However, there has been the removal of some support too. With Linux kernel 6.7, **support for Intel Itanium IA-64 has been dropped**. This was already in the works for quite some time, but now, it is finally done. ### Better RISC-V Support ![riscv linux kernel](https://news.itsfoss.com/content/images/2024/01/linux-kernel-6-7-riscv.png) The highlight with RISC-V has been the **introduction of a software shadow call stack** that aims to protect the CPU architecture against accidents and malicious actions. Additionally, **support for cbo.zero in userspace**, **CBOs in ACPI-based systems**, and many other misc fixes were also made. This [merge](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d46392bbf5c6ce594669f00b8177f0b34e983f90&ref=news.itsfoss.com) has additional information. You can also read up on what a [Shadow Stack](https://en.wikipedia.org/wiki/Shadow_stack?ref=news.itsfoss.com) is for learning more about its uses. ### AMD-specific Enhancements AMD's **seamless boot functionality has been extended to GPUs which support Display Core Next 3.0 and later**. This includes Radeon RDNA2/RDNA3, and any future GPUs. This feature results in **a smooth transition into the system without the usual flickering of the screen** that follows a power button press. Previously, this support was only enabled for AMD's Van Gogh series of APUs. Then there's the **implementation of error detection and correction** ([EDAC](https://en.wikipedia.org/wiki/Error_detection_and_correction?ref=news.itsfoss.com)) for the [Versal](https://www.xilinx.com/products/silicon-devices/acap/versal.html?ref=news.itsfoss.com) line of SoCs that adds an EDAC driver for the RAS features on the integrated Xilinx DDR memory controllers. You can learn more about its implementation in the [commit](https://git.kernel.org/pub/scm/linux/kernel/git/ras/ras.git/commit/?h=edac-drivers&id=0fd934580ea3ea91052b999ff75017c3f08b9783&ref=news.itsfoss.com), and kudos to [Phoronix](https://www.phoronix.com/news/AMD-Xilinx-Versal-EDAC-Linux-67?ref=news.itsfoss.com) for spotting that. ![Follow It's FOSS on Google News](https://news.itsfoss.com/content/images/2023/04/Follow-us-on-Google-News.png) ![Follow It's FOSS on Google News](https://news.itsfoss.com/content/images/2023/04/Follow-us-on-Google-News.png) ### Many Storage Improvements ![linux kernel storage](https://news.itsfoss.com/content/images/2024/01/linux-kernel-6-7-storage.png) We finally see the introduction of the [Bcachefs](https://bcachefs.org/?ref=news.itsfoss.com) file system with Linux kernel 6.7. For those who don't know, it is **a copy-on-write (COW) file system** that focuses on reliability and robustness. Moreover, there are **three new features with Btrfs**, **support for larger page sizes with F2FS**, and even **IBM Journaled File-System (JFS) sees a few improvements**. ### 🛠️ Other Changes & Improvements We wrap this one up with some other notable changes: - Removal of support for the [MIPS AR7](https://en.wikipedia.org/wiki/Texas_Instruments_AR7?ref=news.itsfoss.com)platform. - Various improvements to **x86 CPU microcode loading**. **MicroLZMA compression**is now considered stable on[EROFS](https://en.wikipedia.org/wiki/EROFS?ref=news.itsfoss.com).- Better support for the **RISC-V powered**[Milk-V Pioneer](https://milkv.io/pioneer?ref=news.itsfoss.com)board. - Inclusion of **Nouveau GPU System Processor (GSP)**that paves the way for a better experience on Nvidia's “Turing” and newer GPUs. For a brief look into the technical changes, refer to the [shortlog](https://lore.kernel.org/lkml/CAHk-=widprp4XoHUcsDe7e16YZjLYJWra-dK0hE1MnfPMf6C3Q@mail.gmail.com/T/?ref=news.itsfoss.com#u) or wait for the changelog to be available on [The Kernel Archives](https://www.kernel.org/?ref=news.itsfoss.com). ## Installing Linux Kernel 6.7 For those running a rolling-release distro such as Arch or Fedora, you can expect an upgrade soon enough after some testing by the distro devs. For others, you could either play the waiting game, or **upgrade to the latest mainline Linux kernel on Ubuntu** by following our handy guide: [Install the Latest Mainline Linux Kernel Version in UbuntuThis article shows you how to upgrade to the latest Linux kernel in Ubuntu. There are two methods discussed. One is manually installing a new kernel and the other uses a GUI tool providing even easier way.](https://itsfoss.com/upgrade-linux-kernel-ubuntu/?ref=news.itsfoss.com)![](https://itsfoss.com/content/images/2023/04/install-mainline-kernel-in-ubuntu.png) ![](https://itsfoss.com/content/images/2023/04/install-mainline-kernel-in-ubuntu.png) You can source the tarball for the latest Linux kernel release from the [official website](https://www.kernel.org/?ref=news.itsfoss.com). Just keep in mind that it takes some time for the latest release to be available. *💬 Are you going to upgrade to Linux Kernel 6.7? What do you think of this release?* ## More from It's FOSS... - Support us by opting for [It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our [community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our [weekly Newsletter](https://itsfoss.com/newsletter/).
16,551
Scribus 1.6.0 发布:一次包含新功能的大规模升级
https://news.itsfoss.com/scribus-1-6-release/
2024-01-12T15:44:39
[ "Scribus" ]
https://linux.cn/article-16551-1.html
![](/data/attachment/album/202401/12/154414wmkfolkjdbl2j9ef.jpg) > > Scribus 1.6.0 更新是新年伊始的良好开端! > > > Scribus 是一种非常流行的开源桌面出版([DTP](https://en.wikipedia.org/wiki/Desktop_publishing))软件,用于制作从小册子、新闻简报、海报到广告牌等各种插图。 最近,Scribus 1.6.0 正式发布,成为我们在 2024 年报道的第一个开源工具更新。 请允许我向你展示它所提供的内容。 ### ? Scribus 1.6.0:有什么新变化? ![](/data/attachment/album/202401/12/154440qhuupwhg83ttuw02.png) 作为一个重要的稳定版本,Scribus 1.6.0 已经开发了相当长一段时间了,据开发人员称,它**包含数千个全面的增强功能和修复**。 我们将看一下此版本的**关键亮点**: 首先是**用户界面**,该界面经过全面改造,采用了新图标,支持明/暗模式,并增加了新的搜索功能,允许你搜索 Scribus 的特定功能。 此外,**新的“<ruby> 焊接 <rt> Weld </rt></ruby>”功能**可以让你组合对象,然后在不分组的情况下移动这些对象。**“<ruby> 符号 <rt> Symbol </rt></ruby>”/克隆功能**与 Adobe Illustrator 中的功能类似,可让你保持主对象(符号)与所有副本(克隆)的进度同步。 **在图形方面**,有一个名为“<ruby> 图片浏览器 <rt> Picture Browser </rt></ruby>”的新插件,可以使所有图形文件的资源管理变得简单。它通过允许你标记它们并将它们放入图形集合中以便于访问来实现这一点。 此外,**文件的导入/导出也得到了改进**,Scribus 现在具有许多新的和改进的导入过滤器、支持 Krita 的 KRA 文件格式、改进了 PDF 导入等等。 **关于文本**,Scribus 1.6.0 配备了一些社区要求最多的功能,其中包括**支持页脚和页尾注释**、**文本变量**、**文本垂直对齐**、**窗体/窗口控制**和**交叉引用**。 #### ?️ 其他更改和改进 最后,你还应该了解一些其他值得注意的变化: * 渲染帧功能中添加了对 **XeLaTeX** 的支持。 * 你现在可以使用新的**基于 PDF 的输出预览**。 * 现在可以**以原生文件格式存储位图图像**。 * 用于处理在线资源(例如字典)的**资源管理器**。 * 在 Linux 上,**Scribus 首选项目录已移动**到新位置,使其符合 [XDG 标准](https://specifications.freedesktop.org/basedir-spec/basedir-spec-0.6.html)。 Scribus 1.6 适用于 **Linux、BSD**、**Windows** 和 **macOS**。你可以浏览 [发行说明](https://www.scribus.net/scribus-1-6-0-released/) 来深入了解这个扩展版本。 ### ? 下载 Scribus 1.6.0 获取最新 Scribus 的**最直接**方法是从其 [SourceForge 页面](https://sourceforge.net/projects/scribus/files/scribus/) 获取 Linux 版的 AppImage 文件。 但是,如果你正在寻找其他安装方法或获取源代码,你可以访问 [官方网站](https://www.scribus.net/downloads/)。 还有一个 [Ubuntu 的 PPA](https://launchpad.net/~scribus/+archive/ubuntu/ppa),但是,在撰写本文时,那里还没有最新版本。 > > **[Scribus 1.6.0(SourceForge)](https://sourceforge.net/projects/scribus/files/scribus/1.6.0/)** > > > 如果你需要使用 AppImage 文件的帮助,我们的 [如何在 Linux 中使用 AppImage](https://itsfoss.com/use-appimage-linux/) 指南应该会有很大帮助。 ? 你对本次更新有何看法? 你是否期望添加到其中的所有改进? --- via: <https://news.itsfoss.com/scribus-1-6-release/> 作者:[Sourav Rudra](https://news.itsfoss.com/author/sourav/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![](/assets/images/pikapods-banner-v3.webp) ![](/assets/images/pikapods-banner-v3.webp) Scribus is a very popular open-source desktop publishing ([DTP](https://en.wikipedia.org/wiki/Desktop_publishing?ref=news.itsfoss.com)) software used to create various illustrations ranging from brochures, newsletters, posters all the way to things such as billboards. Starting off this year on a high note, Scribus 1.6.0 was recently introduced, making it the first open-source tool update we cover in 2024. Allow me to show you what it has to offer. ## 🆕 Scribus 1.6.0: What's New? ![a screenshot of scribus 1.6.0](https://news.itsfoss.com/content/images/2024/01/Scribus_1.6.png) Being a major stable release, Scribus 1.6.0 was in the works for quite some time, and according to the developer, it** contains thousands of enhancements and fixes** across the board. We shall take a look at the **key highlights** of this release: Let's begin with **the user interface**, which has been overhauled with new icons, support for light/dark modes, and a new search feature that allows you to search for a specific function of Scribus. Then there's the **new “Weld” feature** that lets you combine objects that can be then moved without being grouped. A **“Symbol”/clone feature** similar to the one in Adobe Illustrator that allows you to keep the progress of the master object (Symbol) synced with all of its copies (Clones). **On the graphics side of things**, there is a new plug-in called “Picture Browser” that makes asset management straightforward for all the graphics files. It does this by allowing you to tag them and place them into graphics collections for easy access. Moreover, the** import/export of files has also been improved**, Scribus now features many new and improved import filters, support for Krita's *KRA* file format, PDF import improvements and more. **All about Text**, Scribus 1.6.0 comes equipped with some of the most requested features by the community, it includes things like **support for foot and end notes**, **text variables**, **vertical justification of text**, **orphans/windows control**, and **cross-references**. ### 🛠️ Other Changes and Improvements To wrap this up, there are some other notable changes that you should know about: **Support for XeLaTeX**was added to the Render Frames feature.- You can now make use of the new **PDF-based output previews**. - It is now possible to **store bitmap images**within its native file format. - A **resource manager**for handling online resources such as dictionaries. - On Linux, **the Scribus preferences directory has been moved**to a new location, bringing it in line with the[XDG standard](https://specifications.freedesktop.org/basedir-spec/basedir-spec-0.6.html?ref=news.itsfoss.com). Scribus 1.6 is available for **Linux, BSD**, **Windows**, and **macOS**. You can go through the [release notes](https://www.scribus.net/scribus-1-6-0-released/?ref=news.itsfoss.com) for diving into this expansive release. ## 📥 Download Scribus 1.6.0 The **most straightforward way for getting the latest Scribus release** is as an AppImage file for Linux from its [SourceForge page](https://sourceforge.net/projects/scribus/files/scribus/?ref=news.itsfoss.com). But, if you were looking for alternative ways to install, or get the source code, you can visit the [official website](https://www.scribus.net/downloads/?ref=news.itsfoss.com). There is also a [PPA for Ubuntu](https://launchpad.net/~scribus/+archive/ubuntu/ppa?ref=news.itsfoss.com), but, at the time of writing, the latest release was not available there. If you need help using AppImage files, our guide on [how to use AppImage in Linux](https://itsfoss.com/use-appimage-linux/?ref=news.itsfoss.com) should be of great help. 👇 [How to Use AppImage in Linux [Complete Guide]What is AppImage? How to run it? How does it work? Here’s the complete guide about using AppImage in Linux.](https://itsfoss.com/use-appimage-linux/?ref=news.itsfoss.com)![](https://itsfoss.com/content/images/wordpress/2017/07/use-appimage-linux.png) ![](https://itsfoss.com/content/images/wordpress/2017/07/use-appimage-linux.png) *💬 What do you think of this update? Did you expect all the improvements added to it?* ## More from It's FOSS... - Support us by opting for [It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our [community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our [weekly Newsletter](https://itsfoss.com/newsletter/).
16,553
13 款最佳开源 ChatGPT 替代品
https://itsfoss.com/open-source-chatgpt-alternatives/
2024-01-13T11:20:02
[ "ChatGPT" ]
https://linux.cn/article-16553-1.html
![](/data/attachment/album/202401/13/111931vcvcn538l3gk9nkk.jpg) > > 正在寻找开源的 ChatGPT 替代方案?我们已经为你挑选了最优选项,供你一览。 > > > ChatGPT 是 OpenAI 推出的一个强大的生成式 AI 工具。你只需要以对话形式键入文本提示,它就会给出详细的回应。 虽然它并非无懈可击,但无可否认,有时它表现得就是那么得力。然而,无论你如何利用它,不可更改的事实是,它并非开源方案。 作为一种专用选项,它并非在所有方面都有优势。那么,何处可以寻找 ChatGPT 的开源替代品呢?让我为你揭晓自然开源的优秀 ChatGPT 替代方案。 > > ? 并非所有 ChatGPT 的替代品都有统一的运作方式。有些是为开发者设计的,让他们在其上打造属于自己的聊天机器人。还有一些则提供了供你测试使用的机器人或演示。 > > > ### 搜寻开源 ChatGPT 替代品的理由 依赖任何单一的服务对消费者来说都不是好事。对于 ChatGPT 来说也是如此。 除此之外,以下是我们需要寻找开源 ChatGPT 替代品的原因: * 掌握我们的数据处理方式,实现透明化。 * 可以选择自己构建解决方案,节省了成本。 * 按需定制 ChatGPT 替代方案。 * 你不再受制于某个公司的规定。开源解决方案可以根据您的需求灵活变化。 * 对开源项目的贡献会对全球每个人产生影响。 我并不是在此表明 ChatGPT 的功能不足,或者你应当放弃使用。然而,以“我们”用户的角度来看,长期而言,更应该从开源的替代品中获得更多收益。 现在,就让我们开始探寻最佳开源的 ChatGPT 方案吧。 > > ❌ 并非所有的选项都可用于商业用途。你需要特别留意使用某些机器人时的相关规定。 > > > ### 1、OpenChatKit ![](/data/attachment/album/202401/13/112002jdidgtfjnqjftqhi.jpg) [OpenChatKit](https://huggingface.co/spaces/togethercomputer/OpenChatKit) 是由 [Together](https://www.together.ai/) 开发的全功能 ChatGPT 替代品。 该公司起初与 **LAION**(主导了 <ruby> <a href="https://github.com/Stability-AI/stablediffusion"> 稳定扩散 </a> <rt> Stable Diffusion </rt></ruby>)等研究机构共同合作,构建出一个训练数据集。在撰写本文时,它搭载了 [RedPajama 模型](https://www.together.ai/blog/redpajama-7b),这是目前最大的开源 AI 模型之一。 你可以试验看看它是否适合你的使用需求,并在其 [GitHub 页面](https://github.com/togethercomputer/OpenChatKit) 进一步探索更多技术细节。 ### 2、ChatRWKV ![](/data/attachment/album/202401/13/112003ls71ss8j2qkqn8n6.jpg) ChatRWKV 是由 <ruby> 循环神经网络 <rt> Recurrent Neural Network </rt></ruby>(RNN) 语言模型驱动的开源替代品。 你可以在 [Huggingface](https://huggingface.co/spaces/BlinkDL/RWKV-Gradio-2) 发现它的演示。 [GitHub 页面](https://github.com/BlinkDL/ChatRWKV) 列出了关于其代码库、技术细节,以及最新版本预览的所有信息。 开发者和商业公司都可以利用 ChatRWKV 构建他们的聊天机器人。 ### 3、ColossalChat ![](/data/attachment/album/202401/13/112003q086mh6lkmm4r4lt.jpg) Colossal AI 是一个开源项目,目标是帮助你克隆 AI 模型,并打造出满足你需求的 ChatGPT 类似的平台。 [ColossalChat](https://chat.colossalai.org/) 是以此项目为基础打造的聊天机器人。然而遗憾的是,在本文撰写之时,它的演示暂未上线。 你可以在 [GitHub](https://github.com/hpcaitech/ColossalAI/tree/main/applications/Chat) 上探索其源代码。 ### 4、KoboldAI KoboldAI 是一个类似于 ChatGPT 的 AI,主要以浏览器前端的形式为写作提供辅助。虽然它具备聊天机器人模式,但它首要的设计目标是作为专为小说设计的 AI 写作助手。 提供了各种各样的模型,你可以在 [Google Colab](https://colab.research.google.com/?utm_source=scs-index) 上轻松运行它。 它支持各种模式来优化你的写作,让你有更大的发挥空间。你可以在其 [GitHub 页面](https://github.com/KoboldAI/KoboldAI-Client) 中详细了解它的所有信息。 ### 5、GPT4ALL GPT4ALL 是一个令人感兴趣的开源项目,旨在为你提供可在任何地方运行的聊天机器人。 没错,你可以在自己的 CPU 上本地运行它,而且几乎所有其他型号的 GPU 都能支持。 你需要做的就是安装它的桌面应用程序(聊天客户端),然后就能开始使用了。如果对其制作过程感兴趣,可以查看其 [GitHub 页面](https://github.com/nomic-ai/gpt4all)。 ### 6、HuggingChat ![](/data/attachment/album/202401/13/112003qnlsa4jp0j3pc3ck.jpg) 听起来熟悉吗?嗯,Huggingface 的平台被其他 AI 模型和聊天机器人用作展示他们的演示。 HuggingChat 正是 Huggingface 打造的开源的 ChatGPT 替代品,使用了社区中最优秀的 AI 模型来实现聊天机器人的功能。 你可以 [尝试一下](https://huggingface.co/spaces/huggingchat/chat-ui),并在 [源代码](https://huggingface.co/spaces/huggingchat/chat-ui/tree/main) 中深入探讨更多细节。如果有特别的需求,可以选择搭配不同的后端来使用聊天应用。 ### 7、Koala EasyLM 的研发成果 Koala 是一款可尝试本地运行的聊天机器人,整个架构基于 LLaMA 数据集完成。 你可以参阅其 [官方博客](https://bair.berkeley.edu/blog/2023/04/03/koala/) 来深入了解细节。 目前,演示版本还未上线,但是,你可以参考其 [文档](https://github.com/young-geng/EasyLM/blob/main/docs/koala.md) 在本地部署,进行试运行并测试。 ### 8、Vicuna ![](/data/attachment/album/202401/13/112003lcy00tnlntxlyycz.jpg) Vicuna 是另一款开源聊天机器人,训练基础依然是 LLaMA。根据开发者的说法,使用 GPT-4 作为评价标准,得出的结论是 Vicuna 的聊天体验接近 ChatGPT。 这是一个你可能想要验证的有趣声明。你可以选择 Vicuna 作为语言模型,并在 [Chatbot Arena](https://chat.lmsys.org/) 进行尝试。 想要了解更多关于它的信息,你可以查阅其 [官方博文](https://lmsys.org/blog/2023-03-30-vicuna/)。 ### 9、Alpaca-LoRA Alpaca-LoRA 雄心勃勃,旨在使用低秩适应技术提供一种可在树莓派中运行的模型。 利用单个 RTX 4090 GPU,整个模型可在几小时之内完成训练。 此时,演示版本仍然未开放,但你可以在其 [GitHub 页面](https://github.com/tloen/alpaca-lora) 上寻找更多详情。 ### 10、Dolly ![](/data/attachment/album/202401/13/112003w6lmn0fbm399xxgl.jpg) Dolly 是另一个在 Databricks 机器学习平台上训练的语言模型,并已获得商业使用许可。 你可以在 [GitHub](https://github.com/databrickslabs/dolly) 上查阅源代码,并在 [Huggingface](https://huggingface.co/databricks/dolly-v2-12b) 上探究模型详情。 ### 11、H2oGPT ![](/data/attachment/album/202401/13/112004l39m1qww3qf89qrl.jpg) H2oGPT 是专门为查询定制的,可以帮助你总结文档。在保证隐私的前提下,它允许你通过用户界面上传和查看文档。 同样,你可以像使用 ChatGPT 那样开始对话。对于 Windows 和 macOS,该项目提供了易于安装的程序。对于 Linux 系统,你可能需要通过 Docker 进行些许设置。 可以尝试该聊天机器人的 [在线演示](https://huggingface.co/spaces/h2oai/h2ogpt-chatbot2) 来了解其运行情况,并在 [GitHub 页面](https://github.com/h2oai/h2ogpt) 查阅源代码。 ### 12、Cerebras-GPT ![](/data/attachment/album/202401/13/112004u3z8ux89x3px9xae.jpg) Cerebras-GPT 呈现了通过大量参数训练的开源 GPT 类似模型。 它并没有提供聊天机器人服务。它的目标旨在提供精准且高效的开源模型供你使用。 获取模型详情,你可以访问 [Hugging Face](https://huggingface.co/cerebras/Cerebras-GPT-6.7B)。 ### 13、OpenAssistant OpenAssistant 的目标,是让每一个人都能访问类似于 ChatGPT 的聊天机器人。 有一段时间,他们通过演示版本收集了用户数据。现在,由于项目已由创作者标记为完成,演示版本不再开放。 但你可以利用该项目的成果,及其 [源代码](https://github.com/LAION-AI/Open-Assistant?tab=readme-ov-file#how-to-try-it-out),在此基础上进行扩展。 ### 总结 面向用户和开发者,ChatGPT 的开源替代品提供了各种各样的优点。你可以选择运用一个开源的聊天机器人,或者借助开源语言模型构建一个属于自己的聊天机器人。 无论你选择哪一个,只要遵守可用语言模型的政策,你都可以自由地修改和使用它以满足你的需求。 你最爱哪个开源的 ChatGPT 替代品呢?是否还有其他优秀的开源型 ChatGPT 项目,我们错过了但你特别喜欢的?请在下方评论区告诉我们你的想法。 *(题图:DA/b757432f-56a4-4493-a109-1eca6c57c1fc)* --- via: <https://itsfoss.com/open-source-chatgpt-alternatives/> 作者:[Ankush Das](https://itsfoss.com/author/ankush/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[ChatGPT](https://linux.cn/lctt/ChatGPT) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![Warp Terminal](/assets/images/warp-terminal.webp) ![Warp Terminal](/assets/images/warp-terminal.webp) ChatGPT is a powerful generative AI tool developed by OpenAI. You enter text prompts in a conversational way, and it gives you a detailed response. Sure, it is not perfect. But, sometimes it is incredibly helpful. No matter what you do with it, unfortunately, it is not an open-source solution. As a proprietary option, it isn't beneficial in every way. So, what are some open source ChatGPT alternatives? Here, let me highlight the best ChatGPT alternatives that are open-source in nature. ## Reasons to Look for Open-Source ChatGPT Alternatives Relying on any single service is bad for the consumers. The same goes for ChatGPT. In addition to that, here's why we should look for open ChatGPT alternatives: - Get transparency on how our data is being handled. - You can choose to build your own solution, saving money in the process. - Customize the ChatGPT alternative as per your requirements. - You are not locked on to the policies of a single company. The open-source solution can be flexible as per your needs. - Contributions to the open-source project will make an impact on everyone across the globe. I do not intend to say that ChatGPT is bad, or you should stop using it. However, "we" as the users should benefit more from the open alternatives in the long-run. Now, let us move on to the best open-source ChatGPT alternatives. ## 1. OpenChatKit ![openchatkit](https://itsfoss.com/content/images/2024/01/openchatkit-screenshot.jpg) [OpenChatKit](https://huggingface.co/spaces/togethercomputer/OpenChatKit) is a full-fledged ChatGPT alternative developed by [Together](https://www.together.ai/). The company initially collaborated with research organizations like **LAION** (responsible for [ Stable Diffusion](https://github.com/Stability-AI/stablediffusion?ref=news.itsfoss.com)) to create a training dataset. When writing this, it uses the [RedPajama model](https://www.together.ai/blog/redpajama-7b), one of the largest open-source AI models. You can try if it fits your use-cases and explore its [GitHub page](https://github.com/togethercomputer/OpenChatKit?ref=news.itsfoss.com) for technical details. ## 2. ChatRWKV ![chatrwkv screenshot](https://itsfoss.com/content/images/2024/01/chatrwkv.jpg) ChatRWKV is an open-source alternative powered by an RNN (Recurrent Neural Network) language model. You can find a demo of it on [Huggingface](https://huggingface.co/spaces/BlinkDL/RWKV-Gradio-2). The [GitHub page](https://github.com/BlinkDL/ChatRWKV) mentions all about its repository, technical details, and the latest version preview. Developers and businesses can build their chatbots utilizing ChatRWKV. ## 3. ColossalChat ![colossalchat](https://itsfoss.com/content/images/2024/01/colossalchat.jpg) Colossal AI is an open-source initiative to help you clone AI models and build ChatGPT-like platforms for your requirements. [ColossalChat](https://chat.colossalai.org) is the chatbot leveraging the project. Unfortunately, the demo is not functional when writing this. You can explore its source code on [GitHub](https://github.com/hpcaitech/ColossalAI/tree/main/applications/Chat). ## 4. KoboldAI A ChatGPT-like AI for assisted writing in the form of a browser-based front-end. While it supports a chatbot mode, it is primarily designed as an AI assistant for writing geared towards Novels. There are various models available, and you can run it on [Google Colab](https://colab.research.google.com/?utm_source=scs-index) easily. It supports different modes to optimize your writing and play with it. You can explore all about it on its [GitHub page](https://github.com/KoboldAI/KoboldAI-Client). ## 5. GPT4ALL GPT4all is an interesting open-source project that aims to provide you with chatbots that you can run anywhere. Yes, you can run it locally on your CPU and supports almost every other GPU. All you need to do is install its desktop application (the chat client), and get started. Want to learn how it's made? Check out its [GitHub page](https://github.com/nomic-ai/gpt4all). ## 6. HuggingChat ![huggingchat screenshot](https://itsfoss.com/content/images/2024/01/huggingchat.jpg) Sounds familiar? Well, Huggingface's platform is used by other AI models and chatbots to showcase a demo. And, HuggingChat is its take on a ChatGPT alternative, which is open-source. It makes use of the community's best AI models to make the chatbot work. You can [take it for a spin](https://huggingface.co/spaces/huggingchat/chat-ui), and explore the [source code](https://huggingface.co/spaces/huggingchat/chat-ui/tree/main) for more details. One can choose to use the chat application with a different back-end to meet specific requirements. ## 7. Koala Koala by [EasyLM](https://github.com/young-geng/EasyLM#koala) is a chatbot that you can try running locally. It is built on top of LLaMA dataset. You can refer to its [official blog post](https://bair.berkeley.edu/blog/2023/04/03/koala/) to explore the intriguing details. The demo is not available at the moment. However, you can follow its [documentation](https://github.com/young-geng/EasyLM/blob/main/docs/koala.md) to try running it locally and test it out. ## 8. Vicuna ![vicuna chatbot](https://itsfoss.com/content/images/2024/01/vicuna.jpg) Vicuna is yet another open-source chatbot trained on top of LLaMA. As per the developers, when evaluated using GPT-4 as a judge, it concluded that it comes close to the quality of ChatGPT. An interesting claim that you might want to test against. You can select the language model Vicuna and try it on [Chatbot Arena](https://chat.lmsys.org). Explore more about it on its [official blog post](https://lmsys.org/blog/2023-03-30-vicuna/). ## 9. Alpaca-LoRA Alpaca-Lora aims to provide an instruct model using low-rank adaptation, letting you run it on a Raspberry Pi. The entire model can be trained using a single RTX 4090 GPU in a few hours. At the time, the demo was not working. You can explore all about it on its [GitHub page](https://github.com/tloen/alpaca-lora). ## 10. Dolly ![dolly source code](https://itsfoss.com/content/images/2024/01/dolly-huggingface.jpg) Dolly is another language model trained in the Databricks machine learning platform licensed for commercial use. You can take a look at the source code on [GitHub](https://github.com/databrickslabs/dolly) and explore the model on [Huggingface](https://huggingface.co/databricks/dolly-v2-12b). ## 11. H2oGPT ![h20gpt](https://itsfoss.com/content/images/2024/01/h2ogpt.jpg) H2oGPT is tailored for queries to help you summarize your documents. To achieve that, it lets you upload and view documents through its user interface, which is private to you. You can also initiate a conversation like ChatGPT. There are easy installers available for Windows, and macOS. A little more effort needed using Docker to set it up on a Linux machine. You can try the [live demo](https://huggingface.co/spaces/h2oai/h2ogpt-chatbot2) of the chatbot to get an idea and explore the source code on its [GitHub page](https://github.com/h2oai/h2ogpt). ## 12. Cerebras-GPT ![cerebrasgpt](https://itsfoss.com/content/images/2024/01/cerebras.jpg) Cerebras-GPT offers open-source GPT-like models trained using a massive number of parameters. It does not offer a chatbot. They only aim to provide open-source models that you can use for better accuracy and compute efficiency. You can get the model details on [Hugging Face](https://huggingface.co/cerebras/Cerebras-GPT-6.7B). ## 13. OpenAssistant OpenAssistant was a project to give everyone access to a chatbot like ChatGPT. For a while, they collected data from users using a demo. Now, the demo is no longer functional as the project was marked complete by the creator. You can utilize the project's progress and the [source](https://github.com/LAION-AI/Open-Assistant?tab=readme-ov-file#how-to-try-it-out) to build on it. **Suggested Read 📖** [7 Tips and Tools to Improve Your Gaming Experience on LinuxHere are the best tips to make your Linux gaming experience enjoyable.](https://itsfoss.com/linux-gaming-tips/)![](https://itsfoss.com/content/images/2024/01/tips-to-enhance-linux-gaming.png) ![](https://itsfoss.com/content/images/2024/01/tips-to-enhance-linux-gaming.png) ## Wrapping Up ChatGPT's open-source alternatives offer various benefits to users and developers. You can choose to use an open-source chatbot or an open-source language model to build one for your business. No matter what you pick, you are free to modify and use it as per your requirements, keeping the policies in mind for available language models. *What is your favorite open-source ChatGPT alternative? Did we miss listing any of your favorite open ChatGPT projects? Let us know your thoughts in the comments down below.*
16,555
在 Linux 上提升游戏体验的 7 个有效建议及工具
https://itsfoss.com/linux-gaming-tips/
2024-01-13T23:01:50
[ "游戏" ]
https://linux.cn/article-16555-1.html
![](/data/attachment/album/202401/13/230125y90rry7bnz0niy90.jpg) > > 下面是一些极好的建议来让你的 Linux 系统游戏体验更上一层楼。 > > > 多亏了各种新工具的诞生和 Linux 发行版在用户体验上的改进,目前已有成千上万的游戏可以在 Linux 系统中运行。 无论你是使用主流的 Linux 发行版还是 [专为游戏设计的 Linux 发行版](https://itsfoss.com/linux-gaming-distributions/),你都能在 Linux 中享受游戏的乐趣。 然而,为了得到流畅的游戏体验,有一些你需要遵循的工具,技巧和方法。在这篇文章中,我会为你详细介绍一些。 ### 1、选择合适的电子游戏 ![](/data/attachment/album/202401/13/230150nv388951e7gwwb1y.png) 最首要的一步就是找到一款你热爱,且在 Linux 上运行流畅的游戏。 假设你购买或下载了一款最初为 Windows 系统制作的游戏,可能不论你使用何种工具,都无法在 Linux 系统中成功运行。而你最终只会挫败地想 “Linux 不适合游戏” ? 那么,该如何避免这类问题呢? 首先,你需要查阅你想要购买或下载的游戏可以在哪些平台上运行。如果游戏支持 Linux 或 Steam OS 系统,那就没问题了。 你还可以查看该游戏是否已经被添加到 [Steam Deck 验证列表](https://store.steampowered.com/greatondeck/) 中。 无论哪种情况,你都可以逛一逛 [ProtonDB](https://www.protondb.com/),在那儿搜索你所关注的游戏,看看其他用户对其的评价和打分。如果大部分评论听起来都令人信服,或者说这款游戏很值得尝试,那你就可以放心购买或下载了。 ### 2、不要选择知名度较低的发行版 如果你希望得到社区或者使用 Linux 的朋友们的支持与帮助,请使用那些并非某某人业余项目的 Linux 发行版。 我建议你从 [最佳 Linux 发行版](https://itsfoss.com/best-linux-distributions/) 中作出选择。 最好的是,选择一款 [长期支持版](https://itsfoss.com/long-term-support-lts/) 以确保稳定的使用体验。 ### 3、别为 Linux 游戏搭建顶级配置 PC ![](/data/attachment/album/202401/13/230150utfuhhl9ooxhs0ok.png) 我知道听起来有点令人失望。但为了确保最大的兼容性以及无忧的游戏体验,最理想的状况是选用前一代的硬件而不是最新的。 利用这种方式,你还可以享受到大额的折扣,省下大笔钱!别忘了,在决定购买前,还可参阅其他 PC 硬件狂热爱好者的评论。 这个建议尤其适用于新硬件,那些刚刚发布没几个月的。 当然,你可以冒险尝试最新的硬件组件。但游戏可能会崩溃,或以其他方式出问题。而且,你也可能无法获取到关于这些硬件组件的可靠评论,从而做出明智的选择。 ### 4、开启 Steam Play 如果你一直都是 Linux 原生游戏的粉丝,你可能想要 [安装 Steam 游戏商店](https://itsfoss.com/install-steam-ubuntu-linux/) 并开启 Proton 兼容层,在 Linux 上运行那些仅供 Windows 系统的游戏。 你可以参考我前面提到的 ProtonDB 或者 Steam Deck 的验证列表,来确认该游戏是否能在 Linux 上流畅运行。 在安装了 Steam 以后,如果你想 [开启 Steam Play](https://itsfoss.com/steam-play/),可以参照我们的指南操作。 ### 5、没有 Steam?不必担忧! 尽管 Steam 提供了跨平台的卓越顺畅的游戏体验。 但如果你不想仅限于 Steam,还想要能访问像 Epic 游戏商店这样的商店中的游戏,你可以考虑安装 [Lutris](https://lutris.net/) 这样的工具。 ![](/data/attachment/album/202401/13/230151njmizz9w97zzgh4m.png) 我们为你准备了一份详尽的指南,来帮助你 [在 Linux 下使用 Epic 游戏商店](https://itsfoss.com/epic-games-linux/),并学习使用此工具(和其他替代工具)。 不用担心,如果你偏爱 GOG 的无数字版权管理(DRM)游戏,我们同样为你准备了指南,指导你使用 Lutris 这样的工具在 Linux 下玩 [GOG 游戏](https://itsfoss.com/play-gog-games-linux/)。 ### 6、使用 MangoHud 跟踪游戏性能 你是否希望在游戏中同时监控你的硬件性能和游戏性能? ![](/data/attachment/album/202401/13/230151oe02r2z725q7rg20.jpg) 借助 [MangoHud](https://github.com/flightlessmango/MangoHud),你可以得到一个信息层,显示 **FPS、CPU/GPU 的温度、显存使用情况等信息**,这与在 Windows 下利用英伟达 GeForce Experience 或者 MSI Afterburner 的效果相似。 安装十分简单,对于像 Fedora、Debian 和 Arch 这样的发行版,提供了 Flatpak 和其他形式的二进制文件。你可以在它的 [GitHub 页面](https://github.com/flightlessmango/MangoHud) 上了解更多关于它的使用方法。 ### 7、已经买好游戏硬件了吗?马上进行配置! 可惜的是,并不是所有的发烧友级游戏硬件都能在 Linux 下进行详细调整,至少,不能和在 Windows 下一样。 例如,你可以使用图形界面工具 [piper 进行游戏鼠标的配置](https://itsfoss.com/piper-configure-gaming-mouse-linux/)。 同理,如果你想要控制或者 [调整 Razer 设备上的灯光](https://itsfoss.com/set-up-razer-devices-linux/),你可以在这里找到我们的快速教程进行学习。 不只是设备,需要监控你的 PC 中的一体式水冷(AIO)或者其他散热硬件吗?你可以试试 [CoolerControl](https://gitlab.com/coolercontrol/coolercontrol)(以前称为 [Coolero](https://itsfoss.com/coolero/))。 监控组件的温度对于获得流畅的游戏体验至关重要。因此,你可以选择工具如 CoolerControl 和 MangoHud,或者手动监控你的系统资源。 ### 结束语 除了上述的所有建议,你还应该微调游戏内的设置以在你的系统上获得沉浸式体验。当然,这依赖于个人用户的偏好,所以没有通用的解决方案。 别忘了,如果你是新手,那么不妨读一读我们的 [Linux 游戏指南](https://itsfoss.com/linux-gaming-guide/)。 ? 你最喜欢用什么工具来提升你的 Linux 游戏体验?你有想要添加到这个列表的建议吗?请随时在评论中让我们知道你的想法。 *(题图:DA/68d71173-992a-423a-bd95-a6e2f64bf254)* --- via: <https://itsfoss.com/linux-gaming-tips/> 作者:[Ankush Das](https://itsfoss.com/author/ankush/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[ChatGPT](https://github.com/ChatGPT) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![Warp Terminal](/assets/images/warp-terminal.webp) ![Warp Terminal](/assets/images/warp-terminal.webp) Thousands of games now work on Linux, thanks to all the new tools available and user experience improvements by the distributions. Whether you use a mainstream distribution or a [gaming-focused distribution](https://itsfoss.com/linux-gaming-distributions/), you can enjoy playing games on Linux. However, there are certain tools, tips, and techniques that you should follow to get a seamless gaming experience. In this article, I shall highlight some of them. ## 1. Pick the Right Video Game ![linux game pick](https://itsfoss.com/content/images/2024/01/linux-gaming-pick.png) The most important task is to pick a game that you love, and also make sure that it runs on Linux without much hassle. Suppose you purchase/download a game newly built for Windows, it may fail to work on Linux irrespective of the tool you use. And, you end up getting frustrated thinking "*Linux is not meant for gaming*"😔 So, how do you do that? Well, first, check the supported platforms for the game you need to purchase/download. If it mentions Linux/Steam OS, you are good to go. You may also check if the game exists in the [Steam Deck Verified list](https://store.steampowered.com/greatondeck/). In either case, head to [ProtonDB](https://www.protondb.com), search for the game, and check its ratings/reviews from other users. You can try the game if the reviews sound convincing (or worth the effort). ## 2. Do Not Pick a Lesser-Known Distribution If you are looking for community support or help from your fellow Linux friends, use a Linux distribution that isn't just someone's side project of sort. I suggest you to pick any of the [best Linux distributions](https://itsfoss.com/best-linux-distributions/) available. Preferably, a [Long-Term Support](https://itsfoss.com/long-term-support-lts/) edition for a stable experience. ## 3. Don't Build The Latest & Greatest PC for Linux Gaming ![linux gaming pc](https://itsfoss.com/content/images/2024/01/linux-gaming-pc.png) I know it sucks to hear this. But, to guarantee maximum compatibility, and a hassle-free experience, it is best to get previous-gen hardware over the current one. You will also be saving a great deal of money with discounts! Not to forget, you can read up reviews from other PC hardware enthusiasts before deciding. This would be my recommendation, especially, if the newer hardware released only a couple of months back. Sure, you can take a leap of faith with the bleeding-edge hardware components. But, games might crash, or act weird in some way (if at all). Not to forget, you may not get reliable reviews on the components to make a wise purchase decision. ## 4. Enable Steam Play If you have been a fan of native Linux games, you might want to [install the Steam game store](https://itsfoss.com/install-steam-ubuntu-linux/) and enable the proton compatibility layer to play Windows-exclusive games on Linux. You can check ProtonDB or the Steam Deck verified list as mentioned in an earlier tip to make sure the game runs comfortably on Linux. To go ahead and [enable Steam Play](https://itsfoss.com/steam-play/) after installing Steam, follow our guide: [How to Play Windows-only Games on Linux with Steam ProtonSteam Play (proton) lets you play Window-only games on Linux. Here’s how to get started.](https://itsfoss.com/steam-play/)![](https://itsfoss.com/content/images/2023/02/run-windows-only-games-in-linux-1.png) ![](https://itsfoss.com/content/images/2023/02/run-windows-only-games-in-linux-1.png) ## 5. No Steam? No Problem! Sure, Steam provides a fantastic hassle-free experience across every platform. But, if you would rather not limit yourself to Steam, but also want to access titles from stores like Epic Games Store, you can install a tool like [Lutris](https://lutris.net). ![lutris game install](https://itsfoss.com/content/images/2024/01/lutris-game-install.png) We have a separate in-depth guide to help you [use the Epic Games Store on Linux](https://itsfoss.com/epic-games-linux/) to explore using the tool (and other alternatives): [How to Use Epic Games Store on LinuxWant to use Epic Games Store (EGS) on Linux? Here’s how you can do that.](https://itsfoss.com/epic-games-linux/)![](https://itsfoss.com/content/images/wordpress/2022/07/using-epic-games-store-on-linux-guide.jpg) ![](https://itsfoss.com/content/images/wordpress/2022/07/using-epic-games-store-on-linux-guide.jpg) Fret not, if you prefer DRM-free titles from GOG, we also have a guide to help you use tools like Lutris to play [GOG games on Linux](https://itsfoss.com/play-gog-games-linux/): [How to Play GOG Games on LinuxWant to access and play GOG games on Linux? Here’s how to do that.](https://itsfoss.com/play-gog-games-linux/)![](https://itsfoss.com/content/images/2023/04/play-gog-games-on-linux.png) ![](https://itsfoss.com/content/images/2023/04/play-gog-games-on-linux.png) ## 6. Check Game Performance Using MangoHud Do you want to monitor your hardware and game performance at the same time? ![mangohud screenshot](https://itsfoss.com/content/images/2024/01/mango-hud.jpg) With [MangoHud](https://github.com/flightlessmango/MangoHud), you can have an overlay displaying **FPS, CPU/GPU temperatures, VRAM usage, and more**, similar to what you get with NVIDIA GeForce Experience or MSI Afterburner on Windows. Installation is pretty easy with Flatpak and other binaries available for distributions like Fedora, Debian, and Arch. You can explore more about its usage on its [GitHub page](https://github.com/flightlessmango/MangoHud). ## 7. Got Gaming Hardware? Configure Them Right Away! Unfortunately, not every gaming-focused hardware can be tweaked on Linux, at least, not to the same extent as on Windows. For instance, you can use a GUI tool [piper to configure a gaming mouse](https://itsfoss.com/piper-configure-gaming-mouse-linux/): [How to Configure Gaming Mouse on Linux Using Piper GUI ToolBrief: Piper is a nifty GUI application that helps you configure your gaming mouse on Linux. Usually, when you switch from Windows to Linux, you lose access to a lot of GUI (Graphical User Interface) tools to manage gaming peripherals. You can still enjoy playing games on Linux, but the](https://itsfoss.com/piper-configure-gaming-mouse-linux/)![](https://itsfoss.com/content/images/wordpress/2020/06/configuring-gaming-mouse-linux.png) ![](https://itsfoss.com/content/images/wordpress/2020/06/configuring-gaming-mouse-linux.png) Similarly, if you want to control/tweak lights on Razer devices, you can also do that by following our quick tutorial here: [How to Set Up Razer Devices on Linux for Lighting EffectsConfigure your Razer devices to set up lighting effects.](https://itsfoss.com/set-up-razer-devices-linux/)![](https://itsfoss.com/content/images/wordpress/2021/06/razer-devices-linux.png) ![](https://itsfoss.com/content/images/wordpress/2021/06/razer-devices-linux.png) Not just accessories, but need something to help monitor **AIOs** (or cooling hardware) on your PC? You can try [CoolerControl](https://gitlab.com/coolercontrol/coolercontrol?ref=itsfoss.com) (formerly [Coolero](https://itsfoss.com/coolero/)). It is important to monitor the temperatures of your components to get a smooth gaming experience. So, you can opt for tools like CoolerControl and MangoHud or manually monitor your system resources. ## Wrapping Up In addition to all the above-mentioned tips, you should also tweak the in-game settings to get an immersive experience on your system. Of course, that depends on user preferences. So, there's no one-size-fits-all solution to it. Not to forget, if you are a newbie, you should not miss reading our [Linux gaming guide](https://itsfoss.com/linux-gaming-guide/): [Gaming On Linux: All You Need To KnowCan I play games on Linux? What are the games available for Linux? Where to find Linux games? This comprehensive article answers all your questions on Linux gaming.](https://itsfoss.com/linux-gaming-guide/)![](https://itsfoss.com/content/images/wordpress/2015/10/Gaming-on-Linux.jpeg) ![](https://itsfoss.com/content/images/wordpress/2015/10/Gaming-on-Linux.jpeg) *💬 What's your favorite tool to enhance your Linux gaming experience? Do you have a tip to add to our list? Feel free to let us know your thoughts in the comments.*
16,557
Textual:为 Python 增加漂亮的文本用户界面(TUI)
https://fedoramagazine.org/crash-course-on-using-textual/
2024-01-15T11:04:38
[ "Textual", "TUI" ]
https://linux.cn/article-16557-1.html
![](/data/attachment/album/202401/15/110359fptrxpqffztniz45.jpg) ### 快速入门使用 Textual Python 在 Linux 上有像 [TkInter](https://docs.python.org/3/library/tkinter.html) 这样的优秀 GUI(图形用户界面)开发库,但如果你不能运行图形应用程序怎么办? 文本终端,并非只在 Linux 上有,而且 BSD 和其它的出色的类 Unix 操作系统上也有。如果你的代码是用 Python 编写的,你应该使用 [Textual](https://textual.textualize.io/) 来帮助你编写 TUI(文本用户界面)。在这个快速介绍中,我将向你展示两个你可以用 Textual 做的示例,并且介绍它未来可能的应用方向。 所以 Textual 是什么? > > Textual 是一个为 Python 构建的快速应用程序开发框架,由 [Textualize.io](http://Textualize.io) 构建。它可以让你用简单的 Python API 构建复杂的用户界面,并运行在终端或网络浏览器上! > > > #### 你需要的跟进这个教程的工具 你需要有以下条件: 1. 具备基础的编程经验,最好熟练使用 Python。 2. 理解基础的面向对象概念,比如类和继承。 3. 一台安装了 Linux 与 Python 3.9+ 的机器 4. 一款好的编辑器(Vim 或者 PyCharm 是不错的选择) 我尽可能简单化代码,以便你能轻松理解。此外,我强烈建议你下载代码,或至少按照接下来的说明安装相关程序。 #### 安装步骤 首先创建一个虚拟环境: ``` python3 -m venv ~/virtualenv/Textualize ``` 现在,你可以克隆 Git 仓库并创建一个可以编辑的发布版本: ``` . ~/virtualenv/Textualize/bin/activate pip install --upgrade pip pip install --upgrade wheel pip install --upgrade build pip install --editable . ``` 或者直接从 [Pypi.org](http://Pypi.org) 安装: ``` . ~/virtualenv/Textualize/bin/activate pip install --upgrade KodegeekTextualize ``` ### 我们的首个程序:日志浏览器 ![](/data/attachment/album/202401/15/110439y6oo97pb89989wwh.svg) 这个 *日志浏览器* 就是一款简单的应用,能执行用户 *[PATH](https://manpages.org/bash)* 路径上的一系列 UNIX 命令,并在任务执行完毕后捕获输出。 以下是该应用的代码: ``` import shutil from textual import on from textual.app import ComposeResult, App from textual.widgets import Footer, Header, Button, SelectionList from textual.widgets.selection_list import Selection from textual.screen import ModalScreen # Operating system commands are hardcoded OS_COMMANDS = { "LSHW": ["lshw", "-json", "-sanitize", "-notime", "-quiet"], "LSCPU": ["lscpu", "--all", "--extended", "--json"], "LSMEM": ["lsmem", "--json", "--all", "--output-all"], "NUMASTAT": ["numastat", "-z"] } class LogScreen(ModalScreen): # ... Code of the full separate screen omitted, will be explained next def __init__(self, name = None, ident = None, classes = None, selections = None): super().__init__(name, ident, classes) pass class OsApp(App): BINDINGS = [ ("q", "quit_app", "Quit"), ] CSS_PATH = "os_app.tcss" ENABLE_COMMAND_PALETTE = False # Do not need the command palette def action_quit_app(self): self.exit(0) def compose(self) -> ComposeResult: # Create a list of commands, valid commands are assumed to be on the PATH variable. selections = [Selection(name.title(), ' '.join(cmd), True) for name, cmd in OS_COMMANDS.items() if shutil.which(cmd[0].strip())] yield Header(show_clock=False) sel_list = SelectionList(*selections, id='cmds') sel_list.tooltip = "Select one more more command to execute" yield sel_list yield Button(f"Execute {len(selections)} commands", id="exec", variant="primary") yield Footer() @on(SelectionList.SelectedChanged) def on_selection(self, event: SelectionList.SelectedChanged) -> None: button = self.query_one("#exec", Button) selections = len(event.selection_list.selected) if selections: button.disabled = False else: button.disabled = True button.label = f"Execute {selections} commands" @on(Button.Pressed) def on_button_click(self): selection_list = self.query_one('#cmds', SelectionList) selections = selection_list.selected log_screen = LogScreen(selections=selections) self.push_screen(log_screen) def main(): app = OsApp() app.title = f"Output of multiple well known UNIX commands".title() app.sub_title = f"{len(OS_COMMANDS)} commands available" app.run() if __name__ == "__main__": main() ``` 现在我们逐条梳理一下程序的代码: 1. 每个应用都扩展自 `App` 类。其中最重要的有 `compose` 与 `mount` 等方法。但在当前应用中,我们只实现了 [compose](https://textual.textualize.io/tutorial/#composing-the-widgets)。 2. 在 `compose` 方法中,你会返回一系列 <ruby> <a href="https://textual.textualize.io/widget_gallery/"> 组件 </a> <rt> Widget </rt></ruby>,并按顺序添加到主屏幕中。每一个组件都有定制自身外观的选项。 3. 你可以设定单字母的 <ruby> <a href="https://textual.textualize.io/api/binding/"> 绑定 </a> <rt> binding </rt></ruby>,比如此处我们设定了 `q` 键来退出应用(参见 `action_quit_app` 函数和 `BINDINGS` 列表)。 4. 利用 `SelectionList` 组件,我们展示了待运行的命令列表。然后,你可以通过 `@on(SelectionList.SelectedChanged)` 注解以及 `on_selection` 方法告知应用获取所选的内容。 5. 对于无选定元素的应对很重要,我们会根据运行的命令数量来决定是否禁用 “exec” 按钮。 6. 我们使用类似的监听器( `@on(Button.Pressed)` )来执行命令。我们做的就是将我们的选择送到一个新的屏幕,该屏幕会负责执行命令并收集结果。 你注意到 `CSS_PATH = "os_app.tcss"` 这个变量了吗?Textual 允许你使用 CSS 来控制单个或多个组件的外观(色彩、位置、尺寸): ``` Screen { layout: vertical; } Header { dock: top; } Footer { dock: bottom; } SelectionList { padding: 1; border: solid $accent; width: 1fr; height: 80%; } Button { width: 1fr } ``` 引自 Textual 官方网站: > > Textual 中使用的 CSS 是互联网上常见 CSS 的简化版本,容易上手。 > > > *这真是太棒了*,只需要用一哥独立的 [样式表](https://textual.textualize.io/guide/styles/),就可以轻松调整应用的样式。 好,我们现在来看看如何在新屏幕上展示结果。 #### 在新屏幕上展示结果 ![](/data/attachment/album/202401/15/110439yqdsozs9m2qhms2m.svg) 以下是在新屏幕上处理输出的代码: ``` import asyncio from typing import List from textual import on, work from textual.reactive import reactive from textual.screen import ModalScreen from textual.widgets import Button, Label, Log from textual.worker import Worker from textual.app import ComposeResult class LogScreen(ModalScreen): count = reactive(0) MAX_LINES = 10_000 ENABLE_COMMAND_PALETTE = False CSS_PATH = "log_screen.tcss" def __init__( self, name: str | None = None, ident: str | None = None, classes: str | None = None, selections: List = None ): super().__init__(name, ident, classes) self.selections = selections def compose(self) -> ComposeResult: yield Label(f"Running {len(self.selections)} commands") event_log = Log( id='event_log', max_lines=LogScreen.MAX_LINES, highlight=True ) event_log.loading = True yield event_log button = Button("Close", id="close", variant="success") button.disabled = True yield button async def on_mount(self) -> None: event_log = self.query_one('#event_log', Log) event_log.loading = False event_log.clear() lst = '\n'.join(self.selections) event_log.write(f"Preparing:\n{lst}") event_log.write("\n") for command in self.selections: self.count += 1 self.run_process(cmd=command) def on_worker_state_changed(self, event: Worker.StateChanged) -> None: if self.count == 0: button = self.query_one('#close', Button) button.disabled = False self.log(event) @work(exclusive=False) async def run_process(self, cmd: str) -> None: event_log = self.query_one('#event_log', Log) event_log.write_line(f"Running: {cmd}") # Combine STDOUT and STDERR output proc = await asyncio.create_subprocess_shell( cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.STDOUT ) stdout, _ = await proc.communicate() if proc.returncode != 0: raise ValueError(f"'{cmd}' finished with errors ({proc.returncode})") stdout = stdout.decode(encoding='utf-8', errors='replace') if stdout: event_log.write(f'\nOutput of "{cmd}":\n') event_log.write(stdout) self.count -= 1 @on(Button.Pressed, "#close") def on_button_pressed(self, _) -> None: self.app.pop_screen() ``` 你会注意到: 1. `LogScreen` 类扩展自 `ModalScreen` 类, 该类负责处理模态模式的屏幕。 2. 这个屏幕同样有一个 `compose` 方法,我们在这里添加了组件以展示 Unix 命令的内容。 3. 我们创建了一个叫做 `mount` 的新方法。一旦你用 `compose` 编排好组件,你就可以运行代码来获取数据,并再进一步定制它们的外观。 4. 我们使用 [asyncio](https://docs.python.org/3/library/asyncio.html) 运行命令,这样我们就能让 TUI 主工作线程在每个命令的结果出来时就及时更新内容。 5. 对于“工作线程”,请注意 `run_process` 方法上的 `@work(exclusive=False)` 注解,该方法用于运行命令并捕获 STDOUT + STDERR 输出。使用 [工作线程](https://textual.textualize.io/guide/workers/) 来管理并发并不复杂,尽管它们在手册中确实有专门的章节。这主要是因为运行的外部命令可能会执行很长时间。 6. 在 `run_process` 中,我们通过调用 `write` 以命令的输出内容来更新 `event_log`。 7. 最后,`on_button_pressed` 把我们带回到前一屏幕(从堆栈中移除屏幕)。 这个小应用向你展示了如何一份不到 200 行的代码来编写一个简单的前端,用来运行非 Python 代码。 现在我们来看一个更复杂的例子,这个例子用到了我们还未探索过的 Textual 的新特性。 ### 示例二:展示赛事成绩的表格 ![通过 Textual 创建的表格应用](/data/attachment/album/202401/15/110439oercynysjncnku7y.svg) 本示例将展示如何使用 `DataTable` 组件在表格中展示赛事成绩。你能通过这个应用实现: * 通过列来排序表格 * 选择表格中的行,完整窗口展示赛事细节,我们将使用我们在日志浏览器中看到的 “推送屏幕” 技巧。 * 能进行表格搜索,查看选手详情,或执行其他操作如退出应用。 下面,我们来看看应用代码: ``` #!/usr/bin/env python """ Author: Jose Vicente Nunez """ from typing import Any, List from rich.style import Style from textual import on from textual.app import ComposeResult, App from textual.command import Provider from textual.screen import ModalScreen, Screen from textual.widgets import DataTable, Footer, Header MY_DATA = [ ("level", "name", "gender", "country", "age"), ("Green", "Wai", "M", "MYS", 22), ("Red", "Ryoji", "M", "JPN", 30), ("Purple", "Fabio", "M", "ITA", 99), ("Blue", "Manuela", "F", "VEN", 25) ] class DetailScreen(ModalScreen): ENABLE_COMMAND_PALETTE = False CSS_PATH = "details_screen.tcss" def __init__( self, name: str | None = None, ident: str | None = None, classes: str | None = None, row: List[Any] | None = None, ): super().__init__(name, ident, classes) # Rest of screen code will be show later class CustomCommand(Provider): def __init__(self, screen: Screen[Any], match_style: Style | None = None): super().__init__(screen, match_style) self.table = None # Rest of provider code will be show later class CompetitorsApp(App): BINDINGS = [ ("q", "quit_app", "Quit"), ] CSS_PATH = "competitors_app.tcss" # Enable the command palette, to add our custom filter commands ENABLE_COMMAND_PALETTE = True # Add the default commands and the TablePopulateProvider to get a row directly by name COMMANDS = App.COMMANDS | {CustomCommand} def action_quit_app(self): self.exit(0) def compose(self) -> ComposeResult: yield Header(show_clock=True) table = DataTable(id=f'competitors_table') table.cursor_type = 'row' table.zebra_stripes = True table.loading = True yield table yield Footer() def on_mount(self) -> None: table = self.get_widget_by_id(f'competitors_table', expect_type=DataTable) columns = [x.title() for x in MY_DATA[0]] table.add_columns(*columns) table.add_rows(MY_DATA[1:]) table.loading = False table.tooltip = "Select a row to get more details" @on(DataTable.HeaderSelected) def on_header_clicked(self, event: DataTable.HeaderSelected): table = event.data_table table.sort(event.column_key) @on(DataTable.RowSelected) def on_row_clicked(self, event: DataTable.RowSelected) -> None: table = event.data_table row = table.get_row(event.row_key) runner_detail = DetailScreen(row=row) self.show_detail(runner_detail) def show_detail(self, detailScreen: DetailScreen): self.push_screen(detailScreen) def main(): app = CompetitorsApp() app.title = f"Summary".title() app.sub_title = f"{len(MY_DATA)} users" app.run() if __name__ == "__main__": main() ``` 有哪些部分值得我们关注呢? 1. `compose` 方法中添加了 [表头](https://textual.textualize.io/widgets/header/),“命令面板” 就位于此处,我们的表格([DataTable](https://textual.textualize.io/widgets/data_table/#guide))也在这里。表格数据在 `mount` 方法中填充。 2. 我们设定了预期的绑定(`BINDINGS`),并指定了外部的 CSS 文件来设置样式(`CSS_PATH`)。 3. 默认情况下,我们无需任何设置便能使用 [命令面板](https://textual.textualize.io/guide/command_palette/),但在此我们显式启用了它(`ENABLE_COMMAND_PALETTE = True`)。 4. 我们的应用有一个自定义表格搜索功能。当用户输入一名选手的名字后,应用会显示可能的匹配项,用户可以点击匹配项查看该选手的详细信息。这需要告诉应用我们有一个定制的命令提供者(`COMMANDS = App.COMMANDS | {CustomCo_ mmand}`),即类 `CustomCommand(Provider)`。 5. 如果用户点击了表头,表格内容会按照该列进行排序。这是通过 `on_header_clicked` 方法实现的,该方法上具有 `@on(DataTable.HeaderSelected)` 注解。 6. 类似地,当选中表格中的一行时, `on_row_clicked` 方法会被调用,这得益于它拥有 `@on(DataTable.RowSelected)` 注解。当方法接受选中的行后,它会推送一个新的屏幕,显示选中行的详细信息(`class DetailScreen(ModalScreen)`)。 现在,我们详细地探讨一下如何显示选手的详细信息。 #### 利用多屏展示复杂视图 ![](/data/attachment/album/202401/15/110439ot0st0qqqzc395am.svg) 当用户选择表格中的一行,`on_row_clicked` 方法就会被调用。它收到的是一个 `DataTable.RowSelected` 类型的事件。从这里我们会用选中的行的内容构建一个 `DetailScreen(ModalScreen)` 类的实例: ``` from typing import Any, List from textual import on from textual.app import ComposeResult from textual.screen import ModalScreen from textual.widgets import Button, MarkdownViewer MY_DATA = [ ("level", "name", "gender", "country", "age"), ("Green", "Wai", "M", "MYS", 22), ("Red", "Ryoji", "M", "JPN", 30), ("Purple", "Fabio", "M", "ITA", 99), ("Blue", "Manuela", "F", "VEN", 25) ] class DetailScreen(ModalScreen): ENABLE_COMMAND_PALETTE = False CSS_PATH = "details_screen.tcss" def __init__( self, name: str | None = None, ident: str | None = None, classes: str | None = None, row: List[Any] | None = None, ): super().__init__(name, ident, classes) self.row: List[Any] = row def compose(self) -> ComposeResult: self.log.info(f"Details: {self.row}") columns = MY_DATA[0] row_markdown = "\n" for i in range(0, len(columns)): row_markdown += f"* **{columns[i].title()}:** {self.row[i]}\n" yield MarkdownViewer(f"""## User details: {row_markdown} """) button = Button("Close", variant="primary", id="close") button.tooltip = "Go back to main screen" yield button @on(Button.Pressed, "#close") def on_button_pressed(self, _) -> None: self.app.pop_screen() ``` 这个类的职责很直接: 1. `compose` 方法取得此行数据,并利用一个 [支持 Markdown 渲染的组件](https://textual.textualize.io/widget_gallery/#markdownviewer) 来展示内容。它的便利之处在于,它会为我们自动生成一个内容目录。 2. 当用户点击 “close” 后,方法 `on_button_pressed` 会引导应用回到原始屏幕。注解 `@on(Button.Pressed, "#close")` 用来接收按键被点击的事件。 最后,我们来详细讲解一下那个多功能的搜索栏(也叫做命令面板)。 #### 命令面板的搜索功能 ![](/data/attachment/album/202401/15/110440xepv8skxe8ueuu8e.svg) 任何使用了表头的 Textual 应用都默认开启了 [命令面板](https://textual.textualize.io/guide/command_palette/)。有意思的是,你可以在 `CompetitorsApp` 类中添加自定义的命令,这会增加到默认命令集之上: ``` COMMANDS = App.COMMANDS | {CustomCommand} ``` 然后是执行大部分任务的 `CustomCommand(Provider)` 类: ``` from functools import partial from typing import Any, List from rich.style import Style from textual.command import Provider, Hit from textual.screen import ModalScreen, Screen from textual.widgets import DataTable from textual.app import App class CustomCommand(Provider): def __init__(self, screen: Screen[Any], match_style: Style | None = None): super().__init__(screen, match_style) self.table = None async def startup(self) -> None: my_app = self.app my_app.log.info(f"Loaded provider: CustomCommand") self.table = my_app.query(DataTable).first() async def search(self, query: str) -> Hit: matcher = self.matcher(query) my_app = self.screen.app assert isinstance(my_app, CompetitorsApp) my_app.log.info(f"Got query: {query}") for row_key in self.table.rows: row = self.table.get_row(row_key) my_app.log.info(f"Searching {row}") searchable = row[1] score = matcher.match(searchable) if score > 0: runner_detail = DetailScreen(row=row) yield Hit( score, matcher.highlight(f"{searchable}"), partial(my_app.show_detail, runner_detail), help=f"Show details about {searchable}" ) class DetailScreen(ModalScreen): def __init__( self, name: str | None = None, ident: str | None = None, classes: str | None = None, row: List[Any] | None = None, ): super().__init__(name, ident, classes) # Code of this class explained on the previous section class CompetitorsApp(App): # Add the default commands and the TablePopulateProvider to get a row directly by name COMMANDS = App.COMMANDS | {CustomCommand} # Most of the code shown before, only displaying relevant code def show_detail(self, detailScreen: DetailScreen): self.push_screen(detailScreen) ``` 1. 所有继承自 `Provider` 的类需实现 `search` 方法。在我们的例子中,我们还覆盖了 `startup` 方法,为了获取到我们应用表格(和其内容)的引用,这里使用到了 `App.query(DataTable).first()`。在类的生命周期中, `startup` 方法只会被调用一次。 2. 在 `search` 方法内,我们使用 `Provider.matcher` 对每个表格行的第二列(即名字)进行模糊搜索,以与用户在 TUI 中输入的词条进行比较。`matcher.match(searchable)` 返回一个整型的评分,大于零说明匹配成功。 3. 在 `search` 方法中,如果评分大于零,则返回一个 `Hit` 对象,以告知命令面板搜索查询是否成功。 4. 每个 `Hit` 都有以下信息:评分(用于在命令面板中对匹配项排序)、高亮显示的搜索词、一个可调用对象的引用(在我们的案例中,它是一个可以将表格行推送到新屏幕的函数)。 5. `Provider` 类的所有方法都是异步的。这使你能释放主线程,只有当响应准备好后才返回结果,这个过程不会冻结用户界面。 理解了这些信息,我们就可以现在展示赛手的详细信息了。 尽管这个架构的追踪功能相对直观,但是组件间传递的消息复杂性不可忽视。幸运的是,Textual 提供了有效的调试工具帮助我们理解背后的工作原理。 ### Textual 应用的问题排查 对于 Python 的 Textual 应用进行 [调试](https://github.com/josevnz/tutorials/blob/main/docs/PythonDebugger/README.md) 相较而言更具挑战性。这是因为其中有一些操作可能是异步的,而在解决组件问题时设置断点可能颇为复杂。 根据具体情况,你可以使用一些工具。但首先,确保你已经安装了 textual 的开发工具: ``` pip install textual-dev==1.3.0 ``` #### 确保你能捕捉到正确的按键 不确定 Textual 应用是否能捕捉到你的按键操作?运行 keys 应用: ``` textual keys ``` 这让你能够验证一下你的按键组合,并确认在 Textual 中产生了哪些事件。 #### 图片比千言万语更直观 如果说你在布局设计上遇到了问题,想向他人展示你当前的困境,Textual 为你的运行应用提供了截图功能: ``` textual run --screenshot 5 ./kodegeek_textualize/log_scroller.py ``` 就像你所看到的,我是通过这种方式为这篇教程创建了插图。 #### 捕获事件并输出定制消息 在 Textual 中,每一个应用实例都有一个日志记录器,可以使用如下方式访问: ``` my_app = self.screen.app my_app.log.info(f"Loaded provider: CustomCommand") ``` 想要查看这些消息,首先需要开启一个控制台: ``` . ~/virtualenv/Textualize/bin/activate textual console ``` 然后在另一个终端运行你的应用程序: ``` . ~/virtualenv/Textualize/bin/activate textual run --dev ./kodegeek_textualize/log_scroller.py ``` 在运行控制台的终端中,你可以看到实时的事件和消息输出: ``` ▌Textual Development Console v0.46.0 ▌Run a Textual app with textual run --dev my_app.py to connect. ▌Press Ctrl+C to quit. ─────────────────────────────────────────────────────────────────────────────── Client '127.0.0.1' connected ──────────────────────────────────────────────────────────────────────────────── [20:29:43] SYSTEM app.py:2188 Connected to devtools ( ws://127.0.0.1:8081 ) [20:29:43] SYSTEM app.py:2192 --- [20:29:43] SYSTEM app.py:2194 driver=<class 'textual.drivers.linux_driver.LinuxDriver'> [20:29:43] SYSTEM app.py:2195 loop=<_UnixSelectorEventLoop running=True closed=False debug=False> [20:29:43] SYSTEM app.py:2196 features=frozenset({'debug', 'devtools'}) [20:29:43] SYSTEM app.py:2228 STARTED FileMonitor({PosixPath('/home/josevnz/TextualizeTutorial/docs/Textualize/kodegeek_textualize/os_app.tcss')}) [20:29:43] EVENT ``` 此外,以开发者模式运行的另一大好处是,如果你更改了 CSS,应用会尝试重新渲染,而无需重启程序。 ### 如何编写单元测试 为你全新开发的 Textual 应用编写 [单元测试](https://docs.python.org/3/library/unittest.html),应该如何操作呢? 在 [官方文档](https://textual.textualize.io/guide/testing/) 展示了几种用于测试我们应用的方式。 我将采用 [unittest](https://docs.python.org/3/library/unittest.html) 进行测试。为了处理异步例程,我们会需要特别的类 `unittest.IsolatedAsyncioTestCase` : ``` import unittest from textual.widgets import Log, Button from kodegeek_textualize.log_scroller import OsApp class LogScrollerTestCase(unittest.IsolatedAsyncioTestCase): async def test_log_scroller(self): app = OsApp() self.assertIsNotNone(app) async with app.run_test() as pilot: # Execute the default commands await pilot.click(Button) await pilot.pause() event_log = app.screen.query(Log).first() # We pushed the screen, query nodes from there self.assertTrue(event_log.lines) await pilot.click("#close") # Close the new screen, pop the original one await pilot.press("q") # Quit the app by pressing q if __name__ == '__main__': unittest.main() ``` 现在让我们详细看看 `test_log_scroller` 方法中的操作步骤: 1. 通过 `app.run_test()` 获取一个 `Pilot` 实例。然后点击主按钮,运行包含默认指令的查询,随后等待所有事件的处理。 2. 从我们新推送出的屏幕中获取 `Log`,确保我们已获得几行返回的内容,即它并非空的。 3. 关闭新屏幕并重新呈现旧屏幕。 4. 最后,按下 `q`,退出应用。 可以测试表格吗? ``` import unittest from textual.widgets import DataTable, MarkdownViewer from kodegeek_textualize.table_with_detail_screen import CompetitorsApp class TableWithDetailTestCase(unittest.IsolatedAsyncioTestCase): async def test_app(self): app = CompetitorsApp() self.assertIsNotNone(app) async with app.run_test() as pilot: """ Test the command palette """ await pilot.press("ctrl+\\") for char in "manuela".split(): await pilot.press(char) await pilot.press("enter") markdown_viewer = app.screen.query(MarkdownViewer).first() self.assertTrue(markdown_viewer.document) await pilot.click("#close") # Close the new screen, pop the original one """ Test the table """ table = app.screen.query(DataTable).first() coordinate = table.cursor_coordinate self.assertTrue(table.is_valid_coordinate(coordinate)) await pilot.press("enter") await pilot.pause() markdown_viewer = app.screen.query(MarkdownViewer).first() self.assertTrue(markdown_viewer) # Quit the app by pressing q await pilot.press("q") if __name__ == '__main__': unittest.main() ``` 如果你运行所有的测试,你将看到如下类似的输出: ``` (Textualize) [josevnz@dmaf5 Textualize]$ python -m unittest tests/*.py .. ---------------------------------------------------------------------- Ran 2 tests in 2.065s OK ``` 这是测试 TUI 的一个不错的方式,对吧? ### 打包 Textual 应用 打包 Textual 应用与打包常规 Python 应用并没有太大区别。你需要记住,需要包含那些控制应用外观的 CSS 文件: ``` . ~/virtualenv/Textualize/bin/activate python -m build pip install dist/KodegeekTextualize-*-py3-none-any.whl ``` 这个教程的 [pyproject.toml](https://tutorials.kodegeek.com/Textualize/pyproject.toml) 文件是一个打包应用的良好起点,告诉你需要做什么。 ``` [build-system] requires = [ "setuptools >= 67.8.0", "wheel>=0.42.0", "build>=1.0.3", "twine>=4.0.2", "textual-dev>=1.2.1" ] build-backend = "setuptools.build_meta" [project] name = "KodegeekTextualize" version = "0.0.3" authors = [ {name = "Jose Vicente Nunez", email = "[email protected]"}, ] description = "Collection of scripts that show how to use several features of textualize" readme = "README.md" requires-python = ">=3.9" keywords = ["running", "race"] classifiers = [ "Environment :: Console", "Development Status :: 4 - Beta", "Programming Language :: Python :: 3", "Intended Audience :: End Users/Desktop", "Topic :: Utilities" ] dynamic = ["dependencies"] [project.scripts] log_scroller = "kodegeek_textualize.log_scroller:main" table_detail = "kodegeek_textualize.table_with_detail_screen:main" [tool.setuptools] include-package-data = true [tool.setuptools.packages.find] where = ["."] exclude = ["test*"] [tool.setuptools.package-data] kodegeek_textualize = ["*.txt", "*.tcss", "*.csv"] img = ["*.svg"] [tool.setuptools.dynamic] dependencies = {file = ["requirements.txt"]} ``` ### 未来计划 这个简短的教程只覆盖了 Textual 的部分方面。还有很多需要探索和学习的内容: * 强烈建议你查看 [官方教程](https://textual.textualize.io/tutorial/)。有大量的示例和指向参考 [API](https://textual.textualize.io/api/) 的链接。 * Textual 可以使用来自 [Rich](https://github.com/Textualize/rich) 项目的组件,这个项目是一切的起源。我认为其中一些甚至可能所有这些组件在某些时候都会合并到 Textual 中。Textual 框架对于使用高级 API 的复杂应用更能胜任,但 Rich 也有很多漂亮的功能。 * 创建你自己的组件!同样,在设计 TUI 时,[拿一张纸,画出你希望这些组件如何布局的](https://textual.textualize.io/how-to/design-a-layout/),这会为你后期省去很多时间和麻烦。 * 调试 Python 应用可能会有点复杂。有时你可能需要 [混合使用不同的工具](https://github.com/josevnz/DebuggingApplications/blob/main/StracePythonWireshark/README.md) 来找出应用的问题所在。 * 异步 IO 是一个复杂的话题,你应该 [阅读开发者文档](https://docs.python.org/3/library/asyncio-dev.html) 来了解更多可能的选择。 * Textual 被其他项目所使用。其中一个非常易于使用的项目是 [Trogon](https://github.com/Textualize/trogon)。[它会让你的 CLI 可以自我发现](https://github.com/josevnz/CLIWithClickAndTrogon/blob/main/README.md)。 * [Textual-web](https://github.com/Textualize/textual-web) 是个很有前景的项目,能让你在浏览器上运行 Textual 应用。尽管它不如 Textual 成熟,但它的进化速度非常快。 * 最后,[查看这些外部项目](https://www.textualize.io/projects/)。在项目组合中有许多有用的开源应用。 *(题图:DA/f11b0eb0-8e16-4cbe-986a-0fe978f6732a)* --- via: <https://fedoramagazine.org/crash-course-on-using-textual/> 作者:[Jose Nunez](https://fedoramagazine.org/author/josevnz/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[ChatGPT](https://linux.cn/lctt/ChatGPT) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
# Crash course on using Textual Python on Linux has nice GUI (Graphic User Interface) development libraries like [TkInter](https://docs.python.org/3/library/tkinter.html), but what if you cannot run graphical applications? Text terminals, are available on not just Linux but BSD and other great Unix-like operating systems. If you write code in Python, you should be using [Textual](https://textual.textualize.io/) to help you write TUI (*Text User Interfaces*). In this quick introduction, I will show you two examples of what you can do with Textual and where you can go after that. So what is Textual? Textual is a Rapid Application Development framework for Python, built by Textualize.io. Build sophisticated user interfaces with a simple Python API. Run your apps in the terminal or a web browser! ## What you need to follow this tutorial You will need the following: - Basic programming experience, preferable in Python. - Understanding basic object oriented concepts like classes and inheritance - A machine with Linux and Python 3.9+ installed - A good editor (Vim or PyCharm are good choices) I tried to keep the code simple, so you can follow it. Also, I strongly recommend you download the code or at least install the programs as explained next. ## Installation First create a virtual environment: python3 -m venv ~/virtualenv/Textualize Now you can either clone the Git repository and make an editable distribution: . ~/virtualenv/Textualize/bin/activate pip install --upgrade pip pip install --upgrade wheel pip install --upgrade build pip install --editable . Or just Install from Pypi.org: . ~/virtualenv/Textualize/bin/activate pip install --upgrade KodegeekTextualize ## Our first application: A log scroller The *log scroller *is a simple application that executes a list of UNIX commands that are on the * PATH* and captures the output as they finish. The resulting application code: import shutil from textual import on from textual.app import ComposeResult, App from textual.widgets import Footer, Header, Button, SelectionList from textual.widgets.selection_list import Selection from textual.screen import ModalScreen # Operating system commands are hardcoded OS_COMMANDS = { "LSHW": ["lshw", "-json", "-sanitize", "-notime", "-quiet"], "LSCPU": ["lscpu", "--all", "--extended", "--json"], "LSMEM": ["lsmem", "--json", "--all", "--output-all"], "NUMASTAT": ["numastat", "-z"] } class LogScreen(ModalScreen): # ... Code of the full separate screen omitted, will be explained next def __init__(self, name = None, ident = None, classes = None, selections = None): super().__init__(name, ident, classes) pass class OsApp(App): BINDINGS = [ ("q", "quit_app", "Quit"), ] CSS_PATH = "os_app.tcss" ENABLE_COMMAND_PALETTE = False # Do not need the command palette def action_quit_app(self): self.exit(0) def compose(self) -> ComposeResult: # Create a list of commands, valid commands are assumed to be on the PATH variable. selections = [Selection(name.title(), ' '.join(cmd), True) for name, cmd in OS_COMMANDS.items() if shutil.which(cmd[0].strip())] yield Header(show_clock=False) sel_list = SelectionList(*selections, id='cmds') sel_list.tooltip = "Select one more more command to execute" yield sel_list yield Button(f"Execute {len(selections)} commands", id="exec", variant="primary") yield Footer() @on(SelectionList.SelectedChanged) def on_selection(self, event: SelectionList.SelectedChanged) -> None: button = self.query_one("#exec", Button) selections = len(event.selection_list.selected) if selections: button.disabled = False else: button.disabled = True button.label = f"Execute {selections} commands" @on(Button.Pressed) def on_button_click(self): selection_list = self.query_one('#cmds', SelectionList) selections = selection_list.selected log_screen = LogScreen(selections=selections) self.push_screen(log_screen) def main(): app = OsApp() app.title = f"Output of multiple well known UNIX commands".title() app.sub_title = f"{len(OS_COMMANDS)} commands available" app.run() if __name__ == "__main__": main() Let’s quickly dissect the code for the application: - An application extends the class *App*. It has several methods but the most important are*compose*and*mount*. Only[compose](https://textual.textualize.io/tutorial/#composing-the-widgets)is implemented in this app. - In *compose*, you yield back Widgets, and they get added in the same order to the main screen. Each[Widget](https://textual.textualize.io/widget_gallery/)has options to customize their appearance. - You can define single letter [bindings](https://textual.textualize.io/api/binding/), in this case the letter ‘q’ allows you to exit the application (see the function*action_quit_app*and the BINDINGS list) - We display the list of commands to run using a *SelectionList widget*. You can then tell your application to capture what was selected by using the annotation*@on(SelectionList.SelectedChanged)*and the method*on_selection*. - It is important to react to a lack of selected elements, we disable or enable the ‘exec’ button depending on how many commands were selected to run. - A similar listener ( *@on(Button.Pressed)*) is used to execute the commands. We do that by pushing our selection to a[new screen](https://textual.textualize.io/guide/screens/)that handles the execution and collection of results. Notice the *CSS_PATH = “os_app.tcss”* variable? Textual allows you to control the appearance (colors, position, size) of individual or classes of widgets using CSS: Screen { layout: vertical; } Header { dock: top; } Footer { dock: bottom; } SelectionList { padding: 1; border: solid $accent; width: 1fr; height: 80%; } Button { width: 1fr } Quoting from the Textual website: The dialect of CSS used in Textual is greatly simplified over web based CSS and much easier to learn. *This is great*, as you can customize the appearance of your application using a separate [stylesheet](https://textual.textualize.io/guide/styles/) without too much effort. Let’s now look at how to display the results on a separate screen. ### Display results on a separate screen The code that handles the output on a separate screen is here: import asyncio from typing import List from textual import on, work from textual.reactive import reactive from textual.screen import ModalScreen from textual.widgets import Button, Label, Log from textual.worker import Worker from textual.app import ComposeResult class LogScreen(ModalScreen): count = reactive(0) MAX_LINES = 10_000 ENABLE_COMMAND_PALETTE = False CSS_PATH = "log_screen.tcss" def __init__( self, name: str | None = None, ident: str | None = None, classes: str | None = None, selections: List = None ): super().__init__(name, ident, classes) self.selections = selections def compose(self) -> ComposeResult: yield Label(f"Running {len(self.selections)} commands") event_log = Log( id='event_log', max_lines=LogScreen.MAX_LINES, highlight=True ) event_log.loading = True yield event_log button = Button("Close", id="close", variant="success") button.disabled = True yield button async def on_mount(self) -> None: event_log = self.query_one('#event_log', Log) event_log.loading = False event_log.clear() lst = '\n'.join(self.selections) event_log.write(f"Preparing:\n{lst}") event_log.write("\n") for command in self.selections: self.count += 1 self.run_process(cmd=command) def on_worker_state_changed(self, event: Worker.StateChanged) -> None: if self.count == 0: button = self.query_one('#close', Button) button.disabled = False self.log(event) @work(exclusive=False) async def run_process(self, cmd: str) -> None: event_log = self.query_one('#event_log', Log) event_log.write_line(f"Running: {cmd}") # Combine STDOUT and STDERR output proc = await asyncio.create_subprocess_shell( cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.STDOUT ) stdout, _ = await proc.communicate() if proc.returncode != 0: raise ValueError(f"'{cmd}' finished with errors ({proc.returncode})") stdout = stdout.decode(encoding='utf-8', errors='replace') if stdout: event_log.write(f'\nOutput of "{cmd}":\n') event_log.write(stdout) self.count -= 1 @on(Button.Pressed, "#close") def on_button_pressed(self, _) -> None: self.app.pop_screen() You will notice the following: - The *LogScreen*class extends*ModalScreen*which handles screens in modal mode. - The screen also has a compose method where we add widgets to show the contents of the Unix commands. - We have a new method called *mount*. Once you ‘*compose*’ the widgets then you can run code to retrieve data and customize their appearance even further - To run the commands we use [asyncio](https://docs.python.org/3/library/asyncio.html), so we give the TUI main worker thread a chance to update the contents as soon as results for each command are known. - On the ‘ *workers*’ topic, please note the*@work(exclusive=False)*annotation on the*run_process*method used to run the commands and capture the STDOUT + STDERR output. Using[workers](https://textual.textualize.io/guide/workers/)to manage concurrency is not complicated, but they do have a dedicated section in the manual. This extra complexity arises because we are running external commands that may or may not take a long time to complete. - In *run_proces*s we update the*event_log*by calling*write*with the contents of the command output. - Finally, the *on_button_pressed*takes us back to the previous screen (pop the screen from the stack). This little app shows you how to write a simple front end to run non-python code, in less than 200 lines of code. Now let’s move to a more complex example that uses new features of Textual we haven’t explored yet. ## Second example: A table with race results This example shows you how to display race results in a table (Using a *DataTable* widget). The application allows you to: - Sort a table by column - Select a row to show race details in a full window, using the same ‘ *push screen*’ technique we saw in the log scroll application. - Search the table and show racer details or run other commands like exit the application. Let’s see the application code then: #!/usr/bin/env python """ Author: Jose Vicente Nunez """ from typing import Any, List from rich.style import Style from textual import on from textual.app import ComposeResult, App from textual.command import Provider from textual.screen import ModalScreen, Screen from textual.widgets import DataTable, Footer, Header MY_DATA = [ ("level", "name", "gender", "country", "age"), ("Green", "Wai", "M", "MYS", 22), ("Red", "Ryoji", "M", "JPN", 30), ("Purple", "Fabio", "M", "ITA", 99), ("Blue", "Manuela", "F", "VEN", 25) ] class DetailScreen(ModalScreen): ENABLE_COMMAND_PALETTE = False CSS_PATH = "details_screen.tcss" def __init__( self, name: str | None = None, ident: str | None = None, classes: str | None = None, row: List[Any] | None = None, ): super().__init__(name, ident, classes) # Rest of screen code will be show later class CustomCommand(Provider): def __init__(self, screen: Screen[Any], match_style: Style | None = None): super().__init__(screen, match_style) self.table = None # Rest of provider code will be show later class CompetitorsApp(App): BINDINGS = [ ("q", "quit_app", "Quit"), ] CSS_PATH = "competitors_app.tcss" # Enable the command palette, to add our custom filter commands ENABLE_COMMAND_PALETTE = True # Add the default commands and the TablePopulateProvider to get a row directly by name COMMANDS = App.COMMANDS | {CustomCommand} def action_quit_app(self): self.exit(0) def compose(self) -> ComposeResult: yield Header(show_clock=True) table = DataTable(id=f'competitors_table') table.cursor_type = 'row' table.zebra_stripes = True table.loading = True yield table yield Footer() def on_mount(self) -> None: table = self.get_widget_by_id(f'competitors_table', expect_type=DataTable) columns = [x.title() for x in MY_DATA[0]] table.add_columns(*columns) table.add_rows(MY_DATA[1:]) table.loading = False table.tooltip = "Select a row to get more details" @on(DataTable.HeaderSelected) def on_header_clicked(self, event: DataTable.HeaderSelected): table = event.data_table table.sort(event.column_key) @on(DataTable.RowSelected) def on_row_clicked(self, event: DataTable.RowSelected) -> None: table = event.data_table row = table.get_row(event.row_key) runner_detail = DetailScreen(row=row) self.show_detail(runner_detail) def show_detail(self, detailScreen: DetailScreen): self.push_screen(detailScreen) def main(): app = CompetitorsApp() app.title = f"Summary".title() app.sub_title = f"{len(MY_DATA)} users" app.run() if __name__ == "__main__": main() What is interesting here?: - compose adds the [header](https://textual.textualize.io/widgets/header/)where the ‘*command palette*’ will live, as well our table ([DataTable](https://textual.textualize.io/widgets/data_table/#guide)). The table gets populated in the mount method. - We have the expected bindings (BINDINGS) and external CSS for appearance (CSS_PATH) - By default, if we want to have the [command palette](https://textual.textualize.io/guide/command_palette/)we do nothing, but it is explicitly enabled here (*ENABLE_COMMAND_PALETTE = True*) - Our application has a custom search in the table contents. When the user types a name, a possible match is shown and the user clicks it to display the details for that racer. This requires telling the application that we have a custom provider ( *COMMANDS = App.COMMANDS | {CustomCo*mmand}), which is the class*CustomCommand(Provider)* - If the user clicks a table header, the contents are sorted by that header. This is done using *on_header_clicked*which is annotated with*@on(DataTable.HeaderSelected)* - Similarly, when a row is selected, the method *on_row_clicked*is called thanks to the annotation*@on(DataTable.RowSelected)*. The method receives the selected row that is then used to push a new screen with details (*class DetailScreen(ModalScreen)*) Now let’s explore in detail how the racer details are shown ### Using screens to show more complex views When the user selects a row, the method *on_row_clicked* gets called. It receives an event of type *DataTable.RowSelected*. From there we construct an instance of class *DetailScreen(ModalScreen) *with the contents of the selected row: from typing import Any, List from textual import on from textual.app import ComposeResult from textual.screen import ModalScreen from textual.widgets import Button, MarkdownViewer MY_DATA = [ ("level", "name", "gender", "country", "age"), ("Green", "Wai", "M", "MYS", 22), ("Red", "Ryoji", "M", "JPN", 30), ("Purple", "Fabio", "M", "ITA", 99), ("Blue", "Manuela", "F", "VEN", 25) ] class DetailScreen(ModalScreen): ENABLE_COMMAND_PALETTE = False CSS_PATH = "details_screen.tcss" def __init__( self, name: str | None = None, ident: str | None = None, classes: str | None = None, row: List[Any] | None = None, ): super().__init__(name, ident, classes) self.row: List[Any] = row def compose(self) -> ComposeResult: self.log.info(f"Details: {self.row}") columns = MY_DATA[0] row_markdown = "\n" for i in range(0, len(columns)): row_markdown += f"* **{columns[i].title()}:** {self.row[i]}\n" yield MarkdownViewer(f"""## User details: {row_markdown} """) button = Button("Close", variant="primary", id="close") button.tooltip = "Go back to main screen" yield button @on(Button.Pressed, "#close") def on_button_pressed(self, _) -> None: self.app.pop_screen() The responsibility of this class is very simple: - Method *compose*takes the row and displays the content using a[widget that knows how to render Markdown](https://textual.textualize.io/widget_gallery/#markdownviewer). Pretty neat as it creates a table of contents for us. - The method *on_button_pressed*pops back the original screen once the user clicks ‘close’. (Annotation*@on(Button.Pressed, “#close”)*takes care of receiving pressed events) Now the last bit of the puzzle, which requires more explanation, the multipurpose search bar (known as command palette). ### You can search too, using the command palette The [command palette](https://textual.textualize.io/guide/command_palette/) is enabled by default on every Textual application that uses a header. The fun part is that you can add your own commands in addition to the default commands, on class *CompetitorsApp*: COMMANDS = App.COMMANDS | {CustomCommand} And now the class that does all the heavy lifting, *CustomCommand(Provider)*: from functools import partial from typing import Any, List from rich.style import Style from textual.command import Provider, Hit from textual.screen import ModalScreen, Screen from textual.widgets import DataTable from textual.app import App class CustomCommand(Provider): def __init__(self, screen: Screen[Any], match_style: Style | None = None): super().__init__(screen, match_style) self.table = None async def startup(self) -> None: my_app = self.app my_app.log.info(f"Loaded provider: CustomCommand") self.table = my_app.query(DataTable).first() async def search(self, query: str) -> Hit: matcher = self.matcher(query) my_app = self.screen.app assert isinstance(my_app, CompetitorsApp) my_app.log.info(f"Got query: {query}") for row_key in self.table.rows: row = self.table.get_row(row_key) my_app.log.info(f"Searching {row}") searchable = row[1] score = matcher.match(searchable) if score > 0: runner_detail = DetailScreen(row=row) yield Hit( score, matcher.highlight(f"{searchable}"), partial(my_app.show_detail, runner_detail), help=f"Show details about {searchable}" ) class DetailScreen(ModalScreen): def __init__( self, name: str | None = None, ident: str | None = None, classes: str | None = None, row: List[Any] | None = None, ): super().__init__(name, ident, classes) # Code of this class explained on the previous section class CompetitorsApp(App): # Add the default commands and the TablePopulateProvider to get a row directly by name COMMANDS = App.COMMANDS | {CustomCommand} # Most of the code shown before, only displaying relevant code def show_detail(self, detailScreen: DetailScreen): self.push_screen(detailScreen) - Any class extending *Provider*only needs to implement the method*search*. In our case we do also override the method*startup*to get a reference to our application table (and its contents), using the*App.query(DataTable).first()*.*startup*gets called only once in the lifetime of the instantiated class. - Inside the *search*method we use the*Provider.matcher*to do a fuzzy search on the second column (name) of each table row comparing with the query (which is the term passed by the user on the TUI). The*matcher.match(searchable)*returns an integer score, where greater than zero indicates a match. - Inside *search*if the score is greater than zero then it returns a*Hit*object that tell the command palette if the search query was successful or not. - Each *Hit*has the following information: score (used for sorting matches on the palette command), a highlighted search term, a reference to a callable (that’s it in our case a function that will push our table row to a new screen) - All the methods of the Provider class are async. This allows you to free the main worker thread and only return once the response is ready to be used (no frozen UI). With all that information we can now display the racer details. While the framework is simple enough to follow there is also a lot of complexity on the messages passed back and forth between the components. Luckily for us Textual has a nice debugging framework that will help us understand what is going on behind scenes. ## Troubleshooting a Textual application [Debugging](https://github.com/josevnz/tutorials/blob/main/docs/PythonDebugger/README.md) a Python Textual application is a little bit more challenging. This is because some operations can be asynchronous and setting breakpoints may be cumbersome when troubleshooting widgets. Depending on the situation, there are some tools you can use. But first make sure you have the textual dev tools: pip install textual-dev==1.3.0 ### Make sure you are capturing the right keys You are not sure what keys are being captured by a Textual application? Run the key app: textual keys This lets you can press your key combinations and confirm what events are generated in Textual. ### A picture is worth more than a thousand words Say that you have a problem placing components on a layout, and you want to show others where you are stuck. Textual allows you to take a screenshot of your running application: textual run --screenshot 5 ./kodegeek_textualize/log_scroller.py That’s how I created the images for this tutorial. ### Capturing events and printing custom messages Textual has a logger that is part of every instance of an Application: my_app = self.screen.app my_app.log.info(f"Loaded provider: CustomCommand") In order to see the messages, you first need to start a console: . ~/virtualenv/Textualize/bin/activate textual console Then in another terminal run your application . ~/virtualenv/Textualize/bin/activate textual run --dev ./kodegeek_textualize/log_scroller.py You will see now events and messages flowing into the terminal where the console is running: ▌Textual Development Console v0.46.0 ▌Run a Textual app with textual run --dev my_app.py to connect. ▌Press Ctrl+C to quit. ─────────────────────────────────────────────────────────────────────────────── Client '127.0.0.1' connected ──────────────────────────────────────────────────────────────────────────────── [20:29:43] SYSTEM app.py:2188 Connected to devtools ( ws://127.0.0.1:8081 ) [20:29:43] SYSTEM app.py:2192 --- [20:29:43] SYSTEM app.py:2194 driver=<class 'textual.drivers.linux_driver.LinuxDriver'> [20:29:43] SYSTEM app.py:2195 loop=<_UnixSelectorEventLoop running=True closed=False debug=False> [20:29:43] SYSTEM app.py:2196 features=frozenset({'debug', 'devtools'}) [20:29:43] SYSTEM app.py:2228 STARTED FileMonitor({PosixPath('/home/josevnz/TextualizeTutorial/docs/Textualize/kodegeek_textualize/os_app.tcss')}) [20:29:43] EVENT Another advantage of running your application in developer mode is that if you change your CSS, the application will try to render again without a restart. ## Writing unit tests What if you want to write [unit tests](https://docs.python.org/3/library/unittest.html) for your brand new Textual application? The documentation [shows there are several ways](https://textual.textualize.io/guide/testing/) to test our application. I will be using [unittest](https://docs.python.org/3/library/unittest.html) for that. We will need the special class, class *unittest.IsolatedAsyncioTestCase*, to handle our asyncio routines: import unittest from textual.widgets import Log, Button from kodegeek_textualize.log_scroller import OsApp class LogScrollerTestCase(unittest.IsolatedAsyncioTestCase): async def test_log_scroller(self): app = OsApp() self.assertIsNotNone(app) async with app.run_test() as pilot: # Execute the default commands await pilot.click(Button) await pilot.pause() event_log = app.screen.query(Log).first() # We pushed the screen, query nodes from there self.assertTrue(event_log.lines) await pilot.click("#close") # Close the new screen, pop the original one await pilot.press("q") # Quit the app by pressing q if __name__ == '__main__': unittest.main() What is happening in the method *test_log_scroller*: - Get a Pilot instance using *app.run_test()*. Then click the main button to run the query with the default commands, and then wait until all the events are processes. - Next get the Log from the new screen we pushed and make sure we got some lines back, it is not empty - Then close the new screen and pop the old one back - Finally, press ‘q’ and exit the application What about the test table, can it be tested?: import unittest from textual.widgets import DataTable, MarkdownViewer from kodegeek_textualize.table_with_detail_screen import CompetitorsApp class TableWithDetailTestCase(unittest.IsolatedAsyncioTestCase): async def test_app(self): app = CompetitorsApp() self.assertIsNotNone(app) async with app.run_test() as pilot: """ Test the command palette """ await pilot.press("ctrl+\\") for char in "manuela".split(): await pilot.press(char) await pilot.press("enter") markdown_viewer = app.screen.query(MarkdownViewer).first() self.assertTrue(markdown_viewer.document) await pilot.click("#close") # Close the new screen, pop the original one """ Test the table """ table = app.screen.query(DataTable).first() coordinate = table.cursor_coordinate self.assertTrue(table.is_valid_coordinate(coordinate)) await pilot.press("enter") await pilot.pause() markdown_viewer = app.screen.query(MarkdownViewer).first() self.assertTrue(markdown_viewer) # Quit the app by pressing q await pilot.press("q") if __name__ == '__main__': unittest.main() If you run all the tests you will see something like this: (Textualize) [josevnz@dmaf5 Textualize]$ python -m unittest tests/*.py .. ---------------------------------------------------------------------- Ran 2 tests in 2.065s OK Not a bad way to test a TUI, is it? ## Packaging a Textual application Packaging is not much different than packaging a regular Python application. You need to remember that you need to include the CSS files that control the appearance of your application: . ~/virtualenv/Textualize/bin/activate python -m build pip install dist/KodegeekTextualize-*-py3-none-any.whl This tutorial [pyproject.toml](https://tutorials.kodegeek.com/Textualize/pyproject.toml) file is a good start that shows you what to do to package your application. [build-system] requires = [ "setuptools >= 67.8.0", "wheel>=0.42.0", "build>=1.0.3", "twine>=4.0.2", "textual-dev>=1.2.1" ] build-backend = "setuptools.build_meta" [project] name = "KodegeekTextualize" version = "0.0.3" authors = [ {name = "Jose Vicente Nunez", email = "[email protected]"}, ] description = "Collection of scripts that show how to use several features of textualize" readme = "README.md" requires-python = ">=3.9" keywords = ["running", "race"] classifiers = [ "Environment :: Console", "Development Status :: 4 - Beta", "Programming Language :: Python :: 3", "Intended Audience :: End Users/Desktop", "Topic :: Utilities" ] dynamic = ["dependencies"] [project.scripts] log_scroller = "kodegeek_textualize.log_scroller:main" table_detail = "kodegeek_textualize.table_with_detail_screen:main" [tool.setuptools] include-package-data = true [tool.setuptools.packages.find] where = ["."] exclude = ["test*"] [tool.setuptools.package-data] kodegeek_textualize = ["*.txt", "*.tcss", "*.csv"] img = ["*.svg"] [tool.setuptools.dynamic] dependencies = {file = ["requirements.txt"]} ## What is next This short tutorial only covers a few aspects of Textual. There is so much more to discover and learn: - You should definitely take a look at the [official tutorial](https://textual.textualize.io/tutorial/). Lots of examples and pointers to the reference[API](https://textual.textualize.io/api/). - Textual can use *widgets*from the project that started it all,[Rich](https://github.com/Textualize/rich). I think some, if not any of these components will get merged into Textual at some point. Textual framework is more capable for complex applications using a high level API, but Rich has lots of nice features. - Make your own widgets! Also while designing the TUI, [grab a piece of paper and draw how you picture the components](https://textual.textualize.io/how-to/design-a-layout/)should align together. It will save you time and headaches later. - Debugging applications in Python can get complicated. Sometimes you may have to [mix different tools](https://github.com/josevnz/DebuggingApplications/blob/main/StracePythonWireshark/README.md)to figure out what is wrong with an application. *Asyncio*is a complex topic, you should[read the developer documentation](https://docs.python.org/3/library/asyncio-dev.html)to see your alternatives.*Textual*is used by other projects. One that is super easy to use is[Trogon](https://github.com/Textualize/trogon). It will[make your CLI self discoverable](https://github.com/josevnz/CLIWithClickAndTrogon/blob/main/README.md).[Textual-web](https://github.com/Textualize/textual-web)is a promising project that will allow you to run Textual applications on a browser. It is less mature than Textual but is evolving really fast.- Finally, [check the external projects](https://www.textualize.io/projects/). There are a lot of useful Open Source applications in the portfolio. ## RG shutil.. Nice. And tbh coming from a direct contact with containers, it took me a while to understand the python environments. Nice that you touched that as well. ## Jose Vicente Nunez Glad that you like it. I can make a docker container for this if you think it will make it easier to try/ use. ## RG Not at all. Much easier and simple to use environments. ## David Frantz Is it me or does this seem like work comparable to using TkInter. Serious question as I’ve little experience with either. ## Jose Vicente Nunez David, It is a good thing than Textual and Tk are so similar. I think Textual is simpler to use, more modern (embraces asyncio) and fact that you can run it on servers with low resources or without graphic environments make this a very attractive tool. There is a place for each, I would not try to spend time generating graphics on a terminal if I can use a graphic environment or we web application. More alternatives is better. ## jgart Great article! What do you think about introducing lockfile for the dependencies into the repo? ## Jose Nunez Hello @jgart, I don’t follow your question, can you elaborate more? ## Jorge Gomez Hi, Are there plans to keep this article up to date as textual changes? I ask because I submitted the article here and the project maintainer wanted to know: https://github.com/davep/transcendent-textual/pull/15#issuecomment-1891526536 ## Jose Nunez Jorge Gomez, I can update the article if people show interest on it, which seems to be the case. Also my GitHub repository has all the code, so a PR is always an option to fix issues
16,558
App Fleet:在 Linux 上实现工作空间自动化的开源应用
https://news.itsfoss.com/app-fleet/
2024-01-15T16:07:49
[ "工作区" ]
https://linux.cn/article-16558-1.html
![](/data/attachment/album/202401/15/160723kzdm578dhzmme3rr.jpg) > > 开源工作区自动化工具。听起来不错! > > > 2024 年刚刚开始,也许你正被需要在不同应用程序中完成的大量工作压得喘不过气来?为什么不使用工作区管理工具来简化工作呢? App Fleet 是**一款全新的开源工作区管理器和启动自动化工具**,主要为 Linux 开发。我必须说,最后一点是你不常听到的! ? 这次,我尝试一下 App Fleet,并与大家分享一下我的经验。 > > ? 该应用相当新,正在积极开发中。它可能会,也可能不会按照你期望的方式工作。 > > > ### App Fleet:主要功能 ⭐ ![](/data/attachment/album/202401/15/160750qzds1k021roz6dse.png) App Fleet 使用 **Flutter 框架** 编写,**针对 GNOME 桌面环境**,并且作为一个相当新的应用,它的开发进展相当顺利,不时定期发布。 一些**关键功能**包括: * 支持大多数应用。 * 直观的用户界面。 * 将应用设置到特定工作空间。 #### ⚙️ 如何安装 App Fleet? ![](/data/attachment/album/202401/15/160751xf1f919zw1ffe059.png) 遗憾的是,App Fleet **没有 Flatpak、Snap、AppImage 或其他流行的打包格式**。 据开发人员称,App Fleet 需要系统范围的读取访问权限,并且使用这些格式对其进行打包对于此类应用来说是不可行的。 **安装 App Fleet 最直接的方法**是运行以下命令(网络安装程序脚本): ``` curl https://raw.githubusercontent.com/omegaui/app_fleet/main/network-install.sh | bash ``` 对于大多数人来说,上述命令是推荐的解决方案。 如果你愿意,你可以从预编译的捆绑包或源代码中安装它。有关更多信息,你可以访问其 [GitHub 仓库](https://github.com/omegaui/app_fleet)。 > > **[App Fleet(GitHub)](https://github.com/omegaui/app_fleet)** > > > #### 初步印象 ?‍? 将其安装到我的 PC 上后,我启动了 App Fleet,然后迎接我的是一个面无表情的幽灵,说这个系统上没有工作区配置。 ![](/data/attachment/album/202401/15/160751h8iy5xxtrzykkzzx.png) 因此,我单击 “<ruby> 马上创建 <rt> Create Now </rt></ruby>” 开始,并为工作区配置指定了一个合适的名称。 ![](/data/attachment/album/202401/15/160751a7ebvy4ewo746uwz.png) 然后我选择了它的图标。它有很多可选图标,也可以自由上传自定义的图标。 ![](/data/attachment/album/202401/15/160752tbxodgv7kaor2ct0.png) 应用选择屏幕列出了我的所有应用,因此我选择了我在工作时经常使用的应用。 ![](/data/attachment/album/202401/15/160752jrfqrgl24mkgwzgg.png) 我还可以**为这些应用提供特定的工作区**,这样它们就可以直接在指定的工作区中启动,从而无需手动放置它们。(这对我来说效果不太好,稍后会详细介绍。) ![](/data/attachment/album/202401/15/160752hfql097r4ljm9ktj.png) 我还可以**从系统或外部存储手动添加应用**,并可以指定名称、设置等待时间等。 ![](/data/attachment/album/202401/15/160753iiqc11wt661ata07.png) 我也可以对添加的应用进行相同的调整。如果你不想被快速连续启动的大量应用淹没,“*等待时间*” 设置可能会很有用。 ![](/data/attachment/album/202401/15/160753ybhvbfrcwws72x6w.png) 设置完所有内容后,我单击右上角的 “保存” 图标来保存我的工作区配置。 ![](/data/attachment/album/202401/15/160754a4yk3ykhky6yy3yi.png) 然后,App Fleet 的主屏幕向我显示了创建的工作区配置。 ![](/data/attachment/album/202401/15/160754umbhz5ddme65hrxe.png) 它还启动了 **App Fleet 启动器** ,这是一个看起来像小部件的东西,让我启动保存的工作区配置。 ![](/data/attachment/album/202401/15/160755igrttj1yddgyddyd.png) 因此,为了测试它的工作原理,我快速重新启动了系统,当我登录系统时,启动器会自动弹出。正如你在下面看到的,**启动器是一个小巧的东西**,并不碍事。 ![](/data/attachment/album/202401/15/160756xvvmeclacwqmz7lz.gif) 但是,你可能已经注意到,**应用没有在我设置它们启动的工作区上启动**。尽管应用的启动和定制的等待时间确实起作用了。 [官方网站](https://omegaui.github.io/app_fleet_webpage/) 提到已在 Ubuntu 22.10 进行了“*精细测试*”,因此这一点值得注意。 当然,该应用是全新的。因此,我们不能期望一切都完美。 但是,如果你问我,**App Fleet 有很大的潜力**,如果你是使用 [Auto Move Windows](https://extensions.gnome.org/extension/16/auto-move-windows/) GNOME 扩展的人,这可能是一个非常方便的替代方案。 我是否说过 **App Fleet 不仅仅限于 GNOME?** 你还可以在其他 [桌面环境](https://itsfoss.com/what-is-desktop-environment/) 上使用它,例如 KDE Plasma、Budgie 和 Cinnamon。 ? 那么,你对 App Fleet 有何看法? 有类似的工具吗? 它对你来说效果如何? 请在下面的评论中告诉我! --- via: <https://news.itsfoss.com/app-fleet/> 作者:[Sourav Rudra](https://news.itsfoss.com/author/sourav/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![](/assets/images/pikapods-banner-v3.webp) ![](/assets/images/pikapods-banner-v3.webp) The year 2024 just started, and maybe you are getting overwhelmed with the amount of work you have to get done across different apps? Why not make that simpler, with, say, a workspace management tool? App Fleet is **a new open-source workspace manager and launch automation tool** primarily developed for Linux; I must say, the last bit is something you don't hear often! 😃 Here, I try App Fleet and share my experience with you. ## App Fleet: Key Features ⭐ ![a screenshot of app fleet about info](https://news.itsfoss.com/content/images/2024/01/App_Fleet_a.png) Written using the **Flutter framework**, App Fleet has been** tailored for the GNOME desktop environment**, and being a fairly new app, the development of it has been progressing rather well, with regular releases from time to time. Some **key features** include: **Support for Most Apps.****Intuitive User Interface.****Set Apps to Specific Workspaces.** ### ⚙️How to Install App Fleet? ![a screenshot of app fleet being installed using the shell](https://news.itsfoss.com/content/images/2024/01/App_Fleet_b.png) Unfortunately, App Fleet is **not available as a Flatpak, Snap, AppImage or any other popular packaging format**. According to the developer, App Fleet requires system-wide read access and packaging it with these formats is not viable for such an app. The **most straightforward way to install App Fleet** is by running the following command (a network installer script): `curl https://raw.githubusercontent.com/omegaui/app_fleet/main/network-install.sh | bash` For most, the above command is the recommended solution. If you wish, you can install it from the precompiled bundle or the source. For more info, you can head over to its [GitHub repo](https://github.com/omegaui/app_fleet?ref=news.itsfoss.com). ### Initial Impressions 👨💻 After installing it on my PC, I launched App Fleet and was greeted with a poker-faced ghost saying there were no workspace configurations on this system. ![a screenshot of app fleet without any workspaces set](https://news.itsfoss.com/content/images/2024/01/App_Fleet_c.png) So, I clicked on “*Create Now*” to get started, and I gave the workspace config a fitting name. ![a screenshot of app fleet workspace creation screen](https://news.itsfoss.com/content/images/2024/01/App_Fleet_d.png) I then picked the icon for it; there were many options with the freedom to upload a custom one too. ![a screenshot of app fleet workspace creation screen icon selection](https://news.itsfoss.com/content/images/2024/01/App_Fleet_e.png) The app selection screen listed all my apps, so I selected the ones I usually use while working. ![a screenshot of app fleet workspace app selection screen](https://news.itsfoss.com/content/images/2024/01/App_Fleet_f.png) I could also **give those apps specific workspaces** so that they would launch directly in the ones specified, doing away with the need to manually place them. (*That didn't work out so well for me, more on that later.*) ![a screenshot of the app fleet workspace number selection for apps](https://news.itsfoss.com/content/images/2024/01/App_Fleet_g.png) There was also the** ability to manually add an app** from the system, or external storage, where I could give it a name, the wait time, and so on. ![a screenshot of app fleet custom app addition](https://news.itsfoss.com/content/images/2024/01/App_Fleet_i.png) I could also tweak the same for the apps added. The “*Wait Time*” settings can be useful if you would rather not be overwhelmed by the number of apps launching in quick succession. ![a screenshot of app fleet edit app screen for the added apps](https://news.itsfoss.com/content/images/2024/01/App_Fleet_j.png) After all things were set, I clicked on the “*Save*” icon on the top-right to save my workspace config. ![a screenshot of app fleet with all the things set in the workspace creator](https://news.itsfoss.com/content/images/2024/01/App_Fleet_h.png) The main screen of App Fleet then showed me the workspace config created. ![a screenshot of app fleet](https://news.itsfoss.com/content/images/2024/01/App_Fleet_k.png) It also launched the **App Fleet launcher**, which was a small widget looking thing that let me launch the saved workspace config. ![a screenshot of app fleet launcher](https://news.itsfoss.com/content/images/2024/01/App_Fleet_l.png) So, to test out how it worked, I did a quick restart of the system, and the launcher automatically popped up when I logged into my system. As you can see below, **the launcher is a neat little thing** that doesn't really get in the way. ![a video showcasing how app fleet works](https://news.itsfoss.com/content/images/2024/01/App_Fleet_m.gif) However, as you may have noticed,** the apps did not launch on the workspaces I set them to launch in**. Though the launching of apps, and the customized wait times do kick in. The [official website](https://omegaui.github.io/app_fleet_webpage/?ref=news.itsfoss.com) mentions that this was “*finely tested*” for Ubuntu 22.10, so that would be a thing to keep in mind. Sure, the app is brand new. So, we cannot expect everything to work perfectly. But, if you ask me, **App Fleet has a lot of potential**, if you were someone who uses the [Auto Move Windows](https://extensions.gnome.org/extension/16/auto-move-windows/?ref=news.itsfoss.com) GNOME extension, this can be a very handy alternative to it. And did I say that** App Fleet is not just limited to GNOME?** You can also use it on other [desktop environments](https://itsfoss.com/what-is-desktop-environment/?ref=news.itsfoss.com) such as KDE Plasma, Budgie, and Cinnamon. **Suggested Read **📖 [8 Best Desktop Environments For LinuxA list of the best Linux Desktop Environments with their pros and cons. Have a look and see which desktop environment you should use.](https://itsfoss.com/best-linux-desktop-environments/?ref=news.itsfoss.com)![](https://itsfoss.com/content/images/wordpress/2016/04/best-linux-desktop-environments.jpg) ![](https://itsfoss.com/content/images/wordpress/2016/04/best-linux-desktop-environments.jpg) *💬 Well, what are your thoughts on App Fleet? Any similar tool in mind? How did it work for you? Let me know in the comments below!* ## More from It's FOSS... - Support us by opting for [It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our [community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our [weekly Newsletter](https://itsfoss.com/newsletter/).
16,560
开源音频编辑器 Audacity 的 AI 工具来了
https://news.itsfoss.com/audacity-ai-tools/
2024-01-16T14:00:06
[ "Audacity", "AI" ]
https://linux.cn/article-16560-1.html
![](/data/attachment/album/202401/16/135942ybxu5aergzk7r8ga.jpg) > > Audacity 现在配备了新的 AI 工具。 > > > 在过去的几年中,我们已经看到了 AI 的显著发展,包括将 AI 驱动的功能添加到各种流行的工具中。而且,我们在 [2024 年 Linux 和开源预测](https://news.itsfoss.com/predictions-linux-open-source-2024/) 中已经提到了更多的人工智能。 这次是 Audacity,[Linux 的最佳音频编辑之一](https://itsfoss.com/best-audio-editors-linux/),迎来了 AI。现在,用户可以通过利用 AI 的力量来增强其音频编辑体验。 让我们来看看这些迷人的功能都有哪些。 ### 英特尔打造 AI 工具 ?️ 英特尔公司推出了由 AI 驱动的处理语音音频和音乐的新功能。 这些功能是 **OpenVino** 插件套件的一部分。对于那些不知道的人来说,英特尔的 OpenVino 是一个 AI 框架,有助于加速深度学习模型。 值得注意的一个很酷但也很重要的方面是,所有这些功能在本地的 PC 上运行! 更具体地说,PC 的 CPU 或 GPU 将用于处理部分。 #### 播客编辑 曾经想快速转录甚至翻译音频吗? 由 OpenAI 的 Whisper 支持的转录功能可以让用户做到这一点。 ![Transcription | Source: GitHub Intel](/data/attachment/album/202401/16/140007f824iph1hhjant20.png) * 它能根据给定的音频样本生成包含转录/翻译文本的新标签音轨。 * 翻译将始终以英语产生输出,而转录将以与源音频相同的语言产生输出。 * 目前,默认情况下仅支持 *Whisper Base* 模型。稍后可能会支持更多模型。 与现有的 “噪音去除”效果类似,**“噪音抑制”** 可帮助去除口语音频样本中不需要的背景噪音。 * 由于它是由 AI 提供动力的,因此你可以期望此功能的效果优于噪音去除。 * 目前,默认情况下仅支持 *denseunet* 模型。稍后可能会支持更多模型。 #### 音乐生成 是的,你没看错:现在,你可以在机器内生成新音乐! **音乐生成** 允许用户生成音乐片段。这要归功于一个名为 **Riffusion** 的开源项目,这是一个基于 **Stable Diffusion** 的音乐生成模型(一种流行的开源模型,用于生成图像。) ![Music Generation | Source: GitHub Intel repo](/data/attachment/album/202401/16/140008c5gn222g3mvpkeg6.png) * 你通过给出文本提示并调整其他一些参数(例如持续时间)来生成音乐。 * 在文本提示符中,你指定要生成的音乐流派,AI 将尽力在生成音乐时保持这种类型。 * 你可以选择在默认的简单模式和可选的高级模式之间切换,以进行更多的控制,例如指定开始提示和结束提示。 此外,你甚至可以通过**音乐风格混音**,选择音乐曲目的一部分,对音乐进行混音! #### 音乐分离 如果你想为自己喜欢的歌曲创建自己的器乐曲目,该怎么办?也许还能与朋友来一场有趣的卡拉 OK 呢? **音乐分离**使你可以将歌曲分为声音或乐器版本。提供了两种分离模式: ![Music Separation. Source: github.com/intel/openvino-plugins-ai-audacity](/data/attachment/album/202401/16/140009rvh6292vf9y98vgy.png) * 2-Stem 为人声和器乐制作两个新音轨。 * 4-Stem 可生成四条新音轨,包括人声、鼓声、贝司声,最后一条是其他乐器声。 ### 如何使用 AI 工具? ? 如果你是 Linux 用户,请等一等。 虽然该插件的 [Windows 版本](https://github.com/intel/openvino-plugins-ai-audacity/releases) 可供下载,但其 Linux 对应版本暂时还不可用。 如果你仍然想尝试一下,则需要自己编译该项目。[你可以参考此的官方说明](https://github.com/intel/openvino-plugins-ai-audacity/blob/main/doc/build_doc/linux/README.md)。 希望 Linux 构建很快到来!? ? 你觉得 Audacity 的这些新人工智能功能怎么样?请在评论中告诉我们你的想法! --- via: <https://news.itsfoss.com/audacity-ai-tools/> 作者:[Rishabh Moharir](https://news.itsfoss.com/author/rishabh/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![](/assets/images/pikapods-banner-v3.webp) ![](/assets/images/pikapods-banner-v3.webp) Over the past couple of years, we have seen notable developments in AI, including AI-powered functionalities being added to various popular tools. And, more AI is something we already mentioned in our [predictions for Linux and open source for 2024](https://news.itsfoss.com/predictions-linux-open-source-2024/). This time it is Audacity, [one of the best audio editors for Linux](https://itsfoss.com/best-audio-editors-linux/?ref=news.itsfoss.com), that has welcomed AI. Users can now enhance their audio editing experience by leveraging the power of AI. Let's take a look at what these fascinating features bring to the table. ## Intel Makes AI Tools 🛠️ The folks over at Intel have introduced new features for working with spoken audio and music, all powered by AI. These features are a part of the **OpenVINO** plugin suite. For those unaware, Intel's OpenVINO is an AI framework that helps accelerate deep-learning models. One cool, yet important, aspect to note is that all these features run on your PC locally! More specifically, the PC's CPU or GPU will be utilized for the processing part. ### Podcast Editing Ever wanted to quickly transcribe or even translate the audio?**Transcription**, which is powered by OpenAI's Whisper, allows users to do exactly this. ![openvino whisper trascription](https://github.com/intel/openvino-plugins-ai-audacity/raw/main/doc/feature_doc/whisper_transcription/properties.png) - It produces a new label track that includes transcribed/translated text based on a given audio sample. - Translation will always produce the output in English, while transcribing will produce the output in the same language as the source audio. - For now, only the *Whisper Base*model is supported by default. Support for more models may arrive later. Similar to the existing Noise Removal effect, there's **Noise Suppression **which helps remove unwanted background noise from a spoken audio sample. - Since it's powered by AI, you can expect this feature to perform better than the Noise Removal effect. - For now, only the *denseunet*model is supported by default. Support for more models may arrive later. ### Music Generation Yes, you read it right: You can now generate new music right inside your machine! **Music Generation **allows users to generate a snippet of music. This is possible thanks to an open-source project called **Riffusion**, which is a music generation model based on **Stable Diffusion **(a popular open-source model used to generate images.) ![openvino music generation](https://github.com/intel/openvino-plugins-ai-audacity/raw/main/doc/feature_doc/music_generation/simple_properties.png) - You generate music by giving a text prompt and adjusting some other parameters like the duration. - In the text prompt, you specify the genre of music to be generated and the AI will try its best to maintain the genre when generating music. - There exists an option to switch between the default Simple mode and an optional Advance mode for more control like specifying a start prompt and end prompt. Furthermore, you can even remix music with **Music Style Remix** by selecting a portion of a music track! ### Music Separation What if you wished to create your own instrumental track of your favourite song? Maybe even have a fun karaoke session with your friends? **Music Separation** allows you to split a song into either a vocal or instrumental version. There are two separation modes offered: ![](https://github.com/intel/openvino-plugins-ai-audacity/raw/main/doc/feature_doc/music_separation/properties.png) - 2-Stem produces two new tracks for vocals and instrumental. - 4-Stem produces four new tracks for vocals, drums, bass and the last one of other instruments combined. ## How to Use The AI Tools? 📥 If you're a Linux user, hold on to your horses. While the [Windows version](https://github.com/intel/openvino-plugins-ai-audacity/releases?ref=news.itsfoss.com) of the plugin is available for download, its Linux counterpart isn't available... just yet. If you still want to try it out, you will need to compile the project yourself. [You can refer to the official instructions for this.](https://github.com/intel/openvino-plugins-ai-audacity/blob/main/doc/build_doc/linux/README.md?ref=news.itsfoss.com) Hopefully, a Linux build arrives soon!🤞 *💬 What do you think about these new AI goodies for Audacity? Let us know your thoughts in the comments!* ## More from It's FOSS... - Support us by opting for [It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our [community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our [weekly Newsletter](https://itsfoss.com/newsletter/).
16,561
连可怜的记事本都没躲过微软的 AI 魔爪
https://www.theregister.com/2024/01/11/microsoft_notepad_ai/
2024-01-16T15:33:21
[ "AI", "记事本" ]
https://linux.cn/article-16561-1.html
![](/data/attachment/album/202401/16/153252wbthcfx205ggg0zi.jpg) > > 深度用户挖掘到实验性 “Cowriter” 功能的证据。 > > > 从一个 Windows Insider 用户发布的截图来看,Windows 记事本将成为微软人工智能关注的下一个对象。 虽然在当前的任何 Windows Insider 版本中都无法直接使用该功能,但精明的用户总能找到方法深入系统,将那些未经公开预览的实验性功能展现出来。 X 用户 @PhantomOfEarth 揭示的 [这些变化](https://twitter.com/PhantomOfEarth/status/1744821347480412388),看起来像是正在进行中的工程项目。可以看到一个名为 “Cowriter” 的弹出菜单,其中包含了一些对文本格式和内容进行调整的选项。 这些选项如何融入记事本的原始设计值得商榷,它们看起来似乎更适合写字板这样的应用。然而,微软已经在 [摒弃写字板](https://www.theregister.com/2024/01/05/wordpad_off_windows_11/),所以只能加给记事本了。 近年来,微软一直在努力~~破坏~~更新记事本,在微软工程师的调整下发生了多次改动 —— 尽管这款文本编辑器在过去的几十年间一直被冷落。 在 Windows 10 的时代,这款编辑器被放到了微软应用商店。在引入 [深色模式](https://www.theregister.com/2021/12/08/notepad_windows_11_update/) 之后,它的界面也得到了更新,并且在 2023 年推出了 [标签支持](https://www.theregister.com/2023/01/23/microsoft_developer_windows_build/)。 在编辑器中添加 AI 功能似乎有些有点过分。微软也似乎在规划采用 [Paint Cocreator 模型](https://support.microsoft.com/en-us/windows/use-paint-cocreator-to-generate-ai-art-107a2b3a-62ea-41f5-a638-7bc6e6ea718f) 进行实现,即用户在注册时会得到一些积分(需要一个微软帐户),要使用该功能需要加入等待名单。 @PhantomOfEarth [评价](https://twitter.com/PhantomOfEarth/status/1744984715814121477):“我觉得这有些过了。记事本除了 AI,本可有更多其他可添加的元素,但唉,大家都喜爱跟风炒作嘛。” 我们也认为记事本已经添加了太多功能,尤其是它本来是作为一个极简的文本编辑器出现的。 关于微软计划在记事本中应用 AI 的方案,我们向微软询问了相关问题并会在得到回应后更新信息。这可能预示着未来微软会在所有可能的地方将 Windows 的功能与 AI 结合。 如截图所示,记事本中的 AI 看起来并无太大实用性,我们相信资深的读者们一定能想到更适合该编辑器的功能。 *(题图:DA/399fe7c0-7c0d-4090-aca2-2e0cc5fc9957)* --- via: <https://www.theregister.com/2024/01/11/microsoft_notepad_ai/> 作者:[Richard Speed](https://www.theregister.com/Author/Richard-Speed) 译者:[ChatGPT](https://linux.cn/lctt/ChatGPT) 校对:[wxy](https://github.com/wxy)
200
OK
# Not even poor Notepad is safe from Microsoft's AI obsession ## Power user excavates evidence of experimental 'Cowriter' feature Windows Notepad is set to be the next recipient of Microsoft's AI attentions judging by screenshots posted by a Windows Insider user. The feature is not immediately accessible in any current Windows Insider build, however, enterprising users have ways and means to delve into the operating system and haul out experiments that are not yet ready to see the light of day. X user @PhantomOfEarth [uncovered the changes](https://twitter.com/PhantomOfEarth/status/1744821347480412388), which appear to be a work in progress at this time. A pop-up menu titled "Cowriter" is visible, with options to tweak the format and content of the text. How these options would fit into the original design of Notepad is debatable since they would seem more at home in something like WordPad, but Microsoft is already in the process of [excising that application from Windows](https://www.theregister.com/2024/01/05/wordpad_off_windows_11/), so Notepad it is. Microsoft has been hard at work ruining updating Notepad in recent years. After decades of being left alone, the text editor has had multiple tweaks by Microsoft engineers. During the Windows 10 era, the editor was added to the Microsoft Store. Its GUI was updated with the [introduction of Dark Mode](https://www.theregister.com/2021/12/08/notepad_windows_11_update/), and [tab support turned up in 2023](https://www.theregister.com/2023/01/23/microsoft_developer_windows_build/). [It's a preview party at Microsoft, but do you really want an invite?](https://www.theregister.com/2024/01/11/microsoft_preview_habit/)[New year, new updates for security holes in Windows, Adobe, Android and more](https://www.theregister.com/2024/01/09/january_patch_tuesday/)[What if Microsoft had given us Windows XP 2024?](https://www.theregister.com/2024/01/04/windows_xp_reimagined/)[Windows keyboards to get a Copilot key – but how quickly will users jump?](https://www.theregister.com/2024/01/04/windows_keyboards_copilot/) Adding AI smarts to the editor seems excessive. Microsoft also appears to be [adopting the Paint Cocreator model](https://support.microsoft.com/en-us/windows/use-paint-cocreator-to-generate-ai-art-107a2b3a-62ea-41f5-a638-7bc6e6ea718f) for the implementation, where users are given a certain number of credits when signing up – a Microsoft account is needed – and a waitlist will be used for the feature. @PhantomOfEarth [commented](https://twitter.com/PhantomOfEarth/status/1744984715814121477): "I feel like this is a bit much. Something else could have been added to Notepad instead of AI but hey gotta ride the hype train." We'd argue that Notepad has already had more than enough added, particularly considering its roots as a simple text editor. We asked Microsoft about its plans for AI in Notepad and will update should they respond. There is every chance this is a sign of things to come as the company adds AI functionality everywhere it can on Windows. AI in Notepad, as shown in the screenshots, does not seem to make much sense – we're sure the wise *Register* readership could think of something more appropriate for the editor. ® 71
16,563
如何检查你的 Linux 系统是否使用 systemd
https://itsfoss.com/check-if-systemd/
2024-01-17T08:08:33
[ "初始化", "systemd" ]
https://linux.cn/article-16563-1.html
![](/data/attachment/album/202401/17/080808gtpgc9rvxxifjx7m.jpg) > > 不知道在使用哪个初始化系统?以下是方法。 > > > 每个主流 Linux 发行版(包括 Ubuntu、Fedora、openSUSE 和 Arch)默认都使用 systemd。 但是有 [许多非 systemd 发行版](https://itsfoss.com/systemd-free-distros/),例如使用轻量级 runit 来获得更好性能的 Void Linux 或主要使用 sysvinit 的 Devuan。 当你尝试遵循某些教程或文档并且其中包含特定于 systemd 或某些其他初始化服务的命令时,就会出现问题。 这时,你必须检查你的 Linux 系统使用的是 systemd 还是其他系统。 一种方法是检查 PID 为 1 的进程(毕竟,初始化系统是 Linux 系统上运行的第一个进程)。 ``` ps 1 ``` 但它的输出可能会产生误导,因为它经常显示 `/sbin/init`,这只是实际的初始化进程的软链接。 如果你 [跟随该符号链接](https://linuxhandbook.com/follow-symbolic-link/),就可以获取初始化系统信息。有两种方法: * 使用 `stat` 命令 * 使用 `readlink` 命令 那么让我们从第一个开始。 > > ? 这些方法在 6 个初始化系统中进行了测试:Systemd、OpenRC、SysVinit、Busybox、runit 和 s6。 > > > ### 方法 1:使用 stat 命令检查 systemd 是否正在使用 以下是如何使用 `stat` 命令来了解你正在使用的初始化系统: ``` stat /sbin/init ``` 如果你使用的是 systemd 支持的发行版,那么它将显示以下输出: ![](/data/attachment/album/202401/17/080833uv5z353fwfokhz4v.png) 但是,如果你使用 systemd 之外的其他任何东西,它将显示初始化系统的名称,但是如果你使用的是 SysVinit,它只会显示 `init` 而不是 `sysvinit`: ![SysVinit only displays "init" instead of sysvinit](/data/attachment/album/202401/17/080833unmh33sxnb3y636n.png) ### 方法 2:使用 readlink 命令检查初始化系统 与之前的方法不同,当你使用 `readlink` 命令时,它只会打印初始化系统的名称。 因此,如果你想知道你是否正在使用 Systemd,只需使用以下命令: ``` readlink /sbin/init ``` ![](/data/attachment/album/202401/17/080833b2c0plzgpzngu0qk.png) 如果你使用 [OpenRC 初始化访问](https://wiki.gentoo.org/wiki/OpenRC/openrc-init),那么它将显示以下输出: ![](/data/attachment/album/202401/17/080834cfzx4xyyzn0y88yr.png) 但如果你使用 SysVinit,那么它会显示以下输出: ![](/data/attachment/album/202401/17/080834fzw7vxarwx9wdwr7.png) ### 我为你写的小“脚本” 另一种方法是检查 `/run/systemd/system` 目录是否存在。 好吧,最简单的找出方法是在终端中 [使用 if-else bash 命令](https://itsfoss.com/bash-if-else/),它将检查你是否正在运行由 systemd 驱动的发行版: ``` if [ -d /run/systemd/system ]; then echo "System is running systemd"; else echo "System is not running systemd"; fi ``` ![](/data/attachment/album/202401/17/080835v96e38q4jr4rf8x9.png) ### 有关 systemd 的更多信息 当你知道你正在使用 systemd 支持的发行版,你就可以 [使用 systemctl 命令管理服务](https://linuxhandbook.com/systemctl-commands/)。 当然你也可以从头开始 [创建一个 systemd 服务](https://linuxhandbook.com/create-systemd-services/)。 我希望本指南对你有所帮助。 *(题图:DA/02d49f79-0ec4-4e49-ae72-e3d46877dfa6)* --- via: <https://itsfoss.com/check-if-systemd/> 作者:[Sagar Sharma](https://itsfoss.com/author/sagar/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![Warp Terminal](/assets/images/warp-terminal.webp) ![Warp Terminal](/assets/images/warp-terminal.webp) Every mainstream Linux distro including Ubuntu, Fedora, openSUSE, and Arch uses systemd by default. But there are [many non-systemd distros](https://itsfoss.com/systemd-free-distros/) like Void Linux that uses lightweight runit for better performance or Devuan that uses sysvinit on principal basis. The problem comes when you are trying to follow some tutorial or documentation and it has commands specific to systemd or some other init service. And this is where you have to check if your Linux system uses systemd or something else. One way would to be check the process with PID 1 (after all, an init system is the first process to run on a Linux system). `ps 1` But its output could be misleading as often it shows `/sbin/init` which is just a soft link to actual init process. If you [follow that symbolic link](https://linuxhandbook.com/follow-symbolic-link/), you can get the init system information. There are two ways of doing that: - Using the stat command - Using the readlink command So let's start with the first one. ## Method 1: Check if systemd is in use with the stat command Here's how you can use the stat command to find out what init system you are using: `stat /sbin/init` If you are using a systemd-powered distro, then it will show you the following output: ![Use the stat command to find if you are using systemd or not](https://itsfoss.com/content/images/2023/12/Use-the-stat-command-to-find-if-you-are-using-systemd-or-not.png) But if you are using anything else than systemd, it will show the init name unless you are using SysVnit which will only show you `init` instead of `sysvnit` : ![Check if you are using SysVnit in Linux or not](https://itsfoss.com/content/images/2023/12/Check-if-you-are-using-SysVnit-in-Linux-or-not.png) ## Method 2: Check the init system using the readlink command Unlike the previous method, when you use the readlink command, it will only print the name of the init system. So if you want to know if you are using Systemd or not, simply use the following command: `readlink /sbin/init` ![Use the readlink command to find if you are using systemd or some other init system in Linux](https://itsfoss.com/content/images/2023/12/Use-the-readlink-command-to-find-if-you-are-using-systemd-or-not-something-else.png) If you are using the [OpenRC init service](https://wiki.gentoo.org/wiki/OpenRC/openrc-init), then it will show the following output: ![how to check if you are using openRC init system](https://itsfoss.com/content/images/2023/12/find-if-you-are-using-openrc-as-init-system.png) But if you are using SysVnit, then, it will show you the following output: ![How to find out if you are using SysVnit as init system in Linux](https://itsfoss.com/content/images/2023/12/How-to-find-out-if-you-are-using-SysVnit-as-init-system-in-Linux.png) ## Tiny 'script' I wrote for you Another way is to check if the `/run/systemd/system` directory exists or not. Well, the easiest way to find out is to [use an if-else bash command](https://itsfoss.com/bash-if-else/) in your terminal which will check if you are running a systemd-powered distro or not: ``` if [ -d /run/systemd/system ]; then echo "System is running systemd"; else echo "System is not running systemd"; fi ``` ![A simple if else statement to know if you are using systemd distro or not](https://itsfoss.com/content/images/2023/12/A-simple-if-else-statement-to-know-if-you-are-using-systemd-distro-or-not.png) ## More on systemd Once you know you are using the systemd-powered distro, here's how you can [manage services using the systemctl command](https://linuxhandbook.com/systemctl-commands/): [Using systemctl Command [15 Examples]The systemctl command is a must know for Linux systems with systemd init system. Here are some practical examples.](https://linuxhandbook.com/systemctl-commands/)![](https://linuxhandbook.com/content/images/2023/11/systemctl-command-examples.png) ![](https://linuxhandbook.com/content/images/2023/11/systemctl-command-examples.png) Want to [create a systemd service](https://linuxhandbook.com/create-systemd-services/) from scratch? You can do that too: [How to create a systemd service in LinuxLearn the steps for creating systemd services in Linux with the practical example demonstrated in this tutorial.](https://linuxhandbook.com/create-systemd-services/)![](https://linuxhandbook.com/content/images/2022/09/create-systemd-service-in-linux.png) ![](https://linuxhandbook.com/content/images/2022/09/create-systemd-service-in-linux.png) I hope you will find this guide helpful.
16,565
Parch Linux:一个简洁易用的基于 Arch 的发行版
https://news.itsfoss.com/parch-linux/
2024-01-17T19:22:30
[ "Parch Linux", "Arch Linux" ]
https://linux.cn/article-16565-1.html
![](/data/attachment/album/202401/17/192209fa7jrrysxaryi39h.jpg) > > 这是一个简约直观的基于 Arch 的发行版,无需繁琐的开箱定制。 > > > 最近,我在寻求一些最佳的 [基于 Arch 的 Linux 发行版](https://itsfoss.com/arch-based-linux-distros/)。 在浏览过我们过去的报道,并进行了一番搜索之后,我找到了一些颇为出色的发行版。 其中 [Archcraft](https://news.itsfoss.com/archcraft/) 这款发行版让我眼前一亮,它极具用户友好性。我希望能有更多类似 Archcraft 的发行版,幸运的是,在几天前,我发现了 **Parch Linux**。 一起来看看这个引人入胜的发行版,它“力图做到美观、易用、轻量、快捷且稳定”。 ### Parch Linux:概述 ⭐ ![](/data/attachment/album/202401/17/192231gsz8gjke3zk1j4vg.jpg) [Parch Linux](https://parchlinux.com/) 是 **一款面向 Linux 新手和经验者的开源轻量级发行版**。它以 Arch Linux 为基础,为用户提供了清新的体验。 一些 **关键特点** 包括: * 直观的用户界面 * 采用滚动更新机制 * 集成 pacman 包管理器 * 少量的定制以增强用户体验 #### 初体验 ?‍? 我在 [虚拟机](https://itsfoss.com/virtual-machine/) 上尝试安装了 **Parch GNOME** 版本,整个过程十分简单明了。点击 “欢迎” 应用程序的一键“安装 Parch”按钮即可启动 [Calamares 安装程序](https://calamares.io/)。 ![](/data/attachment/album/202401/17/192232z0erelcmec01yzmn.jpg) 尽管外观和感觉有所不同,但此次的安装体验,确是你能从 Calamares 那里预期的。 ![](/data/attachment/album/202401/17/192232vmoy0ib0efb1ffwx.jpg) 我依次设置了时区、键盘布局,然后开始设置用户,输入常见的信息,如用户名、密码、计算机的名称等。 ![](/data/attachment/album/202401/17/192233gvx69vuxuz1ql9mq.jpg) 熟悉的 **磁盘分区** 步骤也随之而来,诸如 *ext4* 、 *btrfs* 、 *jfs* 、 *xfs* 、 *f2fs* 和 *reiser* 等文件系统皆在选项之中。 ![](/data/attachment/album/202401/17/192234x63jl9998j93vgmb.jpg) 所有的设置就位后,安装程序开始运行,屏幕底部出现了进度条,屏幕中心处是 Parch Linux 的徽标。 ![](/data/attachment/album/202401/17/192234pbuubmmoiwbm6kjk.jpg) 安装完成后,系统重新启动到了这个美丽的桌面,GNOME 45.1 的全新工作区切换器和更新后的快速设置菜单等新功能一览无余。 ![](/data/attachment/album/202401/17/192235icjly4mbmsbzlc2b.jpg) 我在想还有没有其他的壁纸。你可以在一些带有 Parch Linux 徽标的壁纸中找到一些有趣的选择。 不忘记,停靠栏已经对齐到了屏幕的左侧。 ![](/data/attachment/album/202401/17/192236byy5862w2j5ui85i.jpg) 我还发现 Parch Linux 提供了一套 **实用的应用程序**,包含诸如 [GParted](https://itsfoss.com/gparted/)、[KeePassXC](https://itsfoss.com/keepassxc/)、Vim,以及 GNOME 的一些常见应用,比如图像浏览、视频播放、地图查看等。 ![](/data/attachment/album/202401/17/192236xdy44w8zhuy46wuu.jpg) 这个发行版内置了最新的核心包 Pacman 6.0.2,使用 `pacman -Syu` 命令即可获取最新的包。 然后,我注意到了与默认 GNOME 终端不同的终端模拟器。 ![](/data/attachment/album/202401/17/192237jtt5byjyme8taeqe.jpg) Parch Linux 采用了 [Blackbox](https://itsfoss.com/blackbox-terminal/) 终端,这是一个精致的 GTK4 终端,用于满足喜欢极简终端模拟器的用户。 总的来说,我喜欢 Parch Linux 所提供的一切。 当然,在任何基于 Arch 的发行版上,你都可以自定义所有的东西。 但我认为,Parch Linux 在 Arch Linux 的基础上打造出更简单的用户体验,并且刻意做了一些定制,这对新的 Linux 用户来说,是有益的。 ### ? 下载 Parch Linux 尽管我试验的是 GNOME 版本,但还有其他更多版本可供选择。比如 **Parch KDE**、**Parch XFCE**、**Parch Cinnamon** 等。 所以,如果你要获取 Parch Linux 的任何版本,你可以直接访问其 [官方网站](https://parchlinux.com/download) 或者 [FOSS Torrents 页面](https://fosstorrents.com/distributions/parch-linux/)。 > > **[Parch Linux](https://parchlinux.com/download)** > > > 如果你遇到任何问题,或者对这个发行版有任何问题,都可以访问 [Parch Linux 论坛](https://forum.parchlinux.com/) 或者它的 [GitHub 仓库](https://github.com/parchlinux)。 如果你在想为什么我们更关注 Arch-based 发行版,可能原因在于: > > **[喜欢 Arch Linux 的六个原因](https://itsfoss.com/why-arch-linux/)** > > > ? 可以分享一下你对这个基于 Arch 的发行版的看法吗?我们已经有足够多的发行版了,还是依然需要更多? *(题图:DA/1fee979e-9788-4bc8-a9cc-e8bccc2172c2)* --- via: <https://news.itsfoss.com/parch-linux/> 作者:[Sourav Rudra](https://news.itsfoss.com/author/sourav/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[ChatGPT](https://linux.cn/lctt/ChatGPT) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![](/assets/images/pikapods-banner-v3.webp) ![](/assets/images/pikapods-banner-v3.webp) Recently, I was wondering what are some of the [best Arch-based Linux distros](https://itsfoss.com/arch-based-linux-distros/?ref=news.itsfoss.com)? After going through our past coverage and searching around, I did find some cool ones. One of those distros was [Archcraft](https://news.itsfoss.com/archcraft/), which pleasantly surprised me with its user-friendly nature, and I was thinking we needed more Arch-based distros like that. Luckily, a few days back, I was made aware of **Parch Linux**. So, join me as I take you through this intriguing distro that “*tries to be pretty, easy to use, light, fast and stable*”. ## Parch Linux: Overview ⭐ ![a screenshot of parch linux with a system details page and neofetch output open](https://news.itsfoss.com/content/images/2024/01/Parched_Linux_a.jpg) [Parch Linux](https://parchlinux.com/?ref=news.itsfoss.com) is** an open-source, lightweight Linux distribution** aimed towards both beginners and experienced Linux users alike. It** uses Arch Linux as a strong base** to provide a clean user experience. Some **key highlights** include: **Intuitive User Interface****Follows a Rolling-Release Cycle****Integrates pacman package manager****A bit of customization for enhanced user experience** ### Initial Impressions 👨💻 I tried the **Parch GNOME** variant on a [virtual machine](https://itsfoss.com/virtual-machine/?ref=news.itsfoss.com). The installation process was pretty straightforward, as the welcome app had the “Install Parch” button that started up the [Calamares installer](https://calamares.io/?ref=news.itsfoss.com). ![a screenshot of parch linux welcome app](https://news.itsfoss.com/content/images/2024/01/Parched_Linux_b.jpg) The installation experience is what you expect from Calamares, albeit with a different look and feel to it. ![a screenshot of parch linux calamares installer](https://news.itsfoss.com/content/images/2024/01/Parched_Linux_c.jpg) I **set the timezone**,** the keyboard layout**, then moved on to** set up the user** with the usual information such as the username, password, name of the computer, and so on. ![a screenshot of parch linux calamares installer](https://news.itsfoss.com/content/images/2024/01/Parched_Linux_f.jpg) The **disk partitioning** was familiar too, with file system options such as *ext4*, *btrfs*,* jfs*, *xfs*, *f2fs*, and *reiser*. ![a screenshot of parch linux calamares installer](https://news.itsfoss.com/content/images/2024/01/Parched_Linux_g.jpg) After everything was set, the installation began with a helpful progress bar at the bottom and a greeting with the Parch Linux logo in the center. ![a screenshot of parch linux calamares installer](https://news.itsfoss.com/content/images/2024/01/Parched_Linux_h.jpg) Post installation, the system rebooted into this **beautiful-looking desktop that was running GNOME 45.1** in all its glory, with the new workspace switcher and the updated quick settings menu, among other nuances. ![a screenshot of parch linux gnome desktop](https://news.itsfoss.com/content/images/2024/01/Parched_Linux_i.jpg) I was curious what other wallpapers were offered. You can find some interesting choices among ones with the Parch Linux logo (if you like to show off what you're using). Not to forget, the dock bar comes aligned to the left of the screen. ![a screenshot of parch linux wallpapers](https://news.itsfoss.com/content/images/2024/01/Parched_Linux_l.jpg) I also noticed that Parch Linux has **a decent application suite **with important applications such as [GParted](https://itsfoss.com/gparted/?ref=news.itsfoss.com), [KeePassXC](https://itsfoss.com/keepassxc/?ref=news.itsfoss.com), Vim, and the usual GNOME apps for image viewing, video playing, checking maps etc. ![a screenshot of parch linux application launcher on gnome](https://news.itsfoss.com/content/images/2024/01/Parched_Linux_j.jpg) The distro packs in Pacman 6.0.2, the latest core package. Furthermore, I also tried running *pacman -Syu* to get the latest packages. That's when I noticed the different terminal emulator (not the default GNOME terminal). ![a screenshot of parch linux pacman details](https://news.itsfoss.com/content/images/2024/01/Parched_Linux_k.jpg) Parch Linux features the [Blackbox](https://itsfoss.com/blackbox-terminal/?ref=news.itsfoss.com) terminal, which is **an aesthetically pleasing GTK4 terminal** that appeals to those who prefer a minimal terminal emulator. Overall, **I liked what Parch Linux had to offer**. Sure, you can customize these things for yourself on any Arch distribution. However, I believe Parch Linux manages to provide a simpler user experience on top of Arch Linux, with a pinch of customization. And, this is a good thing for new Linux users (*if you want the adventure to try new distros*). **Suggested Read **📖 [Top 10 User-friendly Arch-Based Linux Distributions [2023]Want to experience Arch Linux without the hassle of the complicated installation and setup? Here are a few user-friendly Arch-based Linux distributions.](https://itsfoss.com/arch-based-linux-distros/?ref=news.itsfoss.com)![](https://itsfoss.com/content/images/2023/03/arch-distros.png) ![](https://itsfoss.com/content/images/2023/03/arch-distros.png) ## 📥 Download Parch Linux I tested out the GNOME variant, but there are other variants too. They are **Parch KDE**, **Parch XFCE,** **Parch Cinnamon** and more. So, for getting any one of the Parch Linux variants, you can either head over to the [official website](https://parchlinux.com/download?ref=news.itsfoss.com) or its [FOSS Torrents page](https://fosstorrents.com/distributions/parch-linux/?ref=news.itsfoss.com). If you run into any issues, or have questions regarding the distro, then you can give the [Parch Linux forum](https://forum.parchlinux.com/?ref=news.itsfoss.com) or its [GitHub repo](https://github.com/parchlinux?ref=news.itsfoss.com) a visit. In case you are wondering why we end up covering Arch-based distros more, probably, this is why: [6 Reasons Why People Love to Use Arch LinuxArch Linux has a cult status among desktop Linux users. What makes Arch Linux so popular? Why people use Arch Linux? This article answers these questions.](https://itsfoss.com/why-arch-linux/?ref=news.itsfoss.com)![](https://itsfoss.com/content/images/wordpress/2020/07/why-arch-linux.jpg) ![](https://itsfoss.com/content/images/wordpress/2020/07/why-arch-linux.jpg) *💬 What are your thoughts on this Arch-based distro? Do we have enough of distros, or do we need more?* ## More from It's FOSS... - Support us by opting for [It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our [community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our [weekly Newsletter](https://itsfoss.com/newsletter/).
16,566
博通还没完成对 VMware 客户的“斩除”行动
https://news.itsfoss.com/broadcom-vmware-continues/
2024-01-18T12:39:58
[ "VMware" ]
https://linux.cn/article-16566-1.html
![](/data/attachment/album/202401/18/123926zyfvpqyo2pfftq2f.jpg) > > 博通致 VMware:“我还没干完!” > > > 看来,[VMware](https://www.vmware.com/) 的新主人还没消停。在对永久许可证客户 [致命打击](https://news.itsfoss.com/vmware-broadcom-subscription/) 之后,[博通](https://www.broadcom.com/) 现在又准备剥离云计算业务长期存在的另一部分了。 这一次,到了**VMware 云服务提供商计划遭到彻底改变的时候**,这将会影响到许多人,如果他们得不到博通的邀请,甚至会失去业务。?‍♂️ ### VMware 的云服务提供商面临“斩除” 精明的 [The Register](https://www.theregister.com/2024/01/10/broadcom_ends_vmware_partner_program/) 老编辑们首先发现,已经确知,**博通将在 2024 年 4 月底之前完全关闭 VMware 云服务提供商计划**。 这已经成为现实,正如早些时候,他们还结束了 VMware 的 [合作伙伴计划](https://www.vmware.com/partners.html),取而代之的只会有**少数合作伙伴**被邀请加入博通优势合作伙伴计划。 [根据消息来源](https://www.crn.com/news/virtualization/broadcom-hands-vmware-partners-termination-notice),这些合作伙伴的资格标准是**年收入至少达到 500,000 美元**,才能保持其合作伙伴身份。 现在,许多 [VMware 云服务提供商](https://cloud.vmware.com/providers) 也面临着类似的命运,他们收到了一封神秘的信,信中写道: > > 自 2024 年 4 月 30 日起,VMware 合作伙伴连接计划下以 VMware 云服务提供商进行交易的能力将终止。 > > > 不过,我们要强调的是,你可能有机会加入博通专家优势合作伙伴计划。此仅限受邀者参与的计划要求更简单,并提供更多好处,我们将于 2024 年初开始邀请合作伙伴加入。 > > > 但问题是,**博通并未明确谁将被邀请加入该计划**,以及邀请的标准。许多人担心,由于这一举措,**较小的云服务提供商将被挤出**,因为所谓的“*更简单的要求*”并不明确。 甚至是**云服务提供商也感到晕头转向**,其中有一家提供商仍在努力解决这个问题。向 *The Register* 提到以下内容: > > 他们怎么能在没有任何通知和细节的情况下,突然取消一项影响数百甚至数千用户的重要计划? > > > 他们在节假日前的星期五就发出了通知,而且没有任何后续行动,这使得情况更加恶劣。 > > > 这看起来确实很糟糕,而且博通最近对 VMware 的处理并不一定得当,许多人已经转向 [Proxmox](https://www.proxmox.com/en/) 和 [MicroCloud](https://canonical.com/microcloud) 等替代服务,以避免日后陷入意外。 如果你是受此影响的提供商之一,你可以访问博通 [合作伙伴门户](https://partnerportal.broadcom.com/),或浏览他们的 [FAQ 页面](https://www.broadcom.com/how-to-buy/software-partners/partnering-with-broadcom) 以获取有关这些变化的更多信息。 截至撰写本文时,**博通或 VMware 尚未就此事发表正式声明**,我真诚地希望他们能够澄清现有合作伙伴对此有何期望。 ### 对于小型云提供商来说是一个糟糕的举动 此举会让许多人感到反感。如果上述情况属实,那么**许多小型云计算提供商将很有可能从这个仅限受邀的博通合作伙伴俱乐部中被踢出局**。 如果这些小型机构打算继续为客户提供服务,则可能必须与收到邀请的机构签约。许多人已经对此举是否具有反竞争性提出质疑,我同意他们的猜测。 甚至 Reddit 上的 [这个帖子](https://www.reddit.com/r/vmware/comments/193jngf/broadcom_ditches_most_of_vmwares_cloud_service/) 也已经有了一些非常有趣的评论。有些人认为,这次收购总是会有一个丑陋的结局。 ? 你对此有何看法? 博通会就此止步,还是会采取更激进的举措? --- via: <https://news.itsfoss.com/broadcom-vmware-continues/> 作者:[Sourav Rudra](https://news.itsfoss.com/author/sourav/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[校对者ID](https://github.com/%E6%A0%A1%E5%AF%B9%E8%80%85ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![](/assets/images/pikapods-banner-v3.webp) ![](/assets/images/pikapods-banner-v3.webp) Well, it appears that the new owners of [VMware](https://www.vmware.com/?ref=news.itsfoss.com) are not done settling down yet. After [dropping the hammer](https://news.itsfoss.com/vmware-broadcom-subscription/) on customers of the perpetual licenses, [Broadcom](https://www.broadcom.com/?ref=news.itsfoss.com) is now all set to alienate another part of the longstanding cloud computing business. This time, it is **the** **VMware Cloud Services Provider program seeing a radical change** that will see many affected, and even lose business if they are not deemed worthy of an invitation by Broadcom. 🤦♂️ **Suggested Read **📖 [Broadcom Drops A Hammer on VMware Customers After AcquisitionVMware customers may not like the intention behind the changes made.](https://news.itsfoss.com/vmware-broadcom-subscription/)![](https://news.itsfoss.com/content/images/2023/12/broadcom-hammers-vmware-customers.png) ![](https://news.itsfoss.com/content/images/2023/12/broadcom-hammers-vmware-customers.png) ## VMware's Cloud Services Providers are Facing the Axe Spotted first by the astute vultures over at [The Register](https://www.theregister.com/2024/01/10/broadcom_ends_vmware_partner_program/?ref=news.itsfoss.com), it has come to light that **Broadcom is completely closing down the VMware Cloud Services Provider program** by the end of April 2024. This was already coming, as earlier, they also ended VMware's [Partner program](https://www.vmware.com/partners.html?ref=news.itsfoss.com), which would see only** a handful of partners being invited** to the Broadcom Advantage Partner Program instead. And [according to sources](https://www.crn.com/news/virtualization/broadcom-hands-vmware-partners-termination-notice?ref=news.itsfoss.com), the qualifying criteria for those partners is **at least $500,000 or more in annual revenue** for them to keep their partner status. Now, a similar fate has come knocking for the many [cloud services providers](https://cloud.vmware.com/providers?ref=news.itsfoss.com) who received a cryptic letter that said: Effective April 30, 2024, the ability to transact as a VMware Cloud Services Provider, under the VMware Partner Connect Program, will come to an end. However, we want to emphasize that you may have the opportunity to join the Broadcom Expert Advantage Partner Program. This invite-only program has simpler requirements and offers expanded benefits, and we will begin inviting partners to join in early 2024. But, the thing is, **Broadcom has not been clear as to who will be invited into the program **and on what basis. Many are concerned that **smaller cloud service providers will be pushed out** due to this move, as there is no clarity on the so-called “*simpler requirements*”. Even **the cloud service providers are in a dizzy**, one such provider was still trying to get their heads wrapped around this; mentioned the following to *The Register*: How can they just cancel a major program affecting hundreds, perhaps thousands of customers, with zero notice, and zero details? They sent the notices out the Friday before the holidays, with no follow-up, which makes the situation even more egregious. That does look bad, and Broadcom's recent handling of VMware has not necessarily been good, many have been switching to alternative services such as [Proxmox](https://www.proxmox.com/en/?ref=news.itsfoss.com) and [MicroCloud](https://canonical.com/microcloud?ref=news.itsfoss.com) to avoid getting caught out surprised down the line. *Psst, here's a handy **free learning resource** for Proxmox *🤓 [Getting Started With ProxmoxA tutorial searies that covers everything from installing and upgrading Proxmox to using it for creating and managing VMs.](https://linuxhandbook.com/proxmox/?ref=news.itsfoss.com)![](https://linuxhandbook.com/content/images/2023/09/proxmox-course.png) ![](https://linuxhandbook.com/content/images/2023/09/proxmox-course.png) If you are one of the providers affected by this, you can either head over to the Broadcom [Partner portal](https://partnerportal.broadcom.com/?ref=news.itsfoss.com) or go through their [FAQ page](https://www.broadcom.com/how-to-buy/software-partners/partnering-with-broadcom?ref=news.itsfoss.com) for more information regarding the changes. There has been **no official word by Broadcom or VMware on this matter** as of writing, I sincerely hope that they clarify what existing partners should expect from this. ## A Bad Move for Small Cloud Providers This move is going to rub many the wrong way. If the above is taken as any indication, then **many small cloud providers will most likely get the boot** from this special invite-only Broadcom partners club. These smaller establishments might have to sign up with the ones who have an invitation if they intend to continue serving their customers. Many have already raised questions over how anticompetitive this move could be, and I share their speculation. Even Reddit is up and about with [this thread](https://www.reddit.com/r/vmware/comments/193jngf/broadcom_ditches_most_of_vmwares_cloud_service/?ref=news.itsfoss.com) already having some very interesting comments. Some people believe that this acquisition was always going to have an ugly ending. *💬 What do you think of this? Will Broadcom stop at this, or push for more aggressive moves such as this?* ## More from It's FOSS... - Support us by opting for [It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our [community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our [weekly Newsletter](https://itsfoss.com/newsletter/).
16,568
Ubuntu 24.04 LTS 将获得长达 12 年的更新支持
https://news.itsfoss.com/ubuntu-24-04-lts-support/
2024-01-19T17:54:00
[ "Ubuntu" ]
https://linux.cn/article-16568-1.html
![](/data/attachment/album/202401/19/175414hp5h57zpe019j2ve.jpg) > > Canonical 公布了将延长 Ubuntu LTS 的软件更新。而且,直到现在我们才知道…… > > > 距离我们期待已久的下一个 Ubuntu [长期支持版本(LTS)](https://itsfoss.com/long-term-support-lts/)(Ubuntu 24.04 LTS “*Noble Numbat* ”) 的发布只有几个月的时间了。 不要忘记,Canonical 曾在去年 12 月初发布了 [路线图](https://discourse.ubuntu.com/t/ubuntu-desktop-24-04-lts-roadmap-highlights/41032),其中展示了桌面团队正在为 Ubuntu 24.04 所做的工作。即使是早期的 [Ubuntu 23.10 版本](https://news.itsfoss.com/ubuntu-23-10-release/)也可以作为即将发布的 LTS 版本的有力指标。 然而,由于 [Destination Linux](https://www.youtube.com/@DestinationLinux) 在 Ubuntu 峰会上与一位特邀嘉宾进行的采访,我们现在**对 Ubuntu 24.04 版本有了更多了解**。 ### 对 Ubuntu LTS 版本提供 12 年支持? 采访的嘉宾正是 Canonical 首席执行官 **Mark Shuttleworth**。他透露,**Ubuntu 24.04 LTS 将获得 12 年的更新支持**,并且对一些较旧的 LTS 版本也做出同样的承诺(未指定任何版本)。 Mark 提到: > > 我不想抢别人的风头,但基本来说,我们将为 24.04 提供 12 年的更新支持,而且我们还将为一些旧版本也提供 12 年的更新支持。 > > > Mark 将其称为“**白金级企业承诺**”,与红帽企业版 Linux(RHEL)[提供](https://access.redhat.com/support/policy/updates/errata)的相当。此外,他们**不仅针对核心组件这样做,而且针对的是整个发行版**大约 30,000 个源代码包。 他还补充道: > > 显然,这其中有一部分是 Ubuntu Pro 的功劳,但一个简单的事实是,你现在可以使用 Ubuntu 24.04,而且你将能够部署一些东西,因为你知道在接下来的 12 年里,你只需定期更新就可以了,而且这些东西会得到保障,一直都会得到维护。 > > > 很明显,**为了获得这种长期支持,你必须注册 Ubuntu Pro**。而且,考虑到 Pro 订阅对个人使用是免费的,这并不一定是件坏事。 如果你不选择 Ubuntu Pro,那么你将在 **2029** 年前获得**五年的标准更新**。 早些时候,我们知道 Ubuntu 24.04 通过订阅可以获得长达 10 年的软件和安全更新,直到 2034 年 4 月。然而,现在随着新信息的出现,情况发生了变化。 现在,我们可以看到 **Ubuntu 24.04 LTS 的支持至少到 2036 年 4 月**,这对于 Linux 发行版来说是相当长的支持期。 如果你问我,我**希望在 Ubuntu 官方博客上看到关于延长支持的公告**,我们可以在其中获得有关哪些旧发行版将受到支持的详细信息。 我强烈建议你观看这篇 [采访](https://www.youtube.com/watch?v=zDzkAs0V81U),因为它也包含一些有关人工智能的有趣信息! ### 如何获得延长支持? 如果你是一家企业,或者不喜欢在标准的五年支持期结束后更换 Ubuntu LTS 安装,那么购买 Ubuntu Pro 就是一个**不错的选择**。 就目前情况而言,如果你是个人用户,你可以在最多五台计算机上**免费订阅 [Ubuntu Pro](https://ubuntu.com/pro)**。**对于企业**,你必须直接 [联系 Canonical](https://ubuntu.com/contact-us/form?product=pro) 获取定价。 > > **[Ubuntu Pro](https://ubuntu.com/pro)** > > > ? 12 年的软件更新支持听起来让你兴奋吗?在下面的评论中分享你的想法。 *(题图:DA/905dc3a4-4d15-4f29-aab3-eda638bdc5bf)* --- via: <https://news.itsfoss.com/ubuntu-24-04-lts-support/> 作者:[Sourav Rudra](https://news.itsfoss.com/author/sourav/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![](/assets/images/pikapods-banner-v3.webp) ![](/assets/images/pikapods-banner-v3.webp) We are just months away from the long-awaited launch of the next Ubuntu [long-term support release](https://itsfoss.com/long-term-support-lts/?ref=news.itsfoss.com) (LTS) i.e., Ubuntu 24.04 LTS "*Noble Numba*t". Not to forget, Canonical shared [a roadmap](https://discourse.ubuntu.com/t/ubuntu-desktop-24-04-lts-roadmap-highlights/41032?ref=news.itsfoss.com) in early December last year that showcased what the Desktop team was working on for Ubuntu 24.04. Even the earlier [Ubuntu 23.10 release](https://news.itsfoss.com/ubuntu-23-10-release/) could be used as a strong indicator of what to expect from the upcoming LTS release. However, we now have** some additional insights into what we could expect from the Ubuntu 24.04 release** thanks to an interview done by [Destination Linux](https://www.youtube.com/@DestinationLinux?ref=news.itsfoss.com) at the Ubuntu Summit with a special guest. **Suggested Read **📖 [Ubuntu 23.10: The Big Release is Here!Ubuntu 23.10 ‘Mantic Minotaur’ is now here with GNOME 45 and other fantastic improvements.](https://news.itsfoss.com/ubuntu-23-10-release/)![](https://news.itsfoss.com/content/images/2023/10/ubuntu-23-10-release-ft.png) ![](https://news.itsfoss.com/content/images/2023/10/ubuntu-23-10-release-ft.png) ## 12 Years of Support for Ubuntu LTS Releases? The interview guest was none other than **Mark Shuttleworth**, CEO of Canonical. He revealed that **Ubuntu 24.04 LTS will be receiving 12 years of updates**, and** **the same commitment would be made for some older LTS releases (without specifying any versions). Mark mentions: I don't want to steal somebody else's thunder, but essentially 12 years is what we are going to do for 24.04, and we are gonna go back and do that for some of the older ones as well. Mark put it as a "**platinum grade enterprise commitment**" that matches what Red Hat Enterprise Linux (RHEL) [offers](https://access.redhat.com/support/policy/updates/errata?ref=news.itsfoss.com). Moreover, they are** not only doing that for the core components, but for the entirety of the distribution** with about 30,000 source packages. He also added: Obviously, some of that is Ubuntu Pro, but the simple fact is that you can now take Ubuntu 24.04, and you will be able to deploy something knowing that you literally can just do apt get updateon a regular basis for the next 12 years and that stuff is gonna be secured, always going to be maintained. It is pretty clear that **for such kind of long-term support, you will have to sign up for Ubuntu Pro**. And, that is not necessarily a bad thing, considering the pro subscription is free for personal use. If you do not opt for the Ubuntu Pro, you get the **standard five years of updates** until **2029**. You see, earlier, we knew that Ubuntu 24.04 would receive up to 10 years of software and security updates with a subscription; until April 2034. However, that now changes with this new information. Now, we could see **Ubuntu 24.04 LTS being supported until at least April 2036**, and that is quite a long support period for a Linux distribution. If you ask me, I **expect an announcement on the official Ubuntu blog** for the extended support, where we get details on which older distros will be supported. I highly suggest you watch [the interview](https://www.youtube.com/watch?v=zDzkAs0V81U&ref=news.itsfoss.com) considering it includes some interesting information on AI too! ## How to Get Extended Years of Support? Well, if you are an enterprise, or someone who doesn't really like changing their Ubuntu LTS installation after the standard five-year support runs out; getting Ubuntu Pro is **a superb option**. And as things stand now, you can **get an ****Ubuntu Pro**** subscription for free** on up to five machines if you want it for personal use cases. **For enterprises**, you will have to [contact Canonical](https://ubuntu.com/contact-us/form?product=pro&ref=news.itsfoss.com) directly for pricing. *💬 Does 12 years of software update support sound exciting to you? Share your thoughts in the comments below.* ## More from It's FOSS... - Support us by opting for [It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our [community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our [weekly Newsletter](https://itsfoss.com/newsletter/).
16,570
free 命令示例
https://itsfoss.com/free-command/
2024-01-19T22:15:30
[ "free" ]
https://linux.cn/article-16570-1.html
![](/data/attachment/album/202401/19/221451m4mprm8p2yp4p51q.jpg) > > Linux 中的 free 命令可以帮助你深入了解系统内存(RAM)的使用情况等。下面介绍如何充分利用它。 > > > `free` 命令是了解系统内存(RAM)消耗情况,以及是否启用了交换的最简单方法之一。 但问题是:如何使用 `free` 命令? 嗯,这非常简单,不需要任何复杂的步骤。 因此,在本教程中,我将引导你使用 `free` 命令,并附有示例和练习题供你练习。 ### Linux 中如何使用 free 命令 要使用 `free` 或任何其他命令,最好从命令语法开始,我将从相同的开始。 以下是 `free` 命令的语法: ``` free [选项] ``` 有多个选项可以使用,以更改 `free` 命令的默认行为。 现在,让我分享一些 `free` 命令常用的选项: | 选项 | 描述 | | --- | --- | | `-h` | 通过调整 KB、GB 等数据单位,以人类可读的形式打印信息。 | | `-s` | 在给定的时间间隔后更新 `free` 输出。 | | `-t` | 显示系统和交换内存的总量。 | | `-g` | 以 GB 为单位显示数据。 | | `-m` | 以 MB 为单位打印信息。 | | `-k` | 以 KB 为单位显示输出。 | 但是如果执行不带选项的 `free` 命令会怎样呢? 你可以看到下面的内容: ![](/data/attachment/album/202401/19/221530q9m93iiwy1gi9gg1.png) 这里, * `total`:表示存储总量。 * `used`:显示系统已使用的存储空间。 * `free`:可用于新进程的可用内存量。 * `shared`:tmpfs(临时文件系统)使用的内存量。 * `buff/cache`: 表示缓冲区和缓存使用的内存总和。 * `available`:它估计有多少内存可用于启动新应用而无需交换。它是`free` 内存和可以立即使用的 `buff/cache` 的一部分的总和。 因此,如果你想要各种信息,只需输入不带选项的命令即可。 现在,让我们看一下 `free` 命令的一些示例。 #### 1、以人类可读的形式显示信息 默认情况下,`free` 命令将以千字节为单位显示数据,这不是最易读的形式。 这就是 `-h` 选项发挥作用的地方,它以人类可读的形式(例如 KB 或 GB)打印值。 ``` free -h ``` ![](/data/attachment/album/202401/19/221530ro37vo7mu2v7fou1.png) #### 2、连续显示统计数据 一旦执行 `free` 命令,它只会显示执行该命令时的统计信息。例如,如果我在 `12:45` 执行 `free` 命令,那么它只会显示该时间的统计信息。 所以问题是:如何实现类似的行为,如显示实时统计数据的 [htop](https://itsfoss.com/use-htop/)?这不完全相同,但你可以使用 `-s` 标志以特定时间间隔刷新统计信息,如下所示: ``` free -s <秒> ``` 例如,如果我想每秒刷新一次 `free` 命令,那么我将使用以下命令: ``` free -s 1 ``` #### 3、定义显示统计数据的次数 在前面的示例中,我解释了如何使用 `free` 命令连续显示统计信息,但你可能不希望它无休止地刷新,而只刷新几次。 为此,你可以使用 `-c` 标志,如下所示: ``` free -c <显示统计信息的次数> ``` 假设我想查看统计数据 3 次,那么我将使用以下内容: ``` free -c 3 ``` ![](/data/attachment/album/202401/19/221530kn4ruirin4zwup4p.gif) 默认情况下,它将每秒刷新一次数据,但你可以使用 `-s` 标志来指定间隔时间: ``` free -c <显示统计数据的次数> -s <秒数> ``` 例如,在这里,如果我想以 2 秒的间隔显示统计信息 3 次,那么我将使用以下命令: ``` free -c 3 -s 2 ``` ![](/data/attachment/album/202401/19/221530sg1vv6o77ito5anz.gif) #### 4、指定输出数据类型 虽然对于大多数用户来说,使用 `-h` 标志以人类可读的形式显示数据就可以完成工作,但是如果你想自己指定数据类型怎么办? 那么,你可以使用以下标志指定数据类型: | 标志 | 描述 | | --- | --- | | `--kilo` 或 `-k` | 以 KB 为单位显示内存。 | | `--mega` 或 `-m` | 以 MB 节为单位显示内存。 | | `--giga` 或 `-g` | 以 GB 为单位显示内存。 | | `--tera` | 以 TB 为单位显示内存。 | 你可以通过以下方式使用上述标志: ``` free --<kilo/mega/giga/tera> ``` 例如,如果我希望以 MB 为单位显示内存统计信息,那么我将使用以下命令: ``` free --mega ``` ![](/data/attachment/album/202401/19/221531ukzi0jk0u8u0kp8e.png) #### 5、获取物理内存和交换内存的总和 默认情况下,可用内存将显示物理内存和交换内存的行,但是如果你想获得它们的总和怎么办? 好吧,你可以使用 `-t` 标志: ``` free -t ``` ![](/data/attachment/album/202401/19/221531tcmzcsuffffggvkh.png) ### 练习题 ?‍? 你可以练习以下一些问题,以更好地使用 `free` 命令: * 连续打印内存统计数据 3 次,中间间隔 3 秒。 * 以人类可读的形式获取物理内存和交换内存的总和。 * 重定向 `free` 命令的输出到文本文件中。 * 如何从 `free` 命令的输出中只打印一列? (提示:使用 [awk 命令](https://linuxhandbook.com/awk-command-tutorial/) 并指定列号)。 如果你对这些问题有任何疑问,你可以在此处发表评论。 ### 总结 每个命令都会以某种方式派上用场。`free` 命令也有这样一个被低估的场景来获取有用的信息。 ? 我希望你发现本指南有用! 请让我知道你对我接下来应该介绍什么内容的想法? *(题图:DA/07440245-cdb2-43ac-94d9-c4a394ced646)* --- via: <https://itsfoss.com/free-command/> 作者:[Sagar Sharma](https://itsfoss.com/author/sagar/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![Warp Terminal](/assets/images/warp-terminal.webp) ![Warp Terminal](/assets/images/warp-terminal.webp) The free command is one of the easiest ways one can learn about their system memory (RAM) consumption and if you have swap enabled. But the question is: How can you use the free command? Well, it is pretty easy and does not require any complex steps. So in this tutorial, I will walk you through using the free command with examples along with exercise questions for you to practice. ## How to use the free command in Linux To use free or any other command, it is a good idea to start with the command syntax, and I'll start with the same. Here's the syntax for the free command: `free [options]` You are given multiple options which are supposed to be used in the `[options]` field to change the default behavior of the free command. Now, allow me to share some commonly used options with the free command: Option | Description | ---|---| `-h` | Print information in human-readable form by adjusting data units in KB, GB, etc. | `-s ` | Update the free output after a given seconds of interval. | `-t` | Shows the total amount of system and swap memory. | `-g` | Display data in gigabytes. | `-c` | Display stats N times. | `-m` | Print information in megabytes. | `-k` | Shows output in kilobytes. | But what if you execute the free command without options? Here's what you can expect: ![Use free command without any options](https://itsfoss.com/content/images/2024/01/Use-free-command-without-any-options.png) Here, `total` : it indicates the total amount of storage.`used` : shows the utilized storage by your system.`free` : the amount of free memory that is available for new processes.`shared` : amount of memory used by tmpfs (temporary filesystem).`buff/cache` : represents the sum of the memory used by buffers and cache.`available` : it estimates how much memory is available to start a new application without swapping. It is a sum of the`free` memory and a part of the`buff/cache` which can be immediately used. So, if you want all kinds of information, just type in the command with no flags. Now, let's look at some examples of the free command. ### 1. Display information in human-readable form By default, the free command will display the data in kibibytes which is not the most human-readable form you can have. That's where the `-h` options come into play which prints values in human-readable form such as in KB or GBs. `free -h` ![Get human-readable data through the free command in Linux](https://itsfoss.com/content/images/2024/01/Get-human-readable-data-through-the-free-command-in-Linux.png) ### 2. Show statistics continuously Once you execute the free command, it will only show you stats of the time when you executed the command. For example, if I executed the `free` command at `12:45` then, it will display the stats of that time only. So the question is: How you can achieve a similar behavior like [htop](https://itsfoss.com/use-htop/) which shows the live stats? Not exactly the same, but you can refresh the stats at specific time intervals using the `-s` flag as shown here: `free -s <seconds>` For example, if I want to refresh the free command every second, then I will use the following command: `free -s 1` **Suggested Read 📖** [How to Install and Use htop in Linuxhtop is an excellent utility for monitoring system resources in Linux. It provides a better user experience than the default top command.](https://itsfoss.com/use-htop/)![](https://itsfoss.com/content/images/wordpress/2022/11/install-and-use-htop.jpg) ![](https://itsfoss.com/content/images/wordpress/2022/11/install-and-use-htop.jpg) ### 3. Define how many times to display the stats In a previous example, I explained how you can use the free command to show stats continuously, but you may not want it to refresh endlessly instead, a few times only. For that purpose, you can use the `-c` flag as shown here: `free -c <times_to_show_stats>` Let's say I want to see the stats 3 times, then I will be using the following: `free -c 3` ![Specify how many times the free command should display the stats](https://itsfoss.com/content/images/2024/01/Specify-how-many-times-the-free-command-should-display-the-stats.gif) By default, it will refresh the data every second but you can use the `-s` flag to specify the interval time: `free -c <times_to_show_stats> -s <seconds>` For example, here, if I would like to display stats 3 times with intervals of 2 seconds, then I will be using the following command: `free -c 3 -s 2` ![Specify how many times the free command should display the stats with custom intevals](https://itsfoss.com/content/images/2024/01/Specify-how-many-times-the-free-command-should-display-the-stats-with-custom-intevals.gif) ### 4. Specify the output datatype While for most users, using the `-h` flag to display data in human-readable form would get the job done, but what if you want to specify the data type by yourself? Well, you can specify the datatype using the following flags: Flag | Description | ---|---| `--kilo` | Display memory in kilobytes. | `--mega` | Display memory in megabytes. | `--giga` | Display memory in gigabytes. | `--tera` | Display memory in terabytes. | You can use the above flags in the following manner: `free --<kilo/mega/giga/tera>` For example, if I wish to display memory stats in megabytes, then, I will use the following: `free --mega` ![Print memory statistics in megabytes using the free command in Linux](https://itsfoss.com/content/images/2024/01/Print-memory-statistics-in-megabytes-using-the-free-command-in-Linux.png) ### 5. Get the sum of physical and swap memory By default, the free memory will show the row of physical and swap memory, but what if you want to get the sum of them? Well, you can use the `-t` flag: `free -t` ![Get the sum of physical and swap memory using the free command](https://itsfoss.com/content/images/2024/01/Get-the-sum-of-physical-and-swap-memory-using-the-free-command.png) ## Exercise questions 👨💻 Here are some questions that you can practice to get better at using the free command: - Print memory stats continuously for 3 times, with an interval of 3 seconds in between. - Get the sum of physical and swap memory but in human-readable form. - Redirect the output of the free command in the text file. - How to print only one column from the output of the free command? (Hint: use [awk command](https://linuxhandbook.com/awk-command-tutorial/)and specify column number). If you have any doubts regarding the questions, you can reach out to us in our [community forum](https://itsfoss.community/) or leave a comment here. ## Wrapping Up Every single command comes in handy in one way or the other. The free command also has one such underrated use-case to get useful information. If you are just getting started with a Linux terminal, we made a series for users like you who are eager to learn but can't find a place to start: [Linux Command Tutorials for Absolute BeginnersNever used Linux commands before? No worries. This tutorial series is for absolute beginners to the Linux terminal.](https://itsfoss.com/tag/terminal-basics/)![](https://itsfoss.com/content/images/2023/03/terminal-basics-series-tag.png) ![](https://itsfoss.com/content/images/2023/03/terminal-basics-series-tag.png) *💬 I hope you find this guide useful! Please let me know your thoughts on what should I cover next?*
16,572
Git 提交是差异、快照还是历史记录?
https://jvns.ca/blog/2024/01/05/do-we-think-of-git-commits-as-diffs--snapshots--or-histories/
2024-01-21T18:47:00
[ "Git" ]
https://linux.cn/article-16572-1.html
![](/data/attachment/album/202401/21/184647vzxemtv993tjgmze.jpg) 大家好!我一直在慢慢摸索如何解释 Git 中的各个核心理念(提交、分支、远程、暂存区),而提交这个概念却出奇地棘手。 要明白 Git 提交是如何实现的对我来说相当简单(这些都是确定的!我可以直接查看!),但是要弄清楚别人是怎么看待提交的却相当困难。所以,就像我最近一直在做的那样,我在 Mastodon 上问了一些问题。 ### 大家是怎么看待 Git 提交的? 我进行了一个 [非常不科学的调查](https://social.jvns.ca/@b0rk/111563158717698550),询问大家是怎么看待 Git 提交的:是快照、差异,还是所有之前提交的列表?(当然,把它看作这三者都是合理的,但我很好奇人们的 *主要* 观点)。这是调查结果: ![](/data/attachment/album/202401/21/184734gklvmdjhvvt2mrmv.png) 结果是: * 51% 差异 * 42% 快照 * 4% 所有之前的提交的历史记录 * 3% “其他” 我很惊讶差异和快照两个选项的比例如此接近。人们还提出了一些有趣但相互矛盾的观点,比如 “在我看来,提交是一个差异,但我认为它实际上是以快照的形式实现的” 和 “在我看来,提交是一个快照,但我认为它实际上是以差异的形式实现的”。关于提交的实际实现方式,我们稍后再详谈。 在我们进一步讨论之前:我们的说 “一个差异” 或 “一个快照” 都是什么意思? ### 什么是差异? 我说的“差异”可能相当明显:差异就是你在运行 `git show COMMIT_ID` 时得到的东西。例如,这是一个 rbspy 项目中的拼写错误修复: ``` diff --git a/src/ui/summary.rs b/src/ui/summary.rs index 5c4ff9c..3ce9b3b 100644 --- a/src/ui/summary.rs +++ b/src/ui/summary.rs @@ -160,7 +160,7 @@ mod tests { "; let mut buf: Vec<u8> = Vec::new(); - stats.write(&mut buf).expect("Callgrind write failed"); + stats.write(&mut buf).expect("summary write failed"); let actual = String::from_utf8(buf).expect("summary output not utf8"); assert_eq!(actual, expected, "Unexpected summary output"); } ``` 你可以在 GitHub 上看到它: <https://github.com/rbspy/rbspy/commit/24ad81d2439f9e63dd91cc1126ca1bb5d3a4da5b> ### 什么是快照? 我说的 “快照” 是指 “当你运行 `git checkout COMMIT_ID` 时得到的所有文件”。 Git 通常将提交的文件列表称为 “树”(如“目录树”),你可以在 GitHub 上看到上述提交的所有文件: <https://github.com/rbspy/rbspy/tree/24ad81d2439f9e63dd91cc1126ca1bb5d3a4da5b>(它是 `/tree/` 而不是 `/commit/`) ### “Git 是如何实现的”真的是正确的解释方式吗? 我最常听到的关于学习 Git 的建议大概是 “只要学会 Git 在内部是如何表示事物的,一切都会变得清晰明了”。我显然非常喜欢这种观点(如果你花了一些时间阅读这个博客,你就会知道我 *喜欢* 思考事物在内部是如何实现的)。 但是作为一个学习 Git 的方法,它并没有我希望的那么成功!通常我会兴奋地开始解释 “好的,所以 Git 提交是一个快照,它有一个指向它的父提交的指针,然后一个分支是一个指向提交的指针,然后……”,但是我试图帮助的人会告诉我,他们并没有真正发现这个解释有多有用,他们仍然不明白。所以我一直在考虑其他方案。 但是让我们还是先谈谈内部实现吧。 ### Git 是如何在内部表示提交的 —— 快照 在内部,Git 将提交表示为快照(它存储每个文件当前版本的 “树”)。我在 [在一个 Git 仓库中,你的文件在哪里?](https://jvns.ca/blog/2023/09/14/in-a-git-repository--where-do-your-files-live-/) 中写过这个,但下面是一个非常快速的内部格式概述。 这是一个提交的表示方式: ``` $ git cat-file -p 24ad81d2439f9e63dd91cc1126ca1bb5d3a4da5b tree e197a79bef523842c91ee06fa19a51446975ec35 parent 26707359cdf0c2db66eb1216bf7ff00eac782f65 author Adam Jensen <[email protected]> 1672104452 -0500 committer Adam Jensen <[email protected]> 1672104890 -0500 Fix typo in expectation message ``` 以及,当我们查看这个树对象时,我们会看到这个提交中仓库根目录下每个文件/子目录的列表: ``` $ git cat-file -p e197a79bef523842c91ee06fa19a51446975ec35 040000 tree 2fcc102acd27df8f24ddc3867b6756ac554b33ef .cargo 040000 tree 7714769e97c483edb052ea14e7500735c04713eb .github 100644 blob ebb410eb8266a8d6fbde8a9ffaf5db54a5fc979a .gitignore 100644 blob fa1edfb73ce93054fe32d4eb35a5c4bee68c5bf5 ARCHITECTURE.md 100644 blob 9c1883ee31f4fa8b6546a7226754cfc84ada5726 CODE_OF_CONDUCT.md 100644 blob 9fac1017cb65883554f821914fac3fb713008a34 CONTRIBUTORS.md 100644 blob b009175dbcbc186fb8066344c0e899c3104f43e5 Cargo.lock 100644 blob 94b87cd2940697288e4f18530c5933f3110b405b Cargo.toml ``` 这意味着检出一个 Git 提交总是很快的:对 Git 来说,检出昨天的提交和检出 100 万个提交之前的提交一样容易。Git 永远不需要重新应用 10000 个差异来确定当前状态,因为提交根本就不是以差异的形式存储的。 ### 快照使用 packfile 进行压缩 我刚刚提到了 Git 提交是一个快照,但是,当有人说 “在我看来,提交是一个快照,但我认为它在实现上是一个差异” 时,这其实也是对的!Git 提交并不是以你可能习惯的差异的形式表示的(它们不是以与上一个提交的差异的形式存储在磁盘上的),但基本的直觉是,如果你要对一个 10,000 行的文件编辑 500 次,那么存储 500 份文件的效率会很低。 Git 有一个将文件以差异的形式存储的方法。这被称为 “packfile”,Git 会定期进行垃圾回收,将你的数据压缩成 packfile 以节省磁盘空间。当你 `git clone` 一个仓库时,Git 也会压缩数据。 这里,我没有足够的篇幅来完整地解释 packfile 是如何工作的(Aditya Mukerjee 的 《[解压 Git packfile](https://codewords.recurse.com/issues/three/unpacking-git-packfiles)》是我最喜欢的解释它们是如何工作的文章)。不过,我可以在这里简单总结一下我对 deltas 工作原理的理解,以及它们与 diff 的区别: * 对象存储为 “原始文件” 和一个 “<ruby> 变化量 <rt> delta </rt></ruby>” 的引用 * 变化量是一系列例如 “读取第 0 到 100 字节,然后插入字节 ‘hello there’,然后读取第 120 到 200 字节” 的指令。它从原始文件中拼凑出新的文本。所以没有 “删除” 的概念,只有复制和添加。 * 我认为变化量的层次较少:我不知道如何检查 Git 究竟要经过多少层变化量才能得到一个给定的对象,但我的印象是通常不会很多。可能少于 10 层?不过,我很想知道如何才能真正查出来。 * 原始文件不一定来自上一个提交,它可以是任何东西。也许它甚至可以来自一个更晚的提交?我不确定。 * 没有一个 “正确的” 算法来计算变化量,Git 只是有一些近似的启发式算法 ### 当你查看差异时,实际上发生了一些奇怪的事情 当我们运行 `git show SOME_COMMIT` 来查看某个提交的差异时,实际上发生的事情有点反直觉。我的理解是: 1. Git 会在 packfile 中查找并应用变化量来重建该提交和其父提交的树。 2. Git 会对两个目录树(当前提交的目录树和父提交的目录树)进行差异比较。通常这很快,因为几乎所有的文件都是完全一样的,所以 git 只需比较相同文件的哈希值就可以了,几乎所有时候都不用做什么。 3. 最后 Git 会展示差异 所以,Git 会将变化量转换为快照,然后计算差异。它感觉有点奇怪,因为它从一个类似差异的东西开始,最终得到另一个类似差异的东西,但是变化量和差异实际上是完全不同的,所以这是说得通的。 也就是说,我认为 Git 将提交存储为快照,而 packfile 只是一个实现细节,目的是节省磁盘空间并加快克隆速度。我其实从来没必要知道 packfile 是如何工作的,但它确实能帮助我理解 Git 是如何在不占用太多磁盘空间的情况下将提交快照化的。 ### 一个 “错误的” Git 理解:提交是差异 我认为一个相当常见的,对 Git 的 “错误” 的理解是: * 提交是以基于上一个提交的差异的形式存储的(加上指向父提交的指针和作者和消息)。 * 要获取提交的当前状态,Git 需要从头开始重新应用所有之前的提交。 这个理解当然是错误的(在现实中,提交是以快照的形式存储的,差异是从这些快照计算出来的),但是对我来说它似乎非常有用而且有意义!在考虑合并提交时会有一点奇怪,但是或许我们可以说这只是基于合并提交的第一个父提交的差异。 我认为这个错误的理解有的时候非常有用,而且对于日常 Git 使用来说它似乎并没有什么问题。我真的很喜欢它将我们最常使用的东西(差异)作为最基本的元素——它对我来说非常直观。 我也一直在思考一些其他有用但 “错误” 的 Git 理解,比如: * 提交信息可以被编辑(实际上不能,你只是复制了一个相同的提交然后给了它一个新的信息,旧的提交仍然存在) * 提交可以被移动到一个不同的基础上(类似地,它们是被复制了) 我认为有一系列非常有意义的、 “错误” 的对 Git 的理解,它们在很大程度上都受到 Git 用户界面的支持,并且在大多数情况下都不会产生什么问题。但是当你想要撤销一个更改或者出现问题时,它可能会变得混乱。 ### 将提交视为差异的一些优势 就算我知道在 Git 中提交是快照,我可能大部分时间也都将它们视为差异,因为: * 大多时候我都在关注我正在做的 **更改** —— 如果我只是改变了一行代码,显然我主要是在考虑那一行代码而不是整个代码库的当前状态 * 点击 GitHub 上的 Git 提交或者使用 `git show` 时,你会看到差异,所以这只是我习惯看到的东西 * 我经常使用变基,它就是关于重新应用差异的 ### 将提交视为快照的一些优势 但是我有时也会将提交视为快照,因为: * Git 经常对文件的移动感到困惑:有时我移动了一个文件并编辑了它,Git 无法识别它是否被移动过,而是显示为 “删除了 old.py,添加了 new.py”。这是因为 Git 只存储快照,所以当它显示 “移动 old.py -> new.py” 时,只是猜测,因为 old.py 和 new.py 的内容相似。 * 这种方式更容易理解 `git checkout COMMIT_ID` 在做什么(重新应用 10000 个提交的想法让我感到很有压力) * 合并提交在我看来更像是快照,因为合并的提交实际上可以是任何东西(它只是一个新的快照!)。它帮助我理解为什么在解决合并冲突时可以进行任意更改,以及为什么在解决冲突时要小心。 ### 其他一些关于提交的理解 Mastodon 的一些回复中还提到了: * 有关提交的 “额外的” 带外信息,比如电子邮件、GitHub 拉取请求或者你和同事的对话 * 将“差异”视为一个“之前的状态 + 之后的状态” * 以及,当然,很多人根据情况的不同以不同的方式看待提交 人们在谈论提交时使用的其他一些词可能不那么含糊: * “修订”(似乎更像是快照) * “补丁”(看起来更像是差异) ### 就到这里吧! 我很难了解人们对 Git 有哪些不同的理解。尤其棘手的是,尽管 “错误” 的理解往往非常有用,但人们却非常热衷于警惕 “错误” 的心智模式,所以人们不愿意分享他们 “错误” 的想法,生怕有什么 Git 解释者会站出来向他们解释为什么他们是错的。(这些 Git 解释者通常是出于善意的,但是无论如何它都会产生一种负面影响) 但是我学到了很多!我仍然不完全清楚该如何谈论提交,但是我们最终会弄清楚的。 感谢 Marco Rogers、Marie Flanagan 以及 Mastodon 上的所有人和我讨论 Git 提交。 *(题图:DA/cc0cada9-4945-4248-8635-3f89dcebd6ef)* --- via: <https://jvns.ca/blog/2024/01/05/do-we-think-of-git-commits-as-diffs--snapshots--or-histories/> 作者:[Julia Evans](https://jvns.ca/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[Cubik65536](https://github.com/Cubik65536) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
Hello! I’ve been extremely slowly trying to figure how to explain every core concept in Git (commits! branches! remotes! the staging area!) and commits have been surprisingly tricky. Understanding how git commits are implemented feels pretty straightforward to me (those are facts! I can look it up!), but it’s been much harder to figure out how other people think about commits. So like I’ve been doing a lot recently, I went on Mastodon and started asking some questions. ### how do people think about Git commits? I did a [highly unscientific poll](https://social.jvns.ca/@b0rk/111563158717698550) on Mastodon about how people think about Git commits: is it a snapshot? is it a diff? is it a list of every previous commit? (Of course it’s legitimate to think about it as all three, but I was curious about the *primary* way people think about Git commits). Here it is: ![](https://jvns.ca/images/git-commit-poll.png) The results were: - 51% diff - 42% snapshot - 4% history of every previous commit - 3% “other” I was really surprised that it was so evenly split between diffs and snapshots. People also made some interesting kind of contradictory statements like “in my mind a commit is a diff, but I think it’s actually implemented as a snapshot” and “in my mind a commit is a snapshot, but I think it’s actually implemented as a diff”. We’ll talk more about how a commit is actually implemented later in the post. Before we go any further: when we say “a diff” or “a snapshot”, what does that mean? ### what’s a diff? What I mean by a diff is probably obvious: it’s what you get when you run `git show COMMIT_ID` . For example here’s a typo fix from rbspy: ``` diff --git a/src/ui/summary.rs b/src/ui/summary.rs index 5c4ff9c..3ce9b3b 100644 --- a/src/ui/summary.rs +++ b/src/ui/summary.rs @@ -160,7 +160,7 @@ mod tests { "; let mut buf: Vec<u8> = Vec::new(); - stats.write(&mut buf).expect("Callgrind write failed"); + stats.write(&mut buf).expect("summary write failed"); let actual = String::from_utf8(buf).expect("summary output not utf8"); assert_eq!(actual, expected, "Unexpected summary output"); } ``` You can see it on GitHub here: [https://github.com/rbspy/rbspy/commit/24ad81d2439f9e63dd91cc1126ca1bb5d3a4da5b](https://github.com/rbspy/rbspy/commit/24ad81d2439f9e63dd91cc1126ca1bb5d3a4da5b) ### what’s a snapshot? When I say “a snapshot”, what I mean is “all the files that you get when you run `git checkout COMMIT_ID` ”. Git often calls the list of files for a commit a “tree” (as in “directory tree”), and you can see all of the files for the above example commit here on GitHub: [https://github.com/rbspy/rbspy/tree/24ad81d2439f9e63dd91cc1126ca1bb5d3a4da5b](https://github.com/rbspy/rbspy/tree/24ad81d2439f9e63dd91cc1126ca1bb5d3a4da5b) (it’s `/tree/` instead of `/commit/` ) ### is “how Git implements it” really the right way to explain it? Probably the most common piece of advice I hear related to learning Git is “just learn how Git represents things internally, and everything will make sense”. I obviously find this perspective extremely appealing (if you’ve spent any time reading this blog, you know I *love* thinking about how things are implemented internally). But as a strategy for teaching Git, it hasn’t been as successful as I’d hoped! Often I’ve eagerly started explaining “okay, so git commits are snapshots with a pointer to their parent, and then a branch is a pointer to a commit, and…”, but the person I’m trying to help will tell me that they didn’t really find that explanation that useful at all and they still don’t get it. So I’ve been considering other options. Let’s talk about the internals a bit anyway though. ### how git represents commits internally: snapshots Internally, git represents commits as snapshots (it stores the “tree” of the current version of every file). I wrote about this in [In a git repository, where do your files live?](https://jvns.ca/blog/2023/09/14/in-a-git-repository--where-do-your-files-live-/), but here’s a very quick summary of what the internal format looks like. Here’s how a commit is represented: ``` $ git cat-file -p 24ad81d2439f9e63dd91cc1126ca1bb5d3a4da5b tree e197a79bef523842c91ee06fa19a51446975ec35 parent 26707359cdf0c2db66eb1216bf7ff00eac782f65 author Adam Jensen <[email protected]> 1672104452 -0500 committer Adam Jensen <[email protected]> 1672104890 -0500 Fix typo in expectation message ``` and here’s what we get when we look at this tree object: a list of every file / subdirectory in the repository’s root directory as of that commit: ``` $ git cat-file -p e197a79bef523842c91ee06fa19a51446975ec35 040000 tree 2fcc102acd27df8f24ddc3867b6756ac554b33ef .cargo 040000 tree 7714769e97c483edb052ea14e7500735c04713eb .github 100644 blob ebb410eb8266a8d6fbde8a9ffaf5db54a5fc979a .gitignore 100644 blob fa1edfb73ce93054fe32d4eb35a5c4bee68c5bf5 ARCHITECTURE.md 100644 blob 9c1883ee31f4fa8b6546a7226754cfc84ada5726 CODE_OF_CONDUCT.md 100644 blob 9fac1017cb65883554f821914fac3fb713008a34 CONTRIBUTORS.md 100644 blob b009175dbcbc186fb8066344c0e899c3104f43e5 Cargo.lock 100644 blob 94b87cd2940697288e4f18530c5933f3110b405b Cargo.toml ``` What this means is that checking out a Git commit is always fast: it’s just as easy for Git to check out a commit from yesterday as it is to check out a commit from 1 million commits ago. Git never has to replay 10000 diffs to figure out the current state or anything, because commits just aren’t stored as diffs. ### snapshots are compressed using packfiles I just said that Git commits are snapshots, but when someone says “I think of git commits as a snapshot, but I think internally they’re actually diffs”, that’s actually kind of true too! Git commits are not represented as diffs in the sense you’re probably used to (they’re not represented on disk as a diff from the previous commit), but the basic intuition that if you’re editing a 10,000 lines 500 times, it would be inefficient to store 500 copies of that file is right. Git does have a way of storing files as differences from other ways. This is called “packfiles” and periodically git will do a garbage collection and compress your data into packfiles to save disk space. When you `git clone` a repository git will also compress the data. I don’t have space for a full explanation of how packfiles work in this post (Aditya Mukerjee’s [Unpacking Git packfiles](https://codewords.recurse.com/issues/three/unpacking-git-packfiles) is my favourite writeup of how they work). But here’s a quick summary of my understanding of how deltas work and how they’re different from diffs: - Objects are stored as a reference to an “original file”, plus a “delta” - the delta has a bunch of instructions like “read bytes 0 to 100, then insert bytes ‘hello there’, then read bytes 120 to 200”. It cobbles together bytes from the original plus new text. So there’s no notion of “deletions”, just copies and additions. - I think there are less layers of deltas: I don’t know how to actually check how many layers of deltas Git actually had to go through to get a given object, but my impression is that it usually isn’t very many. Probably less than 10? I’d love to know how to actually find this out though. - The “original file” isn’t necessarily from the previous commit, it could be anything. Maybe it could even be from a later commit? I’m not sure about that. - There’s no “right” algorithm for how to compute deltas, Git just has some approximate heuristics ### what actually happens when you do a diff is kind of weird When I run `git show SOME_COMMIT` to look at the diff for a commit, what actually happens is kind of counterintuitive. My understanding is: - git looks in the packfiles and applies deltas to reconstruct the tree for that commit and for its parent. - git diffs the two directory trees (the current commit’s tree, and the parent commit’s tree). Usually this is pretty fast because almost all of the files are exactly the same, so git can just compare the hashes of the identical files and do nothing almost all of the time. - finally git shows me the diff So it takes deltas, turns them into a snapshot, and then calculates a diff. It feels a little weird because it starts with a diff-like-thing and ends up with another diff-like-thing, but the deltas and diffs are actually totally different so it makes sense. That said, the way I think of it is that git stores commits as snapshots and packfiles are just an implementation detail to save disk space and make clones faster. I’ve never actually needed to know how packfiles work for any practical reason, but it does help me understand how it’s *possible* for git commits to be snapshots without using way too much disk space. ### a “wrong” mental model for git: commits are diffs I think a pretty common “wrong” mental model for Git is: - commits are stored as diffs from the previous commit (plus a pointer to the parent commit(s) and an author and message). - to get the current state for a commit, Git starts at the beginning and replays all the previous commits This model is obviously not **true** (in real life, commits are stored as snapshots, and diffs are calculated from those snapshots), but it seems very useful and coherent to me! It gets a little weird with merge commits, but maybe you just say it’s stored as a diff from the first parent of the merge. I think wrong mental models are often extremely useful, and this one doesn’t seem very problematic to me for every day Git usage. I really like that it makes the thing that we deal with the most often (the diff) the most fundamental – it seems really intuitive to me. I’ve also been thinking about other “wrong” mental models you can have about Git which seem pretty useful like: - commit messages can be edited (they can’t really, actually you make a copy of the commit with a new message, and the old commit continues to exist) - commits can be moved to have a different base (similarly, they’re copied) I feel like there’s a whole very coherent “wrong” set of ideas you can have about git that are pretty well supported by Git’s UI and not very problematic most of the time. I think it can get messy when you want to undo a change or when something goes wrong though. ### some advantages of “commit as diff” Personally even though I know that in Git commits are snapshots, I probably think of them as diffs most of the time, because: - most of the time I’m concerned with the **change**I’m making – if I’m just changing 1 line of code, obviously I’m mostly thinking about just that 1 line of code and not the entire current state of the codebase - when you click on a Git commit on GitHub or use `git show` , you see the diff, so it’s just what I’m used to seeing - I use rebase a lot, which is all about replaying diffs ### some advantages of “commit as snapshot” I also think about commits as snapshots sometimes though, because: - git often gets confused about file moves: sometimes if I move a file and edit it, Git can’t recognize that it was moved and instead will show it as “deleted old.py, added new.py”. This is because git only stores snapshots, so when it says “moved old.py -> new.py”, it’s just guessing because the contents of `old.py` and`new.py` are similar. - it’s conceptually much easier to think about what `git checkout COMMIT_ID` is doing (the idea of replaying 10000 commits just feels stressful to me) - merge commits kind of make more sense to me as snapshots, because the merged commit can actually be literally anything (it’s just a new snapshot!). It helps me understand why you can make arbitrary changes when you’re resolving a merge conflict, and why it’s so important to be careful about conflict resolution. ### some other ways to think about commits Some folks in the Mastodon replies also mentioned: - “extra” out-of-band information about the commit, like an email or a GitHub pull request or just a conversation you had with a coworker - thinking about a diff as a “before state + after state” - and of course, that lots of people think of commits in lots of different ways depending on the situation some other words people use to talk about commits might be less ambiguous: - “revision” (seems more like a snapshot) - “patch” (seems more like a diff) ### that’s all for now! It’s been very difficult for me to get a sense of what different mental models people have for git. It’s especially tricky because people get really into policing “wrong” mental models even though those “wrong” models are often really useful, so folks are reluctant to share their “wrong” ideas for fear of some Git Explainer coming out of the woodwork to explain to them why they’re Wrong. (these Git Explainers are often well-intentioned, but it still has a chilling effect either way) But I’ve been learning a lot! I still don’t feel totally clear about how I want to talk about commits, but we’ll get there eventually. Thanks to Marco Rogers, Marie Flanagan, and everyone on Mastodon for talking to me about git commits.
16,574
使用 Kate 编写文档
https://fedoramagazine.org/writing-docs-with-kate-and-git/
2024-01-22T10:03:01
[ "Kate", "编辑器" ]
https://linux.cn/article-16574-1.html
![](/data/attachment/album/202401/22/100139stdtdd13ds13353c.jpg) Kate(**K**DE **A**dvanced **T**ext **E**ditor)是一款自由开源的文本编辑器,适用于 Linux、Windows 和 macOS。 对于文档编写者来说,Kate 集成的 Git 功能可以帮助简化编写过程。你无需记住 Git 命令,也无需在每次更改文件或切换分支时在终端中输入它们。 本文重点为从事各种 Fedora 文档仓库的贡献者介绍 Kate 的主要功能。这些功能可以扩展到其他文档仓库。 ### 将 Kate 与你的仓库一起使用的准备工作 1. 将 SSH 密钥添加到 Pagure、GitLab 或 GitHub 上的帐户设置中。 * 在 Pagure 上,转到 <ruby> 我的设置 <rt> My Settings </rt></ruby> – <ruby> SSH 密钥 <rt> SSH Keys </rt></ruby> – <ruby> 添加 SSH 密钥 <rt> Add SSH Key </rt></ruby> * 在 GitLab 上,<ruby> 首选项 <rt> Preferences </rt></ruby> – <ruby> 用户设置 <rt> User Settings </rt></ruby> – <ruby> 添加 SSH 密钥 <rt> Add an SSH Key </rt></ruby> * 在 GitHub 上,<ruby> 设置 <rt> Settings </rt></ruby> – <ruby> SSH 和 GPG 密钥 <rt> SSH and GPG keys </rt></ruby> – <ruby> 新的 SSH 密钥 <rt> New SSH key </rt></ruby> 2. 复刻项目:转到上游仓库并选择 “<ruby> 复刻 <rt> Fork </rt></ruby>” 按钮 3. 克隆仓库 * 在你的分叉仓库中,选择 “<ruby> 使用 SSH 克隆 <rt> Clone with SSH </rt></ruby>”。 * 接下来,将该链接复制到剪贴板并将其粘贴到终端中的 GIT URL 中。 * 克隆仓库时,你可以指定新目录名称作为附加参数。`$ git clone <GIT URL> 新目录` 4. 安装 Kate。如果你是 Linux 用户,请转到发行版的包管理器来安装 Kate。如果你使用 Fedora Linux,我们推荐 Fedora Linux RPM 版本或 Flatpak。 ### 会话 Kate 文本编辑器中的会话功能可以将单独的项目分组在一起,并帮助你在单个视图中处理多个文档仓库。 要将仓库保存在会话中: 转到 “<ruby> 文件 <rt> File </rt></ruby>” 下拉菜单 – 选择 “<ruby> 打开文件夹 <rt> Open folder </rt></ruby>” – 选择克隆的目录。 从 “<ruby> 会话 <rt> Sessions </rt></ruby>” 下拉菜单中 – 选择 “<ruby> 保存会话 <rt> Save session </rt></ruby>” – 输入会话名称 – 按 “<ruby> 确定 <rt> OK </rt></ruby>”。 在左侧窗格中,单击 “<ruby> 项目列表 <rt> project list </rt></ruby>” 保存到新会话“Magazine”。下次打开 Kate 时,保存到会话中的克隆仓库将重新出现。 ![Sessions Menu](/data/attachment/album/202401/22/100303o37vnav49ep963z0.png) ### 使用状态栏签出分支 使用 Kate 编辑器,你可以在状态栏和弹出屏幕上切换分支或创建新分支。 当前分支显示在状态栏的右下角。 要创建新分支,请选择 “Main” 分支。从弹出菜单中选择 “<ruby> 创建新分支 <rt> Create New Branch </rt></ruby>” 并输入新分支名称。 ![Popup menu showing Create New branch](/data/attachment/album/202401/22/100303c198h26j58nco2i6.png) ### 对 AsciiDoc 高亮显示的内置支持 具有 AsciiDoc 扩展名的文件将使用 `asciidoc.xml` 中的规则自动高亮显示。你不需要安装外部插件。 ### 即时拼写检查 如果你希望在输入时自动进行拼写检查,请按 `Ctrl + Shift + O`。此组合键将打开和关闭拼写检查。 ### Git 工具视图 左侧窗格中的工具视图显示每个打开文件的 Git 状态。 ![Show diff](/data/attachment/album/202401/22/100304sghr33c0gopmhmbz.png) “<ruby> 已暂存 <rt> Staged </rt></ruby>” 表示文件已添加(与 Git 添加相同),并且如果你选择顶部的 “<ruby> 提交 <rt> Commit </rt></ruby>” 按钮,文件将被提交。 “<ruby> 已修改 <rt> Modified </rt></ruby>” 显示尚未暂存的更改。 单击左侧面板顶部的 “<ruby> 提交 <rt> Commit </rt></ruby>” 按钮以显示该提交的差异。这将在提交工具视图中打开选定的提交。如果你想查看提交中的所有更改,请右键单击并选择 “<ruby> 显示完整提交 <rt> Show Full Commit </rt></ruby>”,添加一个提交消息。 Git “<ruby> 推送 <rt> Push </rt></ruby>” 按钮在 “<ruby> 提交 <rt> Commit </rt></ruby>” 按钮的右边。Git “<ruby> 拉取 <rt> Pull </rt></ruby>” 按钮在 “<ruby> 推送 <rt> Push </rt></ruby>” 按钮的右边。 选择 “<ruby> 刷新 <rt> Refresh </rt></ruby>” 图标(圆圈箭头)以查看暂存文件和提交的情况。 ### 集成终端 按 `F4` 或选择 “<ruby> 终端 <rt> Terminal </rt></ruby>” 按钮可打开和关闭集成终端。 你可以通过集成终端使用构建脚本和 Vale linter,将你的写作提升到一个新的水平,确保文档质量。 #### 步骤 1. 运行构建脚本 要在本地检查文档质量,你可以在集成终端中运行构建和预览脚本。构建和预览脚本可让你准确查看更改如何通过 Antora 静态站点生成器在文档页面中发布。 注意:检查 Fedora 文档仓库的 README 页面,为构建脚本和说明使用正确的文件名。下面是一个例子: 要构建和预览站点,请运行: ``` $ ./docsbuilder.sh -p ``` 结果可访问 <http://localhost:8080> 要停止预览: ``` $ ./docsbuilder.sh -k ``` #### 步骤 2. 对你的文本运行 Vale Vale 是一个命令行工具,用于检查文本是否符合定义的样式指南。参考该 [指南](https://docs.fedoraproject.org/en-US/fedora-docs/contributing-docs/tools-vale-linter/) 在本地运行 Vale。 ### 鸣谢 非常感谢 KDE 开发人员 Nicco,他的视频教程频道 “[Nicco loves Linux](https://www.youtube.com/c/Niccol%C3%B2Ve)” 给了我很多灵感。 本文使用的 Kate 版本为 23.08.3 > > **[上游文档](https://docs.kde.org/stable5/en/kate/kate/index.html)** > > > 以下是本文使用的 Fedora 文档 Git 仓库: * [快速文档](https://pagure.io/fedora-docs/quick-docs.git) * [Kinoite 用户文档](https://pagure.io/fedora-kde/kinoite-docs.git) * [IoT 用户文档](https://github.com/fedora-iot/iot-docs.git) * [文档贡献者指南](https://gitlab.com/fedora/docs/community-tools/documentation-contributors-guide.git) *(题图:DA/519568d2-a224-4075-a751-a1a8bc702079)* --- via: <https://fedoramagazine.org/writing-docs-with-kate-and-git/> 作者:[Hank Lee](https://fedoramagazine.org/author/hankuoffroad/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
Kate (**K**DE **A**dvanced **T**ext **E**ditor) is a Free and Open Source text editor, available for Linux, Windows and macOS. For documentation writers, the integrated Git features of Kate can help simplify the writing process. You do not need to remember Git commands and type them in the terminal every time you make changes to files or switch branches. This article focuses on key features of Kate for contributors working on various Fedora documentation repositories. The capabilities can be extended to other documentation repositories. ## Preparations For Using Kate With Your Repository - Add SSH key to settings of your account on Pagure, GitLab or GitHub. - On Pagure, go to My Settings – SSH Keys – Add SSH Key - On GitLab, Preferences – User Settings – Add an SSH Key - On GitHub, Settings – SSH and GPG keys – New SSH key - Fork a project: Go to the upstream repository and select the Fork button - Clone the repository - In your forked repository, select Clone with SSH. - Next, copy that link to your clipboard and paste it in GIT URL in terminal. - When cloning a repository, you can specify the new directory name as an additional argument. $ git clone <GIT URL> new directory - Install Kate. If you are Linux users, go to the packager manager of your distro to install Kate. If you use Fedora Linux, we recommend the Fedora Linux RPM version or Flatpak. ## Sessions Sessions in Kate text editor keep separate projects grouped together and help you work with multiple documentation repositories in a single view. To save repositories in a session: Go to the *File*, pull down menu – Select *Open folder* – Choose the cloned directory. From the *Sessions,* pull down menu – Select *Save session *– Enter a session name – Press OK. On the left pane, click *project list* saved to a new session ‘Magazine’. Next time you open Kate, the cloned repositories saved to the session will reappear. ## Using the Status Bar to checkout a branch With Kate editor, you can switch branches or create a new branch on the status bar and pop-up screen. The current branch is shown in the lower right corner in the status bar. To create a new branch, select *Main* branch. From the popup menu select *Create New Branch* and enter a new branch name. ## Built-in support for AsciiDoc highlighting Files with the AsciiDoc extension will automatically be highlighted using the rules in asciidoc.xml. You don’t need to install external plugins. ## On-the-fly spell checking If you want automatic spell checking as you type, press Ctrl + Shift + O. This key combination will toggle spell check on and off. ## Git toolview The toolview on the left pane shows the git status of each open files. *Staged* means the files are added (same as Git add) and will be committed if you select the **Commit** button at the top. *Modified* shows the changes that are not staged yet. Click the *Commit* button at the top of the left panel to show the diff for that commit. This will open the selected commit in the Commit toolview. If you want to see all the changes in the commit, right click and select *Show Full Commit*. Add a commit message. *git push* button is to the right of the *commit* button. *git pull* button is to the right of the git push button. Select the *refresh* icon (circular arrows) to see what has been going on with staged files and commits. ## Integrated terminal Press *F4*, or select the *terminal* button, to toggle the integrated terminal on and off. You may take your writing to the next level, ensure documentation quality, by using build scripts and Vale linter via the integrated terminal. **Step 1. Run build scripts** To check document quality locally, you may run build and preview scripts in the integrated terminal. Build and preview scripts let you view the changes exactly how it will be published in Docs pages through Antora static site generator. Note: check the README page of your Fedora documentation repositories to use the correct file name for build scripts and instructions. The following is an example: To build and preview the site, run: The result will be available at http://localhost:8080 To stop the preview: **Step 2. Run Vale on your text** Vale is a command line tool that checks your text for adherence to a defined style guide. Run Vale locally referring [to the guide](https://docs.fedoraproject.org/en-US/fedora-docs/contributing-docs/tools-vale-linter/). ## Credits and acknowledgements Big thanks to Nicco, a KDE developer, who provided me with a great deal of inspiration from his video tutorial channel ‘[Nicco loves Linux](https://www.youtube.com/c/Niccol%C3%B2Ve)‘. Kate Version used in this article was 23.08.3 The following are Fedora documentation Git repos used in this article; [Quick Docs](https://pagure.io/fedora-docs/quick-docs.git)[Kinoite User Docs](https://pagure.io/fedora-kde/kinoite-docs.git)[IoT User Docs](https://github.com/fedora-iot/iot-docs.git)[Documentation Contributors Guide](https://gitlab.com/fedora/docs/community-tools/documentation-contributors-guide.git) ## Darvond Now here’s a useful guide. Personally I prefer the simpler Mousepad for basic jots, but Kate is certainly there when I need it. And it’s so lightweight even with all the utility it has. When it comes to writing proper documents, I prefer Wordgrinder or WordTsar, maybe FocusWriter if I’m in the mood for a fancier interface. LibreOffice is great but is a distraction waiting to happen with all those fancy knobs, buttons, and ribbons. ## Hank Lee Grateful for your comment. Always helpful to know reader’s point of view 🙂 Like yourself, I use a much simpler editor (Kwrite or notepad++) as well if I write speech note or manuscript in general. I made an improvement for my writing workflow using Kate text editor. I can work through docs repos in Pagure, GitLab and GitHub without changing context. So I can stay on Kate 99% of the time I review and write user documentation, which is often code-rich. It all depends on working rule of team and who I will work with and review my document, and how they want me to submit a draft. ## Alistair Cookie LibreOffice is a disaster waiting to happen. It should not be forced down on anyone. On any distro. ## aye Great info, thanks! I,myself, has been using kate for editing html related files. I like kate, it’s bestowed me certain possibilities and freedom in some area better than its counterparts. ## lunakitty Kate is amazing. It’s a pretty good alternative to VSCode too. ## Ernesto di Terribile I take VSCodium over VSCode every day ## Alistair Cookie what a helpful comment. ## Grandpa Leslie Satenstein Happy New Year to you “Hank”, and to all devoted Linux users. Special wishes include “good health, prosperity and everything positive.” I did read the above, and found it well done. I needed to read it twice, and then evaluate “kate” as my default graphics editor. Is it possible to redo your presentation for a YouTube presentation? It would be appreciated if you had produced a YouTube video to describe what you are documenting above, not because I have become lazy to read too many activities/details, especially when time is short. I tend to learn better by “monkey see, monkey do” approach to learning. ## Hank Lee Hi Leslie, happy 2024 for you and your family! Thanks for your comments and suggestions. I understand this article is introductory one, based on key features. I made a content proposal for ‘Writing user documentation on multiple repos and Git forge’ to Fedora project. https://discussion.fedoraproject.org/t/writing-goals/101047#contributor-guide-3 I’ll record the session with Kate and share the link in Fedora discourse forum (#docs-team tag) in Feb-Mar. Another untold benefit of using a text editor for writing is I can work on multiple documentation drafts (with lots of bash commands and comments) without internet connection. I keep adding changes offline in Kate and push changes later, so I can concentrate on wording and flow. ## johnatan actually this article is low effort one, It should have been written 10 years ago, and there are a lot of articles about Kate, which tell the same info as this one. Nowadays kate is all about new cool plugins like language server and debug server. You literary can set up language server for many languages and to set up debug server plugin to have debugging capability for your languages. For example I use Kate with go to write code with code completion and documentation, build plugin to run the code and debug plugin to debug it. Kate is the coolest default text editor on linux (compared to gedit, mousepad etc) It is not as powerful as vscode, but is very fast and eats small amout of memory. ## Hank Lee Kate’s Git features are recently documented by KDE developer like this https://kate-editor.org/post/2023/2023-02-01-using-kate-git-support/ Use case I tried is that when tech writers use multiple web interfaces of Git forge – Pagure, GitLab and GitHub, the friction started to mount and affected writer’s productivity. I have experimented workflow some time in 2023 at a point I can document for other colleagues I work with. I didn’t find anything that matches my use case. If you have one, let me know. I’d love to reference it for my how to guide. ## Dmitri I remember I used Kate as full IDE even about 13 years ago, one of best editors ever. But now I migrated to Vim.
16,575
曾经,Lotus Notes 几乎能满足公司的一切需求
https://www.theregister.com/2024/01/19/remembering_lotus_notes/
2024-01-22T14:45:54
[ "Lotus Notes" ]
https://linux.cn/article-16575-1.html
![](/data/attachment/album/202401/22/144529wt13s8k71t15gxj8.jpg) > > 现在,它的功能分散在无数供应商之间。 > > > 技术的进步似乎是线性的,新的技术总是会取代旧的。从这个角度来看,新技术总是更好,因为我们假定新技术是基于旧技术,并对其进行了改进。 但当你年纪渐长,你就会开始意识到这并非总是如此。进步并不总是直线前进的。只要看看个人电脑是如何基本上取代之前笨重的大型机和微型机,然后再慢慢积累那些老系统的先进功能,如多用户支持、冗余和安全性等。 还有一些技术似乎走在了时代的前列,或者说成为业界老鸟们怀念的对象,因为它们提供了当今高科技世界所缺少的东西。 其中之一就是 Lotus Notes,提到它可能会让读者嗤之以鼻,因为它确实有不少缺点;例如,它的资源贪婪让一些用户将这个程序称为 “Notice Loads”。 不过,你几乎可以用 Lotus Notes(加上其 Domino 服务器后端)管理整个公司,许多公司也确实是这样做的。这个程序是电子邮件、数据库和工作流的奇特组合,允许公司在 Notes 里面设置定制的应用,并将它们部署给相关的工作人员群体。 笔者曾在一家广泛使用 Notes 的出版公司工作,我发现它在当时非常有用。它不仅提供了电子邮件,还提供了内部电话簿、联系人数据库、请假系统、公司手册等,所有这些都可以通过单个应用程序和单套凭证进行访问,而这远在单点登录成为风潮之前。 如今,即使不是全部,也是大部分,这些功能都通过独立的基于网络的应用程序提供,每个程序都需要不同的登录方式,因此你需要记住几十个不同的凭证,而且每个凭证都有不同的用户界面。因此,我想你当可以把网络浏览器看作是一个应用程序运行时,它是 Notes 的最终继承者。 如果你想了解 Notes 有多有用,可以参考笔者作为评论编辑,使用过的一个应用。我们的杂志(还记得纸质杂志吗?多么古老啊!)过去每个月的月刊都会刊登大约 30 页的产品评论,我们在 Notes 上建立了一个数据库来帮助跟踪所有内容。 过去,待评论的计算机套件运抵到出版商的办公室后,会给一个序列号,并由工作人员记录到仓库。作为评论编辑,我会在 Notes 上收到产品已到的通知,这样评论编辑就可以知道产品正在等待他们的指指点点,我也可以把它添加到目前正在制作的那期杂志的产品列表中。 出版商的内部摄影师(当时是九十年代,出版商比较有钱)可以看到同一张表格,因此他们知道该为该期杂志拍摄哪些产品。这个工作流程是在 Lotus Notes 上内部构建的。公司里的其他人也有许多类似的应用程序可以使用。 也许我对 Notes 的记忆有些美化,但我记得由于邮件信息链的会话视图,管理邮件变得非常容易,而后来我在一家使用 Outlook 的公司工作时,感觉真是大步后退。 然而,在新千年的时候,Notes 已经开始显得有点笨拙和过时,它的庞大用户群体也开始减少,因为企业开始转向微软 Exchange Server 和 Outlook 的组合,而后者在工作流程方面也许更容易与微软 Office 应用程序和 VBA 集成。 最终,IBM 在 1995 年收购了 Lotus,而在 2012 年,IBM 宣布将完全停用 Lotus 品牌,并于 2018 年将 Notes 出售给印度的软件公司 HCL Technologies。 该平台依然存在,HCL 去年发布了 [Domino 14.0](https://www.theregister.com/2023/06/12/hcl_domino_14/),正如 The Register 当时评论的那样,这说明了在该平台上构建的定制工作流程的 “粘性”。 有一家公司出版了 Lotus Notes 从诞生到现在的 [详细历史](https://www.stellarinfo.com/blog/complete-history-ibm-lotus-notes-hcl-notes/),感兴趣的人可以去看看。 但 Notes 并不是所有还在使用的软件中最古老的。据说,为美国国防部(DoD)管理合同的美国国防合同管理机构(DCMA)有一个名为合同管理服务机械化([MOCAS](https://fossbytes.com/mocas-worlds-oldest-computer-program/))的程序,该程序于 1958 年推出,因此它的历史几乎是 Notes 的两倍。 *(题图:DA/51b205bf-c1eb-4c58-8663-ff76a64162e2)* --- via: <https://www.theregister.com/2024/01/19/remembering_lotus_notes/> 作者:[Dan Robinson](https://www.theregister.com/Author/Dan-Robinson) 译者:[ChatGPT](https://linux.cn/lctt/ChatGPT) 校对:[wxy](https://github.com/wxy)
200
OK
# For a moment there, Lotus Notes appeared to do everything a company needed ## Now its functions are shattered between innumerable vendors Retro Tech Week It may seem that progress in technology proceeds in a linear fashion, with new developments replacing older ones. From this viewpoint, newer technology will always be better, since it is presumed to have built upon what came before it and improved on it. Grow older, and you start to realize that this isn't always the case. Progress doesn't always go in a straight line. Just look at how personal computers largely replaced the hulking mainframes and minicomputers that came before them, then proceeded to slowly accumulate the advanced features of those older systems, like multi-user support, redundancy, and security. There are also technologies that seemed ahead of their time, or which industry veterans may look back on with fondness because they offered something missing from our current world of high tech. One of these is Lotus Notes, the mere mention of which is likely to draw derisory comments from readers because it certainly wasn't without its faults; its resource-hungriness caused the program to be referred to as "Notice Loads" among some users, for example. However, you could just about run an entire company on Lotus Notes (plus its Domino server back-end), and many did just that. The program was a weird combination of email, databases, and workflow that allowed companies to stand up custom applications and deploy them to relevant groups of workers inside Notes. This writer worked for one publishing company that used Notes extensively, and I found it to be incredibly useful in its day. It provided not just your email, but an internal telephone directory, contact database, booking system for time off, company handbook, and more, all accessible via a single application and a single set of credentials, long before single sign-on became a thing. Nowadays, it is common for most if not all of these functions to be delivered via separate web-based applications, each requiring a different login so you need to have dozens of different credentials, and each one sporting a different user interface. So I guess you could regard the web browser as an app runtime that is the ultimate successor to Notes? If you wanted some idea of how useful Notes was, consider one of the apps this writer had access to in order to support my role as a reviews editor. The magazine (remember paper magazines? How quaint!) used to run about 30 pages of product reviews in every monthly issue, and we had a database on Notes to help keep track of everything. [40 years since Elite became the most fun you could have with 22 kilobytes](https://www.theregister.com/2024/01/18/elite_game_retro/)[Eben Upton on Sinclair, Acorn, and the Raspberry Pi](https://www.theregister.com/2024/01/15/eben_upton_on_sinclair_acorn/)[How Sinclair's QL computer outshined Apple's Macintosh against all odds](https://www.theregister.com/2024/01/16/ql_legacy_at_40/)[What are our top picks from the vast world of retro tech? Let's find out](https://www.theregister.com/2024/01/17/does_old_tech_never_die/) Computer kit to be reviewed used to arrive at the publisher's offices and would be given a serial code and logged in to a storeroom by a member of staff. As reviews editor, I would get a notification on Notes that it had arrived, so the reviewer could be told it was awaiting their pleasure, and I was able to add it to the table of products to appear in the magazine issue currently being worked towards. The publisher's internal photographer (this was the Nineties, when publishers had more money) had a view of the same table, so they knew which products to photograph for that issue. This workflow had been built internally, all on Lotus Notes. There were many similar applications that others in the company had access to. Perhaps I have a rose-tinted view of Notes, but I recall it being quite easy to manage your emails thanks to a threaded view for email message chains, and it seemed a real retrograde step when I later worked for a company that used Outlook instead. However, Notes had started to look somewhat clunky and dated by the turn of the millennium, and its considerable user base started to dwindle as corporates defected to the combination of Microsoft Exchange Server and Outlook, which were perhaps easier to integrate with Microsoft Office applications and Visual Basic for Applications when it came to workflows. Eventually, IBM, which had acquired Lotus in 1995, announced in 2012 that it would be discontinuing the Lotus brand altogether, before offloading Notes to Indian software outfit [HCL Technologies](https://www.hcl-software.com/) in 2018. The platform still survives, with HCL releasing [Domino 14.0](https://www.theregister.com/2023/06/12/hcl_domino_14/) last year, which, as *The Register* commented at the time, speaks to the "stickiness" of the custom workflows built on the platform. For those interested, one company has published a [detailed history](https://www.stellarinfo.com/blog/complete-history-ibm-lotus-notes-hcl-notes/) of Lotus Notes, from its beginnings to the current day. But Notes is nowhere near holding the record for the oldest piece of software still being used. The US Defense Contract Management Agency (DCMA), which takes care of contracts for the Department of Defense (DoD), is said to have a program called Mechanization of Contract Administration Services ([MOCAS](https://fossbytes.com/mocas-worlds-oldest-computer-program/)), which was introduced in 1958, making it nearly twice as old. ® 71
16,577
使用 GDM 设置来自定义 GNOME 中的登录屏幕
https://itsfoss.com/customize-gdm-login/
2024-01-23T11:20:00
[ "GDM", "GNOME" ]
https://linux.cn/article-16577-1.html
![](/data/attachment/album/202401/23/111959p1n47oww7wu7f1t4.jpg) > > 没错,即使是 GNOME 登录屏幕也可以自定义。这里有一个方便的实用工具,可以让事情变得更简单。 > > > 从停靠区到 GRUB 屏幕,GNOME 都可以根据你的喜好进行定制。 登录界面也在此列,因为一款名为 “<ruby> GDM 设置 <rt> GDM Settings </rt></ruby>”的新工具可让你更改 GNOME 登录界面的外观并调整其功能。 你可以更改壁纸、主题、图标、时间格式、顶部面板项目等。你还可以在登录界面启用轻击功能(我喜欢这个)。 在本教程中,你将了解安装此工具的步骤以及如何使用它来更改 GDM 登录屏幕的各个方面。 不用说,你必须使用 GNOME 桌面环境和 GDM 显示管理器才能按照此处的说明进行操作。 > > ? 以这种方式使用设置可能会产生问题。请使用 Timeshift 备份系统设置。如果你容易手忙脚乱,不喜欢排除故障,这篇文章就不适合你。 > > > ### 使用 GDM 设置工具进行调整 让我们首先看看你可以使用这个很棒的程序进行哪些更改。 #### 1、更改 shell 主题、图标和壁纸 你可以更改登录屏幕的主题、图标和壁纸。这是一个例子。 ![](/data/attachment/album/202401/23/112244n1dddvnshv5eyi5j.png) 要更改主题,你应该先下载它。可以从 [GNOME Look 网站](https://www.gnome-look.org/browse/) 获取一个。 接下来,确保主题位于 `/usr/share/themes` 中。存储在 `~/.themes` 中的主题对 GDM 设置应用是不可见的。 在 GDM 设置应用中,转到 “<ruby> 外观 <rt> Appearance </rt></ruby>” 选项卡并选择 “<ruby> 主题 <rt> Themes </rt></ruby>”(Shell/图标/光标)。 ![GDM 主题设置](/data/attachment/album/202401/23/112058hfrocxvk3vifjxpi.png) 如果要设置壁纸,请将 “<ruby> 背景 <rt> Background </rt></ruby>” 更改为 “<ruby> 图像 <rt> Image </rt></ruby>”,然后从文件浏览器浏览图片。 ![更换壁纸](/data/attachment/album/202401/23/112058l3ly3855v88l9039.png) 完成后,单击 “<ruby> 应用 <rt> Apply </rt></ruby>”。这将要求输入密码。请在出现提示时提供。 你将收到注销通知以应用更改。注销后,更改将可见。 ![注销提示](/data/attachment/album/202401/23/112059cwqgxqx81ftgxgpz.png) > > ? 你可以更改所有设置然后单击“应用”,或者每次设置后单击“应用”。如果按“应用”,则会提示你注销,每次都需要重新登录并再次打开该设置应用。 > > > #### 2、更改字体 在更改字体之前,你需要为所有用户在系统上安装该字体。 为了确保这一点,请将下载的自定义字体文件粘贴到 `/usr/local/share/fonts`,然后使用以下命令创建字体缓存: ``` fc-cache -f -v ``` 现在,打开 GDM 设置并转到“<ruby> 字体 <rt> Fonts </rt></ruby>”选项卡。在那里,你可以设置字体、抗锯齿设置等。 ![更改字体设置](/data/attachment/album/202401/23/112059tme54o13j5ec5o3k.png) 你可以看到新字体现已设置为你的登录屏幕。 ![自定义字体](/data/attachment/album/202401/23/112059nuujtoavfe22ofjp.png) #### 3、更改顶部面板的颜色 要更改顶部面板颜色,请转到侧栏中的 “<ruby> 顶部栏 <rt> Top Bar </rt></ruby>” 选项。在 “<ruby> 调整 <rt> Tweaks </rt></ruby>” 下,启用 “<ruby> 更改背景颜色 <rt> Change Background Color </rt></ruby>” 按钮,然后设置所需的颜色。 ![更改顶部面板颜色设置](/data/attachment/album/202401/23/112100juis22sg6w2bnzee.png) 将顶部栏的文本颜色更改为适合你选择的背景的颜色也同样重要。 ![更改顶栏颜色](/data/attachment/album/202401/23/112100oz7ulec0le9mezqq.png) #### 4、更改时间显示格式 使用下拉菜单将时钟更改为 24 小时或 12 小时格式。 ![更改时间显示格式设置](/data/attachment/album/202401/23/112101xxr3rrz3e3abke6f.png) 此外,你可以通过切换相应的按钮使秒在顶部栏上可见。 ![顶栏显示秒](/data/attachment/album/202401/23/112102zss93r3tqeqrrzip.png) #### 5、启用登录屏幕轻击 在大多数发行版中,这是默认行为。即使在系统中启用了轻击,GNOME 登录界面也需要使用鼠标左键点击。 要更改此设置,请转到鼠标和触摸板部分并启用 “<ruby> 轻击 <rt> Tap to Click </rt></ruby>” 按钮。 ![启用屏幕点击](/data/attachment/album/202401/23/112102w3qtyt2ztatjb4ii.png) 在同一菜单上,你可以选择调整鼠标光标大小(如果你觉得它很小)。 ![更改鼠标光标大小](/data/attachment/album/202401/23/112102e3ses7epqipekshs.png) #### 6、启用夜灯 你可以为 GDM 启用预定的夜灯。 转到 “<ruby> 显示 <rt> Display </rt></ruby>”,打开 “<ruby> 夜灯 <rt> Night Light </rt></ruby>” 按钮。现在,安排日落到日出或你选择的方便时间。 ![启用夜灯](/data/attachment/album/202401/23/112103zplledzw8u8778bw.png) #### 7、添加徽标和欢迎消息 转到 “<ruby> 登录屏幕 <rt> Login Screen </rt></ruby>” 选项卡,然后启用 “<ruby> 启用徽标 <rt> Enable Logo </rt></ruby>” 按钮。这将为你提供一个浏览图像的按钮。 ![添加 logo](/data/attachment/album/202401/23/112104g9pssv9hgg3dd9lr.png) 选择图像并按 “<ruby> 应用 <rt> Apply </rt></ruby>”。 > > ? 在我的系统显示器上,尺寸高达 128×128 像素的图像看起来是可以接受的,超出这个尺寸对我来说看起来很大。因此,请相应地选择尺寸。 > > > 应用图像后,要设置欢迎消息,请启用欢迎消息按钮,然后添加你想要显示的文本。 ![添加欢迎信息](/data/attachment/album/202401/23/112104vygmfabfgcngnpno.png) 当你选择用户输入密码时,将显示该消息。 ![登录屏幕欢迎消息](/data/attachment/album/202401/23/112105aubju6f88nnzmp5u.png) #### 8、导出和导入设置 如果你想在其他系统上应用相同的设置,你可以导出设置并将其导入到运行 GDM 设置工具的其他系统上。 单击左上角的菜单,然后选择 “<ruby> 导出到文件 <rt> Export to file </rt></ruby>”。 ![导出到文件](/data/attachment/album/202401/23/112105ssr7rf3kwpeaa2of.png) 将文件命名为 “.ini” 并将其保存在安全的地方。你可以稍后导入。 ![命名文件](/data/attachment/album/202401/23/112106mzg9qq78xyeq9dzb.png) #### 9、重置所有设置 不喜欢你所做的更改? 有一个简单的方法可以恢复默认值。 要重置调整,请单击左上角的菜单并选择 “<ruby> 重置设置 <rt> Reset settings </rt></ruby>”。 ![重置设置](/data/attachment/album/202401/23/112106jkr2hvbuujd7xxzz.png) 现在,按 “<ruby> 应用 <rt> Apply </rt></ruby>”。它会询问你的密码。提供后,系统将提示你注销。 你可以看到,所有更改均已恢复。 #### 10、更多设置 还有其他可用的调整,例如: 1. 通过 “<ruby> 顶栏 <rt> Top Bar </rt></ruby> ⇾ <ruby> 电源 <rt> Power </rt></ruby> ⇾ <ruby> 显示电池百分比 <rt> Show Battery Percentage </rt></ruby>”,在顶栏显示电池百分比。 2. 通过 “<ruby> 登录屏幕 <rt> Login Screen </rt></ruby> ⇾ <ruby> 禁用用户列表 <rt> Disable User List </rt></ruby>”,在登录屏幕上禁用或启用用户列表。 3. 通过 “<ruby> 电源 <rt> Power </rt></ruby>” 选项卡更改屏幕关闭时间、暂停时间和其他电源设置。 ### 安装 GDM 设置工具 既然你知道该工具可以进行哪些调整,你可能想自己尝试一下。让我们看看如何安装它。 > > ? 在 Ubuntu / Pop!\_OS 上,GDM 设置工具对我不起作用。我在 Debian 12 Bookworm 上以 Flatpak 应用使用。 > > > GDM 设置工具可以作为 Flatpak 安装。 ``` flatpak install flathub io.github.realmazharhussain.GdmSettings ``` 或者,它可以作为 [AppImage](https://github.com/gdm-settings/gdm-settings/releases) 提供。 对于 Arch Linux 用户,请使用 AUR 中的任何 AUR 助手进行安装。 ``` yay -S gdm-settings ``` ### 结论 登录屏幕并不是每个人都可以定制的。除了“轻击”更改之外,大多数其他更改都只是外观更改。 总的来说,对于喜欢自定义设置的每个角落的人们来说,有这样的选择是件好事。 ?️ 你是那些痴迷于定制的 Linux 用户之一吗? 你会尝试 GDM 设置工具吗? *(题图:DA/fb8961d0-852d-4d89-b5b2-d2912b38f6f8)* --- via: <https://itsfoss.com/customize-gdm-login/> 作者:[Sreenath](https://itsfoss.com/author/sreenath/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![Warp Terminal](/assets/images/warp-terminal.webp) ![Warp Terminal](/assets/images/warp-terminal.webp) From the dock to grub screen, GNOME can be customized to your liking. Add the login screen to this list as a new tool called GDM Settings allows you to change the looks and tweak functionalities of the login screen in GNOME. You can change the wallpaper, theme, icon, time format, top panel items etc. You can also enable tap to click on the login screen (I love this one) among other things. In this tutorial, you'll see the steps for installing this tool and how you can use it to change various aspects of the GDM login screen. Needless to say, you must be using GNOME desktop environment and GDM display manager in order to follow the instructions here. ## Tweaks using GDM Settings tool Let's first see the kind of changes you can make with this awesome utility. ### 1. Change shell theme, icon, and wallpaper You can change the theme, icon and wallpaper of the login screen. Here's an example. ![GDM login screen customization](https://itsfoss.com/content/images/2024/01/gdm-settings-applied.webp) To change the theme, you should download it first. Get one from the [GNOME Look website](https://www.gnome-look.org/browse/). Next, ensure that the theme is in `/usr/share/themes` . Themes stored in `~/.themes` are not visible to the GDM settings app. In the GDM Settings tool, go to the Appearance tab and select the themes/icons/cursors. ![Apply themes to the GDM Login Screen](https://itsfoss.com/content/images/2023/12/gdm-settings-set-log-in-themes-settings.png) If you want to set a wallpaper, change the Backgrounds to “Image” and then browse a picture from the file browser. ![Add a custom wallpaper to the GDM login screen](https://itsfoss.com/content/images/2023/12/gdm-settings-set-an-image-settings.png) Once finished, click Apply. This will ask for the password. Give it when prompted. You will be notified to log out to apply changes. When logged out, the changes will be visible. ![GDM Settings tool will prompt the user to log out in order to apply the changes that have been made.](https://itsfoss.com/content/images/2023/12/gdm-settings-click-on-logout.png) ### 2. Change fonts Before you change the font, you need to have that fonts installed on your system for all users. To ensure that, paste the downloaded custom font file to `/usr/local/share/fonts` and then make a font cache using: ``` fc-cache -f -v ``` Now, open GDM Settings and go to the Fonts tab. There, you can set the fonts, anti-alias settings etc. ![The settings to change the default font to a custom font](https://itsfoss.com/content/images/2023/12/gdm-settings-apply-custom-font-settings.png) You can see that the new font is now set to your log in screen. ![A GDM log in screen with a custom font applied](https://itsfoss.com/content/images/2023/12/different-font-applied-1.png) ### 3. Change color of top panel To change the top panel color, go to Top Bar option in the sidebar. Under Tweaks, enable the "Change Background Color" button and then set a color you want. ![GDM Settings tool, setting to change the top bar background and text color.](https://itsfoss.com/content/images/2023/12/gdm-settings-change-topbar-background-color.png) It is equally important to change the text color of the top bar to a convenient color to the background you have selected. ![The top bar color is changed to gren rom the default black.](https://itsfoss.com/content/images/2023/12/panel-color-changed.png) ### 4. Change the time display format Change the clock to 24 hr or 12hr format using the dropdown menu. ![The Setting to change the GDM log in screen top bar time display format.](https://itsfoss.com/content/images/2023/12/gdm-settings-top-bar-clock-settings.png) Furthermore, you can make seconds visible on the top bar, by toggling the corresponding button. ![GDM log in screen top bar shows seconds](https://itsfoss.com/content/images/2023/12/gdm-settings-show-seconds-on-top-bar.png) ### 5. Enable tap to click on login screen On most distros, this is the default behavior. Even if you have tap to click enabled in the system, the GNOME login screen need you to use left mouse click. To change that, go to the Mouse and Touchpad section and enable the Tap to Click button. ![Setting to enable tap to click](https://itsfoss.com/content/images/2023/12/gdm-settings-enable-tap-to-click-settings.png) On the same menu, you have an option to tweak the mouse cursor size, if it looks small to you. ![Setting to change the display size of cursors](https://itsfoss.com/content/images/2023/12/gdm-settings-add-different-cursor-size-settings.png) ### 6. Enable night light You can enable a scheduled night light to the GDM. Go to Display, toggle the Night Light button on. Now, Schedule either sunset to sunrise or to a convenient time of your choice. ![Setting to enable night light in GDM Screen](https://itsfoss.com/content/images/2023/12/gdm-settings-change-night-light-settings.png) ### 7. Add a logo and welcome Message Go to the Login screen tab and then enable the "Enable Logo" button. This will give you a button to browse for the image. ![Add a logo to the GDM log in screen](https://itsfoss.com/content/images/2023/12/gdm-settings-enable-logo-settings.png) Select the Image and press Apply. After the image is applied, to set a welcome message, enable the Welcome Message button and then add the text you wanted to show. ![Add a welcome message on GDM Settings tool](https://itsfoss.com/content/images/2023/12/gdm-settings-enable-welcome-message-settings.png) This will display the message, when you selected a user to enter the password. ![GDM log in screen welcome message and logo](https://itsfoss.com/content/images/2023/12/logo-and-welcome-message-added.png) ### 8. Export and import settings If you want to apply the same settings on some other system, you can export the settings and import it on the other system running GDM Settings tool. Click on the top-left hamburger menu, and select **Export to file**. ![Click on the Export to file button on the top left hamburger menu](https://itsfoss.com/content/images/2023/12/gdm-settings-click-on-export-to-file.png) Name the `.ini` file and save it somewhere safe. You can import it later. ![Name the file and save it somewhere safe.](https://itsfoss.com/content/images/2023/12/gdm-settings-save-the-export-file-as-gdm-settings-ini.png) ### 9. Reset all settings Don't like the changes you made? There is an easy way to revert to default. To reset the tweaks, click on the top-left hamburger menu and select Reset. ![Click on the Reset Settings button on the top-left hamburger menu](https://itsfoss.com/content/images/2023/12/gdm-settings-click-on-reset.png) Now, press Apply. It will ask for your password. Once provided, you will be prompted to log out. You can see that, all the changes have been reverted. ### 10. More settings There are other tweaks available too, like: - Show battery percentage on the top bar, through **Top Bar ⇾ Power ⇾ Show Battery Percentage.** - Disable or enable the user list on the login screen through **Login Screen ⇾ Disable User List**. - Change the screen off time, suspend time and other power settings through the **Power**tab. ## Installing GDM Settings Tool Now that you know what tweaks this tool can do, you may want to try it on your own. Let's see about installing it. GDM Settings Tool can be installed as a Flatpak. `flatpak install flathub io.github.realmazharhussain.GdmSettings` Or, It is available as [an AppImage](https://github.com/gdm-settings/gdm-settings/releases?ref=itsfoss.com). For Arch Linux users, install using any AUR Helper from AUR. `yay -S gdm-settings` ## Conclusion Login screen is not something that everyone customizes. Other than the "tap to click" change, most other changes are just cosmetic changes. Overall, it is good to have such options available for people who love to customize every nook and corner of their settings. 🗨️ Are you one of those Linux users who are obsessed with customization? Will you be trying GDM Settings?
16,579
人工智能教程(六):Keras 和第一个数据集
https://www.opensourceforu.com/2023/01/ai-introduction-to-keras-and-our-first-data-set/
2024-01-24T09:35:18
[ "AI" ]
https://linux.cn/article-16579-1.html
![](/data/attachment/album/202401/24/093419f88e88zchzzauuul.jpg) > > 在本文中我们将继续学习概率论的知识。 > > > 在本系列的 [上一篇文章](/article-16526-1.html)中,我们学习了使用 Anaconda,加强了概率论的知识。在本文中我们将继续学习概率论的知识,学习使用 seaborn 和 Pandas 进行数据可视化,并进一步介绍 TensorFlow 和 Keras 的使用。 让我们从增长人工智能和机器学习的理论知识开始。众所周知人工智能、机器学习、数据科学、深度学习等是当今计算机科学的热门话题。然而,计算机科学还其他热门的话题,比如 <ruby> 区块链 <rt> blockchain </rt></ruby>、<ruby> 物联网 <rt> Internet of Things </rt></ruby>(IoT)、<ruby> 量子计算 <rt> quantum computing </rt></ruby>等。那么,人工智能领域的发展是否会对这些技术产生积极的影响呢? 首先,让我们讨论一下区块链。根据维基百科的定义,“区块链是一种分布式账本,它由不断增长的记录(称为 <ruby> 区块 <rt> block </rt></ruby>)组成,这些记录使用加密技术安全地连接在一起。”乍一看,人工智能和区块链似乎是两个高速发展的独立技术。但令人惊讶的是,事实并非如此。区块链相关的行话是 <ruby> 完整性 <rt> integrity </rt></ruby>,人工智能相关的行话是数据。我们将大量数据交给人工智能程序去处理。虽然这些应用程序产生了惊人的结果,但我们如何信任它们呢?这就提出了对可解释的人工智能的需求。它可以提供一定的保证,以便最终用户可以信任人工智能程序提供的结果。许多专家认为,区块链技术可以用来提高人工智能软件做出的决策的可信度。另一方面,<ruby> 智能合约 <rt> smart contract </rt></ruby>(区块链技术的一部分)可以从人工智能的验证中受益。从本质上讲,智能合约和人工智能通常都是做决策。因此,人工智能的进步将对区块链技术产生积极影响,反之亦然。 下面让我们讨论一下人工智能和物联网之间的影响。早期的物联网设备通常没有强大的处理能力或备用电池。这使得需要大量处理能力的机器学习的软件无法部署在物联网设备上。当时,大多数物联网设备中只部署了基于规则的人工智能软件。基于规则的人工智能的优势在于它很简单,需要相对较少的处理能力。如今的物联网设备具备更强大的处理能力,可以运行更强大的机器学习软件。特斯拉开发的高级驾驶辅助系统 <ruby> 特斯拉自动驾驶仪 <rt> Tesla Autopilo </rt></ruby> 是物联网与人工智能融合的典范。人工智能和物联网对彼此的发展产生了积极影响。 最后,让我们讨论人工智能和量子计算是如何相互影响的。尽管量子计算仍处于起步阶段,但 <ruby> 量子机器学习 <rt> quantum machine learning </rt></ruby>(QML)是其中非常重要的课题。量子机器学习基于两个概念:量子数据和量子-经典混合模型。量子数据是由量子计算机产生的数据。<ruby> 量子神经网络 <rt> quantum neural network </rt></ruby>(QNN)用于模拟量子计算模型。TensorFlow Quantum 是一个用于量子-经典混合机器学习的强大工具。这类工具的存在表明,在不久的将来将会有越来越多的基于量子计算的人工智能解决方案。 ### seaborn 入门 seaborn 是一个基于 Matplotlib 的数据可视化 Python 库。用它能够绘制美观且信息丰富的统计图形。通过 Anaconda Navigator 可以轻松安装 seaborn。我用 ESPNcricinfo 网站上 T20 国际板球赛的击球记录,创建了一个名为 `T20.csv` 的 CSV(<ruby> 逗号分隔值 <rt> comma-separated value </rt></ruby>)文件,其中包含以下 15 列:球员姓名、职业生涯跨度、比赛场次、局数、未出局次数、总得分、最高得分、平均得分、面对球数、击球率、百分次数、五十分次数、零分次数、四分次数和六分次数。图 1 是使用 Pandas 库读取这个 CSV 文件的程序代码。我们已经在前面介绍过 Pandas 了。 ![图 1:使用 seaborn 的简单例子](/data/attachment/album/202401/24/093519u2gynp0ymn7yx60x.png) 下面逐行解释程序代码的作用。第 1 行和第 2 行导入 Pandas 和 seaborn 包。第 3 行从 JupyterLab 的工作目录中读取文件 `T20.csv`。第 4 行打印元数据和第一行数据。图 1 显示了这行数据,它显示了 T20 国际板球赛中得分最高的 Virat Kohli 的击球记录。第 5 行将元数据和 `T20.csv` 中的前五行数据保存到 `Best5.csv` 中。在执行该行代码时会在 JupyterLab 的工作目录中创建这个文件。第 6 行根据列百分次数按升序对 CSV 文件进行排序,并将前 10 名世纪得分手的详细信息存储到 `Highest100.csv` 中。该文件也将存储在 JupyterLab 的工作目录中。最后,第7行代码提取了第 5 列(总得分)和第 7 列(平均得分)的数据信息,并生成散点图。图 2 显示了程序在执行时生成的散点图。 ![图 2:seaborn 绘制的散点图](/data/attachment/album/202401/24/093519ia0ooess58d7f9o0.png) 在程序末尾添加如下代码行并再次运行。 ``` sns.kdeplot(data=df.iloc[:, [5, 7]].head(50), x=’Ave’, y=’Runs’) ``` ![图 3:使用 seaborn 绘制的核密度估计图](/data/attachment/album/202401/24/093520u45z53cz5c3tutjc.png) 这行代码调用 `kdeplot()` 函数绘制第 5 列和第 7 列数据的 <ruby> 核密度估计 <rt> Kernel Distribution Estimation </rt></ruby>(KDE)图。KDE 图可以描述连续或非参数数据变量的概率密度函数。这个定义可能无法让您了解函数 `kdeploy()` 将要执行的实际操作。图 3 是在单个图像上绘制的 KDE 图和散点图。从图中我们可以看到,散点图绘制的数据点被 KDE 图分组成簇。seaborn 还提供了许多其他绘图功能。在图 1 中程序的第 7 行分别替换为下面的的代码行(一次一行),并再次执行该程序,你会看到不同风格的绘图显示。探索 seaborn 提供的其他绘图功能,并选择最适合你需求的功能。 ``` sns.histplot(data=df.iloc[:, [5, 7]].head(50), x=’Ave’, y=’Runs’) sns.rugplot(data=df.iloc[:, [5, 7]].head(50), x=’Ave’, y=’Runs’) ``` ### 更多概率论 在本系列之前的一篇文章中,我们看到可以用正态分布来对现实场景进行建模。但正态分布只是众多重要概率分布中的一种。图 4 中的程序绘制了三种概率分布。 ![图 4:绘制多种概率分布的程序](/data/attachment/album/202401/24/093520dmnn2nznl4moojlm.png) 下面我来解释这个程序。第 1 行导入 NumPy 的 random 模块。第 2 行和第 3 行导入用于绘图的 Matplotlib 和 seaborn。第 5 行生成带有参数 `n`(试验次数)和 `p`(成功概率)的 <ruby> 二项分布 <rt> binomial distribution </rt></ruby>数据。 二项分布是一种离散概率分布,它给出了在一系列 `n` 次独立实验中成功的数量。第三个参数 `size` 决定了输出的形状。第 6 行绘制生成的数据的直方图。由于参数 `kde=True`,它还会绘制 KDE 图。第三个参数 `color='r'` 表示绘图时使用红色。第 7 行生成一个泊松分布。泊松分布是一种离散概率分布,它给出了二项分布的极限。参数 `lam` 表示在固定时间间隔内发生预期事件的次数。这里的参数 `size` 也决定了输出的形状。第 8 行将生成的数据绘制为绿色的直方图。第 9 行生成大小为 1000 的指数分布。第 10 行将生成的数据绘制为蓝色的直方图。最后,第 11 绘制三个概率分布的所有图像(见图 5)。NumPy 的 random 模块提供了大量的其他概率分布,如 Dirichlet 分布、Gamma 分布、几何分布、拉普拉斯分布等。学习和熟悉它们将是非常值得的。 ![图 5:概率分布的图像](/data/attachment/album/202401/24/093520zpq1k8zm1mppq01q.png) 现在,让我们学习线性回归。使用线性回归分析可以根据一个变量来预测一个变量的值。线性回归的一个重要应用是数据拟合。线性回归非常重要,因为它很简单。机器学习中的监督学习范式实际上就是回归建模。因此,线性回归可以被认为是一种重要的机器学习策略。这种学习范式通常被统计学家称为统计学习。线性回归是机器学习中的重要操作。NumPy 和 SciPy 都提供了线性回归的函数。下面我们展示使用 NumPy 和 SciPy 进行线性回归的示例。 ![图 6:使用 NumPy 进行线性回归](/data/attachment/album/202401/24/093520w157nu1gjz5en3hf.png) 图 6 是使用 NumPy 进行线性回归的程序。第 1 行和第 2 行导入 NumPy 和 Matplotlib。第 4 行和第 5 行初始化变量 `a`和 `b`。第 6 行使用函数 `linspace()` 在 0 和 1 之间等间隔地生成 100 个数字。第 7 行使用变量 `a`、`b` 和数组 `x` 生成数组 `y` 中的值。函数 `randn()` 返回标准正态分布的数据。第 8 行将数组 `x` 和 `y` 中的值绘制成散点图(见图 7),图中的 100 个数据点用红色标记。第 9 行使用函数 `polyfit()` 执行称为 <ruby> 最小二乘多项式拟合 <rt> least squares polynomial fit </rt></ruby> 的线性回归技术。函数 `polyfit()` 的输入参数包括数组 `x` 和 `y`,以及第三个表示拟合多项式的阶数的参数,在本例中为 1,表示拟合一条直线。该函数的返回值是多项式的系数,代码中将其存储在数组 `p` 中。第 10 行使用函数 `polyval()` 对多项式求值,并将这些值存储在数组`y_l`中。第 11 行用蓝色绘制拟合得到的直线(见图 7)。最后,第 12 行显示所有的图像。可以用这条回归直线预测可能的 `(x, y)` 数据对。 ![图 7:线性回归散点图 1](/data/attachment/album/202401/24/093520ilb9rpeereh6vmtr.png) 图 8 是使用 SciPy 进行线性回归的程序代码。 ![图 8:使用 SciPy 进行线性回归](/data/attachment/album/202401/24/093521fjt8p556t9ff5za7.png) 下面我解释一下这个程序的工作原理。第 1 行和第 2 行导入库 NumPy 和 Matplotlib。第 3 行从库 SciPy 导入 stats 模块。第 4 到 8 行与前面的程序执行类似的任务。第 9 行使用 SciPy 的 stats 模块的 `linregression()` 函数计算两组测量值的线性最小二乘回归——在本例中是数组 `x` 和 `y` 中的值。该函数返回值中的 `m` 和 `c` 分别表示回归直线的 <ruby> 斜率 <rt> slope </rt></ruby>和<ruby> 截距 <rt> intercept </rt></ruby>。第 10 行使用斜率和截距的值生成回归线。第 11 行用绿色绘制回归线。最后,第 12 行显示所有的图像(见图 9),其中数据点以黄色显示,回归线以绿色显示。 ![图 9:线性回归散点图 2](/data/attachment/album/202401/24/093521ii2flfz8i2go2jdf.png) 在本系列的前面几篇文章中,我们学习了概率和统计学的一些概念。尽管还不够全面的,但我认为这已经打下了一个良好的基础,现在是时候将注意力转移到其他同样重要的问题上了。 ### Keras 简介 Keras 一般与 TensorFlow 一起使用。因此,我们先从使用 TensorFlow 开始。图 10 所示的程序虽然只包含四行代码,但确实构建了在本系列中的第一个神经网络。下面我来介绍它的工作原理。第 1 行导入库 TensorFlow。第 2 行创建了一个名为 `x` 的张量。第 3 行和第 4 行分别在张量 `x` 上应用 ReLU(<ruby> 整流线性单元 <rt> Rectified Linear Unit </rt></ruby>)和 Leaky ReLU 激活函数。在神经网络中,激活函数定义了节点的输出由输入计算出的规则。ReLU 激活函数是定义为 `Relu(x) = max(0,x)`。第 3 行代码的输出如图 10 所示。可以观察到,在应用 ReLU 激活函数后,张量 `x` 中的负值被替换为零。Leaky ReLU 是 ReLU 激活函数的改进版本。从图 10 中的第 4 行代码的输出可以看出 Leaky ReLU 激活函数保留了全量的正值和 20% 的负值。在后面我们将会继续讨论 Keras,同时学习更多神经网络和激活函数的知识。 ![图 10:使用 TensorFlow 实现的神经网络](/data/attachment/album/202401/24/093521awaae7ew5seg53te.png) 下面我们开始使用 Keras。Keras 的安装也可以通过 Anaconda Navigator 轻松完成。图 11 所示的程序导入了我们的第一个数据集并显示了其中的一个数据样本。在下一篇文章中,我们将使用这个数据集来训练和测试模型,从而开启我们开发人工智能和机器学习程序的下一个阶段。 ![图 11:第一个数据集](/data/attachment/album/202401/24/093521xqs5uxxf588c56se.png) 下面介绍这个程序的工作原理。第 1 行导入 Keras。第 2 行从 Keras 导入手写数字数据集 MNIST。它包含 6 万个训练样本和 1 万个测试样本。第 3 行导入 Matplotlib。第 5 行加载 MNIST 数据集。第 6 到 9 行打印训练集和测试集的维数和维度。图 12 显示了这些代码行的输出。可以看出,训练集和测试集都是三维的,所有数据样本的分辨率都是 28 × 28。第 10 行加载了第 1234 个训练图像。第 11 行和第 12 行显示这个图像。从图 12 可以看到它是数字 3 的手写图像。 ![图 12:数据样例](/data/attachment/album/202401/24/093522uyrzzhrywdp6nnya.png) 本文中我们开始涉及到神经网络,并通过 Keras 接触到了第一个数据集。在下一篇文章中,我们将继续讲解神经网络和 Keras,并通过使用该数据集训练自己的模型。我们还会遇到 scikit-learn, 它是另一个强大的机器学习 Python 库 。 *(题图:DA/2f8f2e0c-c9a7-4a55-8a03-3b5105721013)* --- via: <https://www.opensourceforu.com/2023/01/ai-introduction-to-keras-and-our-first-data-set/> 作者:[Deepu Benson](https://www.opensourceforu.com/author/deepu-benson/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[toknow-gh](https://github.com/toknow-gh) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
*In the last article in this series on AI and machine learning, we learned to use Anaconda. We also tried to strengthen our knowledge of probability, a task we will continue in this article. We will discuss seaborn and Keras, and further explore Pandas and TensorFlow in this sixth article in the AI series.* Let us begin by increasing our theoretical knowledge of AI and machine learning. We all know that AI, machine learning, data science, deep learning, etc, are the trending topics in computer science today. However, there are other topics trending in this domain too such as blockchain, IoT (Internet of Things), quantum computing, etc. So do the advances in the field of AI affect any of these technologies in a positive way? First, let us discuss blockchain. According to Wikipedia, “A blockchain is a type of distributed ledger technology that consists of a growing list of records, called blocks, that are securely linked together using cryptography.” At a casual glance it looks as if AI and blockchain are two independent technologies advancing at a very high pace at the same time in history. But surprisingly, this is not the case. The buzzword associated with blockchain is integrity and the buzzword associated with AI is data. We give massive amounts of data to AI based applications to process. Though the results produced by many of these applications are stunning, how do we trust them? This raises the need for explainable AI, which can give certain guarantees so that end users can trust the results provided by AI based applications. Many experts believe that blockchain technologies can be used to increase the trustworthiness of decisions made by AI based software. On the other hand, smart contracts (which are part of blockchain technology) can benefit from AI based verification. Notice that, in essence, smart contracts and AI often lead to decision making. Thus, we can safely conclude that the advances in AI will positively affect blockchain technology and vice versa. Now, let us discuss how AI and IoT impact each other. In the earlier days, IoT devices often did not have large processing power or battery backup. This made the deployment of machine learning based software, which requires large processing power, infeasible in many IoT devices. At that point in time, only rule-based AI software was being deployed in most IoT devices. The advantage with rule-based AI is that it is simple and requires relatively less processing power. However, nowadays, IoT devices are equipped with more processing power and can run powerful machine learning software. The advanced driver-assistance system developed by Tesla, called Tesla Autopilot, is an excellent example for the blending of IoT and AI. Thus, here again, AI and IoT are positively affecting each other’s development. Finally, let us try to understand how AI and quantum computing are impacting each other. Even though quantum computing is still in its infancy, quantum machine learning (QML) is taken very seriously. Quantum machine learning is based on two concepts: quantum data and hybrid quantum-classical models. Quantum data is the data generated by a quantum computer. Quantum neural networks (QNNs) are used to model quantum computational models. A powerful tool for developing quantum computational models is TensorFlow Quantum, a library for hybrid quantum-classical machine learning. The presence of this and many other tools indicates that more and more quantum computing based AI solutions will be available in the near future. ## Introduction to seaborn Now let us learn to use seaborn. Seaborn is a Python data visualisation library based on Matplotlib. It provides functions for drawing visually appealing statistical images. Seaborn can be installed easily by using Anaconda Navigator, as explained in the previous article in this series. I have used the batting records in T20 international cricket from the website ESPNcricinfo to create a CSV (comma-separated values) file called T20.csv, which contains the following 15 columns: Player name, Career span, Matches, Innings, Not out, Total runs, Highest score, Average, Balls faced, Strike rate, Centuries, Fifties, Ducks, Number of 4s scored, and Number of 6s scored. We will use the library called Pandas to read this CSV file. Remember that we have already familiarised ourselves with Pandas. Now, consider the program shown in Figure 1. ![Figure 1: A simple example for seaborn](https://www.opensourceforu.com/wp-content/uploads/2022/11/Figure-1-A-simple-example-for-seaborn-1.png) ![Figure 1: A simple example for seaborn](https://www.opensourceforu.com/wp-content/uploads/2022/11/Figure-1-A-simple-example-for-seaborn-1.png) Let us try to understand the working of the program. Lines 1 and 2 import the packages Pandas and seaborn. Line 3 reads the CSV file called T20.csv from the working directory of JupyterLab. Line 4 prints the metadata and the first line of data. Figure 1 shows this line, which displays the batting record of Virat Kohli, the highest run scorer in T20 international cricket matches. Line 5 stores the metadata and the first five rows of data in the CSV file T20.csv to another CSV file called Best5.csv. On execution of the code, you will see this file created in the working directory of JupyterLab. Line 6 sorts the CSV file in ascending order based on the column ‘100’ (which contains the number of centuries scored by each batsman) and stores the details of the top 10 century scorers into a CSV file called Highest100.csv. This file will also be stored in the working directory of JupyterLab. Finally, Line 7 extracts details of columns 5 and 7 (total runs scored and average, respectively) and generates a scatter plot. Figure 2 shows this scatter plot generated by the program on execution. ![Figure 2: A scatter plot with seaborn](https://www.opensourceforu.com/wp-content/uploads/2022/11/Figure-2-A-scatter-plot-with-seaborn-1.png) ![Figure 2: A scatter plot with seaborn](https://www.opensourceforu.com/wp-content/uploads/2022/11/Figure-2-A-scatter-plot-with-seaborn-1.png) Now add the following line of code at the end of the program and run it again. sns.kdeplot(data=df.iloc[:, [5, 7]].head(50), x=’Ave’, y=’Runs’) This draws a KDE plot, in addition to the scatter plot, of the data obtained from columns 5 and 7. The function kdeplot( ) gives a Kernel Distribution Estimation Plot, which depicts the probability density function of the continuous or non-parametric data variables. This definition may not give you any idea about the actual operation that will be performed by the function kdeplot( ). Figure 3 shows the KDE plot and scatter plot being drawn on a single image. From this figure, we can observe that data points drawn by the scatter plot are grouped into clusters by the KDE plot. Notice that there are a lot of other plotting functions also provided by seaborn. In the program we have discussed now, replace Line 7 with the lines of code (one line at a time) shown below, and execute the program again. You will see plots with varying styles. Explore the other plotting functions offered by seaborn and choose the one that suits your need the most. ![Figure 3: A KDE plot with seaborn](https://www.opensourceforu.com/wp-content/uploads/2022/11/Figure-3-A-KDE-plot-with-seaborn-1-590x415.png) ![Figure 3: A KDE plot with seaborn](https://www.opensourceforu.com/wp-content/uploads/2022/11/Figure-3-A-KDE-plot-with-seaborn-1-590x415.png) sns.histplot(data=df.iloc[:, [5, 7]].head(50), x=’Ave’, y=’Runs’) sns.rugplot(data=df.iloc[:, [5, 7]].head(50), x=’Ave’, y=’Runs’) ## More on probability Now, let us learn some more topics in probability. In one of the previous articles in this series, we saw how a normal distribution can be used to model real world scenarios. But normal distribution is just one among the many important probability distributions. Consider the program shown in Figure 4, which plots three probability distributions. ![Figure 4: Program for probability distributions](https://www.opensourceforu.com/wp-content/uploads/2022/11/Figure-4-Program-for-probability-distributions-1.png) ![Figure 4: Program for probability distributions](https://www.opensourceforu.com/wp-content/uploads/2022/11/Figure-4-Program-for-probability-distributions-1.png) Now, let us try to understand the program. Line 1 imports the random module of NumPy. Lines 2 and 3 import libraries Matplotlib and seaborn for plotting. Line 5 generates a binomial distribution with parameters n (number of trials) and p (probability of success). Binomial distribution is a discrete probability distribution, which gives the number of successes in a sequence of n independent experiments. The third parameter called size decides the shape of the output. Line 6 plots the histogram of the data generated. Notice that a KDE plot is also plotted because the parameter kde is set as true. The third parameter colour decides the colour of the plot, which in this case is red (‘r’). Line 7 generates a Poisson distribution (named after the French mathematician Siméon Denis Poisson). The Poisson distribution is a discrete probability distribution which gives the limit of the binomial distribution. The parameter lam sets the expected number of events occurring in a fixed-time interval. Here also the parameter size decides the shape of the output. Line 8 plots the data generated as a histogram in green. Line 9 generates an exponential distribution with a size of 1000. Line 10 plots the data generated as a histogram in blue. Finally, Line 11 displays all the plots generated. Figure 5 shows the three probability distributions plotted on execution of the program. The random module of NumPy offers a large number of other probability distributions like Dirichlet distribution, Gamma distribution, geometric distribution, Laplace distribution, etc. It would be really rewarding if you could work and get familiarised with more of them. ![Figure 5: Plots of probability distributions](https://www.opensourceforu.com/wp-content/uploads/2022/11/Figure-5-Plots-of-probability-distributions-590x358.png) ![Figure 5: Plots of probability distributions](https://www.opensourceforu.com/wp-content/uploads/2022/11/Figure-5-Plots-of-probability-distributions-590x358.png) Now, let us learn about linear regression. Linear regression analysis can be used to predict the value of a variable based on the value of another variable. One of the important applications of linear regression is data fitting. Linear regression is very important because of its simplicity. The supervised learning paradigm of machine learning is actually another name for regression modelling. Thus, linear regression can be considered as an important machine learning strategy. This learning paradigm is often called statistical learning by statisticians. Both NumPy and SciPy offer functions for performing linear regression. Since linear regression is an important operation in machine learning, we will see examples involving both NumPy and SciPy. Now, consider the program shown in Figure 6. ![Figure 6: Linear regression with NumPy](https://www.opensourceforu.com/wp-content/uploads/2022/11/Figure-6-Linear-regression-with-NumPy-1.png) ![Figure 6: Linear regression with NumPy](https://www.opensourceforu.com/wp-content/uploads/2022/11/Figure-6-Linear-regression-with-NumPy-1.png) The program uses NumPy to perform linear regression. First, let us try to understand the working of this program. Lines 1 and 2 import NumPy and Matplotlib. Lines 4 and 5 initialise the variables a and b for data generation. Line 6 uses the function linspace( ) to generate evenly spaced numbers over the specified interval of 0 and 1. In this case 100 such numbers are generated. Line 7 generates values in the array y by using the values in the array x. The function randn( ) returns samples from the standard normal distribution. These values, together with the values provided by the variables a, b, and array x, are used to generate the values in the array y. Line 8 generates a scatter plot by using the values in the arrays x and y. Figure 7 shows this scatter plot. The hundred data points are marked in red. Line 9 uses the function polyfit( ) to perform a least squares polynomial fit. It is one of the techniques used to perform linear regression. The function polyfit( ) takes for processing the arrays x and y, and a third parameter (in this case 1), which denotes the degree of the fitting polynomial. The function then returns the polynomial coefficients and they are stored in the array p. Line 10 uses the function polyval( ), which evaluates a polynomial at specific values. These values are stored in the array y_l. Line 11 plots the regression line in blue (Figure 7). Finally, Line 12 displays all the plots. This regression line can be used for making predictions about the possible (x, y) data pairs. ![Figure 7: Linear regression scatter plot 1](https://www.opensourceforu.com/wp-content/uploads/2022/11/Figure-7-Linear-regression-scatter-plot-1-2.png) ![Figure 7: Linear regression scatter plot 1](https://www.opensourceforu.com/wp-content/uploads/2022/11/Figure-7-Linear-regression-scatter-plot-1-2.png) Now, let us see how SciPy can be used to perform the same task. Consider the program shown in Figure 8. ![Figure 8: Linear regression with SciPy](https://www.opensourceforu.com/wp-content/uploads/2022/11/Figure-8-Linear-regression-with-SciPy.png) ![Figure 8: Linear regression with SciPy](https://www.opensourceforu.com/wp-content/uploads/2022/11/Figure-8-Linear-regression-with-SciPy.png) Let us try to understand the working of the program. Lines 1 and 2 import the libraries NumPy and Matplotlib. Line 3 imports the stats module from the library SciPy. Lines 4 to 8 are the same as the previous program and perform similar tasks. Line 9 uses the function linregress( ) offered by the stats module of SciPy, which can calculate a linear least-squares regression for two sets of measurements — in this case, the values in the arrays x and y. The function returns, in addition to other data, the slope and intercept of the regression line that is stored in the variables m and c, respectively. Line 10 uses the values of slope and intercept to generate the regression line. Line 11 plots the regression line in green. Finally, Line 12 displays all the plots. Figure 9 shows the image generated on execution of the program. The data points are displayed in yellow and the regression line is shown in green. ![Figure 9: Linear regression scatter plot 2](https://www.opensourceforu.com/wp-content/uploads/2022/11/Figure-9-Linear-regression-scatter-plot-2-590x393.png) ![Figure 9: Linear regression scatter plot 2](https://www.opensourceforu.com/wp-content/uploads/2022/11/Figure-9-Linear-regression-scatter-plot-2-590x393.png) In the last three articles in this series, we have tried to learn more and more concepts from probability and statistics. Though the treatment of the subject is in no way comprehensive, I think we have arrived at a good starting point and it is time to shift our focus to other matters of equal importance. ## Introduction to Keras Now, let us learn to use Keras. Keras is used along with TensorFlow. Hence, let us begin by exploring TensorFlow a bit more. Consider the program shown in Figure 10. Though this program contains just four lines of code, this is our first encounter with neural networks in this series. Now, let us try to understand the working of the program. Line 1 imports the library TensorFlow. Line 2 creates a tensor called x. Lines 3 and 4 apply two activation functions called ReLU (Rectified Linear Unit) and Leaky ReLU, respectively, on the tensor x. In neural networks, the activation function of a node defines the output of that node given an input or set of inputs. ReLU activation function is an activation function defined as the positive part of its argument. The output of the code in Line 3 is shown in Figure 10. It can be observed that the negative values in the tensor x are replaced with zeros after applying the ReLU activation function. Leaky ReLU activation function is a modified version of the ReLU activation function. From the output of the code in Line 4 shown in Figure 10, it can be verified that positive values are retained as such, and 20 per cent of the negative values are retained on applying the Leaky ReLU activation function. Though we are moving on to discuss Keras, we will revisit this topic in the future to learn more about neural networks and activation functions. ![Figure 10: TensorFlow for neural networks](https://www.opensourceforu.com/wp-content/uploads/2022/11/Figure-10-TensorFlow-for-Neural-Networks-2-590x121.png) ![Figure 10: TensorFlow for neural networks](https://www.opensourceforu.com/wp-content/uploads/2022/11/Figure-10-TensorFlow-for-Neural-Networks-2-590x121.png) Now, let us start using Keras. The installation of Keras can also be done very easily with Anaconda Navigator. Consider the program shown in Figure 11. We will use our first data set in this program. For the time being, we will only import and display sample data from the data set. But in the next article, we will use the same data set for training and testing our model, thus beginning the next phase in our journey to develop AI and machine learning based applications. ![Figure 11: Our first data set](https://www.opensourceforu.com/wp-content/uploads/2022/11/Figure-11-Our-first-data-set-590x219.png) ![Figure 11: Our first data set](https://www.opensourceforu.com/wp-content/uploads/2022/11/Figure-11-Our-first-data-set-590x219.png) Now, let us try to understand the working of the program. Line 1 imports Keras. Line 2 imports the MNIST database of handwritten digits. It has a training data set of 60,000 samples and a test data set of 10,000 samples. Line 3 imports Matplotlib. Line 5 loads the data set. Lines 6 to 9 print the dimension and shape of the training data and the test data. Figure 12 shows the output of these lines of code. It can be seen that both the training data and the test data are three-dimensional. It can also be verified that there are 60,000 training images of 28 x 28 pixel quality and 10,000 test images of 28 x 28 pixel quality. Line 10 loads the 1234th training image. Lines 11 and 12 display this image. Figure 12 shows this handwritten image of the digit 3. ![Figure 12: A sample from the data set](https://www.opensourceforu.com/wp-content/uploads/2022/11/Figure-12-A-sample-from-the-data-set.png) ![Figure 12: A sample from the data set](https://www.opensourceforu.com/wp-content/uploads/2022/11/Figure-12-A-sample-from-the-data-set.png) Now, it is time to wind-up our discussion. We are at the halfway mark of our journey through AI and machine learning. We have started discussing neural networks, a discussion we will continue in the next article. We have also come across our first data set with Keras. In the next article, we will continue discussing the use of Keras by training with this data set. We will also have our first interaction with scikit-learn, another powerful Python library for machine learning.
16,582
Floorp 浏览器:这是最先进的跨平台 Firefox 衍生品吗?
https://news.itsfoss.com/floorp-firefox/
2024-01-25T15:12:06
[ "Firefox", "Floorp" ]
https://linux.cn/article-16582-1.html
![](/data/attachment/album/202401/25/151133u5smqdd8pnj8nydp.jpg) > > 让我们探究一下这款有趣的 Firefox 分支产品 - Floorp。 > > > 随着谷歌不断加大其 [数据收集](https://news.itsfoss.com/google-chrome-incognito-mode/) 的力度,许多人开始选择那些能够提供安全浏览体验,尊重他们 [隐私](https://itsfoss.com/privacy-web-browsers/) 的网络浏览器。 Floorp 就是其中一款。我最近发现了这款自称为 “*最先进且最快的 Firefox 衍生品*” 的网络浏览器。 接下来,我将走进这款浏览器。 ### Floorp:简述 ⭐ ![](/data/attachment/album/202401/25/151207xxt4qnesteeyy2qe.png) 作为 **流行的 Firefox 浏览器的一个分支**,[Floorp](https://floorp.app/en/) 以隐私和用户自由为主要构建理念。。它是**一款跨平台的网络浏览器**,以完全开源、不收集任何个人信息为傲。 它的 **几个关键特性** 包括: * 丰富的个性化设置 * 工作区的支持 * 强大的反跟踪功能 #### 初次使用的印象 ?‍? 首次启动的时候,**你可能会将 Floorp 误认为 Firefox**,因为它们的外观非常相似。我初次使用的时候,看到了一个设定向导,帮我定制了个人化体验。 设定向导提供了如导入浏览器数据、选择一个能调整浏览器特性的模板和选择浏览器主题等选项。 ![](/data/attachment/album/202401/25/151208lj8u28t4opf2zjfo.png) 在初步设定完毕后,会打开一个 **界面整洁的标签页**,每当你打开一个新的标签时,背景都会动态更换。然后,显示常见的快捷方式,和由 Pocket 推荐的项目。如果你不喜欢这些,可以选择关闭。 ![](/data/attachment/album/202401/25/151209d8rq2s8rh94hj8pz.png) 接下来你就会看见 **一个整洁的侧栏菜单**,它的存在让我想起了 Vivaldi 上的那个相似功能。该侧栏菜单有许多功能,包括访问书签、查看历史记录、下载内容、查看笔记,甚至有 **一个直接集成的谷歌翻译 WebApp**。 你可以自由定制网络面板,配置每个图标的设置,更改它们的顺序,增添和删除选项。最好的部分就是 —— 你可以一键将所有更改恢复为默认设置,有时候这可能就是最有用的功能。 ![](/data/attachment/album/202401/25/151209p7ngglj223r26g72.png) 此外还有 **一个添加自定义 WebApp 的选项**,只需点击底部的加号符号即可。你可以借此功能轻松访问任何具备适当接口的网站。 ![](/data/attachment/album/202401/25/151210dah2v74awhuxhvzh.png) 不只是网络面板,你还可以更改标签的展示方式/视图。 默认情况下,你的标签是水平放置的。但是,你可以选择多行标签,这样能让你更清楚地看到你的活动标签,轻松处理多个标签的打开和关闭。 ![](/data/attachment/album/202401/25/151210r9jjkl9odudgas99.png) 除此之外,你还可以启用垂直标签布局,尽管它还是试验性功能: ![](/data/attachment/album/202401/25/151211gbu2zuud53xh3792.png) 虽然上述功能运行良好,但像水平放置标签这样的布局可能无法带给你最佳的用户体验。 其 **防止跟踪的保护功能** 与你在 Firefox 上所看到的相似,分为三个级别:标准、严格,以及自定义。 ![](/data/attachment/album/202401/25/151211obsxtememm1qq2m0.png) Floorp 还有一个称之为 “**Floorp 视图**” 的功能,让你能够借助 Mozilla 账户同步你的其他设备,例如智能手机上的标签。 ![](/data/attachment/album/202401/25/151212vppr7yreytrf4fea.png) 同时,**它对多个工作区也有良好的支持**,这是 Firefox 原本所不具备的。 ![](/data/attachment/album/202401/25/151212n2yauzo33ooy5ubb.png) 此外,你可以从设置里更改/指定快捷键,这也是一个相当方便的功能: ![](/data/attachment/album/202401/25/151213zpdw25d56f6qy675.png) 如果你关注了我们所有的报道,你可能已经注意到其工作方式和 [Gecko 版的 Midori](https://news.itsfoss.com/midori-11/) 非常相似。那是因为 Midori 也是作为 Floorp 的衍生产品构建的,实现了它的许多功能。 因此,你可以根据自己的需要选择其中之一。 而针对文章标题的问题:**它是对 Firefox 的最先进衍生版吗?** 我得说,**既是,也不是**。如果我们从其定制的可能性和基于 Firefox 创新的功能上看,你可能会觉得 Floorp 能比原版 Mozilla Firefox 做的更多。 然而,并非所有人都需要所有的功能选项。所以,对某些人来说,这些额外的选项可能有用,也可能没用。 ### ? 获取 Floorp 你可以从其 [官方网站](https://floorp.app/en/download/) 获取最新版本的 Floorp,支持 **Linux**、**Windows** 和 **macOS**。对于那些更喜欢使用 Flatpak 应用的用户,此外还有 Flathub 的 [商店链接](https://flathub.org/apps/one.ablaze.floorp)。 > > **[Floorp (Flathub)](https://flathub.org/apps/one.ablaze.floorp)** > > > 你还可以通过以下的命令 **使用 PPA 进行安装**: ``` curl -fsSL https://ppa.ablaze.one/KEY.gpg | sudo gpg --dearmor -o /usr/share/keyrings/Floorp.gpg sudo curl -sS --compressed -o /etc/apt/sources.list.d/Floorp.list 'https://ppa.ablaze.one/Floorp.list' sudo apt update sudo apt install floorp ``` 如果你对其源代码感兴趣,可以前往 [GitHub 仓库](https://github.com/floorp-Projects/floorp/) 查看。 ? 你会选择 Floorp 还是 Firefox 呢?在下面的评论区告诉我吧! *(题图:DA/2ab303b0-731d-46c6-91b2-aa0ed071fafc)* --- via: <https://news.itsfoss.com/floorp-firefox/> 作者:[Sourav Rudra](https://news.itsfoss.com/author/sourav/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[ChatGPT](https://linux.cn/lctt/ChatGPT) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![](/assets/images/pikapods-banner-v3.webp) ![](/assets/images/pikapods-banner-v3.webp) The way Google has been [stepping up](https://news.itsfoss.com/google-chrome-incognito-mode/) its data collection game, it has prompted many people to opt for [privacy-focused web browsers](https://itsfoss.com/privacy-web-browsers/?ref=news.itsfoss.com) that respect their privacy by providing a secure browsing experience. Floorp is one such web browser that I recently came across that claims to be “*the most Advanced and Fastest Firefox derivative*” around. So, join me as I check out this browser. ## Floorp: Overview ⭐ ![a screenshot of floorp about info](https://news.itsfoss.com/content/images/2024/01/Floorp_a-1.png) Being **a fork of the popular Firefox browser**, [Floorp](https://floorp.app/en/?ref=news.itsfoss.com) was built keeping privacy and user freedom in mind. It is **a cross-platform web browser** that prides itself in being completely open-source and not collecting any kind of personal information. Some of its **key features** include: **Big on Customizability****Support for Workspaces****Robust Anti-Tracking Features** ### Initial Impressions 👨💻 On first launch, it is **easy to get Floorp mixed up with Firefox**, as it looks very familiar. When I first launched it, the usual quick setup wizard popped up that helped me tailor my experience. It had options such as importing browser data, choosing a template which would tweak the browser with different features, and finally the browser theme. ![a screenshot of floorp quick setup wizard](https://news.itsfoss.com/content/images/2024/01/Floorp_b.png) After the initial set up is done, **a neat looking tab page** opens up with a dynamic background that changes whenever you open a new tab. Then, there were the usual shortcuts, and recommended by Pocket elements. But, they can be disabled if you don't prefer having those. ![a screenshot of floorp new tab](https://news.itsfoss.com/content/images/2024/01/Floorp_c.png) The next thing you will notice is **a neat looking sidebar menu** that reminded me of the one found on Vivaldi. It provides similar functionality, with access to things like the bookmarks, history, downloads, notes, and even **a Google Translate WebApp integrated directly into it**. You can customize the web panel, configure the settings for each icon, change their order, add, and remove options from it. The best part — you can reset all your changes back to the default in a single click, which is sometimes the most helpful feature. ![floorp web panel customization](https://news.itsfoss.com/content/images/2024/01/floorp-sidepanel.png) There was also the** option to add a custom WebApp** by clicking on the plus symbol around the bottom. You could virtually add any website that has a decent interface using this for easy access while browsing. ![a screenshot of floorp sidebar menu](https://news.itsfoss.com/content/images/2024/01/Floorp_d-1.png) Not just limited to the web panel, you get flexibility to change the behavior/view of the tabs. By default, you get a horizontal tab. However, you can opt for a multi-row tab where you get more visibility to your active tabs, making it easy to dabble with multiple tabs. ![floorp with multi-row tab bar](https://news.itsfoss.com/content/images/2024/01/tab-style-floorp-multi-row.png) In addition, you can also enable vertical tabs, but it is labelled as an experimental feature: ![floorp vertical tab](https://news.itsfoss.com/content/images/2024/01/floorp-vertical-tab.png) While these work perfectly fine, things like the horizontal-row tabs may not give you the best user experience. The **tracking protection** is pretty similar to the one you get on Firefox with three different levels; Standard, Strict, and Custom. ![a screenshot of floorp tracking protection menu](https://news.itsfoss.com/content/images/2024/01/Floorp_g.png) Floorp also has something called “**Floorp View**” that lets you sync tabs from your other linked devices such as smartphones using a Mozilla account. ![a screenshot of floorp view window](https://news.itsfoss.com/content/images/2024/01/Floorp_h.png) There is **support for multiple workspaces** too, something that Firefox doesn't provide out of the box. ![](https://news.itsfoss.com/content/images/2024/01/Floorp_f-1.png) Furthermore, you get to assign/change keyboard shortcuts from the settings, which is also a convenient ability: ![floorp custom keyboard shortcuts](https://news.itsfoss.com/content/images/2024/01/custom-keyboard-shortcuts-firefox.png) If you have been following all our coverages, you must have noticed that it works similar to the [Gecko Version of Midori](https://news.itsfoss.com/midori-11/). Well, that's because Midori is built as a fork of Floorp and implements many of its features. So, you can decide on any one of the two as per your preferences. And, answer the question in the title: **is it the most advanced take on Firefox? ** **Yes, and no**. If you look at the customizability, and abilities you get on top of Firefox, one can say that you can do a lot more with Floorp compared to vanilla Mozilla Firefox. However, not everyone needs all the options available. So, for some, the additional options may or may not be useful. **Suggested Read **📖 [5 Most Privacy Focused Web BrowsersThe best privacy-friendly web browsers that you can try!](https://itsfoss.com/privacy-web-browsers/?ref=news.itsfoss.com)![](https://itsfoss.com/content/images/2023/12/privacy-focused-web-browsers.png) ![](https://itsfoss.com/content/images/2023/12/privacy-focused-web-browsers.png) ## 📥 Get Floorp You can grab the latest release of Floorp from the [official website](https://floorp.app/en/download/?ref=news.itsfoss.com) for **Linux**, **Windows**, and **macOS**. There is also an official Flathub [store listing](https://flathub.org/apps/one.ablaze.floorp?ref=news.itsfoss.com) for those who prefer Flatpak apps. You can also **install it via PPA** with the following commands: ``` curl -fsSL https://ppa.ablaze.one/KEY.gpg | sudo gpg --dearmor -o /usr/share/keyrings/Floorp.gpg sudo curl -sS --compressed -o /etc/apt/sources.list.d/Floorp.list 'https://ppa.ablaze.one/Floorp.list' sudo apt update sudo apt install floorp ``` If you are interested in the source code, you can head over to its [GitHub repo](https://github.com/floorp-Projects/floorp/?ref=news.itsfoss.com). *💬 Would you prefer Floorp over Firefox? Let me know in the comments below!* ## More from It's FOSS... - Support us by opting for [It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our [community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our [weekly Newsletter](https://itsfoss.com/newsletter/).
16,583
掌握 Linux 桌面中的 Nautilus 文件搜索
https://itsfoss.com/nautilus-file-search/
2024-01-25T15:57:20
[ "Nautilus", "搜索" ]
https://linux.cn/article-16583-1.html
![](/data/attachment/album/202401/25/155635ocrk3q8dgg3rkkgh.jpg) > > 使用 GNOME 的 Nautilus 文件搜索,通过这些方便的提示改善您的文件搜索体验,成为一名专业的搜索者。 > > > GNOME 的 Nautilus 文件管理器功能丰富。 不信?看看这篇文章,你就会知道如何将 [Nautilus 的全部功能](https://itsfoss.com/nautilus-tips-tweaks/) 发挥到极致。 文件搜索是 Nautilus 被忽视的功能之一。没有多少 Linux 用户充分发挥了它的潜力。 因此,我编写了本教程,与大家分享一些使用 Nautilus 文件管理器中文件搜索选项的技巧。 我知道经验丰富的 Linux 用户可以使用终端中的 [find 命令](https://linuxhandbook.com/find-command-examples/?ref=itsfoss.com) 实现相同的目的,但许多桌面用户更喜欢使用 GUI。 让我们从最简单的搜索选项开始。 ### 按名称搜索文件 打开 Nautilus 并单击顶部栏上的放大镜。这将打开一个搜索栏,你可以在其中输入查询字符串。 当你输入时,搜索结果会不断完善,并在输入完整文件名时进行匹配。 ![在 Nautilus 中搜索](/data/attachment/album/202401/25/155721f0v139r2ff974msu.png) > > ? 搜索在当前目录及其子目录中执行。可以启用 [隐藏文件视图](https://itsfoss.com/show-hidden-files-linux/),将隐藏文件包含在搜索结果中。 > > > ### 根据时间搜索文件 使用 Nautilus,你可以根据文件的创建、修改或上次访问的时间过滤搜索。 为此,请单击搜索按钮并开始输入。当你开始输入时,你会注意到搜索按钮附近有一个下拉菜单。点击它。这将为你提供一个菜单,其中包含用于过滤搜索的选项。 ![单击下拉菜单](/data/attachment/album/202401/25/155721jynypyzp7hu5hhi5.png) 单击下拉菜单上的 “<ruby> 选择日期 <rt> Select Dates </rt></ruby>” 按钮。另外,选择选项 “<ruby> 文件名 <rt> File Name </rt></ruby>” 以按文件名匹配。 ![按日期搜索的设置](/data/attachment/album/202401/25/155721u8jbjba82kpeeass.png) 这将为你提供一个扩展菜单,你可以在其中选择文件创建、修改或上次访问的日期。 ![设定标准](/data/attachment/album/202401/25/155722o819iqan3ony39yn.png) 在这里,如果你想设置自定义日期,请单击日历图标,如下图所示: ![点击日历图标](/data/attachment/album/202401/25/155722r2zohw8ki0wx1fkf.png) 现在,你将看到一个小日历,并可以相应地选择日期。 ![选择日期](/data/attachment/album/202401/25/155723ytnk0d2fkykfn8nt.png) 从列表中设置你选择的日期后,你可以看到搜索栏上应用的条件,并向你显示基于该条件的文件。 ![应用日期标准](/data/attachment/album/202401/25/155723dngghh91gj9ecca3.png) ### 根据文件类型搜索文件 你还可以根据文件类型过滤搜索。假设你正在寻找 PDF 文件。 与上一步一样,单击搜索图标并开始输入文件名。现在,从下拉菜单中,单击 “<ruby> 任何 <rt> Anything </rt></ruby>” 选项并选择 “<ruby> 文件名 <rt> File Name </rt></ruby>”。 ![根据文件类型搜索](/data/attachment/album/202401/25/155724oufguvk0dozvpr54.png) 从展开的视图中选择要搜索的文件类型。在这里,我选择了 “PDF/Postscript”。 ![设置所需的文件类型](/data/attachment/album/202401/25/155724lme22ycoy26gijgy.png) 选择所需的文件类型后,你可以在搜索栏上看到应用的条件。你还将看到相应的结果。 ![应用文件类型标准](/data/attachment/album/202401/25/155724yhg0eotiphhg09y9.png) 在搜索选项中没有找到所需的文件类型?向下滚动到底部并单击 “<ruby> 其他类型 <rt> other types </rt></ruby>”。 ![获取更多文件类型](/data/attachment/album/202401/25/155725u97u681pi8s9i949.png) 这将为你提供更多文件类型。 ![列出更多文件类型](/data/attachment/album/202401/25/155725dkx1xnm273nm3a9i.png) ### 搜索文件内容,而不是名称 默认情况下,根据文件名执行文件搜索。如果你想知道是否有包含特定单词的文件,Nautilus 也允许你这样做。 首先,单击搜索图标并开始输入。现在,与前面的部分一样,转到下拉菜单。 在下拉菜单中,不要选择 “<ruby> 文件名 <rt> File Name </rt></ruby>”,而是选择 “<ruby> 全文 <rt> Full Text </rt></ruby>”。 现在,你可以搜索特定字符串并根据特定日期或文件类型进行搜索过滤。过滤的方法与前面提到的相同。 ![选择“全文”选项](/data/attachment/album/202401/25/155726whhz6zhf6k86pgbf.png) 在这里,我使用了字符串 “text to be”,你可以看到列出了几个具有该特定字符串的文件。另外,你可以看到,该部分也突出显示。 ### 仅搜索文件或仅搜索文件夹 默认情况下,Nautilus 会搜索文件和文件夹。你可以将搜索细化为文件或文件夹。 为此,请在下拉菜单中选择 “<ruby> 文件名 <rt> File Name </rt></ruby>”,然后从类型列表中选择 “<ruby> 文件 <rt> Files </rt></ruby>” 或 “<ruby> 文件夹 <rt> Folders </rt></ruby>”,如下所示。 ![仅在文件或文件夹中搜索](/data/attachment/album/202401/25/155726xuc32y3jk3y3wwy2.png) 这将根据你的选择过滤结果。 ### 应用多个过滤器 你可以将日期过滤器和类型过滤器组合在一起以获得更精确的搜索。为此,请从各自的下拉列表中选择每个条件。 你可以在下面的截图中看到,我已经搜索了包含字符串 “to be search” 的文件。我应用的标准是 1 天内创建的 PDF 文件。 ![应用多个过滤器](/data/attachment/album/202401/25/155726mltzllhsszdkshid.png) ### 更多 Nautilus 提示和调整 Nautilus 足以满足大多数搜索场景。如果你需要更多,还有专用的 GUI 工具,可让你执行桌面范围的自定义搜索。 > > **[ANGRYsearch - 用于 Linux 的快速搜索图形用户界面工具](https://itsfoss.com/angrysearch/)** > > > 想要更多这样的 Nautilus 技巧吗? [以 root 身份打开文件](https://itsfoss.com/open-nautilus-as-administrator/) 怎么样? > > **[在 Nautilus 文件管理器中以管理员身份打开文件和文件夹](https://itsfoss.com/open-nautilus-as-administrator/)** > > > 或者将终端的功能与文件管理器结合起来? > > **[在 Linux 中混合搭配终端与 Nautilus 文件管理器](https://itsfoss.com/terminal-nautilus-combination/)** > > > 这里还有更多此类提示。请自行查看。 > > **[在 Linux 中调整 Nautilus 文件管理器的 13 种方法](https://itsfoss.com/nautilus-tips-tweaks/)** > > > 我希望你喜欢这些技巧,它们有助于更好地改善你的桌面 Linux 体验。 你还知道其他这样酷的技巧吗? 请在评论中分享。 *(题图:DA/77ae519f-e942-42b0-9808-4af943b168cb)* --- via: <https://itsfoss.com/nautilus-file-search/> 作者:[Sreenath](https://itsfoss.com/author/sreenath/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![Warp Terminal](/assets/images/warp-terminal.webp) ![Warp Terminal](/assets/images/warp-terminal.webp) GNOME's Nautilus file manager is quite versatile. Don't believe me? Check out this article to see how you can [tweak Nautilus to its full capability](https://itsfoss.com/nautilus-tips-tweaks/). One of the overlooked Nautilus features is the file search. Not many Linux users utilize its full potential. And that's why I created this tutorial to share some tips on using the file search option in the Nautilus file manager. I know that a seasoned Linux user can achieve the same with the [find command](https://linuxhandbook.com/find-command-examples/) in the terminal but using the GUI is preferable by many desktop users. Let's begin with the simplest of the search options. ## Search for files by name Open Nautilus and click on the magnifying glass on the top bar. This will open a search bar, where you can enter the query string. As you type, the results will get refined and will match upon typing the full file name. ![Click on the magnifying glass icon on top bar to start searching](https://itsfoss.com/content/images/2023/08/Click-on-the-search-button-and-start-typing.png) [hidden file view](https://itsfoss.com/show-hidden-files-linux/)to include hidden files in the search result. ## Search files based on time With Nautilus, you can filter your search according to the time the file was created, modified or last accessed. For this, click on the search button and start typing. As you start typing, you will notice a drop-down menu near the search button. Click on it. This will give you a menu with options to filter your search. ![Click on the dropdown menu for more search filters](https://itsfoss.com/content/images/2023/08/Access-more-search-options.png) Click on the “Select Dates” button on the drop-down menu. Also, select the option “**File Name**” to match by file name. ![Select the dates section on the dropdown with "File Name" option selected](https://itsfoss.com/content/images/2023/08/click-on-time-option-to-get-expanded-list.png) This will give you an expanded menu where you can select the date since which the file is created, modified or last accessed. ![Set the date wise criterea for your search, like last modified, accessed etc.](https://itsfoss.com/content/images/2023/08/Search-according-to-date-and-time.png) Here, if you want to set a custom date, click on the calendar icon as shown in the screenshot below: ![Click on Calendar Icon to get a mini calendar](https://itsfoss.com/content/images/2023/08/click-on-calendar-icon.png) Now, you will get a small calendar and can select the date accordingly. ![Select the date required from the mini calendar](https://itsfoss.com/content/images/2023/08/select-date-from-calendar.png) Once you set a date of your choice from the list, you can see the criteria applied on the search bar and files based on that condition are showed to you. ![Date criteria is applied to your search, which is highlighted on the top bar](https://itsfoss.com/content/images/2023/08/Showing-search-criterea-date-on-search-result.png) ## Search files based on file type You can also filter your search based on file type. Let's say you are looking for a PDF file. As in the previous step, click on the search icon and start typing the name of the file. Now, from the drop-down menu, click on “Anything” option with “File Name” selected. ![Select "Anything" dropdown button to select search based on file type](https://itsfoss.com/content/images/2023/08/click-on-type-option-to-get-expanded.png) Select the type of file you want to search from the expanded view. Here, I have selected "PDF/Postscript" option. ![From the dropdown list of file types, select the file type you want](https://itsfoss.com/content/images/2023/08/Search-based-on-file-type-like-pdf.png) Once you have selected your required file type, you can see the criteria applied on the search bar. You'll also see the result accordingly. ![File type criteria applied on search, which is highlighted on the top bar](https://itsfoss.com/content/images/2023/08/showing-search-criteria-type-on-search-result.png) Didn't find the desired file type in the search option? Scroll down to the bottom and click on “other types”. ![Click on "Other Type" option to get more file types](https://itsfoss.com/content/images/2023/08/click-on-other-type.png) This will give you more file types. ![More file types are listed as a dialog box, from which you can select one](https://itsfoss.com/content/images/2023/08/complete-list-of-types.png) ## Search into file content, not names By default, the file search is performed on the name of the files. If you want to know if there are files that contain certain word, Nautilus allows you to do that as well. First, click on the search icon and start typing. Now, as in the previous sections, go to the dropdown menu. In the dropdown menu, instead of selecting “[ File Name](https://linuxhandbook.com/find-command-examples/)”, select “ **Full Text**”. Now, you can search for a particular string and filter that search either based on a particular date or file type. The method for filtering is the same as mentioned in the previous sections. ![Select "Full Text" option to start search within file contents](https://itsfoss.com/content/images/2023/08/Search-inside-the-file.png) Here, I have used a string “text to be” and you can see that several files with that particular string are listed. Also, you can see, that part is also highlighted. ## Search only files or only folders By default, Nautilus searches for both files and folders. You can refine your search to either files or folders. To do this, on the drop-down menu, select “File Name” and then from the type list select either files or folders as shown below. ![Search among only files or only folders](https://itsfoss.com/content/images/2023/08/search-for-only-folders-or-only-files.png) This will filter out the results according to your choice. ## Apply multiple filters You can combine the date filter and type filter together to get a more refined search. For this, select each criteria from their respective dropdown list. You can see, in the below screenshot, that I have searched for a file that contains the string “to be search”. The criteria I have applied is, a PDF file, created since1 day. ![Applied multiple filters to the search action like PDF file type, created since a day and search by file content](https://itsfoss.com/content/images/2023/08/applied-multiple-criteria.png) ## More Nautilus tips and tweaks Nautilus is sufficient for most search scenarios. If you need more, there are dedicated GUI tools too that allow you to perform a desktop-wide, custom search. [ANGRYsearch - Quick Search GUI Tool for LinuxA search application is one of the most important tools you can have on your computer. Most are slow to indexes your system and find results. However, today we will be looking at an application that can display results as you type. Today, we will be looking at ANGRYsearch. What](https://itsfoss.com/angrysearch/)![](https://itsfoss.com/content/images/wordpress/2018/12/search-desktop-linux.jpeg) ![](https://itsfoss.com/content/images/wordpress/2018/12/search-desktop-linux.jpeg) Want more such Nautilus tips? How about [opening files as root](https://itsfoss.com/open-nautilus-as-administrator/)? [Open Files and Folders as Admin in Nautilus File ManagerLearn to add an “Open as Administrator” option in the right click context menu in Nautilus file manager in Ubuntu and other Linux distributions.](https://itsfoss.com/open-nautilus-as-administrator/)![](https://itsfoss.com/content/images/wordpress/2020/04/open-nautilus-as-root.jpg) ![](https://itsfoss.com/content/images/wordpress/2020/04/open-nautilus-as-root.jpg) Or combining the power of terminal with the file manager? [Mix and Match Terminal With Nautilus File Manager in LinuxHere are a few tips and tweaks to save your time by combining the terminal and the file manager in Linux.](https://itsfoss.com/terminal-nautilus-combination/)![](https://itsfoss.com/content/images/2023/07/embed-terminal-nautilus.png) ![](https://itsfoss.com/content/images/2023/07/embed-terminal-nautilus.png) There are many more such tips in the article here. Feel free to check it out. [13 Ways to Tweak Nautilus File Manager in LinuxNautilus, aka GNOME Files, is a good file manager with plenty of features. You can further enhance your experience by using these extensions, tweaks and tips.](https://itsfoss.com/nautilus-tips-tweaks/)![](https://itsfoss.com/content/images/wordpress/2022/07/customizing-GNOME-Nautilus-File-Manager.png) ![](https://itsfoss.com/content/images/wordpress/2022/07/customizing-GNOME-Nautilus-File-Manager.png) I hope you like these tips and they help improve your desktop Linux experience slightly better. Do you know any other such cool tips? Do share it in the comments.
16,585
好消息!Mozilla 终于官方提供了 Firefox Deb 包
https://news.itsfoss.com/mozilla-firefox-deb/
2024-01-26T15:08:18
[ "Firefox" ]
https://linux.cn/article-16585-1.html
![](/data/attachment/album/202401/26/150752nwf3fimewwilyfii.jpg) > > Linux 现在有了 Mozilla Firefox 的新原生包。 > > > 我带来了一个好消息!Mozilla 为 Firefox 推出了新的 .deb 包,这是为 Ubuntu、Debian 以及其他 [基于 Debian 的发行版](https://itsfoss.com/debian-based-distros/) 专门提供的。 现在,你能轻松摆脱那些启动速度让人困扰的其他包格式(比如说 Snap 包)了。跟随我一起探索下如何**在 Linux 系统中安装这个新包**! ### Firefox 的 .deb 包:有何新特性? ![](/data/attachment/album/202401/26/150820xrbuoau0k3ebrwzo.png) 这个全新的 Linux 包由 Mozilla 从头打造,为用户带来了**一个原生的 .deb 包**,类似于 Snap 或 Flatpak,直接开箱即用。 此前,所有提供的 Firefox .deb 包都是由与 Mozilla 无关的个人或组织维护的。如今,我们终于迎来了**官方版本**。 关于新版发布,Mozilla 补充说: > > 25 年来,Mozilla 一直以开发自由开源的网络浏览器而闻名。因为 Firefox 浏览器是开源的,所以我们能深入了解 Firefox 的所有细节,包括如何从中获得最大优势。 > > > 尽管 Firefox 已经在性能上下足了功夫,使用这个 .deb 包应该能让你进一步提升利用这些优化的效果。 你也许在想,**怎么更新呢?** 事实上,Mozilla 推出了**一个新的 APT 仓库**,与 Firefox 的发布流程同步。这样,只要 Firefox 有新发布,你就会收到更新,而你只需要重启 Firefox 就能应用这些更新。 很便捷,不是吗?我很喜欢他们做的这一做法,我现在正在考虑是否从我现在已安装的 Flatpak 包切换到 .deb 包,不过这只是我个人的看法。 ### 如何安装 Firefox 的官方 .deb 包? 想要从 Mozilla 安装最新 .deb 版本,你可以参考下面的步骤在**你的 Ubuntu、Debian 或其他基于 Debian 的系统**上操作。 如果你已安装了 Firefox 的 Snap 版本,就可以运行下列命令将其从系统中完全移除: > > ? 运行这些命令会完全删除所有关于 Snap 版本的 Firefox 的数据,一定要小心操作! > > > ``` sudo snap disable firefox sudo snap remove --purge firefox ``` 接下来,通过运行下面的命令,我们来创建一个存储 APT 仓库密钥的目录: ``` sudo install -d -m 0755 /etc/apt/keyrings ``` 现在,导入 Mozilla 的 APT 仓库签名密钥: ``` wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | sudo tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null ``` 接着,你需要运行以下命令: ``` gpg -n -q --import --import-options import-show /etc/apt/keyrings/packages.mozilla.org.asc | awk '/pub/{getline; gsub(/^ +| +$/,""); print "\n"$0"\n"}' ``` 确保在运行命令后,指纹匹配此内容: > > 35BAA0B33E9EB396F59CA838C0BA5CE6DC6315A3 > > > 然后,将 Mozilla 的 APT 仓库添加到你的源列表: ``` echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" | sudo tee -a /etc/apt/sources.list.d/mozilla.list > /dev/null ``` 接下来,需要优先从 Mozilla 仓库选择安装包,你可以通过以下方式设置 APT: ``` echo ' Package: * Pin: origin packages.mozilla.org Pin-Priority: 1000 ' | sudo tee /etc/apt/preferences.d/mozilla ``` 最后,运行下列命令,再在提示时输入 `Y` 来确认安装: ``` sudo apt update && sudo apt install firefox ``` ![](/data/attachment/album/202401/26/150820njb0bcwmktzkwd9r.png) 好了,你此时已经成功在 Linux 系统上安装了 Firefox 的官方 .deb 包! 这就是我之前提到的最后一步,输入 `Y` 后,安装将会继续进行,完成安装后,Firefox 就能在你的系统上看到了。 ![](/data/attachment/album/202401/26/150821goodottxredtyadd.png) 另外,Firefox 还有**安装各种的语言包**的方式,我强烈建议你读一下 [官方文档](https://support.mozilla.org/en-US/kb/install-firefox-linux)了解详情。 ? 你会选择官方的 .deb 包还是 Snap 或 Flatpak 呢?欢迎在下方留言告诉我们! *(题图:DA/98c884d9-1981-4c94-960e-eac1afc53f75)* --- via: <https://news.itsfoss.com/mozilla-firefox-deb/> 作者:[Sourav Rudra](https://news.itsfoss.com/author/sourav/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[ChatGPT](https://linux.cn/lctt/ChatGPT) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![](/assets/images/pikapods-banner-v3.webp) ![](/assets/images/pikapods-banner-v3.webp) I come bearing some good news! Mozilla has introduced a new *.deb* package for Firefox that is meant for Ubuntu, Debian, and other [Debian-based distros](https://itsfoss.com/debian-based-distros/?ref=news.itsfoss.com). You can now switch from other package formats (or the snap package) that's been bothering you with its slow launches. So, join me as I take you through this, and show you **how to install it on your Linux system**. **Suggested Read **📖 [13 Best Debian Based Linux Distros With Unique TouchDebian is the mother of so many Linux distributions. It is not easy to select the best among them. Here, I share some of the interesting Debian-based distros.](https://itsfoss.com/debian-based-distros/?ref=news.itsfoss.com)![](https://itsfoss.com/content/images/wordpress/2022/07/best-distros-based-on-debian.png) ![](https://itsfoss.com/content/images/wordpress/2022/07/best-distros-based-on-debian.png) ## Firefox .deb Package: What to Expect? ![a screenshot of the official .deb package of mozilla firefox running on linux](https://news.itsfoss.com/content/images/2024/01/Mozilla_Firefox_Deb_a.png) Built from the ground up by Mozilla, the new Linux package is all set to give users **a native .deb package**, similar to Snap or Flatpak that just works out of the box. All the *.deb* packages for Firefox that were available before this were maintained by individuals and organizations that weren't associated with Mozilla. But, we finally have an official one. On the release, Mozilla added: For more than 25 years, Mozilla has built a reputation for building free and open-source web browsers. Because the Firefox browser is open-source, we know Firefox inside and out, including how to get the best from it. While Firefox is already performance-focused, the deb package should help you make the most out of the optimizations done under-the-hood. You're maybe wondering; **what about updates?** Well, Mozilla has introduced **a new APT repository** that is in sync with the Firefox release process. So, you will receive updates whenever there's a new one, and you just have to restart Firefox to apply them. ![Follow It's FOSS on Google News](https://news.itsfoss.com/content/images/2023/04/Follow-us-on-Google-News.png) ![Follow It's FOSS on Google News](https://news.itsfoss.com/content/images/2023/04/Follow-us-on-Google-News.png) Handy, ain't it? I like what they have done with this, I am now considering switching to the .deb package from the Flatpak that I have installed now, but that's just me. ### How to Install the Official .deb of Firefox? To install the latest .deb release from Mozilla, you can refer to the steps shown below** on your Ubuntu, Debian or other Debian-based system**. If you have the Snap version of Firefox installed, then you can run the following commands to remove it completely from your system: `sudo snap disable firefox` `sudo snap remove --purge firefox` Next, we create a directory for storing the APT repo keys by running the following command: `sudo install -d -m 0755 /etc/apt/keyrings` Now, import the Mozilla APT repo signing key: `wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | sudo tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null` Then, you have to run the following command: `gpg -n -q --import --import-options import-show /etc/apt/keyrings/packages.mozilla.org.asc | awk '/pub/{getline; gsub(/^ +| +$/,""); print "\n"$0"\n"}'` Ensure that the fingerprint matches this after the command is run: 35BAA0B33E9EB396F59CA838C0BA5CE6DC6315A3 Thereafter, you have to add the Mozilla APT repo to your sources list: `echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" | sudo tee -a /etc/apt/sources.list.d/mozilla.list > /dev/null` Next, you have to set up APT to prioritize packages from the Mozilla repo: ``` echo ' Package: * Pin: origin packages.mozilla.org Pin-Priority: 1000 ' | sudo tee /etc/apt/preferences.d/mozilla ``` And, finally, run the following command and confirm the installation by entering “*Y*” when prompted: `sudo apt update && sudo apt install firefox` ![a screenshot showing how to install the official .deb package of mozilla firefox on linux using the terminal](https://news.itsfoss.com/content/images/2024/01/Mozilla_Firefox_Deb_b.png) That's it, you have now successfully installed the official .deb package of Firefox on your Linux system! This is the final step that I mentioned earlier, you just have to type “*Y*” and the installation should continue, with Firefox being installed onto your system by the end of it. ![a screenshot showing how to install the official .deb package of mozilla firefox on linux using the terminal](https://news.itsfoss.com/content/images/2024/01/Mozilla_Firefox_Deb_c-1.png) There is also a way to** install different language packs** for Firefox, I highly suggest you go through the [official documentation](https://support.mozilla.org/en-US/kb/install-firefox-linux?ref=news.itsfoss.com) for that. *💬 Would you go for the official .deb package over Snap or Flatpak? Let us know below!* ## More from It's FOSS... - Support us by opting for [It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our [community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our [weekly Newsletter](https://itsfoss.com/newsletter/).
16,587
在 Obsidian 中创建和使用链接
https://itsfoss.com/obsidian-create-links/
2024-01-27T09:53:38
[ "Obsidian", "链接" ]
https://linux.cn/article-16587-1.html
![](/data/attachment/album/202401/27/095314xdbbtbjek22bbm8r.jpg) > > Obsidian 知识库工具的真正威力在于链接。学习使用它。 > > > Obsidian 的最大卖点之一是其强大的文档链接和可视化。Obsidian 提供了多种链接文档和图像的方法。我们将逐一介绍。 你将在 Obsidian 中看到三种内部链接方法: * 拖放方式(简单但有限) * 使用 Markdown 链接 * 使用维基链接(广泛且强大) 我还将分享一些有关使用图表和反向链接的技巧。让我们来看看它。 > > ✋ **非自由和开源软件警告!** Obsidian 不是开源软件,我们知道这一事实。然而,它是一种在编码人员(包括开源开发人员)中非常流行的工具。这就是我们介绍它的原因。 > > > ### 方法 1:通过拖放链接 是的,这是最简单的链接。转到要在其中创建链接的文档。现在,在左侧边栏上,展开该特定文件夹,其中包含目标注释。 要创建链接,只需将此目标文件拖放到你希望链接显示的位置即可。 ![通过拖放添加链接](/data/attachment/album/202401/27/095339jggrbpgpo15w61si.gif) 你可以稍后更改链接文本。 ### 方法 2:使用 Markdown 链接 由于 Obsidian 使用 Markdown 作为其核心,因此可以通过输入传统的 Markdown 命令进行链接。 比方说,你必须在 “Markdown Advanced” 页面中创建一个指向 “Markdown Checklist” 页面的链接。首先,你需要记下要链接到的文件的位置。 然后,只需添加这一行: ``` [链接文本](文件的相对路径) ``` 或者,如果你有要链接的文件,并且想要提供系统中的绝对路径,请使用: ``` [链接文本](file://绝对路径) ``` ![使用绝对路径链接](/data/attachment/album/202401/27/095339hsiyseu2wxsywuxo.png) > > ? 如果你 [使用 Markdown 链接](https://itsfoss.com/markdown-links/),请确保文件和文件夹的名称中没有空格,因为这在某些情况下可能会引起一些麻烦。 > > > ### 方法 3:使用紧凑型维基链接来链接页面 Obsidian 支持使用 <ruby> <a href="https://en.wikipedia.org/wiki/Help:Link"> 维基链接 </a> <rt> Wikilink </rt></ruby> 来链接页面的直观方式。它们是紧凑的链接并且是交互式链接。默认情况下,此功能处于打开状态。 如果你想知道,是的,它与维基百科有关。他们用它来内部链接他们的维基页面。 #### 添加内部注释的链接 要创建链接,只需输入 `[[`。这将启动一个交互式对话框,你可以在其中搜索要链接的文档。 ![添加交互式维基链接](/data/attachment/album/202401/27/095339n1er1q0tgecc1zie.gif) > > ? 你可以使用 [[link|要显示的文本]]使自定义文本显示在维基链接上。例如 [[notes/hello.md|这是 Hello 文件的链接]] > > > #### 添加图像文件 此外,你可以使用此链接方法添加其他文件,例如图像,但在使用 `[[` 搜索之前需要添加 `!` 符号。请看下图以了解其实际效果。 ![使用维基链接添加图像](/data/attachment/album/202401/27/095340v88jn11h8te3ybh7.gif) #### 添加内部标题链接 有一种方法可以在同一页面的各个标题之间创建内部链接。为此,首先输入 `[[`,然后使用 Markdown 标题语法和要链接的特定标题的名称。 例如,如果你打算链接到文档中的第六个标题(2 级标题),请使用: ``` [[##Paragraph Six ``` 这将显示在交互式选择中。 ![链接到标题](/data/attachment/album/202401/27/095340hqzlb4h9xavnb2kb.gif) > > ? 你可以将鼠标悬停在链接上时按 CTRL 键来进行预览。 > > > #### 添加指向文本块的链接 Obsidian 允许你创建指向文档中特定文本块的链接。为此,首先,转到要添加链接的块的最末尾。 现在,使用 `^` 符号向该块添加唯一标识符。 ![向块添加唯一标识符](/data/attachment/album/202401/27/095340do0kkfwd0of7ggdi.png) 现在,你可以通过输入 `[[^` 来添加到此部分的链接。这将自动提示你可用的块。选择一项并按回车键。 ![添加链接到块](/data/attachment/album/202401/27/095340vwjgg19hsg3rgjjj.gif) #### 维基链接的问题 有时,如果你想要纯 Markdown 文档,并且专注于多个 Markdown 编辑器之间的互操作性,那么维基链接功能可能会产生问题。 由于这些在 Obsidian 内部工作,因此链接在其他编辑器上显示为损坏。在这种情况下,你可以关闭维基链接。一切都完美无缺,只是链接现在将以 Markdown 格式显示。 为此,首先选择左下角的设置按钮。 ![点击设置](/data/attachment/album/202401/27/095341boljfvlmvvlflsjo.png) 现在,从 “<ruby> 文件和链接 <rt> Files and Links </rt></ruby>” 选项卡关闭维基链接功能。 ![关闭维基链接功能](/data/attachment/album/202401/27/095341yimdrmrnstirtar5.png) #### 组织附件文件的提示 对于那些在 Obsidian 中附加许多文件的人,建议在每本书下为这些附件创建一个单独的文件夹。 现在,打开 “<ruby> 设置 <rt> Settings </rt></ruby> > <ruby> 文件和链接 <rt> Files and Links </rt></ruby>”。在这里,首先,你需要确保链接路径是相对于文件位置的。然后,将新附件的默认位置设置为 “<ruby> 当前文件夹下的子文件夹 <rt> Subfolder under current folder </rt></ruby>”。现在,在下一个字段中指定 “<ruby> 附件 <rt> Attachments </rt></ruby>”,即 “<ruby> 子文件夹名称 <rt> Subfolder name </rt></ruby>”。 ![设置附件文件夹位置](/data/attachment/album/202401/27/095341ifn3ibpjqpcqofmx.png) 就是这样。从现在开始,当你通过复制和粘贴放置任何附件时,它们将自动放置在该笔记文件夹内的“附件”文件夹中。新链接将在任何 Markdown 编辑器之间完美地互操作,因为路径现在是相对于文件位置的。 > > ? 即使此维基链接功能已关闭,你仍然可以使用 [[ 键以交互方式搜索和添加链接。变化是,现在链接不再是紧凑的,而是长 Markdown 链接。 > > > 此外,你还可以打开 “<ruby> 自动更新内部链接 <rt> Automatically Update Internal Links </rt></ruby>” 按钮,以确保在重命名文件时自动更新链接。 ### 使用图表和反向链接 创建完链接后,就可以通过链接查看笔记之间的其他笔记之间的关系。单击侧面的图表视图按钮即可进入图表预览。 ![Obsidian 中的图表视图](/data/attachment/album/202401/27/095342z3kalwsllwj1k4c9.png) 正如你所看到的,你将在一个整洁的图表上获得该注释的链接。如果你按空白选项卡上的图表视图,你将获得所有笔记及其关系。 ![Notes Vault 示例的一些链接示例](/data/attachment/album/202401/27/095342ahphb5m5eed6poeh.png) 此外,每个笔记都有一 “传出链接” 和 “传入链接” 选项卡,你可以在其中跟踪相关链接。 ![传出和传入链接](/data/attachment/album/202401/27/095343oqgwh4h84wym11zy.png) ### 总结 正如你所看到的,虽然在 Obsidian 中创建指向其他页面的内部链接很简单,但通过维基链接,你可以创建更加个性化和定制的知识库。 对于那些不喜欢 Obsidian 闭源性质的人来说,[Logseq](https://itsfoss.com/logseq/) 是一个不错的选择。 *(题图:DA/57173f4d-5548-471f-8d70-a48e3b5e964a)* --- via: <https://itsfoss.com/obsidian-create-links/> 作者:[Sreenath](https://itsfoss.com/author/sreenath/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![Warp Terminal](/assets/images/warp-terminal.webp) ![Warp Terminal](/assets/images/warp-terminal.webp) One of the best-selling points of Obsidian is its strong document interlinking and visualization. Obsidian provides several ways of linking documents and images. We will be taking a look at each of them. You'll see three methods of internal linking in Obsidian: - Drag and drop method (simple but limited) - Using Markdown linking - Using Wikilinks (extensive and powerful) I'll also share some tips on using the graphs and backlinks. Let's see it. **Obsidian is not open source software and we are aware of that fact. However, it is an immensely popular tool among coders, including open source developers. That's the reason we have covered it.** **Non-FOSS Warning!**## Method 1: Link by drag and drop Yes, this is the simplest linking. Go to the document where you want to create the link. Now, on the left sidebar, expand that particular folder, where you have the target note. To create a link, just drag and drop this target file to the location you want the link to appear. ![Add the link to a note by dragginf and dropping that file to the destination file.](https://itsfoss.com/content/images/2023/12/link-by-drag-and-drop.gif) You can change the link text later. ## Method 2: Link Using Markdown Since Obsidian uses Markdown at its core, linking is possible, typing the traditional Markdown commands. Let's say, you have to create a link to the “Markdown Checklist” page in “Markdown Advanced” page. First, you need to note the location of the file you want to link to. Then, just add this line: `[Link Text](relative path to the file)` Or, if you have a file to link, and want to provide the absolute path in the system, use: `[Link text](file://absolute path)` ![Link to a file in the local system, usig the absolute path](https://itsfoss.com/content/images/2023/12/linking-using-absolute-path.png) [using Markdown linking](https://itsfoss.com/markdown-links/), make sure that the files and folders do not have space in their names, as this can cause some headache in some cases. ## Method 3: Link Pages using Compact Wikilinks Obsidian supports an intuitive way of linking pages using [Wikilinks](https://en.wikipedia.org/wiki/Help:Link). They are compact links and are interactive to link. By default, this feature is on. And if you are wondering, yes, it relates to Wikipedia. They use it for internal linking their wiki pages. ### Add link to an internal note To create a link, just type `[[` . This will start an interactive dialog, where you can search for the document that you want to link. ![Add links to pages interactively in Obsidian](https://itsfoss.com/content/images/2023/12/add-interactive-wikilinks.gif) `[[link|Text to appear]]` to make a custom text appear on a Wikilink. e.g. `[[notes/hello.md|This is a Link to the file Hello]]` ### Add an image file Also, you can add other files like images using this linking method, but you need to add a `!` symbol before searching using `[[` . Look at the image below to see it in action. ![Add images attachments in Obsidian using Wikilinks](https://itsfoss.com/content/images/2023/12/add-image-using-wikilinks.gif) ### Add link to an internal heading There is a method to create internal link between various headings of the same page. To do so, first type `[[` and then, use the Markdown heading syntax and name of that particular heading that you want to link. For example, if you intend to link to the Sixth heading, on your document, which is a level 2 heading, use: ``` [[##Paragraph Six ``` This will show that in the interactive to choose from. ![Link to a particular Heading](https://itsfoss.com/content/images/2023/12/Link-to-heading-1.gif) ### Add link to a block of text Obsidian allows you to create links to particular blocks of text in a document. For this, first, go to the very end of the block that you want to add a link. Now, add a unique identifier to this block, by using the `^` symbol. ![Add a unique identifier to the end of the block that you want to link to](https://itsfoss.com/content/images/2023/12/Add-unique-identifier-to-a-block.png) Now, you can add a link to this part by typing `[[^` . This will automatically prompt you about the available blocks. Select one and press enter. ![Add link to a particular block of text.](https://itsfoss.com/content/images/2023/12/your-block-link.gif) ### Issues with Wikilinks Sometimes, if you want pure Markdown documents, and are focussing on interoperability between multiple markdown editors, the Wikilinks feature may create issues. Since these work inside Obsidian, the links appear broken on other editors. In such cases, you can turn off the Wikilinks. Everything works flawlessly, except that the links will now appear in Markdown format. To do this, first select the settings button on the bottom left. ![Click on the settings button on the bottom left of Obsidian main window](https://itsfoss.com/content/images/2023/12/click-on-settings-button-in-obsidian.png) Now, turn off the Wikilinks feature from the “Files and Links” tab. ![From the Files and Links tab in Obsidian Settings, turn off the Wikilinks feature using the toggle button.](https://itsfoss.com/content/images/2023/12/turn-off-the-wikilink-feature.png) ### Tip for organizing attachment Files For those, who are attaching many files to the Obsidian notes, it is advised to create a separate folder for those attachments under each book. Now, open the **Settings > Files and Links**. Here, first, you need to make sure the link path is relative to the file location. Then, set the default location for new attachments to "Subfolder under current folder". Now, specify the “Attachments” in the next field, that is "Subfolder name". ![Set the location of attachments subfolder as "attachments"](https://itsfoss.com/content/images/2023/12/set-attachment-folder-location-and-other-settings-1.png) That's, it. From now on, when you place any attachments by copy and paste, they will be automatically placed in the “attachments” folder inside that notebook folder. And the new link will be perfectly interoperable between any Markdown editors, since the path is now relative to the file location. `[[` keys. The change will be that, now, the link will not be compact, but the long Markdown Link.Also, you can turn on the "Automatically Update Internal Links" button to make sure that, while renaming a file, the link is automatically updated. ## Using the Graph and Backlinks Once you are done creating links, it's time to see the notes' relation between other notes via links. Click on the graph view button on the side to go to the graph preview. ![Graph view in Obsidian for the current note](https://itsfoss.com/content/images/2023/12/graph-view-in-obsidian.png) As you can see, you will get the links to and from that note on a neat graph. If you press on the graph view on an empty tab, you will get all your notes and their relations. ![Some Links example of a sample Notes Vault](https://itsfoss.com/content/images/2023/12/part-of-a-graph-view.png) Also, for each note, there is an outgoing link and an incoming link mentions tab, where you can follow the links associated. ![Outgoing and incoming links in Obsidian](https://itsfoss.com/content/images/2023/12/Links-out-and-in.png) ## Conclusion As you can see, while it is simple to create internal links to other pages in Obsidian, with Wikilinks, you can create a more [personalized and customized knowledge base](https://itsfoss.com/open-source-second-brain-apps/). [13 Useful Tips on Organizing Notes Better With ObsidianUtilize Obsidian knowledge tool more effectively with these helpful tips and tweaks.](https://itsfoss.com/obsidian-tips/)![](https://itsfoss.com/content/images/2024/02/tips-organizing-notes-obsidian.png) ![](https://itsfoss.com/content/images/2024/02/tips-organizing-notes-obsidian.png) For those who do not like the closed source nature of Obsidian, [Logseq](https://itsfoss.com/logseq/) is a good alternative. [Logseq: An Open Source Obsidian Alternative for Second BrainLogseq is a versatile knowledge platform with the support for Markdown and Org-mode. You can create tasks, manage notes, and do a lot more things with them.](https://itsfoss.com/logseq/)![](https://itsfoss.com/content/images/wordpress/2022/01/logseq.png) ![](https://itsfoss.com/content/images/wordpress/2022/01/logseq.png)
16,588
Wine 9.0 发布,实验性地加入了 Wayland 驱动
https://news.itsfoss.com/wine-9-0-release/
2024-01-27T13:58:47
[ "Wine" ]
https://linux.cn/article-16588-1.html
![](/data/attachment/album/202401/27/135710uz5az55e9qj5mgc6.jpg) > > Wine 的这个新版本正在为未来做好准备! > > > Wine 是一款广受欢迎的开源兼容性层,可以轻松地 [在 Linux 上运行 Windows 应用](https://itsfoss.com/use-windows-applications-linux/),而这在几年前还非常困难。 即使 [Vaas](https://en.wikipedia.org/wiki/Vaas_Montenegro) 也认可,Wine 的出现,以一种深具影响力的方式推动了 Linux 的发展。 去年,我们关注到 [Wine 8.0 版](https://news.itsfoss.com/wine-8-0-release/),它的目标是沿袭所有 7.x 系列的改变。但现在是 2024 年了,我们又迎来了 Wine 的一次新版本发布。 ### ? Wine 9.0:有哪些新鲜出炉的内容? 这次 Wine 的新版本带来了一个**试验性的 Wayland 图形驱动**,引入了**高 DPI 缩放**、**多显示器支持**,**基本的窗口管理**等功能。 然而,这并不是完整的实施,也因此**默认是禁用的**。你可以通过运行以下命令来启用它: ``` wine reg.exe add HKCU\\Software\\Wine\\Drivers /v Graphics /d x11,wayland ``` 这并不让人感到惊讶,因为 **我们已经看到 Wayland 的应用在稳步增长**,而 Wine 只是加入这个行列的众多软件之一。接下来的几年对 [Wayland](https://wayland.freedesktop.org/) 将至关重要,我期待它能够实现其所做的承诺。 **从图形方面来看**,Wine 现在已经支持到 Vulkan 规范的 1.3.272 版本,而 PostScript 驱动已被重构,可以使用 Windows 格式的打印文件,并且避免了直接从 Unix 进行调用。 在将模块转换为 PE 格式的工作基础上,现在,**在 WoW64 上**,所有从 Windows 到 Unix 代码的转换现都通过 NT 系统调用接口完成。 新版本还提供了 **对 macOS 上 32 位应用程序的支持**,这要归功于 **新的 WoW64 模式**,它通过从 32 位 PE 代码调用 64 位 Unix 库来实现。 最后,我们在 Wine 9.0 中有了 **对输入设备支持的改进**,现在实现了 *DirectInput 动作映射*,提升了很多老游戏的兼容性。 关于 Wine 9.0 发布的详细信息,你可以阅读 [更新日志](https://gitlab.winehq.org/wine/wine/-/releases/wine-9.0)。 ### ? 如何获取 Wine 9.0 可以在 [官方网站](https://wiki.winehq.org/Download) 上找到 Wine 的二进制包,那里提供了包括 **Ubuntu**、**Debian**、**Fedora** 和 **macOS** 在内的多个版本。 > > **[Wine 9.0](https://wiki.winehq.org/Download)** > > > 另外还有一些由 **SUSE**、**Slackware** 和 **FreeBSD**等提供的其他二进制包。如果你对它们不感兴趣,你也可以访问其 [GitLab 仓库](https://gitlab.winehq.org/wine/wine/) 来从源码中构建。 #### ⚙️ 从旧版本升级 如果你正在使用旧版本的 Wine,那么**按照以下步骤获取 Ubuntu 的最新发行版**,或者是装备有基于 Ubuntu 派生系统的硬件。 首先运行以下命令启用 32 位架构的支持(如果尚未启用): ``` sudo dpkg --add-architecture i386 ``` 下载 Wine 的官方仓库密钥并添加它: ``` sudo mkdir -pm755 /etc/apt/keyrings sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key ``` 然后运行以下命令**之一**获取适合你的 Ubuntu 版本的 WineHQ 源文件: ``` sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/mantic/winehq-mantic.sources #Ubuntu 23.10 sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/lunar/winehq-lunar.sources #Ubuntu 23.04 sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources #Ubuntu 22.04 sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/focal/winehq-focal.sources #Ubuntu 20.04 ``` 最后,执行以下命令(分开运行)来安装 Wine 9.0: ``` sudo apt update sudo apt install --install-recommends winehq-stable ``` 在我撰写这篇文章时,我正在运行 Ubuntu 22.04 LTS 的系统中的 Wine 稳定分支还停留在旧版本 Wine 8.x。开发分支已经有了更新的 Wine 9.0 版本,我建议你可以稍微等待一会再进行升级。 ? 你对 Wine 9.0版本的看法是什么?欢迎分享你的观点。 *(题图:DA/d8042d74-5719-413a-a1fc-4b5a3be581e9)* --- via: <https://news.itsfoss.com/wine-9-0-release/> 作者:[Sourav Rudra](https://news.itsfoss.com/author/sourav/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[ChatGPT](https://linux.cn/lctt/ChatGPT) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![](/assets/images/pikapods-banner-v3.webp) ![](/assets/images/pikapods-banner-v3.webp) Wine is a popular open-source compatibility layer used to [run Windows applications on Linux](https://itsfoss.com/use-windows-applications-linux/?ref=news.itsfoss.com) with ease; something that was a far cry a few years back. Even [Vaas](https://en.wikipedia.org/wiki/Vaas_Montenegro?ref=news.itsfoss.com) would agree that Wine is a very neat piece of software that has **taken Linux forward** in a very meaningful way. Last year, we took a look at the [Wine 8.0 release](https://news.itsfoss.com/wine-8-0-release/) that aimed to unify all the changes from the 7.x series of releases. But, it is now 2024, and we have yet another Wine release to take a look at. **Suggested Read **📖 [Run Windows Applications on Linux [Beginners Guide]Here’s a detailed step-by-step guide with screenshots to show how you can run Windows software on Linux using Wine.](https://itsfoss.com/use-windows-applications-linux/?ref=news.itsfoss.com)![](https://itsfoss.com/content/images/2023/06/run-windows-apps-on-linux.png) ![](https://itsfoss.com/content/images/2023/06/run-windows-apps-on-linux.png) ## 🆕 Wine 9.0: What's New? Debuting with this Wine release is **an experimental Wayland graphics driver** that brings about things like **High-DPI scaling**,** support for multiple monitors**, **basic window management**, and more. However, this is not a complete implementation, and naturally is **disabled by default**. You can enable it by running the following command: `wine reg.exe add HKCU\\Software\\Wine\\Drivers /v Graphics /d x11,wayland` This comes as no surprise, as **we have been seeing a steady growth in the adoption of Wayland**, and Wine is just among the many to join the club. The coming years will be crucial for [Wayland](https://wayland.freedesktop.org/?ref=news.itsfoss.com), and I hope it makes good on its promises. **On the graphics side of things**, Wine now supports up to version *1.3.272* of the Vulkan spec and the *PostScript* driver was reimplemented to work using Windows-format spool files and to avoid any direct calls from Unix. Building on the work done to convert modules into the PE format, now,** on WoW64,** all transitions from Windows to Unix code now go through the *NT syscall interface*. There is also **support for 32-bit applications on macOS** thanks to the **new WoW64 mode**, which works by making calls to the 64-bit Unix library from the 32-bit PE code. And finally, we have **improvements to the input device support** with Wine 9.0 that now implements *DirectInput action maps* to improve compatibility with many old games. For details of the Wine 9.0 release, you may go through the [changelog](https://gitlab.winehq.org/wine/wine/-/releases/wine-9.0?ref=news.itsfoss.com). ## 📥 Get Wine 9.0 The binary packages for Wine can be found on the [official website](https://wiki.winehq.org/Download?ref=news.itsfoss.com), where you can find packages for **Ubuntu**, **Debian**, **Fedora**, and **macOS**. There are some other binary packages maintained by distros such as **SUSE**, **Slackware** and **FreeBSD**. If that doesn't interest you, then you could build from source by visiting its [GitLab repo](https://gitlab.winehq.org/wine/wine/?ref=news.itsfoss.com). ### ⚙️ Upgrade from Older Release If you are running an older release of Wine, then **follow these steps to get the latest release of Ubuntu**, or systems equipped with Ubuntu-based derivatives. Enable support for 32-bit architecture (if not enabled already) by running the following command: ``` sudo dpkg --add-architecture i386 ``` Download the official Wine repo key and add it: ``` sudo mkdir -pm755 /etc/apt/keyrings sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key ``` Then run **one **of the following commands to get the WineHQ sources file for your Ubuntu version: ``` sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/mantic/winehq-mantic.sources #Ubuntu 23.10 sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/lunar/winehq-lunar.sources #Ubuntu 23.04 sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources #Ubuntu 22.04 sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/focal/winehq-focal.sources #Ubuntu 20.04 ``` And finally, to install Wine 9.0, run the following commands (separately): ``` sudo apt update ``` `sudo apt install --install-recommends winehq-stable` At the time of writing, **the stable branch had the older Wine 8.x release for my system running Ubuntu 22.04 LTS**. The development branch had the newer Wine 9.0 release, so I suggest you wait it out a bit before upgrading. *💬 What do you think about the Wine 9.0 release? Feel free to share your thoughts on it.* ## More from It's FOSS... - Support us by opting for [It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our [community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our [weekly Newsletter](https://itsfoss.com/newsletter/).
16,590
Valve 对于 Ubuntu 的 Snap 版本的 Steam 并不满意:原因何在
https://news.itsfoss.com/valve-steam-snap-ubuntu/
2024-01-28T09:32:11
[ "Snap", "Steam" ]
https://linux.cn/article-16590-1.html
![](/data/attachment/album/202401/28/093058ewv0j4za4i4a4lgv.jpg) > > 你可能会发现,Snap 版本的 Steam 并不如你期待的那样好,你怎么看? > > > 近年来,由于 Wine、Proton 等工具的兴起,在 Linux 上 [玩游戏](https://itsfoss.com/linux-gaming-guide/) 变得非常容易。 甚至,**越来越多的游戏开发商为 Linux 提供原生支持**,通过为运行 [SteamOS](https://itsfoss.com/steamos/) 的 Valve 手持设备 Steam Deck 发布游戏。 然而,最近的报道显示,**一名 Valve 开发者注意到,Steam 客户端的非官方 Snap 版表现并不如预期**。 **事情是这样的:** 一位负责 Valve 的 Steam 客户端开发的开发者,Timothée Besset,在 [Mastodon](https://mastodon.social/@TTimo/111772575146054328) 上对 Linux 的 Steam Snap 版本表达了担忧。 需要知道的是,[该 Snap 版本](https://snapcraft.io/steam) 是 Canonical 在 2022 年发布的非官方版本,作为他们全力打造 Ubuntu 游戏体验的一部分。 该开发者指出,他们**发现由 Snap 版本的 Steam 客户端引发的问题报告数量大幅度增加**。 然而,问题在于,**许多用户可能并未意识到他们正在运行的是 Steam 客户端的 Snap 版本**,反倒是首先向 Valve 报告问题,而非与 Canonical 取得联系。 原因何在呢? 主要是因为 Ubuntu(及其官方发行版)在推广 Snap 包的使用。同时,当用户从软件中心安装 Steam 时,系统会默认安装 Snap 应用,许多用户并未觉察。 ![](/data/attachment/album/202401/28/093213o7fj669azh5cijj6.png) 然而,用户并未得到任何关于这个包并非由 Valve 官方维护的信息。 虽然有一个标记表明 Canonical 是它的维护者,验证了包的真实性,但是,它并不是 Valve 官方推荐的东西。 因此,若在 Ubuntu 上安装 Steam,用户可能会被误导(或是产生困惑)。 ![](/data/attachment/album/202401/28/093213jefqwvijeq7jfbue.png) 自然地,用户会希望软件开箱即用。如果做不到,就会有人声称 “Steam 在 Ubuntu 或 Linux 上无法工作”,这会对 Valve 的声誉产生影响。 **如何应对:** 根据 Timothée 的建议,对于 Debian 及其它基于 Debian 的发行版(当然,包括 Ubuntu),你**最佳的选择是从他们的 [GitHub 仓库](https://github.com/ValveSoftware/steam-for-linux/) 下载并安装官方的 *.deb*** 包。 作为替代,你也可以选择 [非官方的 Flatpak](https://flathub.org/apps/com.valvesoftware.Steam)。 有人**建议让 Steam 检测 Snap 并禁止其运行**,Timothée 进一步补充说: > > 运行报告会检测到 snap/flatpak(或即将检测到)。但考虑到用户的自由等等因素,我们通常不会因此停止服务。如果真的出现严重问题,我们可能会开始发出警告。 > > > 我觉得发出警告听起来不错。但当然,既然 Valve 的关切已经被公之于众,Canonical 应对这个问题采取行动,与 Valve 合作改善现状。 ? 你觉得呢? Canonical 会采取行动,解决他们所开发的基于 Snap 的 Steam 客户端存在的问题吗? > > 参考:[GamingOnLinux](https://www.gamingonlinux.com/2024/01/valve-seeing-increasing-bug-reports-due-to-steam-snap-other-methods-recommended/) > > > *(题图:DA/13bf0574-9608-4d18-97ef-c136cbd81ef4)* --- via: <https://news.itsfoss.com/valve-steam-snap-ubuntu/> 作者:[Sourav Rudra](https://news.itsfoss.com/author/sourav/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[ChatGPT](https://linux.cn/lctt/ChatGPT) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![](/assets/images/pikapods-banner-v3.webp) ![](/assets/images/pikapods-banner-v3.webp) Over the years, [playing games on Linux](https://itsfoss.com/linux-gaming-guide/?ref=news.itsfoss.com) has become very accessible, thanks to the rise of tools like Wine, Proton, and others based on those two. Even **game developers are increasingly providing native support for Linux** by releasing games for Valve's handheld, Steam Deck that runs [SteamOS](https://itsfoss.com/steamos/?ref=news.itsfoss.com). However, according to recent reports, it appears that **the unofficial Snap package of the Steam client is not behaving as intended**, as noticed by a Valve developer. **Suggested Read **📖 [Gaming On Linux: All You Need To KnowCan I play games on Linux? What are the games available for Linux? Where to find Linux games? This comprehensive article answers all your questions on Linux gaming.](https://itsfoss.com/linux-gaming-guide/?ref=news.itsfoss.com)![](https://itsfoss.com/content/images/wordpress/2015/10/Gaming-on-Linux.jpeg) ![](https://itsfoss.com/content/images/wordpress/2015/10/Gaming-on-Linux.jpeg) **What's Happening: **A developer (**Timothée Besset) **who works on the Steam client for Valve raised the concern in a [Mastodon post](https://mastodon.social/@TTimo/111772575146054328?ref=news.itsfoss.com) about Steam's Snap app for Linux. If you didn't know, the [Snap version](https://snapcraft.io/steam?ref=news.itsfoss.com) is an unofficial offering developed by Canonical that was introduced back in 2022, as part of them going *“all in on the gaming experience on Ubuntu*”. The developer highlighted that they are** seeing a considerable increase in the number of bug reports** for issues caused by the Snap version of the Steam client. But, the thing is, **many users may not be aware that they are running the Snap version** of the Steam client, and reaching out to Valve with their issues instead of getting in touch with Canonical. And, why is that the case? Primarily, Ubuntu (and its official flavors) promote the use of Snap packages. And, whenever a user decides to install Steam from the software center, you end up installing the Snap app. And, many do not realize it. ![steam search result on software center ubuntu](https://news.itsfoss.com/content/images/2024/01/steam-list-app.png) You do not get any disclosure that this package not officially maintained by Valve. Sure, a tick mark shows that Canonical maintains it, verifying the authenticity of the package. But, it is still not something officially recommended by Valve. So, I guess, the users are being misled (or confused) with the user experience when installing Steam on Ubuntu. ![steam snap app on ubuntu store](https://news.itsfoss.com/content/images/2024/01/steam-snap.png) And, naturally, users will expect it to work out of the box. And, if it does not, everyone will say "*Steam does not work on Ubuntu or Linux*" affecting Valve's reputation. **What to do: **Well, according to Timothée, for Debian and any other Debian-based distros (including Ubuntu, of course), your **best bet is to install the official .deb** package from their [GitHub repo](https://github.com/ValveSoftware/steam-for-linux/?ref=news.itsfoss.com). As an alternative, you can opt for the [unofficial Flatpak](https://flathub.org/apps/com.valvesoftware.Steam?ref=news.itsfoss.com). When **someone suggested making Steam detect Snap and stop it from working**, Timothée had the following to add: the runtime report detects snap/flatpak (or it will). But generally we wouldn't error out .. user freedom and all that. If it gets really bad I guess we could start popping a warning. A warning does sound good to me. But, of course, now that Valve's concern is out there as a news, Canonical should work on resolving the issue and working together with Valve to improve the state of things. *💬 What do you think? Will Canonical step up and address the issues with their Snap-based Steam Client?* Via: [GamingOnLinux](https://www.gamingonlinux.com/2024/01/valve-seeing-increasing-bug-reports-due-to-steam-snap-other-methods-recommended/?ref=news.itsfoss.com) ## More from It's FOSS... - Support us by opting for [It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our [community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our [weekly Newsletter](https://itsfoss.com/newsletter/).
16,592
Unix 桌面:在 Linux 问世之前
https://www.theregister.com/2024/01/27/opinion_column/
2024-01-29T10:30:16
[ "Unix", "Linux" ]
https://linux.cn/article-16592-1.html
![](/data/attachment/album/202401/29/102948u0h78aeihaeel7qf.jpg) > > 仅仅开源还不足以实现开放,还需开放标准和建立共识。 > > > 现在,由于有了安卓和 ChromeOS,Linux 已成为重要的终端用户操作系统。但在 Linux 之前,Unix 桌面起着重要的作用,尽管大多数并未留存至今。 追溯至 1993 年,我在 《PC Magazine》上做了一篇 [Unix 桌面的特性评测](https://books.google.com/books?id=jMKfH6i9OcYC&pg=PA220&dq=Vaughan-Nichols&hl=en&sa=X&ved=2ahUKEwi8pdG5gveDAxXhlmoFHSYsDdcQ6AF6BAgMEAI#v=onepage&q=Vaughan-Nichols&f=false)。是的,在我成为 Linux 桌面用户之前,我是 Unix 的使用者。自从 1979 年 [2BSD Unix](https://opensource.fandom.com/wiki/Berkeley_Software_Distribution) 出现以来,我就是 Unix 的忠实拥趸。到了 1993 年,Unix 桌面繁多,我成功说服我们的杂志让我试用它们。 我和我的团队评测了来自 Consensys、Dell、Interactive Unix、SCO、Univel、<ruby> 昇阳 <rt> Sun </rt></ruby>,和 NeXT 的 Unix 版本。我们也注意到了来自 UHC、Microport 和其它公司的 Unix,但没有进行评测。我相信你们中的大多数人都未曾听说过这些。 那 Linux 呢?那时候,Linux 已经问世,而且我也使用过。但当时最先进的 Linux 发行版是 [Softlanding Linux System(SLS)](https://archiveos.org/sls/),我无法说服编辑们 —— 或者说我自己,认为它是值得评测的。我本可以评测的第一个版本是 [Slackware](http://www.slackware.com/),它至今仍在我们身边,但在那时候,它的发布日期还有数月之遥。 现如今,只有 Dell 仍然存在,不过它之所以至今仍在业界,不完全是因为它的 System V Release 4(SVR4)Unix 发行版。然而,那些早期的 Unix 桌面中,仍有一个仍然活跃健康,且运行在大约 [四分之一的桌面](https://www.statista.com/statistics/218089/global-market-share-of-windows-7/) 上。 那个操作系统,当然,就是 macOS X,它是 NeXT 的 [NeXTSTEP](https://www.zdnet.com/article/steve-jobs-the-next-years/) 的直接后裔。你可以说基于多线程、多进程微内核操作系统 [Mach](https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/KernelProgramming/Mach/Mach.html)、[BSD Unix](https://docs.freebsd.org/en/articles/explaining-bsd/),和开源的 [Darwin](https://github.com/apple/darwin-xnu) 的 macOS,是所有 Unix 操作系统中最成功的。 但在当时看来,情况并非如此。并不是因为 Windows 比 Unix 更好。在 1993 年,可以称作 Unix 的竞争对手的只是 Windows 3.1 和 NT 3.1。 特别是 [NT](https://www.theregister.com/2023/12/19/windows_nt_30_years_on/),在那时,它只能算是个笑料级别的服务器操作系统。直到 Windows NT 3.5 发布后,NT 才开始变得重要。 Windows 击败 Unix 的原因多种多样。其中最重要的一点就是微软确保所有硬件和软件供应商要么与它对齐,要么就无法 [使用 Windows 或微软 Office](http://www.practical-tech.com/business/b020298.htm)。 那个时候,这是个极其重要的问题。我们如今看待 Mac,通常将其视为等同于或者超过 Windows PC 的竞争对手。但那个时期的情况并非如此。史蒂夫·乔布斯当时已被解雇,并且在苹果公司 1993 年的年度报告中,该公司报告显示其 [净收入](https://www.nytimes.com/1993/10/15/business/company-reports-a-small-profit-for-apple-computer.html) 已下降了97%。 然而,尽管微软的成功在很大程度上得益于其历史上的 [不正当商业行为](https://www.theregister.com/2000/04/04/judge_finds_against_ms/),但它并非靠不正当手段得以胜出。Unix 公司正在自我毁灭。 尽管有许多为 Unix 创立软件开发标准的尝试,但它们或者过于宽泛而无法做出实质性贡献,例如 [POSIX](https://www.techtarget.com/whatis/definition/POSIX-Portable-Operating-System-Interface);或者它们在 <ruby> 开放系统基金会 <rt> Open Systems Foundation </rt></ruby> 和 <ruby> Unix 国际 <rt> Unix International </rt></ruby> 之间的商业联盟争端中陷入僵局,这就是著名的 [Unix 战争](https://klarasystems.com/articles/unix-wars-the-battle-for-standards/)。 在 Unix 公司忙于内斗的同时,微软正乐得财源滚滚。关键问题在于 Unix 公司无法就软件标准达成一致。独立软件开发商(ISV)需要为每一个 Unix 平台编写应用。而这些应用在桌面市场的份额都微乎其微。对开发者来说,为 SCO OpenDesktop(也被称为 OpenDeathtrap)、NeXTStep,以及 SunOS 分别编写一个版本的应用程序,从商业的角度来看,这完全没有意义。 这种情况听起来似曾相识吗?这种问题如今依旧困扰着 Linux 桌面,这也是我对诸如红帽的 Flatpak 和 Canonical 的 Snap 这样的 [Linux 容器化桌面应用](https://www.theregister.com/2023/06/09/will_flatpak_and_snap_replace/) 如此钟情的原因。 等到双方于 1996 年最终在 [The Open Group](https://www.opengroup.org/membership/forums/platform/unix) 合力和解时,已经为时已晚。Unix 在传统桌面上的市场被挤压出局,工作站基本上都变成了 <ruby> 昇阳微系统 <rt> Sun Microsystems </rt></ruby> 的天下。 那么,Linux 是如何崭露头角的呢?实际上,相比 Unix 发行版,它有两个主要的优点。首先,它是开源的。在开源的优胜劣汰机制下,好的代码能够生存,差的代码将被淘汰。我认为 Linux 使用 GPL,这点非常关键。 毕竟,如果成功只需要开源代码,那么我们现在都应该在运行如 [FreeBSD](https://www.freebsd.org/)、[DragonflyBSD](https://www.dragonflybsd.org/) 以及 [GhostBSD](https://ghostbsd.org/) 这类纯 BSD 操作系统。但是实际情况却是,虽然 BSD Unix 系统至今仍然重要,却远远比不上 Linux 的市场份额。 Linux 基金会的开源供应链安全主任 David Wheeler 解释了这个原因:BSD 许可证存在的问题在于每隔几年就会有人说:“嘿,让我们基于这个 BSD 代码 [开一家公司](https://lwn.net/Articles/197875/)!”他们会利用这些 \*BSD 代码,某些最优秀的 BSD 开发者,然后开发出一款专有的派生产品。但作为专有厂商,他们的分支成本高昂,维护不易,因此公司最终走向破产……如此反复。 “而与此同时,GPL 通过法律约束将大型商业公司聚集在一起……他们所有人都在作出贡献,并且感到安心,因为他们知道他人也被法律要求必须同样做。这就创造了一个安全的合作区。” Linux 的另一大优势便是其领导,Linus Torvalds。有了 Torvalds 这唯一领导,Linux 规避了 Unix 陷入的内斗困境。 然而 Torvalds 的积极力量并不只在于他是一位天才开发者。尽管他的头衔可能笑称为“<ruby> 终生仁慈独裁者 <rt> Benevolent Dictator for Life </rt></ruby>”,多年来,Torvalds 已经 [学会](https://www.theregister.com/2018/10/22/linus_torvalds_back/) 了如何与他人和谐合作。 有些人说,Torvalds 的人缘不够好,的确,他并不宽容对待愚蠢的行为。然而,我多次参加过 [Linux Plumbers 会议](https://lpc.events/),他和顶尖的 Linux 内核开发者们的合作过程中,我并未见到他们之间有过什么明显的矛盾。如今的 Linux 已是一个集体的功劳。 如果 Linux 的未来全都寄托在 Torvalds 一人身上,我也会担心 Linux 的未来。Torvalds 无疑是一位杰出的人才,一个伟大的程序员,但如果这就是 Linux 成功的全部,我们就会陷入一个痛苦的问题:一场 [公交车事故](https://deviq.com/terms/bus-factor/),就会让我们失去整个 Linux。 幸运的是,Linux 的发行者和开发者们从 Unix 的历史中汲取了教训。 他们清楚,拥有一款成功的桌面操作系统,需要的不仅仅是开源,还需要开放的标准和共识。 我们可能永远都无法迎来那个传说中的 “Linux 桌面年”,但通过安卓和 Chrome OS,Linux 已然成为顶级的终端用户操作系统。经过漫长的等待,Unix 终于通过 Linux 成为了一款顶级的终端用户操作系统。 *(题图:DA/c2e3142a-794b-4532-942e-1a3aea29acf6)* --- via: <https://www.theregister.com/2024/01/27/opinion_column/> 作者:[Steven J. Vaughan-Nichols](https://www.theregister.com/Author/Steven-J-Vaughan-Nichols) 译者:[ChatGPT](https://linux.cn/lctt/ChatGPT) 校对:[wxy](https://github.com/wxy)
200
OK
# The Land Before Linux: Let's talk about the Unix desktops ## It takes more than open source, it takes open standards and consensus Opinion Today, thanks to Android and ChromeOS, Linux is an important end-user operating system. But, before Linux, there were important Unix desktops, although most of them never made it. Way back in 1993, I oversaw a PC Magazine [feature review on Unix desktops](https://books.google.com/books?id=jMKfH6i9OcYC&pg=PA220&dq=Vaughan-Nichols&hl=en&sa=X&ved=2ahUKEwi8pdG5gveDAxXhlmoFHSYsDdcQ6AF6BAgMEAI#v=onepage&q=Vaughan-Nichols&f=false). Yes, that's right, before I was a Linux desktop user, I was a Unix user. Indeed, I've been a Unix fan since 1979, when [2BSD Unix](https://opensource.fandom.com/wiki/Berkeley_Software_Distribution) arrived on the scene. But by 1993, numerous Unix desktops had appeared, and I talked the magazine into letting me kick their tires. My team and I reviewed Unix distros from Consensys, Dell, Interactive Unix, SCO, Univel, Sun, and NeXT. We also looked at but didn't review Unixes from UHC, Microport, and other companies. I guarantee many of you have never heard of them. What about Linux? Yes, it was around, and I was already using it. But the state-of-the-art Linux distro was [Softlanding Linux System (SLS)](https://archiveos.org/sls/), and I couldn't convince my editors – or myself, for that matter – that it was reviewable. The first version that I would have reviewed, [Slackware](http://www.slackware.com/), which is still with us today – was still months in the future. Today, only Dell is still with us, and it's not certainly in business now because of its System V Release 4 (SVR4) Unix release. However, one of those early Unix desktops is still alive, well, and running in about [one in four desktops](https://www.statista.com/statistics/218089/global-market-share-of-windows-7/). That operating system, of course, is macOS X, the direct descendent of [NeXT's NeXTSTEP](https://www.zdnet.com/article/steve-jobs-the-next-years/). You could argue that macOS, based on the multi-threaded, [multi-processing microkernel operating system Mach](https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/KernelProgramming/Mach/Mach.html), [BSD Unix](https://docs.freebsd.org/en/articles/explaining-bsd/), and the [open source Darwin](https://github.com/apple/darwin-xnu), is the most successful of all Unix operating systems. It sure didn't look that way at the time. It wasn't that Windows was better than Unix. In 1993, Unix's competition, if you can call it that, was Windows 3.1 and NT 3.1. [NT](https://www.theregister.com/2023/12/19/windows_nt_30_years_on/), in particular, at that point, was a bad joke of a server operating system. NT only started to matter with the Windows NT 3.5 release. There are many reasons Windows beat Unix. Not least of these was that Microsoft made sure hardware and software vendors either played ball with Microsoft or didn't [get access to Windows or Microsoft Office.](http://www.practical-tech.com/business/b020298.htm) That was an enormous deal at the time. Today, we think of Macs as being rivals or better than Windows PCs. That wasn't the case then. Steve Jobs had been fired, and in Apple's 1993 annual report, the company reported its [net income](https://www.nytimes.com/1993/10/15/business/company-reports-a-small-profit-for-apple-computer.html) had fallen by 97 percent. But, as important as its historically [underhanded business dealings](https://www.theregister.com/2000/04/04/judge_finds_against_ms/) were for its success, Microsoft didn't have to cheat to win. The Unix companies were doing a great job of killing themselves off. You see, while there were many attempts to create software development standards for Unix, they were too general to do much good – for example [Portable Operating System Interface (POSIX)](https://www.techtarget.com/whatis/definition/POSIX-Portable-Operating-System-Interface) – or they became mired in the business consortium fights between the Open Software Foundation and Unix International, which became known as the [Unix wars](https://klarasystems.com/articles/unix-wars-the-battle-for-standards/). While the Unix companies were busy ripping each other to shreds, Microsoft was smiling all the way to the bank. The core problem was that the Unix companies couldn't settle on software standards. Independent Software Vendors (ISV) had to write applications for each Unix platform. Each of these had only a minute desktop market share. It simply made no business sense for programmers to write one version of an application for SCO OpenDesktop (also known as OpenDeathtrap), another for NeXTStep, and still another one for SunOS. Does that sound familiar? That kind of thing is still a problem for the Linux desktop, and it's why I'm a big fan of [Linux containerized desktop applications](https://www.theregister.com/2023/06/09/will_flatpak_and_snap_replace/), such as Red Hat's Flatpak and Canonical's Snap. By the time the two sides finally made peace by joining forces in [The Open Group](https://www.opengroup.org/membership/forums/platform/unix) in 1996, it was too late. Unix was crowded out on the conventional desktop, and the workstation became pretty much a Sun Microsystems-only play. So, how did Linux come to win? Well, it had two major advantages over the Unix distros. The first was that it was open source. In open source's meritocracy, the good code survives, and the bad code dies. In particular I credit Linux's use of the GNU General Public License (GPL). [Will Flatpak and Snap replace desktop Linux native apps?](https://www.theregister.com/2023/06/09/will_flatpak_and_snap_replace/)[The rise and fall of the standard user interface](https://www.theregister.com/2024/01/24/rise_and_fall_of_cua/)[Your pacemaker should be running open source software](https://www.theregister.com/2024/01/12/column/)[Bricking it: Do you actually own anything digital?](https://www.theregister.com/2023/12/22/opinion_column/) After all, if all it took for success were open source code, we'd all be running pure BSD operating systems such as [FreeBSD](https://www.freebsd.org/), [DragonflyBSD](https://www.dragonflybsd.org/), and [GhostBSD](https://ghostbsd.org/). Instead, while the BSD Unix systems are still important, they have nothing like Linux's market share. The reason for this, as David Wheeler, today the Linux Foundation's Director of Open Source Supply Chain Security, explained, was the BSD license has been troublesome because, every few years, someone says, "[Hey, let's start a company based on this BSD code!](https://lwn.net/Articles/197875/)" … They pull the *BSD code in, and some of the best BSD developers, and write a proprietary derivative. But as a proprietary vendor, their fork becomes expensive to self-maintain, and eventually, the company founders. Lather, rinse, repeat. "Meanwhile, the GPL has legally enforced a consortia on major commercial companies … [All] are contributing, and feel safe in doing so because the others are legally required to do the same. It's basically created a 'safe' zone of cooperation." Linux's other killer advantage was it had Linus Torvalds. With Torvalds as Linux's single leader, it avoided the old Unix trap of in-fighting, It's far more than Torvalds being a genius developer. Torvald's humorous title may be Benevolent Dictator for Life, but over the years, [Torvalds has learned to work and play well with others](https://www.theregister.com/2018/10/22/linus_torvalds_back/). The stories go that Torvalds is something of a meanie, and it's certainly true that he doesn't suffer fools gladly, but I've been to many [Linux Plumbers meetings](https://lpc.events/). There, I've seen him and the top Linux kernel developers work with each other without any drama. Today's Linux is a group effort. If all Linux had was Torvalds, I'd worry about the operating system's future. Linus is a wonderful person and a great programmer, but if that's all there was to Linux's success, we'd be one [bus problem](https://deviq.com/terms/bus-factor/) away from its end. Instead, the Linux distributors and developers have learned their Unix history lessons. They've realized that it takes more than open source; it takes open standards and consensus to make a successful desktop operating system. We may never see the fabled "Year of the Linux Desktop," but Linux has already become a top end-user operating system, thanks to Android and Chrome OS. It took its own sweet time, but Unix, via Linux, finally has become a top end-user operating system. ® 111
16,594
如何通过 VLC 使用字幕
https://itsfoss.com/vlc-use-subtitles/
2024-01-29T18:16:00
[ "VLC" ]
https://linux.cn/article-16594-1.html
![](/data/attachment/album/202401/29/181554ruyylfyiusdq9yla.jpg) > > 使用 VLC 媒体播放器播放和管理字幕的新手指南。 > > > 我是一个超级动漫迷,如果你想观看最新的剧集,那么你只能观看日语音频,因此字幕对于非日语观众来说是必不可少的。 值得庆幸的是,我最喜欢的视频播放器 VLC 很好地支持字幕。难怪它是有史以来 [最好的视频播放器](https://itsfoss.com/video-players-linux/) 之一。 VLC 实际上可以做的不仅仅是播放提供的字幕。 在本指南中,我将引导你完成以下内容: * 如何使用可用的字幕(如果有的话) * 如何使用下载的字幕 * 如何自动下载字幕(使用 vlsub 扩展) * 如何将字幕与视频同步 * VLC 支持哪些字幕格式 那么让我们从第一个开始。 ### 如何在 VLC 中启用字幕 有些视频附带字幕文件。如果字幕与视频文件位于同一文件夹中,你可以轻松启用字幕。 虽然启用字幕的方法有多种,但我将向你展示两种有效的方法。 #### 按 V 键(最简单的方法) 如果当前播放的视频有一个或多个字幕,那么你可以按 `V` 键,它将在可用选项之间更改字幕。 正如你所看到的,当我按下 `V` 时,它会在多个字幕之间漫游,甚至可以选择完全禁用字幕。 #### 使用顶部菜单栏或右键单击上下文菜单 虽然按 `V` 键是启用字幕的最简单方法,但如果你有多个字幕文件(可能有多种语言)并且必须选择其中之一,那么按 `V` 键的效果就不是最好了。 假设你要查找的字幕位于最后一个位置,那么你必须按 `V` 键几次,如果你错过了,请再次重复该过程。 因此,在这种情况下,从顶部菜单中选择字幕轨道是一种简单方便的方法。 要使用此方法,你必须遵循两个简单的步骤: * 单击顶部菜单栏中的 “<ruby> 字幕 <rt> Subtitle </rt></ruby>” 菜单 * 选择 “<ruby> 子轨道 <rt> Sub Track </rt></ruby>”,然后选择所需的字幕轨道 ![](/data/attachment/album/202401/29/182017abzabesa67811af9.jpg) 你还可以通过右键单击正在播放的视频,并选择字幕选项来完成此操作。 ### 如何在 VLC 中使用下载的字幕 如果你从网上下载了字幕,但不知道如何在 VLC 中使用它们,那么本节将解决该问题。 要使用下载的字幕,你必须将其导入 VLC。并且可以通过遵循给定的简单步骤轻松完成: * 首先,单击顶部菜单栏中的 “字幕” * 选择第一个 “<ruby> 添加字幕文件 <rt> Add Subtitle File </rt></ruby>” 选项,它将打开文件管理器 * 从这里找到字幕文件所在的位置并选择它 ![](/data/attachment/album/202401/29/181623c7sk2nrs7cqx1k7r.png) 完成后,可以通过顶部菜单栏中的`字幕`菜单访问添加的字幕: ![](/data/attachment/album/202401/29/181623ypp2wz2m9mpeemu8.png) > > ? 如果你要保存视频以供将来使用,我建议将字幕文件复制到与视频文件本身相同的文件夹中。更好的方法是将文件重命名为与视频文件相同的名称。因此,如果视频文件是 `my-xyz.mp4`,则字幕文件应该是 `my-xyz.srt`。这样,字幕要么自动播放,要么在你按 `v` 键时被识别。 > > > ### 如何在 VLC 中自动下载字幕(适用于 Linux 用户) 你是否知道 VLC 有一个名为 VLsub 的插件,可用于从网络下载字幕并直接在 VLC 中访问它们? 如果你是 Linux 用户,请按照给定的说明将其添加到 VLC 中。 首先,[使用 wget 命令](https://learnubuntu.com/install-wget/?ref=itsfoss.com) 下载 zip 文件: ``` wget https://github.com/exebetche/vlsub/archive/master.zip ``` 接下来,如下所示 [使用 unzip 命令解压文件](https://learnubuntu.com/unzip-file/?ref=itsfoss.com): ``` unzip master.zip ``` 之后,你需要 [创建一个新目录](https://linuxhandbook.com/mkdir-command/?ref=itsfoss.com): ``` mkdir -p ~/.local/share/vlc/lua/extensions ``` 最后,使用 [mv 命令](https://linuxhandbook.com/mv-command/?ref=itsfoss.com) 将文件移动到创建的目录,如下所示: ``` mv ~/vlsub-master/vlsub.lua ~/.local/share/vlc/lua/extensions ``` 现在,打开VLC播放器,在 “<ruby> 视图 <rt> View </rt></ruby>” 菜单下,你将找到 “VLsub”: ![](/data/attachment/album/202401/29/181624nycy4zb6c6feapju.png) 要使用 VLsub 下载字幕,首先,输入电影名称和年份以获得更好的结果,然后点击“<ruby> 按名称搜索 <rt> Search by name </rt></ruby>”按钮,从结果中选择字幕文件,然后单击“<ruby> 下载选择 <rt> Download selection </rt></ruby>”按钮,如图所示 : ![](/data/attachment/album/202401/29/181624z67w1fwe155el56z.png) 就是这样! 要了解有关如何使用 VLsub 扩展的更多信息,请参阅我们有关该主题的 [详细指南](https://itsfoss.com/download-subtitles-automatically-vlc-media-player-ubuntu/)。 ### 如何在 VLC 中将字幕与电影同步 有时,下载的字幕可能会比电影中发生的事情稍微落后或提前,这可能会令人沮丧! 不用担心! VLC也有解决这个问题的方法! 在 VLC 中,你可以通过按 `G` 和 `H` 键前进或后退字幕。 * `G` 键将使字幕快进 50 毫秒 * `H` 键将使字幕后退 50 毫秒 虽然 50 毫秒听起来太短,但你会在 2-3 次按键内注意到显着差异。 **如果你在实际场景中跑得太超前或落后,也可以按住它们。** 还感到困惑吗? 你可以参考我们的 [如何在 VLC 中同步字幕的详细指南](https://itsfoss.com/how-to-synchronize-subtitles-with-movie-quick-tip/)。 ### VLC 支持哪些字幕格式? 如果你想从互联网上下载字幕,那么你必须了解 VLC 支持的字幕格式。 以下是 VLC 支持的字幕格式列表: * \*.idx(VOBSub) * \*.cvd(Chaoji VCD) * \*.usf(通用字幕) * \*.ttxt(MPEG-4 定时文本) * \*.srt(SubRip) * \*.ssa(Sub Station Alpha) * \*.smi(SAMI) * \*.aqt(AQTitle) * \*.txt(ML2/VPlayer) * \*.rt(RealText/Smil) * \*.psb(PowerDivX) * \*.pjs(Phoenix Subtitle) * \*.dks(DKS) * \*.mpl(ML2) * \*.jss(JACOSub) * \*.svcd(Super Video CD) * \*.txt(ML2/VPlayer) 但最流行的微妙类型是 `*.srt`,并且通常在你下载视频文件时默认提供。 ### VLC 的功能远不止播放视频 你知道可以使用 VLC 下载 YouTube 视频吗? 嗯,它可以做的远不止这些。 为此,我们制作了关于 [你可以使用 VLC 播放器做的很酷的事情](https://itsfoss.com/simple-vlc-tips/) 的详细指南。 以下是如何充分利用 VLC 的方法: > > **[让 VLC 播放器在 Linux 中发挥更大作用的 5 个技巧](https://itsfoss.com/vlc-pro-tricks-linux/)** > > > 我希望本指南对你有所帮助。 *(题图:DA/39a917f2-a1b3-4167-8393-1af0859105b0)* --- via: <https://itsfoss.com/vlc-use-subtitles/> 作者:[Sagar Sharma](https://itsfoss.com/author/sagar/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![Warp Terminal](/assets/images/warp-terminal.webp) ![Warp Terminal](/assets/images/warp-terminal.webp) I'm a huge fan of anime and if you want to watch the latest episodes, then you have to watch in Japanese audio only making subtitles essential for non-japanese audiences. Thankfully, my favorite video player VLC supports subtitles pretty well. No wonder it is one of the [best video players](https://itsfoss.com/video-players-linux/) of all time. VLC can actually do a lot more than just playing the provided subtitles. In this guide, I will walk you through the following: - How to use available subtitles (if there are any) - How to use downloaded subtitles - How to download subtitles automatically (using the vlsub extension) - How to synchronize subtitles with video - What are the supported subtitle formats with VLC So let's start with the first one. ## How to enable subtitles in VLC Some videos come with companion subtitle files. If the subtitles are in the same folder as the video file, you can enable subtitles easily. While there are several ways to enable subtitles, I will show you two effective ways to do so. ### By pressing `V` (easiest way) If you have one or more subtitles for the currently playing video, then you can press the `V` button and it will change the subtitles between the available options: And as you can see when I pressed the `V` , it roamed through multiple subtitles and even had the option to disable the subtitles completely. ### Using top menubar or right click context menu While pressing the `V` key is the easiest way to enable subtitles but it won't work best if you have multiple subtitle files (perhaps in multiple languages) and you have to select one of them. Suppose that the subtitle which you're looking for is in the last position then you have to press the `V` key several times and if you missed it, repeat the process again. So in that case, choosing a subtitle track from the top menu is an easy and convenient way. To use this method, you have to follow two simple steps: - Click on `Subtitle` menu, located in the top menu bar - Choose `Sub Track` and then, select the preferred subtitle track ![](https://itsfoss.com/content/images/2023/08/Enable-subtitles-from-menu-bar-in-VLC.png) You can also do it by pressing the right-click on the playing video and choosing the subtitles option. ## How to use downloaded subtitles in VLC If you have downloaded subtitles from the web and have no idea how you can use them in VLC, then this section will solve the problem. To use the downloaded subtitle, you'll have to import it to VLC. And can easily be done by following the given simple steps: - First, click on the `Subtitle` from the top menubar - Choose the first `Add Subtitle File` option and it will open the file manager - From here, navigate to where the subtitle file is located and select it ![](https://itsfoss.com/content/images/2023/08/Use-subtitles-downloaded-from-web-in-VLC.png) Once done, added subtitles can be accessed through the `Subtitle` menu located in the top menubar: ![Add subtitles in VLC](https://itsfoss.com/content/images/2023/08/Add-subtitles-in-VLC.png) ## How to download subtitles automatically in VLC (for Linux users) Did you know that VLC has a plugin called VLsub that can be used to download subtitles from the web and accessed them directly in VLC? And if you're a Linux user, then follow the given instructions to add it in VLC. First, download the zip file [using the wget command](https://learnubuntu.com/install-wget/): `wget https://github.com/exebetche/vlsub/archive/master.zip` Next, [unzip the file using the unzip command](https://learnubuntu.com/unzip-file/) as shown: `unzip master.zip` After that, you'd need to [create a new directory](https://linuxhandbook.com/mkdir-command/): `mkdir -p ~/.local/share/vlc/lua/extensions` And finally, move files to the created directory using [the mv command](https://linuxhandbook.com/mv-command/) as shown: `mv ~/vlsub-master/vlsub.lua ~/.local/share/vlc/lua/extensions` Now, open the VLC player, and under the `View` menu, you'll find `VLsub` : ![use VLsub extension in VLC to download subtitles easily](https://itsfoss.com/content/images/2023/08/use-VLsub-extension-in-VLC-to-download-subtitles-easily.png) To download subtitles using VLsub, first, enter the name of the movie with the year to have better results, and hit `Search by name` button, select the subtitle file from the results, and click on the `Download selection` button as shown: ![How to download subtitles in VLC using VLsub extension](https://itsfoss.com/content/images/2023/08/How-to-download-subtitles-in-VLC-using-VLsub-extension.png) That's it! To learn more about [how to use the VLsub extension](https://itsfoss.com/download-subtitles-automatically-vlc-media-player-ubuntu/), refer to our detailed guide on that topic: [Download Subtitles Automatically With VLC Media PlayerVLC is a versatile media player. One of the lesser known features is the automatic subtitle download. Here’s how to use it.](https://itsfoss.com/download-subtitles-automatically-vlc-media-player-ubuntu/)![](https://itsfoss.com/content/images/2023/05/download-subtitles-automatically-in-vlc.png) ![](https://itsfoss.com/content/images/2023/05/download-subtitles-automatically-in-vlc.png) ## How to synchronize subtitles with the movie in VLC Sometimes the downloaded subtitles may be a little behind or forward to what's going on in the movie which can be frustrating! Worry not! VLC has a solution for this problem too! In VLC, you can forward or backward subtitles by pressing `G` and `H` keys. - The `G` key will forward the subtitle by 50 milliseconds - The `H` key will backward the subtitle by 50 milliseconds While 50 milliseconds sounds too less, you will notice a significant difference within 2-3 keystrokes. **You can also press and hold them if you're running too ahead or behind the actual scenes.** Still confused? You may refer to our [detailed guide on how to synchronize subtitles in VLC](https://itsfoss.com/how-to-synchronize-subtitles-with-movie-quick-tip/): [How To Synchronize Subtitles With Movie [Quick Tip]Some people, especially the non-native English speakers prefer to watch a movie or TV program with subtitles. Even the native English speakers need use subtitles if it is in a language other than English. Normally, you download movies from one source and the subtitles from another source. And t…](https://itsfoss.com/how-to-synchronize-subtitles-with-movie-quick-tip/)![](https://itsfoss.com/content/images/wordpress/2012/09/synchronize-subtitles-with-movie-linux.jpg) ![](https://itsfoss.com/content/images/wordpress/2012/09/synchronize-subtitles-with-movie-linux.jpg) ## What are the supported subtitle formats in VLC? If you wish to download subtitles from the internet, then, you must know the supported subtitle formats by VLC. Here is the list of the supported subtitle formats by VLC: - *.idx (VOBSub) - *.cvd (Chaoji VCD) - *.usf (Universal Subtitle) - *.ttxt (MPEG-4 Timed Text) - *.srt (SubRip) - *.ssa (Sub Station Alpha) - *.smi (SAMI) - *.aqt (AQTitle) - *.txt (ML2/VPlayer) - *.rt (RealText/Smil) - *.psb (PowerDivX) - *.pjs (Phoenix Subtitle) - *.dks (DKS) - *.mpl (ML2) - *.jss (JACOSub) - *.svcd (Super Video CD) - *.txt (ML2/VPlayer) But the most popular subtle type is `*.srt` and often shipped by default when you download video files. [App Highlight: Penguin Subtitle Player for Adding Subtitles to Online VideosI must confess. I am addicted to subtitles. It helps me understand the dialogues completely, specially if some dialogues are in a different accent or in a different language. This has led to a habit of watching online videos with subtitles. While streaming services like Netflix and Amazon…](https://itsfoss.com/penguin-subtitle-player/)![](https://itsfoss.com/content/images/wordpress/2019/11/Add_subtitle_online_videos.png) ![](https://itsfoss.com/content/images/wordpress/2019/11/Add_subtitle_online_videos.png) ## VLC can do a lot more than playing videos Did you know that you can download YouTube videos using VLC? Well, it can do a lot more than just that. And for that purpose, we made a detailed guide on [cool things you can do with VLC](https://itsfoss.com/simple-vlc-tips/) player: [Make VLC More Awesome With These Simple TipsVLC is one of the best open source video players, if not the best. What most people don’t know about it is that it is a lot more than just a video player. You can do a lot of complex tasks like broadcasting live videos, capturing devices etc. Just](https://itsfoss.com/simple-vlc-tips/)![](https://itsfoss.com/content/images/wordpress/2019/12/VLC_TIPS.png) ![](https://itsfoss.com/content/images/wordpress/2019/12/VLC_TIPS.png) And here's how you can get more out of VLC: [5 Tricks To Get More Out Of VLC Player In LinuxBrief: This article shows you some expert VLC tips that will help you use this great video player for greater causes. VLC tips to get more out of it Do you know VLC, the ubiquitous media player, flagship of the VideoLAN project? VLC is a cross-platform tool and you can](https://itsfoss.com/vlc-pro-tricks-linux/)![](https://itsfoss.com/content/images/wordpress/2017/05/vlc-tips-tricks-linux.jpg) ![](https://itsfoss.com/content/images/wordpress/2017/05/vlc-tips-tricks-linux.jpg) I hope you will find this guide helpful.
16,595
Linux Matrix 消息应用 Fractal 6 发布
https://news.itsfoss.com/fractal-6-release/
2024-01-30T14:59:36
[ "Matrix" ]
https://linux.cn/article-16595-1.html
![](/data/attachment/album/202401/30/145910y979e9x7x4er8s93.jpg) > > Matrix 用户可以升级 Fractal 6 了! > > > Fractal 是目前 [最好的 Matrix 客户端](https://itsfoss.com/best-matrix-clients/) 之一,近来一直在不断更新。 根据他们在 [Fractal 5 发布时](https://news.itsfoss.com/fractal-5/) 宣布的计划,开发人员已经兑现了承诺,改进了应用程序的方方面面。 现在,Fractal 的下一次升级已经到来,并进行了进一步的改进。 ### ? Fractal 6:有什么新内容? ![](/data/attachment/album/202401/30/145937scwsr378xjm3c6yr.png) 乍一看,你可能没有发现任何重大变化。然而,底层有许多重要的变化。 以通知设置为例,它们已得到更新,现在用户可以设置全局和每个房间的通知。还有一个选项可以选择获取特定关键字的通知。 ![](/data/attachment/album/202401/30/145938dklw9yfwyw95dwwx.png) **对于加密房间**,用户可以轻松访问媒体历史记录,以查找以前上传的照片和视频。现在,当你输入标识符或 URI 时,“*加入房间*” 对话框会显示有用的预览。 既然谈到了这个话题,那么**现在就可以用 Fractal 打开** [Matrix URI](https://matrix.org/blog/2021/04/23/this-week-in-matrix-2021-04-23/) 了\*\*。它也是\*\*Matrix 方案的注册处理程序。如果你不知道,URI 是一种标识符,可以让你轻松与其他用户取得联系或加入房间,类似于 Telegram 等平台上的标识符。 房间成员现在拥有**一个外观整洁的个人资料页面**,可用于查看有关个人资料的简短简介、踢/禁止等审核选项,甚至可以忽略他们;这样你就看不到他们发送的任何消息或邀请。 ![](/data/attachment/album/202401/30/145938hk9vuxnpqrdwudzb.png) 因此,用户现在可以**从帐户设置页面轻松管理他们的“忽略用户”列表**,可以通过单击个人资料图标附近的齿轮图标来访问该页面。 总而言之,还有许多其他改进、修复和新翻译,我在这里没有介绍。为此,我强烈建议你阅读官方 [发行说明](https://gitlab.gnome.org/GNOME/fractal/-/releases/6)。 ### ? 下载 Fractal 6 Fractal 6 可从 [Flathub 商店](https://flathub.org/apps/org.gnome.Fractal) 获取,如果你有兴趣深入了解源代码,你也可以浏览其 [GitLab 仓库](https://gitlab.gnome.org/GNOME/fractal)。 > > **[Fractal 6](https://flathub.org/apps/org.gnome.Fractal)** > > > ? 你使用 Fractal 吗?你会选择其它的替代品吗?让我们知道! --- via: <https://news.itsfoss.com/fractal-6-release/> 作者:[Sourav Rudra](https://news.itsfoss.com/author/sourav/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![](/assets/images/pikapods-banner-v3.webp) ![](/assets/images/pikapods-banner-v3.webp) Fractal is one of the [best Matrix clients](https://itsfoss.com/best-matrix-clients/?ref=news.itsfoss.com) available right now that has been seeing plenty of updates in recent times. Working on the plans that they announced with the [Fractal 5 release](https://news.itsfoss.com/fractal-5/), the developers have made good on their commitment by improving every aspect of the app. Now, the next upgrade for Fractal is here with further refinements. ## 🆕 Fractal 6: What's New? ![a screenshot of fractal 6](https://news.itsfoss.com/content/images/2024/01/Fractal_6_a.png) At first glance, you may not find any major changes; however, there are many important ones under the hood. Take for instance the **notification settings**, they have been given an update with now users being able to set global and per-room notifications. There is also an option to get notifications for specific keywords. ![a screenshot of fractal 6 notification settings](https://news.itsfoss.com/content/images/2024/01/Fractal_6_b.png) **For encrypted rooms**, users can access the media history for finding previously uploaded photos and videos without any fuss. The “*Join Room*” dialog now shows a helpful preview when you enter an identifier or URI. Seeing that we are on the topic, it is** now possible to open ****Matrix URIs**** with Fractal** thanks to this release; it is also **a registered handler for the matrix scheme**. If you didn't know, URIs are identifiers that allow you to easily get in touch with other users or join rooms, similar to what you find on platforms like Telegram. The room members now have **a neat looking profile page** that can be used to see a brief bio about the profile, moderation options such as kick/ban, and even the ability to ignore them; so that you don't get to see any messages or invitations from them. ![a screenshot of fractal 6 showing a user profile](https://news.itsfoss.com/content/images/2024/01/Fractal_6_c.png) In line with that, users can now **easily manage their “ Ignored Users” list** from the account settings page that can be accessed by clicking on the cogwheel icon near the profile icon. ![Follow It's FOSS on Google News](https://news.itsfoss.com/content/images/2023/04/Follow-us-on-Google-News.png) ![Follow It's FOSS on Google News](https://news.itsfoss.com/content/images/2023/04/Follow-us-on-Google-News.png) To wrap this up, there are many other improvements, fixes and new translations that I have not covered here. For that, I highly suggest you go through the official [release notes](https://gitlab.gnome.org/GNOME/fractal/-/releases/6?ref=news.itsfoss.com). **Suggested Read **📖 [9 Best Matrix Clients for Decentralized MessagingMatrix clients help you experience secure, and decentralized messaging. Here are the best options if you want to use it.](https://itsfoss.com/best-matrix-clients/?ref=news.itsfoss.com)![](https://itsfoss.com/content/images/wordpress/2022/06/best-matrix-clients.jpg) ![](https://itsfoss.com/content/images/wordpress/2022/06/best-matrix-clients.jpg) ## 📥 Download Fractal 6 Fractal 6 is available from the [Flathub store](https://flathub.org/apps/org.gnome.Fractal?ref=news.itsfoss.com), you can also go through its [GitLab repo](https://gitlab.gnome.org/GNOME/fractal?ref=news.itsfoss.com) if you are interested in diving into the source code. *💬 Do you use Fractal? Do you have some other alternatives in mind? Let us know!* ## More from It's FOSS... - Support us by opting for [It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our [community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our [weekly Newsletter](https://itsfoss.com/newsletter/).
16,596
如何在 RHEL 上通过绑定配置 VLAN 标记
https://www.2daygeek.com/configure-vlan-tagging-over-network-bonding-rhel/
2024-01-30T15:47:31
[ "网络绑定", "VLAN" ]
https://linux.cn/article-16596-1.html
![](/data/attachment/album/202401/30/154618igt5zj2dwgfax2th.jpg) 在 Linux 中,你可以根据自己的需要创建高级网络设置,如 <ruby> 网络绑定 <rt> Network Bonding </rt></ruby> 或 <ruby> 网卡聚合 <rt> NIC teaming </rt></ruby>、VLAN 标记和桥接。这些高级功能可以提高网络连接的效率和可靠性。 你可以在以太网、绑定、聚合或桥接设备等其他接口上创建 VLAN 接口。 在本文中,我们将学习如何在 RHEL 系统中通过网络绑定配置 VLAN 标记,它允许来自不同网络的流量共享共同的物理链接。 ### 通过绑定对 VLAN 进行标记的先决条件 * 网络聚合需要在网络交换机端口上启用 LACP(802.3ad),以聚合链路。 * 网络聚合需要将网络端口配置为中继端口,这样可以在同一端口上添加多个 VLAN。此外,还要从它们那里获取 VLAN ID,以便在操作系统层面进行配置。 * Linux 系统应该有两个接口。 * 如果是物理服务器,我们建议在板载接口和 PCI 接口之间配置绑定,以避免主机端的网卡出现单点故障。 #### 绑定内核模块 使用 `lsmod` 命令检查 Linux 系统是否已加载绑定模块。 ``` lsmod | grep -i bonding bonding 12451 0 ``` 默认情况下已加载。否则,请使用 `modprobe` 命令加载它。 ``` modprobe bonding ``` ### 1) LACP 绑定配置 我们将配置基于 LACP(Mode 4 – 802.3ad)的链路聚合绑定,通过组合名为 `em1` 和 `p7p1` 的两个接口,为绑定接口提供更大的带宽。 #### 1a) 创建 Bond 接口 在目录 `/etc/sysconfig/network-scripts/` 下创建绑定接口文件 `ifcfg-bond0`。 ``` vi /etc/sysconfig/network-scripts/ifcfg-bond0 TYPE=Bond DEVICE=bond0 NAME=bond0 BONDING_MASTER=yes BOOTPROTO=none ONBOOT=yes BONDING_OPTS="mode=4 miimon=100 lacp_rate=1" NM_CONTROLLED=no ``` #### 1b) 配置第一个从接口 配置你想要进行绑定的第一个从属接口 `em1`。请根据你的环境使用正确的接口名称。 ``` vi /etc/sysconfig/network-scripts/ifcfg-em1 TYPE=Ethernet BOOTPROTO=none DEVICE=em1 ONBOOT=yes MASTER=bond0 SLAVE=yes ``` #### 1c) 配置第二个从接口 配置你想要进行绑定的第二个从属接口 `p7p1`。 请根据你的环境使用正确的接口名称。 ``` vi /etc/sysconfig/network-scripts/ifcfg-p7p1 TYPE=Ethernet BOOTPROTO=none DEVICE=p7p1 ONBOOT=yes MASTER=bond0 SLAVE=yes ``` #### 重启网络服务 重启网络服务以启用绑定接口或使用 `ifup` 命令启动它们。 ``` systemctl restart network ``` ### 2) 通过绑定接口进行 VLAN 标记 LACP 绑定配置已完成,所有接口现已启动并运行。让我们按照以下步骤配置绑定接口上的 VLAN 标记。 正如先决条件中所讨论的,以下是映射到相应以太网卡端口(`em1` 和 `p7p1`)和网络交换机端口的 VLAN。 * VLAN ID (221), VLAN N/W = 192.168.10.0/24 * VLAN ID (331), VLAN N/W = 192.168.20.0/24 #### 2a) 将 VLAN 221 配置到 Bond0 为 VLAN id 221 创建标记接口文件 `/etc/sysconfig/network-scripts/ifcfg-bond0.221` 并添加以下内容。 ``` vi /etc/sysconfig/network-scripts/ifcfg-bond0.221 DEVICE=bond0.221 BOOTPROTO=none ONBOOT=yes IPADDR=192.168.10.100 NETMASK=255.255.255.0 GATEWAY=192.168.10.1 VLAN=yes NM_CONTROLLED=no ``` #### 2b) 将 VLAN 331 配置到 Bond0 为 VLAN id 331 创建标记接口文件 `/etc/sysconfig/network-scripts/ifcfg-bond0.331` 并添加以下内容。 ``` vi /etc/sysconfig/network-scripts/ifcfg-bond0.331 DEVICE=bond0.331 BOOTPROTO=none ONBOOT=yes IPADDR=192.168.20.100 NETMASK=255.255.255.0 GATEWAY=192.168.20.1 VLAN=yes NM_CONTROLLED=no ``` #### 重启网络服务 重启网络服务以启用绑定接口或使用 `ifup` 命令启动它们。 ``` systemctl restart network ``` ### 验证 VLAN 标记配置 最后使用 [ip 命令](https://www.2daygeek.com/linux-ip-command-configure-network-interface/) 验证 VLAN 标记接口是否已配置并启动和运行。 是的,我可以看到 `bondo.221@bond0` 和 `bon0.331@bond0` 有两个不同的 IP,并且能够通过 ssh 访问系统,没有任何问题。因此,VLAN 标记按预期工作。 ![](/data/attachment/album/202401/30/154732hmbzbnmrs1u2a11a.jpg) ### 结论 恭喜,你已经了解了如何在 RHEL 系统上通过 LACP 绑定配置 VLAN 标记,该系统监听两个 VLAN。VLAN 标记不限于两个 VLAN,支持多个 VLAN,你可以根据该 VLAN 的网络配置添加 VLAN 标记。 *(题图:DA/2854516d-4d19-4008-a421-05f9a2a78368)* --- via: <https://www.2daygeek.com/configure-vlan-tagging-over-network-bonding-rhel/> 作者:[Jayabal Thiyagarajan](https://www.2daygeek.com/author/jayabal/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
404
Not Found
null
16,598
MX Linux 23.2 “Libretto” 已来!
https://news.itsfoss.com/mx-linux-23-2-release/
2024-01-31T10:34:02
[ "MX Linux" ]
https://linux.cn/article-16598-1.html
![](/data/attachment/album/202401/31/103333byvuvmo6vzusn2pm.jpg) > > 最新的 MX Linux 23.2 小版本更新带来了基本的改进和新增功能。 > > > MX Linux 推出了 2024 年的第一个主要版本,作为 23.x 版本的延续。上一版本 [MX Linux 23](https://news.itsfoss.com/mx-linux-23-release/) 采用了新徽标,并进行了其他重大更改。 新版本 **MX Linux 23.2** 旨在继续沿着这条道路前进。 如果你正在寻找一款不含 systemd 的发行版,而且在使用时不会碍手碍脚,那么你可以看看这款基于 Debian 的发行版是否是一个极佳的选择。 如果你很好奇,如果你正在寻找一个在使用时不会妨碍的 [无 systemd 发行版](https://itsfoss.com/systemd-free-distros/),那么这个[基于 Debian 的发行版](https://itsfoss.com/debian-based-distros/)是一个绝佳的选择。 所以,话不多说,让我们开始吧。 ### ? MX Linux 23.2:有什么新变化? ![](/data/attachment/album/202401/31/103403wpfr6fpx6pfv6c5m.jpg) MX Linux 23.2 基于 Debian 12.4 “Bookworm” 基础构建,标准版使用 [Linux 内核 6.1](https://news.itsfoss.com/linux-kernel-6-1-release/),“高级硬件支持”(AHS)版使用 Linux 内核 6.6 “[liquix](https://liquorix.net/)”,用于更新的硬件。 至于**此版本的亮点**,安装程序现在为 “toram” 实时功能的用户提供了修复,更新了 `fstab` 的生成,并提供了更好的图形用户界面。 **各种应用和工具也得到升级**,对于音频/视频处理,使用了 [PipeWire 1.0](https://gitlab.freedesktop.org/pipewire/pipewire/-/releases/1.0.0),引入了新工具 “**MX Locale**” 来管理系统区域设置信息,默认语言等等。 **在 UI/UX 部分**,“mx-comfort-themes” 已修复,因为某些应用无法很好地配合它,并且**引入了名为 “MX Linux Desert Landscape” 的新壁纸** 。 这里还提供了一个名为 “papirus-folder-colors” 的新工具,它允许你**尝试不同的文件夹颜色**。 然后是 **新的相机应用**。在 MX Linux 的 KDE Plasma 版本中,[Webcamoid](https://webcamoid.github.io/) 取代了 [Kamoso](https://apps.kde.org/kamoso/),同样,对于 Xfce 和 Fluxbox,Webcamoid 被替换为 [Guvcview](https://guvcview.sourceforge.net/)。 最后,**MX Linux 的旗舰桌面(Xfce)的 AHS 版本现在**更新了固件和 Mesa 库\*\*,并在 MX-Packageinstaller 菜单下新增了启用自动更新的可选设置。 如需进一步了解,你可以浏览 [发行说明](https://mxlinux.org/blog/mx-23-2-libretto-released/)。 ### ? 获取 MX Linux 23.2 要获取最新的 MX 版本,你可以访问其 [官方网站](https://mxlinux.org/download-links/),其中包含各种下载镜像并可使用 torrent 文件。 > > **[MX Linux 23.2](https://mxlinux.org/download-links/)** > > > ?对此版本有什么想法吗? 请在下面告诉我! --- via: <https://news.itsfoss.com/mx-linux-23-2-release/> 作者:[Sourav Rudra](https://news.itsfoss.com/author/sourav/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[校对者ID](https://github.com/%E6%A0%A1%E5%AF%B9%E8%80%85ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![](/assets/images/pikapods-banner-v3.webp) ![](/assets/images/pikapods-banner-v3.webp) MX Linux has introduced their first major release of 2024 as a continuation to their 23.x release. The previous release, [MX Linux 23](https://news.itsfoss.com/mx-linux-23-release/), featured a new logo, and other major changes. The new release, **MX Linux 23.2** aims to continue in that path. If you are curious, this [Debian-based distro](https://itsfoss.com/debian-based-distros/?ref=news.itsfoss.com) is a superb choice if you are looking for a [systemd-free distro](https://itsfoss.com/systemd-free-distros/?ref=news.itsfoss.com) that doesn't get in the way while using it. So, without any further ado, let's dive in. ## 🆕 MX Linux 23.2: What's New? ![a screenshot of mx linux 23.2 with a neofetch output welcome app and about mx linux app open on the desktop screen](https://news.itsfoss.com/content/images/2024/01/MX_Linux_23.2.jpg) Built on Debian 12.4 “Bookworm” base, MX Linux 23.2 **uses ****Linux kernel 6.1**** for the standard variant**, and Linux kernel 6.6 “[liquorix](https://liquorix.net/?ref=news.itsfoss.com)” for its “Advanced Hardware Support” (AHS) release, meant for newer hardware. As for the** highlights of this release**, the installer now features fixes for users of the “*toram*” live feature, an update that addresses *fstab* generation, and a better graphical user interface. The **various applications and tools also see upgrades**, for audio/video handling, [PipeWire 1.0](https://gitlab.freedesktop.org/pipewire/pipewire/-/releases/1.0.0?ref=news.itsfoss.com) is used, a new tool “**MX Locale**” has been introduced for managing system locale information, the default language, and more. **On the UI/UX part**, the “*mx-comfort-themes*” has been fixed due to some apps not playing nice with it, and **a new wallpaper** called “MX Linux Desert Landscape” has been introduced. A new tool called “*papirus-folder-colors*” is also here that allows you to **experiment with different folder colors**. Then there's the **new camera apps;** in the case of the KDE Plasma version of MX Linux, [Webcamoid](https://webcamoid.github.io/?ref=news.itsfoss.com) replaces [Kamoso](https://apps.kde.org/kamoso/?ref=news.itsfoss.com) and similarly, for Xfce and Fluxbox, Webcamoid is replaced with [Guvcview](https://guvcview.sourceforge.net/?ref=news.itsfoss.com). And to close this out,** **the AHS release for MX Linux's flagship desktop (Xfce) now receives **updated firmware and Mesa libraries** with a new optional setting for enabling auto-updates under the *MX-Packageinstaller* menu. For further reading, you may go through the [release notes](https://mxlinux.org/blog/mx-23-2-libretto-released/?ref=news.itsfoss.com). ## 📥 Get MX Linux 23.2 For getting the latest MX release, you can head over to the [official website](https://mxlinux.org/download-links/?ref=news.itsfoss.com), with various download mirrors and access to the torrent files. *💬 Got any thoughts on this release? Let me know below!* ## More from It's FOSS... - Support us by opting for [It's FOSS Plus](https://itsfoss.com/#/portal/signup)membership. - Join our [community forum](https://itsfoss.community/). - 📩 Stay updated with the latest on Linux and Open Source. Get our [weekly Newsletter](https://itsfoss.com/newsletter/).
16,599
关闭 WSL 中正在运行的 Linux 发行版
https://itsfoss.com/shut-down-wsl-distros/
2024-01-31T11:16:00
[ "WSL" ]
https://linux.cn/article-16599-1.html
![](/data/attachment/album/202401/31/111542n7hb9b97xd56dpth.jpg) > > 以下是使用 WSL 关闭在 Windows 内运行的 Linux 系统的不同方法。 > > > 你使用 WSL 在 Windows 内运行 Linux 吗?你想知道如何关闭在 WSL 中运行的 Linux 发行版吗? 你当然可以在 WSL 中运行的 Linux 系统中 [执行 shutdown 命令](https://linuxhandbook.com/linux-shutdown-command/): ``` sudo shutdown now ``` 你还可以使用 `wsl` 命令关闭 Linux 系统。如果你有多个发行版在 WSL 中运行,这是一种极好的方法。 ### 在 WSL 中使用 Windows 终端关闭 Linux 系统 在这个方法中,我假设通常的 `shutdown` 命令在 WSL Linux 系统中不起作用。 首先,在 Windows 中打开一个终端。在这里,我使用的是 Windows 11,并在 WSL 2 下安装了 Ubuntu。 ![打开 Windows 终端](/data/attachment/album/202401/31/111616g8g3zt8lmsg90z77.png) > > ? 你可以在标准的 Windows 终端上使用 `wsl` 命令。在运行的 Linux 发行版中也可以访问该命令。这里,命令的名称是 `wsl.exe`。 > > > 现在,你需要列出已安装的发行版及其状态。为此,请输入 ``` wsl --list --verbose 或 wsl -l -v ``` ![列出已安装的发行版](/data/attachment/album/202401/31/112206km0mrs99ffk86su9.png) 在这里,你可以看到,我已经安装了一个 WSL Ubuntu,它目前正在运行。 #### 关闭所有正在运行的 Linux 发行版 有时,你可能想一次性停止正在运行的 WSL 实例。 在 Powershell 或 Windows 终端中,使用以下命令: ``` wsl --shutdown ``` 这将关闭所有会话。 此外,你还可以**在任何正在运行的 WSL Linux 发行版终端中执行相同的功能**。在发行版中时,你只需要使用 `wsl.exe` 而不是 `wsl`。 ``` wsl.exe --shutdown ``` ![关闭所有正在运行的 WSL 发行版](/data/attachment/album/202401/31/111617o5ggi85s1g5f8cb8.gif) 运行此命令后,所有正在运行的 WSL 发行版都将终止。WSL 2 轻量级虚拟机也被终止。**因此,如果你想重新启动 WSL 2 虚拟机环境,它将很有用。** #### 终止特定的 Linux 发行版 要终止特定正在运行的 WSL 发行版,请打开单独的 Windows 终端并运行: ``` wsl --terminate <发行版名称> ``` 此处,发行版名称是你使用 `wsl -l -v` ⁣ 命令列出所有已安装的 WSL 发行版时获得的名称。 ![列出 WSL 发行版](/data/attachment/album/202401/31/111617h038x9r70x2b78j0.png) ``` wsl --terminate Ubuntu ``` 执行后,指定的 Linux 发行版将被终止。 如果你在另一个发行版中,请使用以下命令列出系统上安装的所有 WSL 发行版: ``` wsl.exe -l -v ``` 现在,使用以下命令终止所需的发行版: ``` wsl.exe --terminate <发行版名称> ``` ![从另一个 WSL 发行版中关闭 WSL 发行版](/data/attachment/album/202401/31/111617lfjhoos6k5ofj5lk.png) ### 总结 有些人直接关闭正在运行的 Linux 应用,但我认为这不太优雅。 另外,就像 Linux 终端一样,你可以使用: * `logout` 命令,用于关闭该发行版。 * `exit` 命令用于退出运行 Linux 发行版的终端。 * 或者,按 `CTRL+D` 执行与 `exit` 命令相同的操作。 但关闭 Linux 系统的 WSL 方式还有一个额外的优势,即可以针对多个 Linux 系统执行此操作。 我希望它对你有帮助。 *(题图:DA/615fd564-a02c-4340-9c8f-ebabcc7c0e0c)* --- via: <https://itsfoss.com/shut-down-wsl-distros/> 作者:[Sreenath](https://itsfoss.com/author/sreenath/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
# Shut Down WSL Running Linux Distributions Here are different ways to shut down Linux systems running inside Windows with WSL. So you are running Linux inside Windows using WSL. And you are wondering how you can shut down the Linux distribution running in WSL. You can surely [try the shutdown command](https://linuxhandbook.com/linux-shutdown-command/) from within the Linux system running in WSL: `sudo shutdown now` You can also shut down Linux systems using WSL commands. It's an excellent method if you have more than one distro running is WSL. ## Shutdown Linux in WSL using Windows Terminal In this method, I assume that the usual `shutdown` command doesn't work in WSL Linux Systems. First, open a terminal in windows. Here, I am using Windows 11 with an Ubuntu setup under WSL 2. ![Open a terminal by searching for it on the Windows 11 Start menu](https://itsfoss.com/content/images/2024/01/open-a-terminal-from-start-menu.png) `wsl` command on a standard Windows terminal. The command is also accessible inside a running Linux distribution. Here, the name of the command is `wsl.exe` .Now, you need to list what distros are installed and what are their status. To do this, enter: ``` wsl --list --verbose OR wsl -l -v ``` ![List all the installed WSL Linux Distribution and their current status.](https://itsfoss.com/content/images/2024/01/list-installed-distributions-and-their-status.png) Here, you can see that, I have one installed WSL Ubuntu, which is currently running. ### Shutdown all running Linux distributions There may be times, when you want to stop app the running WSL instances in one go. In Powershell or Windows Terminal, use this command: ``` wsl --shutdown ``` This will shut down all sessions. Also, you can **perform the same function inside any running WSL Linux Distribution terminal**. You just need to use `wsl.exe` instead of `wsl` , while working inside a distribution. ``` wsl.exe --shutdown ``` ![Shutting down all running WSL distributions from within another WSL Linux distribution](https://itsfoss.com/content/images/2024/01/shutdown-all-wsl-distros-within-another-distro.gif) Once you run this command, all the running WSL distributions will be terminated. The WSL 2 lightweight utility virtual machine is also terminated. **So it will be useful, if you want to restart the WSL 2 virtual machine environment.** ### Terminate a particular Linux distribution To terminate a particular running WSL distribution, open a separate Windows terminal and run: ``` wsl --terminate <Distribution Name> ``` Here, the distribution name is the one you get, when you list all the installed WSL distributions using the `wsl -l -v` command. ![List the WSL distributions](https://itsfoss.com/content/images/2024/01/list-the-distro-to-terminate-only-that-one.png) `wsl --terminate Ubuntu` Once executed, the specified Linux distribution will be terminated. If you are inside another distribution, list all the WSL distros installed on your system using: `wsl.exe -l -v` Now, terminate the required distro using: `wsl.exe --terminate <Distribution name>` ![Shutting Down another WSL Distribution from a running WSL distribution](https://itsfoss.com/content/images/2024/01/shutdown-successfully-completed.png) ## Conclusion Some people just close the running Linux application but I don't think that's very graceful. Also, like a Linux terminal, you can either use: - The `logout` command, to close that distro. - The `exit` command to quit that terminal running the Linux distro. - Or, press CTRL+D to do the same as exit command. But the WSL way of shutting down Linux system has the added advantage of doing it for multiple Linux systems. I hope it helps you.
16,600
人工智能教程(七):Scikit-learn 和训练第一个模型
https://www.opensourceforu.com/2023/02/ai-an-introduction-to-scikit-learn-and-our-first-trained-model/
2024-01-31T15:34:18
[ "AI" ]
https://linux.cn/article-16600-1.html
![](/data/attachment/album/202401/31/153305qiqxi3aq23qqvini.jpg) 在本系列的 [上一篇文章](/article-16579-1.html) 中,我们用 TensorFlow 构建了第一个神经网络,然后还通过 Keras 接触了第一个数据集。在本系列的第七篇文章中,我们将继续探索神经网络,并使用数据集来训练模型。我们还将介绍另一个强大的机器学习 Python 库 scikit-learn。不过在进入正题之前,我要介绍两个轰动性的人工智能应用:ChatGPT 和 DALL-E 2。(LCTT 译注:此文原文发表于 2023 年初,恰值以 ChatGPT 为代表的 AI 热潮开始掀起。) OpenAI 是一个人工智能研究实验室,它在人工智能和机器学习领域做了很多研究。<ruby> 埃隆·马斯克 <rt> Elon Musk </rt></ruby> 是该组织的联合创始人之一。2022 年 11 月,该实验室推出了一款名为 ChatGPT 的在线工具。它是一个可以像人类一样聊天的人工智能聊天机器人。它是使用监督学习和强化学习技术训练的<ruby> 大型语言模型 <rt> large language model </rt></ruby>(LLM)。ChatGPT 使用了 OpenAI 的 GPT-3.5 语言模型,这是 GPT-3(<ruby> 生成式预训练变换器 <rt> Generative Pre-trained Transformer </rt></ruby>)的改进版本,GPT-3 是一种使用深度学习来生成类似人类文本的语言模型。(LCTT 译注:OpenAI 已于 2023 年 3 月 14 日 发布了 GPT-4.0,它支持图文混合的输入输出,并大幅提升了推理能力和准确性。)我仍然记得第一次使用 ChatGPT 时的兴奋。它清楚地展现了人工智能的能力。ChatGPT 的回答质量很高,通常与人类给出的答案没有区别。你可以使用它来纠正语法错误、改写句子、总结段落、编写程序等。实际上,我就用 ChatGPT 改写了本文中的许多句子。此外,我还故意使用有语法错误的文本测试了 ChatGPT,它纠正后的句子非常准确。它重新措辞和总结段落的能力也很惊人。 程序员甚至有可能使用 ChatGPT 在短时间内解决编程难题。在 <ruby> 编程探险挑战赛 2022 <rt> Advent of Code 2022 </rt></ruby> 中,就有人这样宣称(LCTT 译注:比赛官方只是没有完全禁止使用人工智能作为辅助,但是并不很推崇这样的作法。[消息来源](https://adventofcode.com/2022/about))。事实上在 2022 年 12 月,也就是 ChatGPT 发布的一个月后,Stack Overflow 发布了一条新的规定,禁止提交 GPT 或 ChatGPT 生成答案。(LCTT 译注:消息来源:[Temporary policy Generative AI (e.g., ChatGPT) is banned - Meta Stack Overflow](https://meta.stackoverflow.com/questions/421831/temporary-policy-generative-ai-e-g-chatgpt-is-banned)) ![图 1:ChatGPT 生成的程序](/data/attachment/album/202401/31/153418s298c9trt3953o85.jpg) 图 1 显示了 ChatGPT 编写的将两个矩阵相加的 Python 程序。我要求用 BASIC、FORTRAN、Pascal、Haskell、Lua、Pawn、C、c++、Java 等语言编写程序,ChatGPT 总能给出答案,甚至对于像 Brainfuck 和 Ook! 这样生僻的编程语言也是如此。我很确定 ChatGPT 没有从互联网上复制程序代码。更确切地说,我认为 ChatGPT 是基于对上述编程语言的语法知识生成了这些答案的,这些知识是从训练它的大量数据中获得的。许多专家和观察人士认为,随着 ChatGPT 的发展,人工智能已经成为主流。ChatGPT 的真正力量将在未来几个月或几年里被看到。 OpenAI 的另一个令人惊叹的在线人工智能工具是 DALL-E 2,它以卡通机器人 WALL-E(LCTT 译注:电源《机器人总动员》中的主角)和著名画家/艺术家 <ruby> 萨尔瓦多·达利 <rt> Salvador Dalí </rt></ruby> 的名字命名。DALL-E 2 是一个可以根据英文描述来生成绘画的人工智能系统。该工具支持丰富的图像风格,如油画、卡通、漫画、现实主义、超现实主义、壁画等。它还可以模仿著名画家的风格,如达利、毕加索、梵高等。由 DALL-E 2 生成的图像质量非常高。我用下面的描述测试了这个工具:“一个快乐的人在海滩旁看日出的立体主义画作”。图 2 是 DALL-E 2 根据我的描述生成的图像之一。立体主义是毕加索推广的一种绘画风格。问问你的任何一个画家朋友,他/她都会说这确实是一幅立体主义风格的画。令人惊讶的是软件——它也许很复杂——能够模仿像毕加索、梵高、达利这样的大师。我强烈建议你体验一下它。这种体验将非常有趣,同时也体现了人工智能的威力。但请记住,像 ChatGPT 和 DALL-E 2 这样的工具也会带来很多问题,比如版权侵犯、学生的作业抄袭等。(LCTT 译注:本文的题图就是 DALL-E 3 生成的。) ![图 2: DALL-E 2 生成的立体主义画作](/data/attachment/album/202401/31/153419duotqtsu4gfo5gwg.jpg) ### 介绍 scikit-learn scikit-learn 是一个非常强大的机器学习 Python 库。它是一个采用 <ruby> 新 BSD 许可协议 <rt> new BSD licence </rt></ruby>(LCTT 译注:即三句版 BSD 许可证) 的自由开源软件。scikit-learn 提供了回归、分类、聚类和降维等当面的算法,如<ruby> 支持向量机 <rt> Support Vector Machine </rt></ruby>(SVM)、随机森林、k-means 聚类等。 在下面关于 scikit-learn 的介绍中,我们将通过代码讨论支持向量机。支持向量机是机器学习中的一个重要的监督学习模型,可以用于分类和回归分析。支持向量机的发明人 Vladimir Vapnik 和 Alexey Chervonenkis。他们还一起提出了 <ruby> VC 维 <rt> Vapnik–Chervonenkis dimension </rt></ruby> 概念,这是一个评估模型分类能力的理论框架。 图 3 是使用支持向量机对数据进行分类的程序。第 1 行从 scikit-learn 导入 svm 模块。跟前面几篇中介绍的 python 库一样,scikit-learn 也可以通过 Anaconda Navigator 轻松安装。第 2 行定义了一个名为 `X` 的列表,其中包含训练数据。`X` 中的所有元素都是大小为 3 的列表。第 3 行定义了一个列表 `y`,其中包含列表 `X` 中数据的类别标签。在本例中,数据属于两个类别,标签只有 0 和 1 两种。但是使用该技术可以对多个类别的数据进行分类。第 4 行使用 svm 模块的 `SVC()` 方法生成一个支持向量分类器。第 5 行使用 svm 模块的 `fit()` 方法,根据给定的训练数据(本例中为数组 `X` 和 `y`)拟合 svm 分类器模型。最后,第 6 行和第 7 行基于该分类器进行预测。预测的结果也显示在图 3 中。可以看到,分类器能够正确区分我们提供的测试数据。 ![图 3: 使用 SVM 进行分类](/data/attachment/album/202401/31/153419qyf0jyym8ven4k40.jpg) 图 4 中的代码是一个使用 SVM 进行回归的例子。第 1 行次从 scikit-learn 导入 svm 模块。第 2 行定义了一个名为 `X` 的列表,其中包含训练数据。注意,`X` 中的所有元素都是大小为 2 的列表。第 3 行定义了一个列表 `y`,其中包含与列表 `X` 中的数据相关的值。第 4 行使用 svm 模块的 `SVR()` 方法生成支持向量回归模型。第 5 行使用 svm 模块的 `fit()` 方法,根据给定的训练数据(本例中为数 `X` 和 `y`)拟合 svm 回归模型。最后,第 6 行根据该 svm 回归模型进行预测。此预测的结果显示在图 4 中。除了 `SVR()` 之外,还有 `LinearSVR()` 和 `NuSVR()` 两种支持向量回归模型。将第 4 行替换为 `regr = svm.LinearSVR()` 和 `regr = svm.NuSVR()`,并执行代码来查看这些支持向量回归模型的效果。 ![图 4:使用 SVM 进行回归](/data/attachment/album/202401/31/153419ig34an86xngwi99a.jpg) 现在让我们把注意力转到神经网络和 TensorFlow 上。但在下一篇讲无监督学习和聚类时,我们还会学习 scikit-learn 提供的其他方法。 ### 神经网络和 TensorFlow 在上一篇中我们已经看到了 TensorFlow 的 nn 模块提供的 ReLU (<ruby> 整流线性单元 <rt> rectified linear unit </rt></ruby>)和 Leaky ReLU 两个激活函数,下面再介绍两个其他激活函数。`tf.nn.crelu()` 是串联 ReLU 激活函数。`tf.nn.elu()` 是 <ruby> 指数线性单元 <rt> exponential linear unit </rt></ruby> 激活函数。我们将在后续用 TensorFlow 和 Keras 训练我们的第一个模型时用到其中一个激活函数。 在开始训练模型之前,我想向你分享 TensorFlow 的提供的“神经网络实验场”工具。它通过可视化的方式帮助你理解神经网络的工作原理。你可以直观地向神经网络中添加神经元和隐藏层,然后训练该模型。你可以选择 Tanh、Sigmoid、Linear 和 ReLU 等激活函数。分类模型和回归模型都可以使用该工具进行分析。训练的效果以动画的形式显示。图 5 显示了一个示例神经网络和它的输出。你可以通过 <https://playground.tensorflow.org> 访问它。 ![图 5:神经网络实验场](/data/attachment/album/202401/31/153419s0ijth95njjqi9ii.jpg) ### 训练第一个模型 现在,我们使用 [上一篇](/article-16579-1.html) 提到的 MNIST 手写数字数据集来训练模型,然后使用手写数字图像对其进行测试。完整的程序 `digital.py` 相对较大,为了便于理解,我将程序拆分成几个部分来解释,并且添加了额外的行号。 ``` import numpy as np from tensorflow import keras, expand_dims from tensorflow.keras import layers num_classes = 10 input_shape = (28, 28, 1) (x_train, y_train), (x_test, y_test) = keras.datasets.mnist.load_data( ) ``` 第 1 行到第 3 行加载必要的包和模块。第 4 行将类别的数量定义为 10,因为我们试图对 0 到 9 进行分类。第 5 行将输入维度定义为 `(28,28,1)`,这表明我们使用是 28 x 28 像素的灰度图像数据。第 6 行加载该数据集,并将其分为训练数据和测试数据。关于该数据集的更多信息可以参考 [上一篇](/article-16579-1.html) 的相关介绍。 ``` x_train = x_train.astype("float32") / 255 x_test = x_test.astype("float32") / 255 x_train = np.expand_dims(x_train, 3) x_test = np.expand_dims(x_test, 3) y_train = keras.utils.to_categorical(y_train, num_classes) y_test = keras.utils.to_categorical(y_test, num_classes) ``` 第 7 行和第 8 行将图像像素值从 `[0,255]` 转换到 `[0,1]`。其中 `astype()` 方法用于将整数值类型转换为浮点值。第 9 行和第 10 行将数组 `x_test` 和 `x_train` 的维度从 `(60000,28,28)` 扩展为 `(60000,28,28,1)`。列表 `y_train` 和 `y_test` 包含从 0 到 9 的 10 个数字的标签。第 11 行和第 12 行将列表 `y_train` 和 `y_test` 转换为二进制类别矩阵。 ``` try: model = keras.models.load_model(“existing_model”) except IOError: model = keras.Sequential( [ keras.Input(shape=input_shape), layers.Conv2D(32, kernel_size=(3, 3), activation=”relu”), layers.MaxPooling2D(pool_size=(2, 2)), layers.Conv2D(64, kernel_size=(3, 3), activation=”relu”), layers.MaxPooling2D(pool_size=(2, 2)), layers.Flatten( ), layers.Dropout(0.5), layers.Dense(num_classes, activation=”softmax”), ] ) batch_size = 64 epochs = 25 model.compile(loss=”categorical_crossentropy”, optimizer=”adam”, metrics=[“accuracy”]) model.fit(x_train, y_train, batch_size=batch_size, epochs=epochs, validation_split=0.1) model.save(“existing_model”) ``` 训练模型是一个处理器密集和高内存消耗的操作,我们可不希望每次运行程序时都要重新训练一遍模型。因此,在第 13 行和第 14 行中,我们先尝试从 `existing_model` 目录加载模型。第一次执行此代码时,没有模型存在,因此会引发异常。第 16 到 21 行通过定义、训练和保存模型来处理这个异常。第 16 行代码(跨越多行)定义了模型的结构。这一行的参数决定了模型的行为。我们使用的是一个序列模型,它有一系列顺序连接的层,每一层都有一个输入张量和一个输出张量。我们将在下一篇文章中讨论这些定义模型的参数。在此之前,将这个神经网络看作一个黑箱就可以了。 第 17 行将批大小定义为 64,它决定每批计算的样本数量。第 18 行将 epoch 设置为 25,它决定了整个数据集将被学习算法处理的次数。第 19 行对模型的训练行为进行了配置。第 20 行根据给定的数据和参数训练模型。对这两行代码的详细解释将推迟到下一篇文章中。最后,第 21 行将训练好的模型保存到 `existing_model` 目录中。模型会以多个 `.pb` 文件的形式保存在该目录中。注意,第 16 到 21 行位于 `except` 块中。 ``` print(model.summary( )) score = model.evaluate(x_test, y_test, verbose=0) print(“Test loss:”, score[0]) print(“Test accuracy:”, score[1]) ``` 第 22 行打印我们训练的模型的摘要信息(见图 6)。回想一下,在加载数据集时将其分为了训练数据和测试数据。第 23 行使用测试数据来测试我们训练的模型的准确性。第 24 行和第 25 行打印测试的详细信息(见图 8)。 ![图 6:模型的细节信息](/data/attachment/album/202401/31/153419znrers9ei9tnnyes.jpg) ``` img = keras.utils.load_img("sample1.png").resize((28, 28)).convert('L') img = keras.utils.img_to_array(img) img = img.reshape((1, 28, 28, 1)) img = img.astype('float32')/255 score = model.predict(img) print(score) print("Number is", np.argmax(score)) print("Accuracy", np.max(score) * 100.0) ``` 现在,是时候用实际数据来测试我们训练的模型了。我在纸上写了几个数字,并扫描了它们。图 7 是我用来测试模型的一个图像。第 26 行加载图像,然后将其大小调整为 28 x 28 像素,最后将其转换为灰度图像。第 27 到 29 行对图像进行必要的预处理,以便将它输入到我们训练好的模型中。第 30 行预测图像所属的类别。第 31 到 33 行打印该预测的详细信息。图 8 显示了程序 `digital.py` 的这部分输出。从图中可以看出,虽然图像被正确识别为 7,但置信度只有 23.77%。进一步,从图 8 中可以看到它被识别为 1 的置信度为 12.86%,被识别为 8 或 9 的置信度约为 11%。此外,该模型甚至在某些情况下会是分类错误。虽然我找不到导致性能低于标准的准确原因,但我认为相对较低的训练图像分辨率以及测试图像的质量可能是主要的影响因素。这虽然不是最好的模型,但我们现在有了第一个基于人工智能和机器学习原理的训练模型。希望在本系列的后续文章中,我们能构建出可以处理更困难任务的模型。 ![图 7:测试手写数字样例](/data/attachment/album/202401/31/153420specs40ckki4pq0m.jpg) 在本文介绍了 scikit-learn,在下一篇文章中我们还会继续用到它。然后介绍了一些加深对神经网络的理解的知识和工具。我们还使用 Keras 训练了第一个模型,并用这个模型进行预测。下一篇文章将继续探索神经网络和模型训练。我们还将了解 PyTorch,这是一个基于 Torch 库的机器学习框架。PyTorch 可以用于开发 <ruby> 计算机视觉 <rt> computer vision </rt></ruby>(CV) 和 <ruby> 自然语言处理 <rt> natural language processing </rt></ruby>(NLP) 相关的应用程序。 ![图 8:digit.py 脚本的输出](/data/attachment/album/202401/31/153420w19asm161k4fh6h9.jpg) 致谢:感谢我的学生 Sreyas S. 在撰写本文过程中提出的创造性建议。 *(题图:DA/c8e10cac-a5a5-4d53-b5eb-db06f448e60e)* --- via: <https://www.opensourceforu.com/2023/02/ai-an-introduction-to-scikit-learn-and-our-first-trained-model/> 作者:[Deepu Benson](https://www.opensourceforu.com/author/deepu-benson/) 选题:[lujun9972](https://github.com/lujun9972) 译者:[toknow-gh](https://github.com/toknow-gh) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
*In the last article in this series on AI and machine learning, we started our discussion of neural networks by using TensorFlow. We also got familiar with our first data set by using Keras. In this seventh article in the AI series, we will continue exploring neural networks and the use of data sets for training models. We will also introduce yet another powerful Python library for machine learning called scikit-learn. But we will begin by discussing two sensational applications that will show us the power of AI and machine learning.* OpenAI is an artificial intelligence (AI) research laboratory which does a lot of research in the fields of AI and machine learning. Elon Musk is one of the founding members of this organisation. In November 2022, the lab launched a new online tool called ChatGPT. It is an AI chatbot that can chat like a human being. This chatbot is a large language model trained with both supervised and reinforcement learning paradigms of machine learning. ChatGPT uses OpenAI’s GPT-3.5 language model, an improved version of GPT-3 (Generative Pre-trained Transformer 3), a language model that uses deep learning to produce human-like text. I still feel the excitement I felt while using ChatGPT for the first time. The application clearly demonstrates the power of AI. The answers given by the chatbot are of high quality and often indistinguishable from a reply given by a human being. You can use ChatGPT to correct grammatical errors, rephrase sentences, summarise passages, write programs, etc. Indeed, I have rephrased many of the sentences in this article using ChatGPT. Further, I have tested ChatGPT using text with intentional grammar mistakes, not the usual ones I commit, and the corrected sentences were highly accurate. The ability to re-phrase and summarise passages was also phenomenal. It might be even possible that programmers could solve programming puzzles within a very short time using ChatGPT. One such claim was made in a recent programming contest called ‘Advent of Code 2022’. In fact, in December 2022, just after one month of ChatGPT’s existence, Stack Overflow banned its use for generating answers. ![Figure 1: A program written by ChatGPT](https://www.opensourceforu.com/wp-content/uploads/2023/01/Figure-1-A-program-written-by-ChatGPT-1.jpg) ![Figure 1: A program written by ChatGPT](https://www.opensourceforu.com/wp-content/uploads/2023/01/Figure-1-A-program-written-by-ChatGPT-1.jpg) Figure 1 shows the Python program to add two matrices, written by ChatGPT. I asked for different programs in languages like BASIC, FORTRAN, Pascal, Haskell, Lua, Pawn, C, C++, Java, and even in some esoteric programming languages like Brainfuck, Ook!, etc, but ChatGPT always came up with an answer. I am pretty sure that ChatGPT is not copying the programs from some source on the Internet. Rather, I think ChatGPT is generating these answers by having a syntactic knowledge of the above-mentioned programming languages, obtained from the vast data with which it was trained. Many experts and observers are of the opinion that with the development of ChatGPT, AI has gone mainstream. Yet, the true power of ChatGPT is to be seen and analysed in the coming months and years. Another wonderful AI based online tool provided by OpenAI is called DALL-E 2, named after WALL-E (a cartoon robot) and Salvador Dalí (a famous painter and artist). DALL-E 2 is an AI system that can create images and art from a description given in English. The tool will generate images in different styles like oil paintings, cartoons, caricatures, realistic paintings, surrealistic paintings, mural paintings, etc. The tool can also imitate the styles of famous painters like Salvador Dalí, Pablo Picasso, Vincent van Gogh, etc. The images created by DALL-E 2 are of exceptionally high quality. I have tested the tool with the following description: ‘Cubist painting of a happy man watching sunrise near a beach’. Figure 2 shows one of the images generated by DALL-E 2 from my description. Cubism is a painting style popularised by Pablo Picasso. Ask any painter friend of yours and he or she will confirm that this indeed is a painting drawn in the Cubist style. It was quite surprising to see that software, however complicated it may be, could imitate master craftsmen like Picasso, van Gogh, Dalí, etc. I urge you to use this online tool. The experience will be quite entertaining as well as illuminating about the powers of AI. But remember that tools like ChatGPT and DALL-E 2 also bring up a lot of issues like copyright violations, copying of homework by students, etc. ![Figure 2: A Cubist painting generated by DALL-E 2](https://www.opensourceforu.com/wp-content/uploads/2023/01/Figure-2-A-Cubist-painting-generated-by-DALL-E-2.jpg) ![Figure 2: A Cubist painting generated by DALL-E 2](https://www.opensourceforu.com/wp-content/uploads/2023/01/Figure-2-A-Cubist-painting-generated-by-DALL-E-2.jpg) ## Introduction to scikit-learn Now, it is time for us to start using scikit-learn, a very powerful Python library for machine learning. This free and open-source software is licensed under the new BSD licence. Scikit-learn offers regression, classification, clustering and dimensionality reduction algorithms like support vector machines, random forests, k-means clustering, etc. In this introductory discussion on scikit-learn, we will discuss code to implement support vector machines (SVM), a key idea in machine learning. An SVM is a supervised learning model. SVM is used for classification and regression analysis. The person behind the development of SVMs is a computer scientist called Vladimir Vapnik. He is a key figure in machine learning and, together with Alexey Chervonenkis, he proposed the Vapnik–Chervonenkis (VC) dimension, a theoretical framework to measure the capacity of a classification model. Now, consider the program shown in Figure 3. First, let us try to understand the code. The program uses SVM to classify data. Line 1 imports the svm module from scikit-learn. Notice that scikit-learn can be very easily installed by using Anaconda Navigator, as shown in the previous articles in this series. Line 2 defines a list called X which contains the training data. All the elements in X are lists of size 3. Line 3 defines a list y, which contains the class labels associated with the data in the list X. In this example, the data is classified into just two classes labelled 0 and 1. However, it is possible to classify data into multiple classes using the same technique. Line 4 uses the SVC( ) method provided by the module svm. SVC( ) method generates a support vector classifier. Line 5 uses the fit( ) method provided by the module svm to fit the SVM classifier model according to the given training data, in this case the arrays X and y. Finally, lines 6 and 7 make predictions based on this classifier. The results of the predictions are also shown in Figure 3. Notice that the classifier is able to distinguish between the two sets of data we have provided for testing. ![Figure 3: Classification with SVM](https://www.opensourceforu.com/wp-content/uploads/2023/01/Figure-3-Classification-with-SVM.jpg) ![Figure 3: Classification with SVM](https://www.opensourceforu.com/wp-content/uploads/2023/01/Figure-3-Classification-with-SVM.jpg) Now, let us see an example where SVM is used for regression. Consider the code shown in Figure 4. First, let us try to understand the code. Here again, Line 1 imports the svm module from scikit-learn. Line 2 defines a list called X, which contains the training data. Notice that all the elements in X are lists of size 2. Line 3 defines a list y which contains the values associated with the data in the list X. Line 4 uses the SVR( ) method provided by the module svm. This method generates a support vector regression model. Line 5 uses the fit( ) method provided by the module svm to fit the SVM regression model according to the given training data, in this case the arrays X and y. Finally, Line 6 makes a prediction based on this SVM regression model. The result of this prediction is also shown in Figure 4. There are two other methods in addition to SVR( ), LinearSVR( ) and NuSVR( ), to implement a support vector regression model. Replace Line 4 with the lines of code ‘regr = svm.LinearSVR( )’ and ‘regr = svm.NuSVR( )’, and execute the code to see the effect of these support vector regression models also. ![Figure 4: Regression with SVM](https://www.opensourceforu.com/wp-content/uploads/2023/01/Figure-4-Regression-with-SVM-1.jpg) ![Figure 4: Regression with SVM](https://www.opensourceforu.com/wp-content/uploads/2023/01/Figure-4-Regression-with-SVM-1.jpg) Let us now shift our focus to neural networks and TensorFlow. But we will definitely revisit other methods provided by scikit-learn in the next article in this series when we discuss unsupervised learning and clustering. ## Neural networks and TensorFlow The deployment of neural networks is the main strength of machine learning based applications. Let us go through a few more examples from the nn (primitive Neural Net Operations) module of TensorFlow to get better familiarity with the neural network jargon. We have already seen two activation functions called ReLU (rectified linear unit) and Leaky ReLU offered by the module nn of TensorFlow. There are other activation functions also offered by the module nn. The method tf.nn.crelu( ) computes the concatenated ReLU. The method tf.nn.elu( ) computes the exponential linear function. Soon, we will use one of these activation functions while training our first model using TensorFlow and Keras. But before we move on to that section, let me share with you the details of an excellent visual tool that will help you understand the working of a neural network. This resource called ‘Neural Network Playground’ is provided by TensorFlow itself. You can visually add new neurons and new hidden layers to a neural network and then train that model. You can choose between activation functions like Tanh, Sigmoid, Linear and ReLU. Both classification and regression models can be analysed by using this tool. The effect of the training is shown as an animation. Figure 5 shows a sample neural network and the output provided by it. The tool is available online at the following URL, [https://playground.tensorflow.org.](https://playground.tensorflow.org.) This is a great resource for learning about neural networks and this might be a good time in our journey through AI and machine learning to learn more about neural networks. ![Figure 5: The neural network playground in action](https://www.opensourceforu.com/wp-content/uploads/2023/01/Figure-5-The-neural-network-playground-in-action.jpg) ![Figure 5: The neural network playground in action](https://www.opensourceforu.com/wp-content/uploads/2023/01/Figure-5-The-neural-network-playground-in-action.jpg) ## Our first trained model Now, let us continue our discussion on the MNIST database of handwritten digits, a topic which we started to learn in the last article. In this article, we will train our model completely and test it with an image of a handwritten digit. The complete program, named digit.py, is relatively large. Hence, a part by part explanation is given here for better understanding. Line numbers are added to the program for ease of explanation. 1. import numpy as np 2. from tensorflow import keras, expand_dims 3. from tensorflow.keras import layers 4. num_classes = 10 5. input_shape = (28, 28, 1) 6. (x_train, y_train), (x_test, y_test) = keras.datasets.mnist.load_data( ) Lines 1 to 3 load the necessary packages and modules. Line 4 defines the number of classes as 10 because we are trying to classify the 10 digits (0 to 9). Line 5 defines the input shape as (28, 28, 1) because the data set we are going to use is a collection of 28 X 28 pixel grayscale images of handwritten digits. Line 6 loads this data set and divides it into training data and test data. More details about this data set were provided in the previous article in this series on AI and machine learning. 7. x_train = x_train.astype(“float32”) / 255 8. x_test = x_test.astype(“float32”) / 255 9. x_train = np.expand_dims(x_train, 3) 10. x_test = np.expand_dims(x_test, 3) 11. y_train = keras.utils.to_categorical(y_train, num_classes) 12. y_test = keras.utils.to_categorical(y_test, num_classes) Lines 7 and 8 change the pixel values of the image, which is currently in the range [0, 255], to the new range [0, 1]. The method astype( ) is used for typecasting integer values to floating-point values. Lines 9 and 10 expand the shapes of arrays x_test and x_train (changing the shape from (60000, 28, 28) to (60000, 28, 28, 1)). The lists y_train and y_test contain an array of digit labels denoting the classes. In this case, it is 10 denoting the 10 digits from 0 to 9. Lines 11 and 12 convert the lists y_train and y_test to binary class matrices. 13. try: 14. model = keras.models.load_model(“existing_model”) 15. except IOError: 16. model = keras.Sequential( [ keras.Input(shape=input_shape), layers.Conv2D(32, kernel_size=(3, 3), activation=”relu”), layers.MaxPooling2D(pool_size=(2, 2)), layers.Conv2D(64, kernel_size=(3, 3), activation=”relu”), layers.MaxPooling2D(pool_size=(2, 2)), layers.Flatten( ), layers.Dropout(0.5), layers.Dense(num_classes, activation=”softmax”), ] ) 17. batch_size = 64 18. epochs = 25 19. model.compile(loss=”categorical_crossentropy”, optimizer=”adam”, metrics=[“accuracy”]) 20. model.fit(x_train, y_train, batch_size=batch_size, epochs=epochs, validation_split=0.1) 21. model.save(“existing_model”) Remember that model training is a processor intensive and memory consuming operation. Thus, with lines 13 and 14, we try to load a model from the directory existing_model, if such a model is already trained and saved there. The first time you execute this code, no model is existing and hence an exception will be raised. Line 15 handles this exception by executing lines 16 to 21 which define, train and save our model. The 16th line of code (which spans over multiple lines) defines our model. The parameters given in this line decide the behaviour of our model. We are using a sequential model having a stack of layers such that each layer has exactly one input tensor and one output tensor. Our discussion of the parameters used to define the model is deferred till the next article in this series. Since neural networks are so important in machine learning, our discussion then will cover a lot of details. Until then, consider the neural network used here as a black box. Line 17 defines the batch size as 64. This line of code decides the number of samples per batch of computation. Line 18 defines the number of epochs as 25. This value decides the number of times the entire data set will be processed by the learning algorithm. Line 19 configures the model for training. Line 20 trains the model for the given number of epochs, which in this case is 25. The detailed explanation of these two lines of code is also deferred till the next article. Finally, Line 21 saves our trained model to the directory named existing_model. You will find the model saved in this directory as a number of .pb (TensorFlow) files. Notice that lines 16 to 21 are inside the except block. 22. print(model.summary( )) 23. score = model.evaluate(x_test, y_test, verbose=0) 24. print(“Test loss:”, score[0]) 25. print(“Test accuracy:”, score[1]) Line 22 prints a summary about the model trained by us. Figure 6 shows this summary of the model trained. Recall that the data set loaded in the beginning was divided into training data and test data. Line 23 uses the test data to test the accuracy of the model we have trained. Lines 24 and 25 print the details of this test. ![Figure 6: Details of the model trained](https://www.opensourceforu.com/wp-content/uploads/2023/01/Figure-6-Details-of-the-model-trained-590x463.jpg) ![Figure 6: Details of the model trained](https://www.opensourceforu.com/wp-content/uploads/2023/01/Figure-6-Details-of-the-model-trained-590x463.jpg) 26. img = keras.utils.load_img(“sample1.png”).resize((28, 28)).convert(‘L’) 27. img = keras.utils.img_to_array(img) 28. img = img.reshape((1, 28, 28, 1)) 29. img = img.astype(‘float32’)/255 30. score = model.predict(img) 31. print(score) 32. print(“Number is”, np.argmax(score)) 33. print(“Accuracy”, np.max(score) * 100.0) Now, it is time for us to deploy our model. I have written a few digits on paper and scanned them so that our model can use these images for classification. Figure 7 shows one of the images I have used to test our model. Line 26 loads our image after converting it to grayscale and resizing it to 28 x 28 pixels. Lines 27 to 29 do the necessary pre-processing so that the image can be given as input to our trained model. Line 30 predicts the class to which the image belongs to. Lines 31 to 33 print the details of this prediction. Figure 8 shows this part of the output of the program digit.py. From the figure it can be seen that, though the image is correctly identified as 7, the accuracy is only 23.77%. Further, from the value of the list score shown in Figure 8, it can be verified that the same number was identified as 1 with 12.86% accuracy and as 8 or 9 with about 11% accuracy. Moreover, the model even failed to identify the digit correctly on a few occasions. Though I couldn’t pinpoint any reasons for this sub-par performance, I think the relatively low resolution (28 x 28 pixel) training images as well as the quality of the scanned images I have generated could be the main contributing factors. Though not the best model available in town, we now have our first trained model based on AI and machine learning principles. Hopefully, in the coming articles in this series, we will build models capable of performing even more difficult tasks. ![Figure 7: A handwritten digit for testing](https://www.opensourceforu.com/wp-content/uploads/2023/01/Figure-7-A-handwritten-digit-for-testing.jpg) ![Figure 7: A handwritten digit for testing](https://www.opensourceforu.com/wp-content/uploads/2023/01/Figure-7-A-handwritten-digit-for-testing.jpg) Now, it is time to wind-up our discussion. We have started to learn about scikit-learn in this article, a discussion we will continue in the next article in this series also. Later, we have seen more ways to deepen our understanding of neural networks. We also used Keras to train our first model and made predictions with this trained model. We will continue exploring neural networks and model training in the next article. We will also get familiar with PyTorch, a machine learning framework based on the Torch library. PyTorch is used for developing applications involving computer vision and natural language processing. ![Figure 8: Output of the Python script digit.py](https://www.opensourceforu.com/wp-content/uploads/2023/01/Figure-8-Output-of-the-Python-script-digit.py_.jpg) ![Figure 8: Output of the Python script digit.py](https://www.opensourceforu.com/wp-content/uploads/2023/01/Figure-8-Output-of-the-Python-script-digit.py_.jpg) * Acknowledgement: *I thank my student Sreyas S. for his creative suggestions during the preparation of this article.