From 02657d2a936eea8f77f8241888ef41cf594ffa37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=8D=9A?= <1594914459@qq.com> Date: Thu, 16 May 2019 09:25:08 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E7=94=B3=E9=A2=86=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...x Shell Script To Monitor Disk Space Usage And Send Email.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190505 Linux Shell Script To Monitor Disk Space Usage And Send Email.md b/sources/tech/20190505 Linux Shell Script To Monitor Disk Space Usage And Send Email.md index 38a1d6419b..0052115ed1 100644 --- a/sources/tech/20190505 Linux Shell Script To Monitor Disk Space Usage And Send Email.md +++ b/sources/tech/20190505 Linux Shell Script To Monitor Disk Space Usage And Send Email.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (warmfrog) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d22a18c30bfff4517a6b6f894f670c75569fe4a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=8D=9A?= <1594914459@qq.com> Date: Thu, 16 May 2019 10:37:33 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E7=94=B3=E9=A2=86=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0190411 How do you contribute to open source without code.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190411 How do you contribute to open source without code.md b/sources/tech/20190411 How do you contribute to open source without code.md index 659fd9064e..40c2a89842 100644 --- a/sources/tech/20190411 How do you contribute to open source without code.md +++ b/sources/tech/20190411 How do you contribute to open source without code.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (warmfrog) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From e10b066d82515c5a2df4d4b38aed2e07896e3f88 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 May 2019 22:26:06 +0800 Subject: [PATCH 3/7] PRF:20190506 How to Add Application Shortcuts on Ubuntu Desktop.md @warmfrog --- ...Application Shortcuts on Ubuntu Desktop.md | 40 +++++++------------ 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/translated/tech/20190506 How to Add Application Shortcuts on Ubuntu Desktop.md b/translated/tech/20190506 How to Add Application Shortcuts on Ubuntu Desktop.md index 3c836b069a..627aaf14d7 100644 --- a/translated/tech/20190506 How to Add Application Shortcuts on Ubuntu Desktop.md +++ b/translated/tech/20190506 How to Add Application Shortcuts on Ubuntu Desktop.md @@ -1,18 +1,18 @@ [#]: collector: (lujun9972) [#]: translator: (warmfrog) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Add Application Shortcuts on Ubuntu Desktop) [#]: via: (https://itsfoss.com/ubuntu-desktop-shortcut/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -在 Ubuntu 桌面如何添加应用快捷方式 +如何在 Ubuntu 桌面手动添加应用快捷方式 =============================== -_**在这篇快速指南中,你将学到如何在 Ubuntu 桌面和其他使用 GNOME 桌面的发行版中添加应用图标。**_ +> 在这篇快速指南中,你将学到如何在 Ubuntu 桌面和其他使用 GNOME 桌面的发行版中添加应用图标。 -一个经典的桌面操作系统在 ‘桌面屏’ 上总是有图标的。这些桌面图标包括文件管理器,回收站和应用图标。 +一个经典的桌面操作系统在“桌面屏”上总是有图标的。这些桌面图标包括文件管理器、回收站和应用图标。 当在 Windows 中安装应用时,一些程序会询问你是否在桌面创建一个快捷方式。但在 Linux 系统中不是这样。 @@ -26,43 +26,37 @@ _**在这篇快速指南中,你将学到如何在 Ubuntu 桌面和其他使用 ![][5] -个人来讲,我更喜欢为应用图标准备的 Ubuntu 启动器方式。如果我经常使用一个程序,我会添加到启动器。但是我知道不是每个人都有相同的偏好并且少数人更喜欢桌面的快捷方式。 +个人来讲,我更喜欢为应用图标准备的 Ubuntu 启动器方式。如果我经常使用一个程序,我会添加到启动器。但是我知道不是每个人都有相同的偏好,可能少数人更喜欢桌面的快捷方式。 让我们看在桌面中创建应用快捷方式的最简单方式。 -免责声明 +> 免责声明 -这篇指南已经在 Ubuntu18.04 LTS 的 GNOME 桌面上测试过了。它可能在其他发行版和桌面环境上也能发挥作用,但你必须自己尝试。一些 GNOME 特定步骤可能会变,所以请在[其他桌面环境][7]尝试时注意。 - -[Subscribe to our YouTube Channel for More Linux Videos][8] +> 这篇指南已经在 Ubuntu 18.04 LTS 的 GNOME 桌面上测试过了。它可能在其他发行版和桌面环境上也能发挥作用,但你必须自己尝试。一些 GNOME 特定步骤可能会变,所以请在[其他桌面环境][7]尝试时注意。 #### 准备 首先最重要的事是确保你有 GNOME 桌面的图标权限。 -如果你跟随 Ubuntu 18.04 自定义提示,你会知道如何安装 GNOME Tweaks 工具。在这个工具中,确保你设置 ‘Show Icons’ 选项为允许。 +如果你跟随 Ubuntu 18.04 自定义提示,你会知道如何安装 GNOME Tweaks 工具。在这个工具中,确保你设置“Show Icons”选项为启用。 ![Allow icons on desktop in GNOME][9] 一旦你确保已经设置,是时候在桌面添加应用快捷方式了。 -[][10] - -建议阅读在双启动中如何替代一个 Linux 发行版 [保留 Home分区] - #### 第一步:定位应用的 .desktop 文件 -到 Files -> Other Location -> Computer。 +到 “Files -> Other Location -> Computer”。 ![Go to Other Locations -> Computer][11] -从这里,到目录 usr -> share -> applications。你会在这里看到几个你已经安装的 [Ubuntu 应用][12]。即使你没有看到图标,你应该看到被命名为 应用名.desktop 形式的文件。 +从这里,到目录 “usr -> share -> applications”。你会在这里看到几个你已经安装的 [Ubuntu 应用][12]。即使你没有看到图标,你应该看到被命名为“应用名.desktop”形式的文件。 ![Application Shortcuts][13] #### 第二步:拷贝 .desktop 文件到桌面 -现在你要做的只是查找应用图标(或者它的 desktop 文件)。当你找到后,拖文件到桌面或者拷贝文件(使用 Ctrl+C 快捷方式)并在桌面粘贴(使用 Ctrl+V 快捷方式)。 +现在你要做的只是查找应用图标(或者它的 desktop 文件)。当你找到后,拖文件到桌面或者拷贝文件(使用 `Ctrl+C` 快捷方式)并在桌面粘贴(使用 `Ctrl+V` 快捷方式)。 ![Add .desktop file to the desktop][14] @@ -70,7 +64,7 @@ _**在这篇快速指南中,你将学到如何在 Ubuntu 桌面和其他使用 当你这么做,你应该在桌面上看到一个图标的文本文件而不是应用 logo。别担心,一会就不一样了。 -你要做的就是双击桌面的那个文件。它将警告你它是一个 ‘未信任的应用启动器’,点击信任并启动。 +你要做的就是双击桌面的那个文件。它将警告你它是一个“未信任的应用启动器’,点击“信任并启动”。 ![Launch Desktop Shortcut][15] @@ -80,20 +74,16 @@ _**在这篇快速指南中,你将学到如何在 Ubuntu 桌面和其他使用 #### Ubuntu 19.04 或者 GNOME 3.32 用户的疑难杂症 -如果你使用 Ubuntu 19.04 或者 GNOME 3.32,你的 .desktop 文件可能根本不会启动。你应该右击 .desktop 文件并选择 “Allow Launching”。 +如果你使用 Ubuntu 19.04 或者 GNOME 3.32,你的 .desktop 文件可能根本不会启动。你应该右击 .desktop 文件并选择 “允许启动”。 在这之后,你应该能够启动应用并且桌面上的应用快捷方式能够正常显示了。 -**总结** +### 总结 如果你不喜欢桌面的某个应用启动器,选择删除就是了。它会删除应用快捷方式,但是应用仍安全的保留在你的系统中。 我希望你发现这篇快速指南有帮助并喜欢在 Ubuntu 桌面上的应用快捷方式。 -[][17] - -建议阅读在 Ubuntu 中如何安装和设置 Nemo 为默认的文件管理器。 - 如果你有问题或建议,请在下方评论让我知道。 -------------------------------------------------------------------------------- @@ -103,7 +93,7 @@ via: https://itsfoss.com/ubuntu-desktop-shortcut/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[warmfrog](https://github.com/warmfrog) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 98677c8cb9c4ff871af26fa0265aad543d09e35f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 18 May 2019 22:26:58 +0800 Subject: [PATCH 4/7] PUB:20190506 How to Add Application Shortcuts on Ubuntu Desktop.md @warmfrog https://linux.cn/article-10872-1.html --- ...0506 How to Add Application Shortcuts on Ubuntu Desktop.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190506 How to Add Application Shortcuts on Ubuntu Desktop.md (98%) diff --git a/translated/tech/20190506 How to Add Application Shortcuts on Ubuntu Desktop.md b/published/20190506 How to Add Application Shortcuts on Ubuntu Desktop.md similarity index 98% rename from translated/tech/20190506 How to Add Application Shortcuts on Ubuntu Desktop.md rename to published/20190506 How to Add Application Shortcuts on Ubuntu Desktop.md index 627aaf14d7..2e6946ac79 100644 --- a/translated/tech/20190506 How to Add Application Shortcuts on Ubuntu Desktop.md +++ b/published/20190506 How to Add Application Shortcuts on Ubuntu Desktop.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (warmfrog) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10872-1.html) [#]: subject: (How to Add Application Shortcuts on Ubuntu Desktop) [#]: via: (https://itsfoss.com/ubuntu-desktop-shortcut/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From e4438d7e997080d12adcc444c87116e80d1564f6 Mon Sep 17 00:00:00 2001 From: way-ww <40491614+way-ww@users.noreply.github.com> Date: Sun, 19 May 2019 09:52:34 +0800 Subject: [PATCH 5/7] Delete 20190505 How To Install-Uninstall Listed Packages From A File In Linux.md --- ...ll Listed Packages From A File In Linux.md | 338 ------------------ 1 file changed, 338 deletions(-) delete mode 100644 sources/tech/20190505 How To Install-Uninstall Listed Packages From A File In Linux.md diff --git a/sources/tech/20190505 How To Install-Uninstall Listed Packages From A File In Linux.md b/sources/tech/20190505 How To Install-Uninstall Listed Packages From A File In Linux.md deleted file mode 100644 index 1e56511de8..0000000000 --- a/sources/tech/20190505 How To Install-Uninstall Listed Packages From A File In Linux.md +++ /dev/null @@ -1,338 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (way-ww) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How To Install/Uninstall Listed Packages From A File In Linux?) -[#]: via: (https://www.2daygeek.com/how-to-install-uninstall-listed-packages-from-a-file-in-linux/) -[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) - -How To Install/Uninstall Listed Packages From A File In Linux? -====== - -In some case you may want to install list of packages from one server to another server. - -For example, You have installed 15 packages on ServerA, and those packages needs to be installed on ServerB, ServerC, etc., - -We can manually install all the packages but it’s time consuming process. - -It can be done for one or two servers, think about if you have around 10 servers. - -In this case it doesn’t help you then What will be the solution? - -Don’t worry we are here to help you out in this situation or scenario. - -We have added four methods in this article to overcome this situation. - -I hope this will help you to fix your issue. I have tested these commands on CentOS7 and Ubuntu 18.04 systems. - -I hope this will work with other distributions too. Just replace with distribution official package manager command instead of us. - -Navigate to the following article if you want to **[check list of installed packages in Linux system][1]**. - -For example, if you would like to create a package lists from RHEL based system then use the following steps. Do the same for other distributions as well. - -``` -# rpm -qa --last | head -15 | awk '{print $1}' > /tmp/pack1.txt - -# cat /tmp/pack1.txt -mariadb-server-5.5.60-1.el7_5.x86_64 -perl-DBI-1.627-4.el7.x86_64 -perl-DBD-MySQL-4.023-6.el7.x86_64 -perl-PlRPC-0.2020-14.el7.noarch -perl-Net-Daemon-0.48-5.el7.noarch -perl-IO-Compress-2.061-2.el7.noarch -perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 -mariadb-5.5.60-1.el7_5.x86_64 -perl-Data-Dumper-2.145-3.el7.x86_64 -perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 -httpd-2.4.6-88.el7.centos.x86_64 -mailcap-2.1.41-2.el7.noarch -httpd-tools-2.4.6-88.el7.centos.x86_64 -apr-util-1.5.2-6.el7.x86_64 -apr-1.4.8-3.el7_4.1.x86_64 -``` - -### Method-1 : How To Install Listed Packages From A File In Linux With Help Of cat Command? - -To achieve this, i would like to go with this first method. As this very simple and straightforward. - -To do so, just create a file and add the list of packages that you want to install it. - -For testing purpose, we are going to add only the below three packages into the following file. - -``` -# cat /tmp/pack1.txt - -apache2 -mariadb-server -nano -``` - -Simply run the following **[apt command][2]** to install all the packages in a single shot from a file in Ubuntu/Debian systems. - -``` -# apt -y install $(cat /tmp/pack1.txt) - -Reading package lists... Done -Building dependency tree -Reading state information... Done -The following packages were automatically installed and are no longer required: - libopts25 sntp -Use 'sudo apt autoremove' to remove them. -Suggested packages: - apache2-doc apache2-suexec-pristine | apache2-suexec-custom spell -The following NEW packages will be installed: - apache2 mariadb-server nano -0 upgraded, 3 newly installed, 0 to remove and 24 not upgraded. -Need to get 339 kB of archives. -After this operation, 1,377 kB of additional disk space will be used. -Get:1 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 apache2 amd64 2.4.29-1ubuntu4.6 [95.1 kB] -Get:2 http://in.archive.ubuntu.com/ubuntu bionic/main amd64 nano amd64 2.9.3-2 [231 kB] -Get:3 http://in.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 mariadb-server all 1:10.1.38-0ubuntu0.18.04.1 [12.9 kB] -Fetched 339 kB in 19s (18.0 kB/s) -Selecting previously unselected package apache2. -(Reading database ... 290926 files and directories currently installed.) -Preparing to unpack .../apache2_2.4.29-1ubuntu4.6_amd64.deb ... -Unpacking apache2 (2.4.29-1ubuntu4.6) ... -Selecting previously unselected package nano. -Preparing to unpack .../nano_2.9.3-2_amd64.deb ... -Unpacking nano (2.9.3-2) ... -Selecting previously unselected package mariadb-server. -Preparing to unpack .../mariadb-server_1%3a10.1.38-0ubuntu0.18.04.1_all.deb ... -Unpacking mariadb-server (1:10.1.38-0ubuntu0.18.04.1) ... -Processing triggers for ufw (0.36-0ubuntu0.18.04.1) ... -Setting up apache2 (2.4.29-1ubuntu4.6) ... -Processing triggers for ureadahead (0.100.0-20) ... -Processing triggers for install-info (6.5.0.dfsg.1-2) ... -Setting up nano (2.9.3-2) ... -update-alternatives: using /bin/nano to provide /usr/bin/editor (editor) in auto mode -update-alternatives: using /bin/nano to provide /usr/bin/pico (pico) in auto mode -Processing triggers for systemd (237-3ubuntu10.20) ... -Processing triggers for man-db (2.8.3-2ubuntu0.1) ... -Setting up mariadb-server (1:10.1.38-0ubuntu0.18.04.1) ... -``` - -For removal, use the same format with appropriate option. - -``` -# apt -y remove $(cat /tmp/pack1.txt) -Reading package lists... Done -Building dependency tree -Reading state information... Done -The following packages were automatically installed and are no longer required: - apache2-bin apache2-data apache2-utils galera-3 libaio1 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libjemalloc1 liblua5.2-0 - libmysqlclient20 libopts25 libterm-readkey-perl mariadb-client-10.1 mariadb-client-core-10.1 mariadb-common mariadb-server-10.1 mariadb-server-core-10.1 mysql-common sntp socat -Use 'apt autoremove' to remove them. -The following packages will be REMOVED: - apache2 mariadb-server nano -0 upgraded, 0 newly installed, 3 to remove and 24 not upgraded. -After this operation, 1,377 kB disk space will be freed. -(Reading database ... 291046 files and directories currently installed.) -Removing apache2 (2.4.29-1ubuntu4.6) ... -Removing mariadb-server (1:10.1.38-0ubuntu0.18.04.1) ... -Removing nano (2.9.3-2) ... -update-alternatives: using /usr/bin/vim.tiny to provide /usr/bin/editor (editor) in auto mode -Processing triggers for ufw (0.36-0ubuntu0.18.04.1) ... -Processing triggers for install-info (6.5.0.dfsg.1-2) ... -Processing triggers for man-db (2.8.3-2ubuntu0.1) ... -``` - -Use the following **[yum command][3]** to install listed packages from a file on RHEL based systems such as CentOS, RHEL (Redhat) and OEL (Oracle Enterprise Linux). - -``` -# yum -y install $(cat /tmp/pack1.txt) -``` - -Use the following format to uninstall listed packages from a file on RHEL based systems such as CentOS, RHEL (Redhat) and OEL (Oracle Enterprise Linux). - -``` -# yum -y remove $(cat /tmp/pack1.txt) -``` - -Use the following **[dnf command][4]** to install listed packages from a file on Fedora system. - -``` -# dnf -y install $(cat /tmp/pack1.txt) -``` - -Use the following format to uninstall listed packages from a file on Fedora system. - -``` -# dnf -y remove $(cat /tmp/pack1.txt) -``` - -Use the following **[zypper command][5]** to install listed packages from a file on openSUSE system. - -``` -# zypper -y install $(cat /tmp/pack1.txt) -``` - -Use the following format to uninstall listed packages from a file on openSUSE system. - -``` -# zypper -y remove $(cat /tmp/pack1.txt) -``` - -Use the following **[pacman command][6]** to install listed packages from a file on Arch Linux based systems such as Manjaro and Antergos system. - -``` -# pacman -S $(cat /tmp/pack1.txt) -``` - -Use the following format to uninstall listed packages from a file on Arch Linux based systems such as Manjaro and Antergos system. - -``` -# pacman -Rs $(cat /tmp/pack1.txt) -``` - -### Method-2 : How To Install Listed Packages From A File In Linux With Help Of cat And xargs Command? - -Even, i prefer to go with this method because this is very simple and straightforward method. - -Use the following apt command to install listed packages from a file on Debian based systems such as Debian, Ubuntu and Linux Mint. - -``` -# cat /tmp/pack1.txt | xargs apt -y install -``` - -Use the following apt command to uninstall listed packages from a file on Debian based systems such as Debian, Ubuntu and Linux Mint. - -``` -# cat /tmp/pack1.txt | xargs apt -y remove -``` - -Use the following yum command to install listed packages from a file on RHEL based systems such as CentOS, RHEL (Redhat) and OEL (Oracle Enterprise Linux). - -``` -# cat /tmp/pack1.txt | xargs yum -y install -``` - -Use the following format to uninstall listed packages from a file on RHEL based systems such as CentOS, RHEL (Redhat) and OEL (Oracle Enterprise Linux). - -``` -# cat /tmp/pack1.txt | xargs yum -y remove -``` - -Use the following dnf command to install listed packages from a file on Fedora system. - -``` -# cat /tmp/pack1.txt | xargs dnf -y install -``` - -Use the following format to uninstall listed packages from a file on Fedora system. - -``` -# cat /tmp/pack1.txt | xargs dnf -y remove -``` - -Use the following zypper command to install listed packages from a file on openSUSE system. - -``` -# cat /tmp/pack1.txt | xargs zypper -y install -``` - -Use the following format to uninstall listed packages from a file on openSUSE system. - -``` -# cat /tmp/pack1.txt | xargs zypper -y remove -``` - -Use the following pacman command to install listed packages from a file on Arch Linux based systems such as Manjaro and Antergos system. - -``` -# cat /tmp/pack1.txt | xargs pacman -S -``` - -Use the following format to uninstall listed packages from a file on Arch Linux based systems such as Manjaro and Antergos system. - -``` -# cat /tmp/pack1.txt | xargs pacman -Rs -``` - -### Method-3 : How To Install Listed Packages From A File In Linux With Help Of For Loop Command? - -Alternatively we can use the “For Loop” command to achieve this. - -To install bulk packages. Use the below format to run a “For Loop” with single line. - -``` -# for pack in `cat /tmp/pack1.txt` ; do apt -y install $i; done -``` - -To install bulk packages with shell script use the following “For Loop”. - -``` -# vi /opt/scripts/bulk-package-install.sh - -#!/bin/bash -for pack in `cat /tmp/pack1.txt` -do apt -y remove $pack -done -``` - -Set an executable permission to `bulk-package-install.sh` file. - -``` -# chmod + bulk-package-install.sh -``` - -Finally run the script to achieve this. - -``` -# sh bulk-package-install.sh -``` - -### Method-4 : How To Install Listed Packages From A File In Linux With Help Of While Loop Command? - -Alternatively we can use the “While Loop” command to achieve this. - -To install bulk packages. Use the below format to run a “While Loop” with single line. - -``` -# file="/tmp/pack1.txt"; while read -r pack; do apt -y install $pack; done < "$file" -``` - -To install bulk packages with shell script use the following "While Loop". - -``` -# vi /opt/scripts/bulk-package-install.sh - -#!/bin/bash -file="/tmp/pack1.txt" -while read -r pack -do apt -y remove $pack -done < "$file" -``` - -Set an executable permission to `bulk-package-install.sh` file. - -``` -# chmod + bulk-package-install.sh -``` - -Finally run the script to achieve this. - -``` -# sh bulk-package-install.sh -``` - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/how-to-install-uninstall-listed-packages-from-a-file-in-linux/ - -作者:[Magesh Maruthamuthu][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.2daygeek.com/author/magesh/ -[b]: https://github.com/lujun9972 -[1]: https://www.2daygeek.com/check-installed-packages-in-rhel-centos-fedora-debian-ubuntu-opensuse-arch-linux/ -[2]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ -[3]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ -[4]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ -[5]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ -[6]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ From 40fd90619d6ed8c75530f27515f65b827bd178d5 Mon Sep 17 00:00:00 2001 From: way-ww <40491614+way-ww@users.noreply.github.com> Date: Sun, 19 May 2019 09:55:15 +0800 Subject: [PATCH 6/7] Create 20190505 How To Install-Uninstall Listed Packages From A File In Linux.md --- ...ll Listed Packages From A File In Linux.md | 343 ++++++++++++++++++ 1 file changed, 343 insertions(+) create mode 100644 translated/tech/20190505 How To Install-Uninstall Listed Packages From A File In Linux.md diff --git a/translated/tech/20190505 How To Install-Uninstall Listed Packages From A File In Linux.md b/translated/tech/20190505 How To Install-Uninstall Listed Packages From A File In Linux.md new file mode 100644 index 0000000000..b825435dcb --- /dev/null +++ b/translated/tech/20190505 How To Install-Uninstall Listed Packages From A File In Linux.md @@ -0,0 +1,343 @@ +[#]: collector: (lujun9972) +[#]: translator: (way-ww) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Install/Uninstall Listed Packages From A File In Linux?) +[#]: via: (https://www.2daygeek.com/how-to-install-uninstall-listed-packages-from-a-file-in-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +如何在 Linux 上安装/卸载一个文件中列出的软件包? +====== + +在某些情况下,你可能想要将一个服务器上的软件包列表安装到另一个服务器上。 + +例如,你已经在服务器A 上安装了 15 个软件包并且这些软件包也需要被安装到服务器B,服务器C 上等等。 + +我们可以手动去安装这些软件但是这将花费大量的时间。 + +你可以手动安装一俩个服务器,但是试想如果你有大概十个服务器呢。 + +在这种情况下你无法手动完成工作,那么怎样才能解决问题呢? + +不要担心我们可以帮你摆脱这样的情况和场景。 + +我们在这篇文章中增加了四种方法来克服困难。 + +我希望这可以帮你解决问题。我已经在 Centos7 和 Ubuntu 18.04 上测试了这些命令。 + +我也希望这可以在其他发行版上工作。这仅仅需要使用该发行版的官方包管理器命令替代本文中的包管理器命令就行了。 + +如果想要 **[检查 Linux 系统上已安装的软件包列表][1]** 请点击链接。 + +例如,如果你想要在基于 RHEL 系统上创建软件包列表请使用以下步骤。其他发行版也一样。 + +``` +# rpm -qa --last | head -15 | awk '{print $1}' > /tmp/pack1.txt + +# cat /tmp/pack1.txt +mariadb-server-5.5.60-1.el7_5.x86_64 +perl-DBI-1.627-4.el7.x86_64 +perl-DBD-MySQL-4.023-6.el7.x86_64 +perl-PlRPC-0.2020-14.el7.noarch +perl-Net-Daemon-0.48-5.el7.noarch +perl-IO-Compress-2.061-2.el7.noarch +perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 +mariadb-5.5.60-1.el7_5.x86_64 +perl-Data-Dumper-2.145-3.el7.x86_64 +perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 +httpd-2.4.6-88.el7.centos.x86_64 +mailcap-2.1.41-2.el7.noarch +httpd-tools-2.4.6-88.el7.centos.x86_64 +apr-util-1.5.2-6.el7.x86_64 +apr-1.4.8-3.el7_4.1.x86_64 +``` + +### 方法一 : 如何在 Linux 上使用 cat 命令安装文件中列出的包? + +为实现这个目标,我将使用简单明了的第一种方法。 + +为此,创建一个文件并添加上你想要安装的包列表。 + +出于测试的目的,我们将只添加以下的三个软件包名到文件中。 + +``` +# cat /tmp/pack1.txt + +apache2 +mariadb-server +nano +``` + +只要简单的运行 **[apt 命令][2]** 就能在 Ubuntu/Debian 系统上一次性安装所有的软件包。 + +``` +# apt -y install $(cat /tmp/pack1.txt) + +Reading package lists... Done +Building dependency tree +Reading state information... Done +The following packages were automatically installed and are no longer required: + libopts25 sntp +Use 'sudo apt autoremove' to remove them. +Suggested packages: + apache2-doc apache2-suexec-pristine | apache2-suexec-custom spell +The following NEW packages will be installed: + apache2 mariadb-server nano +0 upgraded, 3 newly installed, 0 to remove and 24 not upgraded. +Need to get 339 kB of archives. +After this operation, 1,377 kB of additional disk space will be used. +Get:1 http://in.archive.ubuntu.com/ubuntu bionic-updates/main amd64 apache2 amd64 2.4.29-1ubuntu4.6 [95.1 kB] +Get:2 http://in.archive.ubuntu.com/ubuntu bionic/main amd64 nano amd64 2.9.3-2 [231 kB] +Get:3 http://in.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 mariadb-server all 1:10.1.38-0ubuntu0.18.04.1 [12.9 kB] +Fetched 339 kB in 19s (18.0 kB/s) +Selecting previously unselected package apache2. +(Reading database ... 290926 files and directories currently installed.) +Preparing to unpack .../apache2_2.4.29-1ubuntu4.6_amd64.deb ... +Unpacking apache2 (2.4.29-1ubuntu4.6) ... +Selecting previously unselected package nano. +Preparing to unpack .../nano_2.9.3-2_amd64.deb ... +Unpacking nano (2.9.3-2) ... +Selecting previously unselected package mariadb-server. +Preparing to unpack .../mariadb-server_1%3a10.1.38-0ubuntu0.18.04.1_all.deb ... +Unpacking mariadb-server (1:10.1.38-0ubuntu0.18.04.1) ... +Processing triggers for ufw (0.36-0ubuntu0.18.04.1) ... +Setting up apache2 (2.4.29-1ubuntu4.6) ... +Processing triggers for ureadahead (0.100.0-20) ... +Processing triggers for install-info (6.5.0.dfsg.1-2) ... +Setting up nano (2.9.3-2) ... +update-alternatives: using /bin/nano to provide /usr/bin/editor (editor) in auto mode +update-alternatives: using /bin/nano to provide /usr/bin/pico (pico) in auto mode +Processing triggers for systemd (237-3ubuntu10.20) ... +Processing triggers for man-db (2.8.3-2ubuntu0.1) ... +Setting up mariadb-server (1:10.1.38-0ubuntu0.18.04.1) ... +``` + +至于删除,需要使用相同的命令格式和适当的选项。 + +``` +# apt -y remove $(cat /tmp/pack1.txt) +Reading package lists... Done +Building dependency tree +Reading state information... Done +The following packages were automatically installed and are no longer required: + apache2-bin apache2-data apache2-utils galera-3 libaio1 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libjemalloc1 liblua5.2-0 + libmysqlclient20 libopts25 libterm-readkey-perl mariadb-client-10.1 mariadb-client-core-10.1 mariadb-common mariadb-server-10.1 mariadb-server-core-10.1 mysql-common sntp socat +Use 'apt autoremove' to remove them. +The following packages will be REMOVED: + apache2 mariadb-server nano +0 upgraded, 0 newly installed, 3 to remove and 24 not upgraded. +After this operation, 1,377 kB disk space will be freed. +(Reading database ... 291046 files and directories currently installed.) +Removing apache2 (2.4.29-1ubuntu4.6) ... +Removing mariadb-server (1:10.1.38-0ubuntu0.18.04.1) ... +Removing nano (2.9.3-2) ... +update-alternatives: using /usr/bin/vim.tiny to provide /usr/bin/editor (editor) in auto mode +Processing triggers for ufw (0.36-0ubuntu0.18.04.1) ... +Processing triggers for install-info (6.5.0.dfsg.1-2) ... +Processing triggers for man-db (2.8.3-2ubuntu0.1) ... +``` + +使用 **[yum 命令][3]** 在基于 RHEL (如 Centos,RHEL (Redhat) 和 OEL (Oracle Enterprise Linux)) 的系统上安装文件中列出的软件包。 + + +``` +# yum -y install $(cat /tmp/pack1.txt) +``` + +使用以命令在基于 RHEL (如 Centos,RHEL (Redhat) 和 OEL (Oracle Enterprise Linux)) 的系统上卸载文件中列出的软件包。 + +``` +# yum -y remove $(cat /tmp/pack1.txt) +``` + +使用以下 **[dnf 命令][4]** 在 Fedora 系统上安装文件中列出的软件包。 + +``` +# dnf -y install $(cat /tmp/pack1.txt) +``` + +使用以下命令在 Fedora 系统上卸载文件中列出的软件包。 + +``` +# dnf -y remove $(cat /tmp/pack1.txt) +``` + +使用以下 **[zypper 命令][5]** 在 openSUSE 系统上安装文件中列出的软件包。 + +``` +# zypper -y install $(cat /tmp/pack1.txt) +``` + +使用以下命令从 openSUSE 系统上卸载文件中列出的软件包。 + +``` +# zypper -y remove $(cat /tmp/pack1.txt) +``` + +使用以下 **[pacman 命令][6]** 在基于 Arch Linux (如 Manjaro 和 Antergos) 的系统上安装文件中列出的软件包。 + +``` +# pacman -S $(cat /tmp/pack1.txt) +``` + +使用以下命令从基于 Arch Linux (如 Manjaro 和 Antergos) 的系统中卸载文件中列出的软件包。 + + +``` +# pacman -Rs $(cat /tmp/pack1.txt) +``` + +### 方法二 : 如何使用 cat 和 xargs 命令在 Linux 中安装文件中列出的软件包。 + +甚至,我更喜欢使用这种方法,因为这是一种非常简单直接的方法。 + +使用以下 apt 命令在基于 Debian 的系统 (如 Debian,Ubuntu和Linux Mint) 上安装文件中列出的软件包。 + + +``` +# cat /tmp/pack1.txt | xargs apt -y install +``` + +使用以下 apt 命令 从基于 Debian 的系统 (如 Debian,Ubuntu和Linux Mint) 上卸载文件中列出的软件包。 + +``` +# cat /tmp/pack1.txt | xargs apt -y remove +``` + +使用以下 yum 命令在基于 RHEL (如 Centos,RHEL (Redhat) 和 OEL (Oracle Enterprise Linux)) 的系统上安装文件中列出的软件包。 + +``` +# cat /tmp/pack1.txt | xargs yum -y install +``` + +使用以命令从基于 RHEL (如 Centos,RHEL (Redhat) 和 OEL (Oracle Enterprise Linux)) 的系统上卸载文件中列出的软件包。 + +``` +# cat /tmp/pack1.txt | xargs yum -y remove +``` + +使用以下 dnf 命令在 Fedora 系统上安装文件中列出的软件包。 + +``` +# cat /tmp/pack1.txt | xargs dnf -y install +``` + +使用以下命令从 Fedora 系统上卸载文件中列出的软件包。 + +``` +# cat /tmp/pack1.txt | xargs dnf -y remove +``` + +使用以下 zypper 命令在 openSUSE 系统上安装文件中列出的软件包。 + + +``` +# cat /tmp/pack1.txt | xargs zypper -y install +``` + +使用以下命令从 openSUSE 系统上卸载文件中列出的软件包。 + +``` +# cat /tmp/pack1.txt | xargs zypper -y remove +``` + +使用以下 pacman 命令在基于 Arch Linux (如 Manjaro 和 Antergos) 的系统上安装文件中列出的软件包。 + +``` +# cat /tmp/pack1.txt | xargs pacman -S +``` + +使用下以命令从基于 Arch Linux (如 Manjaro 和 Antergos) 的系统上卸载文件中列出的软件包。 + +``` +# cat /tmp/pack1.txt | xargs pacman -Rs +``` + +### 方法三 : 如何使用 For Loop 在 Linux 上安装文件中列出的软件包? +我们也可以使用 For 循环命令来实现此目的。 + +安装批量包可以使用以下一条 For 循环的命令。 + +``` +# for pack in `cat /tmp/pack1.txt` ; do apt -y install $i; done +``` + +要使用 shell 脚本安装批量包,请使用以下 For 循环。 + + +``` +# vi /opt/scripts/bulk-package-install.sh + +#!/bin/bash +for pack in `cat /tmp/pack1.txt` +do apt -y remove $pack +done +``` + +为 bulk-package-install.sh 设置可执行权限。 + +``` +# chmod + bulk-package-install.sh +``` + +最后运行这个脚本。 + +``` +# sh bulk-package-install.sh +``` + +### 方法四 : 如何使用 While 循环在 Linux 上安装文件中列出的软件包。 + +我们也可以使用 While 循环命令来实现目的。 + +安装批量包可以使用以下一条 While 循环的命令。 + +``` +# file="/tmp/pack1.txt"; while read -r pack; do apt -y install $pack; done < "$file" +``` + +要使用 shell 脚本安装批量包,请使用以下 While 循环。 + +``` +# vi /opt/scripts/bulk-package-install.sh + +#!/bin/bash +file="/tmp/pack1.txt" +while read -r pack +do apt -y remove $pack +done < "$file" +``` + +为 bulk-package-install.sh 设置可执行权限。 + +``` +# chmod + bulk-package-install.sh +``` + +最后运行这个脚本。 + +``` +# sh bulk-package-install.sh +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/how-to-install-uninstall-listed-packages-from-a-file-in-linux/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[way-ww](https://github.com/way-ww) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/check-installed-packages-in-rhel-centos-fedora-debian-ubuntu-opensuse-arch-linux/ +[2]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[3]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[4]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ +[5]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ +[6]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ + From d8628e2e53f513af5442a23e7cd61632a8507d15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=8D=9A?= <1594914459@qq.com> Date: Sun, 19 May 2019 10:08:34 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E7=94=B3=E9=A2=86=E8=AF=91=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/talk/20190131 OOP Before OOP with Simula.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20190131 OOP Before OOP with Simula.md b/sources/talk/20190131 OOP Before OOP with Simula.md index cae9d9bd3a..aca160ad2d 100644 --- a/sources/talk/20190131 OOP Before OOP with Simula.md +++ b/sources/talk/20190131 OOP Before OOP with Simula.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (warmfrog) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( )