mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-25 23:11:02 +08:00
commit
5fdf023091
@ -1,19 +1,18 @@
|
||||
|
||||
如何在Linux/Unix中的Web服务根文档目录(DocumentRoot)上设置只读文件权限
|
||||
如何在 Web 服务器文档根目录上设置只读文件权限
|
||||
======
|
||||
我是如何对存放在/var/www/html/目录中的所有我的文件设置只读权限的?
|
||||
|
||||
**Q:如何对我存放在 `/var/www/html/` 目录中的所有文件设置只读权限?**
|
||||
|
||||
你可以使用 `chmod` 命令对 Linux/Unix/macOS/OS X/*BSD 操作系统上的所有文件来设置只读权限。这篇文章介绍如何在 Linux/Unix 的 web 服务器(如 Nginx、 Lighttpd、 Apache 等)上来设置只读文件权限。
|
||||
|
||||
你可以使用`chmod`命令对Linux / Unix / macOS / Apple OS X / *BSD操作系统上的所有文件来设置只读权限。这篇文章介绍如何在Linux/Unix的web服务器(如 Nginx, Lighttpd, Apache等)上来设置只读文件权限。
|
||||
[![Proper read-only permissions for Linux/Unix Nginx/Apache web server's directory][1]][1]
|
||||
|
||||
### 如何设置文件为只读模式
|
||||
|
||||
|
||||
语法为:
|
||||
|
||||
```
|
||||
### 仅针对文件 ##
|
||||
### 仅针对文件 ###
|
||||
chmod 0444 /var/www/html/*
|
||||
chmod 0444 /var/www/html/*.php
|
||||
```
|
||||
@ -21,54 +20,59 @@ chmod 0444 /var/www/html/*.php
|
||||
### 如何设置目录为只读模式
|
||||
|
||||
语法为:
|
||||
|
||||
```
|
||||
### 仅针对目录##
|
||||
### 仅针对目录 ###
|
||||
chmod 0444 /var/www/html/
|
||||
chmod 0444 /path/to/your/dir/
|
||||
# ***************************************************************************
|
||||
# Say webserver user/group is www-data, and file-owned by ftp-data user/group
|
||||
# 假如webserver用户/用户组是www-data ,文件拥有者是ftp-data用户/用户组
|
||||
# 假如 web 服务器的用户/用户组是 www-data,文件拥有者是 ftp-data 用户/用户组
|
||||
# ***************************************************************************
|
||||
# 设置目录所有文件为只读
|
||||
chmod -R 0444 /var/www/html/
|
||||
#设置文件/目录拥有者为ftp-data
|
||||
# 设置文件/目录拥有者为 ftp-data
|
||||
chown -R ftp-data:ftp-data /var/www/html/
|
||||
# 所有目录和子目录的权限为0445 (这样webserver用户或用户组就可以读取我们的文件)
|
||||
# 所有目录和子目录的权限为 0445 (这样 web 服务器的用户或用户组就可以读取我们的文件)
|
||||
find /var/www/html/ -type d -print0 | xargs -0 -I {} chmod 0445 "{}"
|
||||
```
|
||||
找到所有/var/www/html下的所有文件(包括子目录),键入:
|
||||
|
||||
找到所有 `/var/www/html` 下的所有文件(包括子目录),键入:
|
||||
|
||||
```
|
||||
### 仅对文件有效##
|
||||
### 仅对文件有效 ###
|
||||
find /var/www/html -type f -iname "*" -print0 | xargs -I {} -0 chmod 0444 {}
|
||||
```
|
||||
然而,你需要在/var/www/html目录及其子目录上设置只读和执行权限,如此才能让web server能够访问根目录,键入:
|
||||
|
||||
然而,你需要在 `/var/www/html` 目录及其子目录上设置只读和执行权限,如此才能让 web 服务器能够访问根目录,键入:
|
||||
|
||||
```
|
||||
### 仅对目录有效 ##
|
||||
### 仅对目录有效 ###
|
||||
find /var/www/html -type d -iname "*" -print0 | xargs -I {} -0 chmod 0544 {}
|
||||
```
|
||||
|
||||
### 警惕写权限
|
||||
|
||||
请注意在 `/var/www/html/` 目录上的写权限会允许任何人删除文件或添加新文件。也就是说,你可能需要设置一个只读权限给 `/var/www/html/` 目录本身。
|
||||
|
||||
请注意在/var/www/html/目录上的写权限会允许任何人删除文件或添加新文件。也就是说,你可能需要设置一个只读权限给/var/www/html/目录本身。
|
||||
```
|
||||
### web根目录只读##
|
||||
### web根目录只读 ###
|
||||
chmod 0555 /var/www/html
|
||||
```
|
||||
|
||||
在某些情况下,根据你的设置要求,你可以改变文件的属主和属组来设置严格的权限。
|
||||
|
||||
```
|
||||
### 如果/var/www/html目录的拥有人是普通用户,你可以设置拥有人为: root:root 或 httpd:httpd (推荐) ###
|
||||
### 如果 /var/www/html 目录的拥有人是普通用户,你可以设置拥有人为:root:root 或 httpd:httpd (推荐) ###
|
||||
chown -R root:root /var/www/html/
|
||||
|
||||
### 确保apache拥有/var/www/html/ ##
|
||||
### 确保 apache 拥有 /var/www/html/ ###
|
||||
chown -R apache:apache /var/www/html/
|
||||
```
|
||||
|
||||
### 关于NFS导出目录
|
||||
### 关于 NFS 导出目录
|
||||
|
||||
你可以在 `/etc/exports` 文件中指定哪个目录应该拥有[只读或者读写权限 ][2]。这个文件定义各种各样的共享在 NFS 服务器和他们的权限。如:
|
||||
|
||||
你可以在/etc/exports文件中指定哪个目录应该拥有[只读或者读写权限 ][2] . 这个文件定义各种各样的共享在NFS服务器和他们的权限。如:
|
||||
|
||||
```
|
||||
# 对任何人只读权限
|
||||
@ -78,11 +82,11 @@ chown -R apache:apache /var/www/html/
|
||||
/var/www/html 192.168.1.10(rw,sync)
|
||||
```
|
||||
|
||||
|
||||
### 关于Samba (CIFS)只读共享对MS-Windows客户端
|
||||
### 关于用于 MS-Windows客户端的 Samba(CIFS)只读共享
|
||||
|
||||
|
||||
共享sales为只读,更新smb.conf,如下:
|
||||
要以只读共享 `sales`,更新 `smb.conf`,如下:
|
||||
|
||||
```
|
||||
[sales]
|
||||
comment = Sales Data
|
||||
@ -91,39 +95,47 @@ read only = Yes
|
||||
guest ok = Yes
|
||||
```
|
||||
|
||||
### 关于文件系统表(file systems table)
|
||||
### 关于文件系统表(fstab)
|
||||
|
||||
你可以在 Unix/Linux 上的 `/etc/fstab` 文件中配置挂载某些文件为只读模式。
|
||||
|
||||
你可以在Unix/Linux上的/etc/fstab文件中配置挂载某些文件为只读模式。
|
||||
你需要有专用分区,不要设置其他系统分区为只读模式。
|
||||
|
||||
如下在/etc/fstab文件中设置/srv/html为只读模式。
|
||||
如下在 `/etc/fstab` 文件中设置 `/srv/html` 为只读模式。
|
||||
|
||||
```
|
||||
/dev/sda6 /srv/html ext4 ro 1 1
|
||||
```
|
||||
你可以使用`mount`命令[重新挂载分区为只读模式][3](使用root用户)
|
||||
|
||||
你可以使用 `mount` 命令[重新挂载分区为只读模式][3](使用 root 用户)
|
||||
|
||||
```
|
||||
# mount -o remount,ro /dev/sda6 /srv/html
|
||||
```
|
||||
|
||||
或者
|
||||
|
||||
```
|
||||
# mount -o remount,ro /srv/html
|
||||
```
|
||||
|
||||
上面的命令会尝试重新挂载已挂载的文件系统到 `/srv/html`上。这是改变文件系统挂载标志的常用方法,特别是让只读文件改为可写的。这种方式不会改变设备或者挂载点。让文件变得再次可写,键入:
|
||||
|
||||
上面的命令会尝试重新挂载已挂载的文件系统在/srv/html上。这是改变文件系统挂载标志的常用方法,特别是让只读文件改为可写的。这种方式不会改变设备或者挂载点。让文件变得再次可写,键入:
|
||||
```
|
||||
# mount -o remount,rw /dev/sda6 /srv/html
|
||||
```
|
||||
|
||||
或
|
||||
|
||||
```
|
||||
# mount -o remount,rw /srv/html
|
||||
```
|
||||
|
||||
### Linux: chattr 命令
|
||||
### Linux:chattr 命令
|
||||
|
||||
|
||||
你可以在Linux文件系统上使用`chattr`命令[改变文件属性为只读][4],如:
|
||||
你可以在 Linux 文件系统上使用 `chattr` 命令[改变文件属性为只读][4],如:
|
||||
|
||||
```
|
||||
chattr +i /path/to/file.php
|
||||
chattr +i /var/www/html/
|
||||
@ -132,13 +144,13 @@ chattr +i /var/www/html/
|
||||
find /var/www/html -iname "*" -print0 | xargs -I {} -0 chattr +i {}
|
||||
```
|
||||
|
||||
通过提供 `-i` 选项可删除只读属性:
|
||||
|
||||
通过提供`-i`选项可删除只读属性
|
||||
```
|
||||
chattr -i /path/to/file.php
|
||||
```
|
||||
|
||||
FreeBSD, Mac OS X 和其他BSD Unix用户可使用[`chflags`命令][5]:
|
||||
FreeBSD、Mac OS X 和其他 BSD Unix 用户可使用[`chflags`命令][5]:
|
||||
|
||||
```
|
||||
### 设置只读 ##
|
||||
@ -148,14 +160,13 @@ chflags schg /path/to/file.php
|
||||
chflags noschg /path/to/file.php
|
||||
```
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
来源: https://www.cyberciti.biz/faq/howto-set-readonly-file-permission-in-linux-unix/
|
||||
via: https://www.cyberciti.biz/faq/howto-set-readonly-file-permission-in-linux-unix/
|
||||
|
||||
作者:[Vivek Gite][a]
|
||||
译者:[yizhuoyan](https://github.com/yizhuoyan)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,11 +1,13 @@
|
||||
使用树莓派和 pi-hole 拦截你的网络上的广告
|
||||
在你的网络中使用树莓派和 Pi-hole 拦截广告
|
||||
======
|
||||
|
||||
> 痛恨上网时看到广告?学习这篇教程来设置 Pi-hole。
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/pi-hole-banner.png?itok=1TXcp3hm)
|
||||
|
||||
有一个闲置的树莓派?在浏览网页时讨厌广告?[Pi-hole][1] 是一个拦截广告的开源软件项目,它可以将你的家庭网络上的所有广告路由到一个不存在的地方,从而实现在你的设备上拦截广告的目的。这么好的方法只需要花几钟的时间来设置,你就可以使用它了。
|
||||
|
||||
Pi-hole 拦截了超过 100,000 个提供广告的域名,它可以拦截任何设备(包括移动设备、平板电脑、以及个人电脑)上的广告,并且它是完整的拦截了广告,而不是仅将它们隐藏起来,它这样做可以提升总体的网络性能(因为广告不需要下载)。你可以在一个 web 界面上、或者也可以使用一个 API 来监视性能和统计数据。
|
||||
Pi-hole 拦截了超过 100,000 个提供广告的域名,它可以拦截任何设备(包括移动设备、平板电脑、以及个人电脑)上的广告,并且它是完整的拦截了广告,而不是仅将它们隐藏起来,这样做可以提升总体的网络性能(因为广告不需要下载)。你可以在一个 web 界面上、或者也可以使用一个 API 来监视性能和统计数据。
|
||||
|
||||
### 你需要:
|
||||
|
||||
@ -19,7 +21,7 @@ Pi-hole 拦截了超过 100,000 个提供广告的域名,它可以拦截任何
|
||||
![](https://opensource.com/sites/default/files/u128651/power-supply.png)
|
||||
![](https://opensource.com/sites/default/files/u128651/ethernet-cable.png)
|
||||
|
||||
你不需要使用一个最新型号的树莓派 — 一个老款足够完成这项工作,只要它的内存不小于 512MB 就可以 — 因此一个一代树莓派 Model B(rev 2)就足够,一个 Model B+、或者二代的或者三代的树莓派都可以。你可能需要一个 Pi Zero,也需要一个 USB micro 以太网适配器。你可以使用一个带 WiFi 的 Pi Zero W 而不是以太网。但是,作为你的网络基础设施的一部分,我建议你使用一个性能良好、稳定的有线连接来代替 WiFi 连接。
|
||||
你不需要使用一个最新型号的树莓派 — 一个老款足够完成这项工作,只要它的内存不小于 512MB 就可以 — 因此一个一代树莓派 Model B(rev 2)就足够,一个 Model B+、或者二代的或者三代的树莓派都可以。你可以使用 Pi Zero,但需要一个 USB micro 以太网适配器。你可以使用一个带 WiFi 的 Pi Zero W 而不是以太网。但是,作为你的网络基础设施的一部分,我建议你使用一个性能良好、稳定的有线连接来代替 WiFi 连接。
|
||||
|
||||
### 准备 SD 卡
|
||||
|
||||
@ -33,14 +35,14 @@ Pi-hole 拦截了超过 100,000 个提供广告的域名,它可以拦截任何
|
||||
|
||||
![](https://opensource.com/sites/default/files/etcher-win-520px.png)
|
||||
|
||||
SD 卡准备完成之后,你可以将它插入到你的树莓派,连接上键盘、显示器、和以太网,然后为树莓派接上电源。在初始化设置之后,这个树莓派就不需要键盘或显示器了。如果你有使用”无头“树莓派工作的经验,你可以去 [启用 SSH][4] 然后去设置它 [启用远程连接][5]。
|
||||
SD 卡准备完成之后,你可以将它插入到你的树莓派,连接上键盘、显示器和以太网,然后为树莓派接上电源。在初始化设置之后,这个树莓派就不需要键盘或显示器了。如果你有使用“<ruby>无末端<rt>headless</rt></ruby>”树莓派工作的经验,你可以 [启用 SSH][4] 然后去设置它 [启用远程连接][5]。
|
||||
|
||||
### 安装 Pi-hole
|
||||
|
||||
在你的树莓派引导完成之后,用缺省用户名(`pi`)和密码(`raspberry`)登入。现在你就可以运行命令行了,可以去安装 Pi-hole 了。简单地输入下列命令并回车:
|
||||
|
||||
```
|
||||
curl -sSL https://install.pi-hole.net | bash
|
||||
|
||||
```
|
||||
|
||||
这个命令下载了 Pi-hole 安装脚本然后去运行它。你可以在你的电脑浏览器中输入 `https://install.pi-hole.net` 来查看它的内容,你将会看到这个脚本做了些什么。它为你生成了一个**管理员密码**,并和其它安装信息一起显示在你的屏幕上。
|
||||
@ -59,17 +61,17 @@ curl -sSL https://install.pi-hole.net | bash
|
||||
|
||||
关于这一步的更多信息,可以查看 [Pi-hole discourse][6]。
|
||||
|
||||
你还需要确保你的 Pi-hole 始终保持相同的 IP 地址,因此,你需要去查看 DHCP,将你的树莓派的 IP 地址条目添加到保留地址中。
|
||||
你还需要确保你的 Pi-hole 始终保持相同的 IP 地址,因此,你需要去查看 DHCP 设置,将你的树莓派的 IP 地址条目添加到保留地址中。
|
||||
|
||||
### 外部测试
|
||||
|
||||
现在,在命令行下输入 `sudo halt` 关闭运行的树莓派,并断开它的电源。你可以拔掉显示器连接线和键盘,然后将你的树莓派放置到一个合适的固定的地方 — 或许应该将它放在你的路由器附近。确保连接着以太网线,然后重新连接电源以启动它。
|
||||
|
||||
在你的个人电脑上导航到一个网站(强烈建议访问 [Opensource.com][7] 网站),或者用你的 WiFi 中的一个设备去检查你的因特网访问是否正常(如果不能正常访问,可能是你的 DNS 配置错误)。如果在浏览器中看到了预期的结果,说明它的工作正常。现在,你浏览网站时,应该再也看不到广告了!甚至在你的 apps 中提供的广告也无法出现在你的移动设备中!祝你”冲浪“愉快!
|
||||
在你的个人电脑上导航到一个网站(强烈建议访问 [Opensource.com][7] 网站),或者用你的 WiFi 中的一个设备去检查你的因特网访问是否正常(如果不能正常访问,可能是你的 DNS 配置错误)。如果在浏览器中看到了预期的结果,说明它的工作正常。现在,你浏览网站时,应该再也看不到广告了!甚至在你的 app 中提供的广告也无法出现在你的移动设备中!祝你“冲浪”愉快!
|
||||
|
||||
如果你想去测试一下你的广告拦截的新功能,你可以去这个 [测试页面][8] 尝试浏览一些内置广告的网站。
|
||||
|
||||
现在你可以在你的电脑浏览器上输入 Pi-hole 的 IP 地址来访问它的 web 界面(比如,<http://192.168.1.4/admin> \- 或者 `http://pi.hole/admin` 也可能会工作)。你将看到 Pi-hole 管理面板和一些统计数据(在这时可能数字比较小)。在你输入密码(在安装时显示在屏幕上的)后,你将看到更漂亮的图形界面:
|
||||
现在你可以在你的电脑浏览器上输入 Pi-hole 的 IP 地址来访问它的 web 界面(比如,`http://192.168.1.4/admin` 或者 `http://pi.hole/admin` 也可能会工作)。你将看到 Pi-hole 管理面板和一些统计数据(在这时可能数字比较小)。在你输入(在安装时显示在屏幕上的)密码后,你将看到更漂亮的图形界面:
|
||||
|
||||
![](https://opensource.com/sites/default/files/u128651/pi-hole-web.png)
|
||||
|
||||
@ -87,7 +89,7 @@ via: https://opensource.com/article/18/2/block-ads-raspberry-pi
|
||||
|
||||
作者:[Ben Nuttall][a]
|
||||
译者:[qhwdw](https://github.com/qhwdw)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -0,0 +1,142 @@
|
||||
可以运行在 Windows 10 中的最实用的 Linux 命令
|
||||
======
|
||||
|
||||
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/wsl-commands.png?itok=91oEXdO8)
|
||||
|
||||
在本系列早先的文章中,我们讨论了关于如何在 [Windows 10 上开启 WSL 之旅][1] 的内容。作为本系列的最后一篇文章,我们准备探讨一些能在 Windows 10 上广泛使用的 Linux 命令。
|
||||
|
||||
话题深入之前,请先让我们明确本教程所适用的人群。本文适用于使用 Windows 10 系统,但是又想在 Azure、AWS 或是私有云平台上学习 Linux 的初级开发者。换句话说,就是为了帮助初次接触 Linux 系统的 Windows 10 用户。
|
||||
|
||||
您的工作任务决定了您所需要的命令,而我的需求可能和您的不一样。本文旨在帮助您在 Windwos 10 上舒服的使用 Linux。不过请牢记,WSL 并不提供硬件访问的功能,比如声卡、GPU,至少官方是这么描述的。但是这可能并不能阻止 Linux 用户的折腾精神。很多用户不仅完成了硬件访问,甚至已经在 Windows 10 上安装上了 Linux 桌面程序。但是本文并不会涉及这些内容,我们可能会讨论这些,但不是现在。
|
||||
|
||||
下面是我们需要着手的任务。
|
||||
|
||||
### 如何让您的 Linux 系统保持到最新的版本
|
||||
|
||||
因为 Linux 运行在了 Windows 系统中,所以您将被剥夺 Linux 系统所提供的所有安全特性。另外,如果不及时给 Linux 系统打补丁,你的 Windows 设备将被迫暴露在外界威胁中,所以还请保持您的 Linux 为最新版本。
|
||||
|
||||
WSL 官方支持 openSUSE/SUSE Linux Enterprise 和 Ubuntu。您也可以安装其他发行版,但是我只需要它们当中的二者之一就可以完成我的所有工作,毕竟,我只需要访问一些 Linux 基础程序。
|
||||
|
||||
**更新 openSUSE Leap:**
|
||||
|
||||
```
|
||||
sudo zypper up
|
||||
```
|
||||
|
||||
如果您想升级系统,您可以运行下面的命令:
|
||||
|
||||
```
|
||||
sudo zypper dup
|
||||
```
|
||||
|
||||
**更新 Ubuntu:**
|
||||
|
||||
```
|
||||
sudo apt-get update
|
||||
sudo apt-get dist-upgrade
|
||||
```
|
||||
|
||||
这样你就安全了,由于 Linux 系统的更新是渐进式的,所以更新系统成为了我的日常。不像 Windows 10 的更新通常需要重启系统,而 Linux 不同,一般只有 KB 或是 MB 级的更新,无需重启。
|
||||
|
||||
### 管理文件目录
|
||||
|
||||
系统更新之后,我们来看看一些或普通或不太普通的任务。
|
||||
|
||||
系统更新之外的第二重要的任务是使用 Linux 管理本地和远程文件。我承认我更青睐图形界面程序,但是终端能提供更可靠、更有价值的服务。要不你使用资源管理器移动 1 TB 的文件试试?我通常使用 `rsync` 命令来移动大量文件。如果中断任务,`rsync` 可以在上次停止的位置继续工作。
|
||||
|
||||
虽然您可能更习惯使用 `cp` 或是 `mv` 命令复制、移动文件,但是我还是喜欢灵活的 `rsync` 命令,了解 `rsync` 对远程文件传输也有帮助。使用 `rsync` 大半为了完成下面三个任务:
|
||||
|
||||
**使用 rsync 复制整个目录:**
|
||||
|
||||
```
|
||||
rsync -avzP /source-directory /destination directory
|
||||
```
|
||||
|
||||
**使用 rsync 移动文件:**
|
||||
|
||||
```
|
||||
rsync --remove-source-files -avzP /source-directory /destination-directory
|
||||
```
|
||||
|
||||
在成功复制目标目录之后,此命令将删除源文件。
|
||||
|
||||
**使用 rsync 同步文件:**
|
||||
|
||||
我的文件可能在多处存储。但是,我只会在主要位置中增加或是删除。如果不使用专业的软件,同步文件可能会给用户带来挑战,而 `rsync` 刚好可以简化这个过程。这个命令可以让两个目录文件内容同步。不过要注意,这是一个单向同步,即从源位置同步到目标位置。
|
||||
|
||||
```
|
||||
rsync --delete -avzP /source-directory /destination-directory
|
||||
```
|
||||
|
||||
如果源目录中没有找到文件,上述命令将删除目标目录中的文件。换言之,它创建了源目录的一个镜像。
|
||||
|
||||
### 文件自动备份
|
||||
|
||||
保持文件备份是一项乏味的工作。为了保持我的设备的完全同步,我运行了一个 cron 作业在夜间保持我的所有目录同步。不过我会留一个外部驱动器,基本上每周我都会手动同步一次。由于可能删掉我不想删除的文件,所以我并没有使用 `--delete` 选项。我会根据情况手动决定是否使用这个选项。
|
||||
|
||||
**创建 cron 作业,打开 crontab:**
|
||||
|
||||
```
|
||||
crontab -e
|
||||
```
|
||||
|
||||
移动大文件时,我会选择在系统空闲的深夜执行该命令。此命令将在每天早上 1 点运行,您大概可以这样修改它:
|
||||
|
||||
```
|
||||
# 0 1 * * * rsync -avzP /source-directory /destination-directory
|
||||
```
|
||||
|
||||
这是使用 crontab 的定时作业的命令结构:
|
||||
|
||||
```
|
||||
# m h dom mon dow command
|
||||
```
|
||||
|
||||
在此,`m` = 分钟,`h` = 小时,`dom` = 本月的某天,`mon` = 月,`dow` = 本周的某天。
|
||||
|
||||
我们将在每天早上 1 点运行这条命令。您可以选择 `dow` 或是 `dom`(比如,每月 5 号)等。您可以在 [这里][2] 阅读更多相关内容。
|
||||
|
||||
### 管理远程服务器
|
||||
|
||||
在 Windows 系统上使用 WSL 的优势之一就是能方便管理云上的 Linux 服务器,WSL 能提供原生的 Linux 工具给您。首先,您需要使用 `ssh` 命令登录远程 Linux 服务器。
|
||||
|
||||
比如,我的服务器 ip 是 192.168.0.112;端口为 2018(不是默认的 22 端口);Linux 用户名是 swapnil,密码是 “就不告诉你”。
|
||||
|
||||
```
|
||||
ssh -p2018 swapnil@192.168.0.112
|
||||
```
|
||||
|
||||
它会向您询问用户密码,然后您就可以登录到 Linux 服务器了。现在您可以在 Linux 服务器上执行任意您想执行的所有操作了。不需使用 PuTTY 程序了。
|
||||
|
||||
使用 `rsync` ,您可以很轻易的在本地机器和远程机器之间传输文件。源目录还是目标目录取决于您是上传文件到服务器,还是下载文件到本地目录,您可以使用 `username@IP-address-of-server:/path-of-directory` 来指定目录。
|
||||
|
||||
如果我想复制一些文本内容到服务器的 home 目录,命令如下:
|
||||
|
||||
```
|
||||
rsync -avzP /source-directory-on-local-machine ‘ssh -p2018’ swapnil@192.168.0.112:/home/swapnil/Documents/
|
||||
```
|
||||
|
||||
这将会复制这些文件到远程服务器中 `Documents` 目录。
|
||||
|
||||
### 总结
|
||||
|
||||
本教程主要是为了证明您可以在 Windows 10 系统上通过 WSL 完成 Linux 方面的很大一部分的任务。通常来说,它提高了生产效率。现在,Linux 的世界已经向 Windwos 10 系统张开怀抱了,尽情探索吧。如果您有任何疑问,或是想了解 WSL 涉及到的其他层面,欢迎在下方的评论区分享您的想法。
|
||||
|
||||
在 [Administering Linux on Azure (LFS205)][4] 课程中了解更多,可以在 [这里][5] 注册。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linux.com/blog/learn/2018/3/most-useful-linux-commands-you-can-run-windows-10
|
||||
|
||||
作者:[SAPNIL BHARTIYA][a]
|
||||
译者:[CYLeft](https://github.com/CYLeft)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.linux.com/users/arnieswap
|
||||
[1]:https://www.linux.com/blog/learn/2018/2/how-get-started-using-wsl-windows-10
|
||||
[2]:http://www.adminschoice.com/crontab-quick-reference
|
||||
[3]:mailto:username@IP
|
||||
[4]:https://training.linuxfoundation.org/linux-courses/system-administration-training/administering-linux-on-azure
|
||||
[5]:http://bit.ly/2FpFtPg
|
56
sources/talk/20180323 7 steps to DevOps hiring success.md
Normal file
56
sources/talk/20180323 7 steps to DevOps hiring success.md
Normal file
@ -0,0 +1,56 @@
|
||||
7 steps to DevOps hiring success
|
||||
======
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/desk_clock_job_work.jpg?itok=Nj4fuhl6)
|
||||
As many of us in the DevOps scene know, most companies are hiring, or, at least, trying to do so. The required skills and job descriptions can change entirely from company to company. As a broad overview, most teams are looking for a candidate from either an operations and infrastructure background or someone from a software engineering and development background, then combined with key skills relating to continuous integration, configuration management, continuous delivery/deployment, and cloud infrastructure. Currently in high-demand is knowledge of container orchestration.
|
||||
|
||||
In the ideal world, the two backgrounds will meet somewhere in the middle to form Dev and Ops, but in most cases, there is a lean toward one side or the other while maintaining sufficient skills to understand the needs and demands of their counterparts to work collaboratively and achieve the end goal of continuous delivery/deployment. Every company is different and there isn’t necessarily a right or wrong here. It all depends on your infrastructure, tech stack, other team members’ skills, and the individual goals you hope to achieve by hiring this individual.
|
||||
|
||||
### Focus your hiring
|
||||
|
||||
Now, given the various routes to becoming a DevOps practitioner, how do hiring managers focus their search and selection process to ensure that they’re hitting the mark?
|
||||
|
||||
#### Decide on the background
|
||||
|
||||
Assess the strengths of your existing team. Do you already have some amazing software engineers but you’re lacking the infrastructure knowledge? Aim to close these gaps in skills. You may have been given the budget to hire for DevOps, but you don’t have to spend weeks/months searching for the best software engineer who happens to use Docker and Kubernetes because they are the current hot trends in this space. Find the person who will provide the most value in your environment and go from there.
|
||||
|
||||
#### Contractor or permanent employee?
|
||||
|
||||
Many hiring managers will automatically start searching for a full-time permanent employee when their needs may suggest that they have other options. Sometimes a contractor is your best bet or maybe contract-hire. If you’re aiming to design, implement and build a new DevOps environment, why not find a senior person who has done this a number of times already? Try hiring a senior contractor and bring on a junior full-time hire in parallel; this way, you’ll be able to retain the external contractor knowledge by having them work alongside the junior hire. Contractors can be expensive, but the knowledge they bring can be invaluable, especially if the work can be completed over a shorter time frame. Again, this is just another point of view and you might be best off with a full-time hire to grow the team.
|
||||
|
||||
#### CTRL F is not the solution
|
||||
|
||||
Focus on their understanding of DevOps and CI/CD-related processes over specific tools. I believe the best approach is to focus on finding someone who understands the methodologies over the tools. Does your candidate understand the concept of continuous integration or the concept of continuous delivery? That’s more important than asking whether your candidate uses Jenkins versus Bamboo versus TeamCity and so on. Try not to get caught up in the exact tool chain. The focus should be on the candidates’ ability to solve problems. Are they obsessed with increasing efficiency, saving time, automating manual processes and constantly searching for flaws in the system? They might be the person you were looking for, but you missed them because you didn’t see the word "Puppet" on the resume.
|
||||
|
||||
#### Work closely with your internal talent acquisition team and/or an external recruiter
|
||||
|
||||
Be clear and precise with what you’re looking for and have an ongoing, open communication with recruiters. They can and will help you if used effectively. The job of these recruiters is to save you time by sourcing candidates while you’re focusing on your day-to-day role. Work closely with them and deliver in the same way that you would expect them to deliver for you. If you say you will review a candidate by X time, do it. If they say they’ll have a candidate in your inbox by Y time, make sure they do it, too. Start by setting up an initial call to talk through your requirement, lay out a timeline in which you expect candidates by a specific time, and explain your process in terms of when you will interview, how many interview rounds, and how soon after you will be able to make a final decision on whether to offer or reject the candidates. If you can get this relationship working well, you’ll save lots of time. And make sure your internal teams are focused on supporting your process, not blocking it.
|
||||
|
||||
#### $$$
|
||||
|
||||
Decide how much you want to pay. It’s not all about the money, but you can waste a lot of your and other people’s time if you don’t lock down the ballpark salary or hourly rate that you can afford. If your budget doesn’t stretch as far as your competitors’, you need to consider what else can help sell the opportunity. Flexible working hours and remote working options are some great ways to do this. Most companies have snacks, beer, and cool offices nowadays, so focus on the real value such as the innovative work your team is doing and how awesome your game-changing product might be.
|
||||
|
||||
#### Drop the ego
|
||||
|
||||
You may have an amazing company and/or product, but you also have some hot competition. Everyone is hiring in this space and candidates have a lot of the buying power. It is no longer as simple as saying, "We are hiring" and the awesome candidates come flowing in. You need to sell your opportunities. Maintaining a reputation as a great place to work is also important. A poor hiring process, such as interviewing without giving feedback, can contribute to bad rumors being spread across the industry. It only takes a few minutes to leave a sour review on Glassdoor.
|
||||
|
||||
#### A smooth process is a successful One
|
||||
|
||||
"Let’s get every single person within the company to do a one-hour interview with the new DevOps person we are hiring!" No, let’s not do that. Two or three stages should be sufficient. You have managers and directors for a reason. Trust your instinct and use your experience to make decisions on who will fit into your organization. Some of the most successful companies can do one phone screen followed by an in-person meeting. During the in-person interview, spend a morning or afternoon allowing the candidate to meet the relevant leaders and senior members of their direct team, then take them for lunch, dinner, or drinks where you can see how they are on a social level. If you can’t have a simple conversation with them, then you probably won’t enjoy working with them. If the thumbs are up, make the hire and don’t wait around. A good candidate will usually have numerous offers on the table at the same time.
|
||||
|
||||
If all goes well, you should be inviting your shiny new employee or contractor into the office in the next few weeks and hopefully many more throughout the year.
|
||||
|
||||
This article was originally published on [DevOps.com][1] and republished with author permission.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/3/7-steps-devops-hiring-success
|
||||
|
||||
作者:[Conor Delanbanque][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://opensource.com/users/cdelanbanque
|
||||
[1]:https://devops.com/7-steps-devops-hiring-success/
|
@ -0,0 +1,83 @@
|
||||
pinewall Translating
|
||||
How to tell when moving to blockchain is a bad idea
|
||||
======
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/blocks_building.png?itok=eMOT-ire)
|
||||
So, there's this thing called "blockchain" that is quite popular…
|
||||
|
||||
You know that already, of course. I keep wondering whether we've hit "peak hype" for blockchain and related technologies yet, but so far there's no sign of it. When I'm talking about blockchain here, I'm including distributed ledger technologies (DLTs), which are, by some tight definitions of the term, not really blockchains at all. I'm particularly interested, from a professional point of view, in permissioned blockchains. You can read more about how that's defined in my article [Is blockchain a security topic?][1] The key point here is that I'm interested in business applications of blockchain beyond cryptocurrency.1
|
||||
|
||||
And, if the hype is to be believed—and some of it probably should be2—then there is an almost infinite set of applications for blockchain. That's probably correct, but it doesn't mean all of them are good applications for blockchain. Some, in fact, are likely to be very bad applications for blockchain.
|
||||
|
||||
The hype associated with blockchain, however, means that businesses are rushing to embrace this new technology3 without really understanding what they're doing. The drivers towards this are arguably three-fold:
|
||||
|
||||
1. You can, if you try, make almost any application with multiple users that stores data into a blockchain-enabled application.
|
||||
2. There are lots of conferences and "gurus" telling people that if they don't embrace blockchain now, they'll go out of business within six months4.
|
||||
3. It's not easy technology to understand fully, and lots of its proponents "on-the-ground" in organisations are techies.
|
||||
|
||||
|
||||
|
||||
I want to unpack that last statement before I get a hail of trolls flaming me.5 I have nothing against techies—I'm one myself—but one of our characteristics tends to be enormous enthusiasm about new things ("shinies") that we understand, but whose impact on the business we don't always fully grok.6 That's not always a positive for business leaders.
|
||||
|
||||
The danger, then, is that the confluence of those three drivers may lead to businesses moving to blockchain applications without fully understanding whether it's a good idea. I wrote in another post ([Blockchain: should we all play?][2]) about some tests to decide when a process is a good fit for blockchain and when it's not. They were useful, but the more I think about it, the more I'm convinced that we need some simple tests to tell us when we should definitely not move a process or an application to a blockchain. I present my three tests. If your answer to any of these questions is "yes," then you almost certainly don't need a blockchain.
|
||||
|
||||
### Test 1: Does it have a centralised controller or authority?
|
||||
|
||||
If the answer is "yes," then you don't need a blockchain.
|
||||
|
||||
If, for instance, you're selling, I don't know, futons, and you have a single ordering system, then you have a single authority for deciding when to send out a futon. You almost certainly don't need to make this a blockchain. If you are a purveyor of content that has to pass through a single editorial and publishing process, you almost certainly don't need to make this a blockchain.
|
||||
|
||||
The lesson is: Blockchains really don't make sense unless the tasks required in the process execution—and the trust associated with those tasks—is distributed among multiple entities.
|
||||
|
||||
### Test 2: Could it work fine with a standard database?
|
||||
|
||||
If the answer to this question is "yes," then you don't need a blockchain.
|
||||
|
||||
This and the previous question are somewhat intertwined but don't need to be. There are applications where you have distributed processes but need to store information centrally, or you have centralised authorities but distributed data, where one answer may be "yes" and the other is "no." But if your answer to this question is "yes," use a standard database.
|
||||
|
||||
Databases are good at what they do, they are cheaper in terms of design and operations than running a blockchain or distributed ledger, and we know how to make them work. Blockchains are about letting everybody8 see and hold data, but the overheads can be high and the implications costly.
|
||||
|
||||
### Test 3: Is adoption going to be costly or annoying to some stakeholders?
|
||||
|
||||
If the answer to this question is "yes," then you don't need a blockchain.
|
||||
|
||||
I've heard assertions that blockchains always benefit all users. This is patently false. If you are creating an application for a process and changing the way your stakeholders interact with you and it, you need to consider whether that change is in their best interests. It's very easy to create and introduce an application, blockchain or not, that reduces business friction for the owner of the process but increases it for other stakeholders.
|
||||
|
||||
If I make engine parts for the automotive industry, it may benefit me immensely to be able to track and manage the parts on a blockchain. I may be able to see at a glance who supplied what, when, and the quality of the steel used in the (for example) ball bearings I buy. On the other hand, if I'm a ball-bearing producer with an established process that works for the 40 other companies to whom I sell ball bearings, adopting a new process for one company—with associated changes to my method of work, systems, storage, and security requirements—is unlikely to be in my best interests. It's going to be both costly and annoying.
|
||||
|
||||
### In summary
|
||||
|
||||
Tests are guidelines; they're not fixed in stone. One of these tests looks like a technical test (the database one), but it's really as much about business roles and responsibilities as the other two. All of them, hopefully, can be used as a counterbalance to the three drivers of blockchain adoption I mentioned.
|
||||
|
||||
1\. Which, don't get me wrong, is definitely interesting and a business application—it's just not what I'm going to talk about in this post.
|
||||
|
||||
2\. The trick is knowing which bits. Let me know if you work out how, OK?
|
||||
|
||||
3\. It's actually quite a large set of technologies, to be honest.
|
||||
|
||||
4\. Which is patently untrue, unless the word "they" refers to the conferences and gurus, in which case it's probably correct.
|
||||
|
||||
5\. Which may happen anyway due to my egregious mixing of metaphors.
|
||||
|
||||
6\. There's a word to love. I've put it in to exhibit my techie credentials.7
|
||||
|
||||
7\. And before you doubt them, yes, I've read the book, in both cut and uncut versions.
|
||||
|
||||
8\. Within reason.
|
||||
|
||||
This article originally appeared on [Alice, Eve, and Bob – a security blog][3] and is republished with permission.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/3/3-tests-not-moving-blockchain
|
||||
|
||||
作者:[Mike Bursell][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://opensource.com/users/mikecamel
|
||||
[1]:https://opensource.com/article/17/12/blockchain-security-topic
|
||||
[2]:https://aliceevebob.com/2017/09/12/blockchain-should-we-all-play/
|
||||
[3]:https://aliceevebob.com/2018/02/13/3-tests-for-not-moving-to-blockchain/
|
78
sources/talk/20180323 Top Linux tools for writers.md
Normal file
78
sources/talk/20180323 Top Linux tools for writers.md
Normal file
@ -0,0 +1,78 @@
|
||||
Top Linux tools for writers
|
||||
======
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDUCATION_pencils.png?itok=U2FwL2LA)
|
||||
If you've read [my article about how I switched to Linux][1], then you know that I’m a superuser. I also stated that I’m not an “expert” on anything. That’s still fair to say. But I have learned many helpful things over the last several years, and I'd like to pass these tips along to other new Linux users.
|
||||
|
||||
Today, I’m going to discuss the tools I use when I write. I based my choices on three criteria:
|
||||
|
||||
1. My main writing tool must be compatible for any publisher when I submit stories or articles.
|
||||
2. The software must be quick and simple to use.
|
||||
3. Free is good.
|
||||
|
||||
|
||||
|
||||
There are some wonderful all-in-one free solutions, such as:
|
||||
|
||||
However, I tend to get lost and lose my train of thought when I'm trying to find information, so I opted to go with multiple applications that suit my needs. Also, I don’t want to be reliant on the internet in case service goes down. I set these programs up on my monitor so I can see them all at once.
|
||||
|
||||
Consider the following tools suggestions—everyone works differently, and you might find some other app that better fits the way you work. These tools are current to this writing:
|
||||
|
||||
### Word processor
|
||||
|
||||
[LibreOffice 6.0.1][2]. Until recently, I used [WPS][3], but font-rendering problems (Times New Roman was always in bold format) nixed it. The newest version of LibreOffice adapts to Microsoft Office very nicely, and the fact that it's open source ticks the box for me.
|
||||
|
||||
### Thesaurus
|
||||
|
||||
[Artha][4] gives you synonyms, antonyms, derivatives, and more. It’s clean-looking and fast. Type the word "fast," for example, and you'll get the dictionary definition as well as the other options listed above. Artha is a huge gift to the open source community, and more people should try it as it seems to be one of those obscure little programs. If you’re using Linux, install this application now. You won’t regret it.
|
||||
|
||||
### Note-taking
|
||||
|
||||
[Zim][5] touts itself as a desktop wiki, but it’s also the easiest multi-level note-taking app you’ll find anywhere. There are other, prettier note-taking programs available, but Zim is exactly what I need to manage my characters, locations, plots, and sub-plots.
|
||||
|
||||
### Submission tracking
|
||||
|
||||
I once used a proprietary piece of software called [FileMaker Pro][6], and it spoiled me. There are plenty of database applications out there, but in my opinion the easiest one to use is [Glom][7]. It suits my needs graphically, letting me enter information in a form rather than a table. In Glom, you create the form you need so you can see relevant information instantly (for me, digging through a spreadsheet table to find information is like dragging my eyeballs over shards of glass). Although Glom no longer appears to be in development, it remains relevant.
|
||||
|
||||
### Research
|
||||
|
||||
I’ve begun using [StartPage.com][8] as my default search engine. Sure, [Google][9] can be one of your best friends when you're writing. But I don't like how Google tracks me every time I want to learn about a specific person/place/thing. So I use StartPage.com instead; it's fast and does not track your searches. I also use [DuckDuckGo.com][10] as an alternative to Google.
|
||||
|
||||
### Other tools
|
||||
|
||||
[Chromium Browser][11] is an open source version of [Google Chrome][12], with privacy plugins.
|
||||
|
||||
Though [Thunderbird][13], from [Mozilla][14], is a great program, I find [Geary][15] a much quicker and lighter email app. For more on open source email apps, read [Jason Baker][16]'s excellent article, [Top 6 open source desktop email clients][17].
|
||||
|
||||
As you might have noticed, my taste in apps tends to merge the best of Windows, MacOS, and the open source Linux alternatives mentioned here. I hope these suggestions help you discover helpful new ways to compose (thank you, Artha!) and track your written works.
|
||||
|
||||
Happy writing!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/3/top-Linux-tools-for-writers
|
||||
|
||||
作者:[Adam Worth][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://opensource.com/users/adamworth
|
||||
[1]:https://opensource.com/article/18/2/my-linux-story-Antergos
|
||||
[2]:https://www.libreoffice.org/
|
||||
[3]:http://wps-community.org/
|
||||
[4]:https://sourceforge.net/projects/artha/
|
||||
[5]:http://zim-wiki.org/
|
||||
[6]:http://www.filemaker.com/
|
||||
[7]:https://www.glom.org/
|
||||
[8]:https://www.startpage.com/
|
||||
[9]:https://www.google.com/
|
||||
[10]:https://duckduckgo.com/
|
||||
[11]:https://www.chromium.org/
|
||||
[12]:https://www.google.com/chrome/
|
||||
[13]:https://www.mozilla.org/en-US/thunderbird/
|
||||
[14]:https://www.mozilla.org/en-US/
|
||||
[15]:https://wiki.gnome.org/Apps/Geary
|
||||
[16]:https://opensource.com/users/jason-baker
|
||||
[17]:https://opensource.com/business/18/1/desktop-email-clients
|
@ -1,3 +1,5 @@
|
||||
translating---geekpi
|
||||
|
||||
Caffeinated 6.828: Exercise: Shell
|
||||
======
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
Translating by MjSeven
|
||||
|
||||
10 Free Linux Productivity Apps You Haven’t Heard Of
|
||||
======
|
||||
|
||||
|
@ -1,80 +0,0 @@
|
||||
translating---geekpi
|
||||
|
||||
Quick Look at the Arch Based Indie Linux Distribution: MagpieOS
|
||||
======
|
||||
Most of the Linux distros that are in use today are either created and developed in the US or Europe. A young developer from Bangladesh wants to change all that.
|
||||
|
||||
### Who is Rizwan?
|
||||
|
||||
[Rizwan][1] is a computer science student from Bangladesh. He is currently studying to become a profession Python programmer. He started using Linux back in 2015. Working with Linux inspired him to create this own Linux distribution. He also wants to let the rest of the world know that Bangladesh is upgrading to Linux.
|
||||
|
||||
He has also worked on creating a [live version of Linux From Scratch][2].
|
||||
|
||||
## ![MagpieOS Linux][3]
|
||||
|
||||
### What is MagpieOS?
|
||||
|
||||
Rizwan's new distro is named MagpieOS. [MagpieOS][4] is very simple. It is basically Arch with the GNOME3 desktop environment. MagpieOS also includes a custom repo with icons and themes (claimed to be) not available on other Arch-based distros or AUR.
|
||||
|
||||
Here is a list of the software included with MagpieOS: Firefox, LibreOffice, Uget, Bleachbit, Notepadqq, SUSE Studio Image Writer, Pamac Package Manager, Gparted, Gimp, Rhythmbox, Simple Screen Recorder, all default GNOME software including Totem Video Player, and a new set of custom wallpaper.
|
||||
|
||||
Currently, MagpieOS only supported the GNOME desktop environment. Rizwan picked it because it is his favorite. However, he plans to add more desktop environments in the future.
|
||||
|
||||
Unfortunately, MagpieOS does not support the Bangla language or any other local languages. It supports GNOME's default language like English, Hindi etc.
|
||||
|
||||
Rizwan named his distro MagpieOS because the [magpie][5] is the official bird of Bangladesh.
|
||||
|
||||
## ![MagpieOS Linux][6]
|
||||
|
||||
### Why Arch?
|
||||
|
||||
Like most people, Rizwan started his Linux journey by using [Ubuntu][7]. In the beginning, he was happy with it. However, sometimes the software he wanted to install was not available in the repos and he had to hunt through Google looking for the correct PPA. He decided to switch to [Arch][8] because Arch has many packages that were not available on Ubuntu. Rizwan also liked the fact that Arch is a rolling release and would always be up-to-date.
|
||||
|
||||
The problem with Arch is that it is complicated and time-consuming to install. So, Rizwan tried out several Arch-based distros and was not happy with any of them. He didn't like [Manjaro][9] because they did not have permission to use Arch's repos. Also, Arch repo mirrors are faster than Manjaro's and have more software. He liked [Antergos][10], but to install you need a constant internet connection. If your connection fails during installation, you have to start over.
|
||||
|
||||
Because of these issues, Rizwan decided to create a simple distro that would give him and others an Arch install without all the hassle. He also hopes to get developers from his home country to switch from Ubuntu to Arch by using his distro.
|
||||
|
||||
### How to Help Rizwan with MagpieOS
|
||||
|
||||
If you are interested in helping Rizwan develop MagpieOS, you can contact him via the [MagpieOS website][4]. You can also check out the project's [GitHub page][11]. Rizwan said that he is not looking for financial support at the moment.
|
||||
|
||||
## ![MagpieOS Linux][12]
|
||||
|
||||
### Final Thoughts
|
||||
|
||||
I installed MagpieOS to give it a quick once-over. It uses the [Calamares installer][13], which means installing it was relatively quick and painless. After I rebooted, I was greeted by an audio message welcoming me to MagpieOS.
|
||||
|
||||
To be honest, it was the first time I have heard a post-install greeting. (Windows 10 might have one, but I'm not sure.) There was also a Mac OS-esque application dock at the bottom of the screen. Other than that, it felt like any other GNOME 3 desktop I have used.
|
||||
|
||||
Considering that it's an indie project at the nascent stage, I won't recommend it using as your main OS. But if you are a distrohopper, you can surely give it a try.
|
||||
|
||||
That being said, this is a good first try for a student seeking to put his country on the technological map. All the best, Rizwan.
|
||||
|
||||
Have you already heard of MagpieOS? What is your favorite region or locally made Linux distro? Please let us know in the comments below.
|
||||
|
||||
If you found this article interesting, please take a minute to share it on social media.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/magpieos/
|
||||
|
||||
作者:[John Paul][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/john/
|
||||
[1]:https://twitter.com/Linux_Saikat
|
||||
[2]:https://itsfoss.com/linux-from-scratch-live-cd/
|
||||
[3]:https://itsfoss.com/wp-content/uploads/2018/01/magpieos1.jpg
|
||||
[4]:http://www.magpieos.net
|
||||
[5]:https://en.wikipedia.org/wiki/Magpie
|
||||
[6]:https://itsfoss.com/wp-content/uploads/2018/01/magpieos2.jpg
|
||||
[7]:https://www.ubuntu.com
|
||||
[8]:https://www.archlinux.org
|
||||
[9]:http://manjaro.org
|
||||
[10]:https://antergos.com
|
||||
[11]:https://github.com/Rizwan-Hasan/MagpieOS
|
||||
[12]:https://itsfoss.com/wp-content/uploads/2018/01/magpieos3.png
|
||||
[13]:https://calamares.io
|
@ -1,3 +1,5 @@
|
||||
hankchow translating
|
||||
|
||||
Build a bikesharing app with Redis and Python
|
||||
======
|
||||
|
||||
|
@ -0,0 +1,176 @@
|
||||
How To Find If A CPU Supports Virtualization Technology (VT)
|
||||
======
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2018/03/Virtualization-Technology-720x340.png)
|
||||
We already knew how to [**check if your Linux OS is 32 bit or 64 bit**][1] and how to [**find if your Linux system is physical or virtual machine**][2]. Today, we are going to learn yet another useful topic – how to find if a CPU supports virtualization technology (VT) or not? This should be first thing you might want to verify before installing virtualization applications such as VirtualBox or VMWare workstation to run virtual machines on your Linux system. Now let us go and find out if your computer supports VT or not. Trust me, it is really easy!
|
||||
|
||||
### Find If A CPU Supports Virtualization Technology (VT)
|
||||
|
||||
We can check if the CPU supports VT in several methods. Here I present you four methods.
|
||||
|
||||
#### Method 1: Using “egrep” command
|
||||
|
||||
**Egrep** is one of the variant of [**Grep**][3] command which is used to search text files with regular expressions. For the purpose of this guide, we are going to grep **/cpu/procinfo/** file to find out if the CPU supports VT or not.
|
||||
|
||||
To find out if your CPU supports VT using egrep command, run:
|
||||
```
|
||||
$ egrep "(svm|vmx)" /proc/cpuinfo
|
||||
|
||||
```
|
||||
|
||||
**Sample output:**
|
||||
|
||||
You will get either **“vmx”** (Intel-VT technology) or **“svm”** (AMD-V support) in the output.
|
||||
```
|
||||
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer xsave avx lahf_lm epb pti tpr_shadow vnmi flexpriority ept vpid xsaveopt dtherm arat pln pts
|
||||
[...]
|
||||
|
||||
```
|
||||
|
||||
Since the output is very long, you may find it hard to find the words “vmx” or “svm” in the output. No worries! You can distinguish those terms with colors like below.
|
||||
```
|
||||
$ egrep --color -i "svm|vmx" /proc/cpuinfo
|
||||
|
||||
```
|
||||
|
||||
![][5]
|
||||
|
||||
If you don’t get any output, it means that your system doesn’t support virtualization.
|
||||
|
||||
Please note that these CPU flags (vmx or svm) in the cpuinfo means that your system will support VT. In some CPU models, the VT support might be disabled in the BIOS, by default. In such cases, you should check your BIOS settings to enable VT support.
|
||||
|
||||
For more details about grep/egrep command, refer the man pages.
|
||||
```
|
||||
$ man grep
|
||||
|
||||
```
|
||||
|
||||
#### Method 2 – Using “lscpu” command
|
||||
|
||||
The “lscpu” command is used to display the information about your CPU architecture. It gathers information from sysfs, /proc/cpuinfo file and displays the number of CPUs, threads, cores, sockets, and Non-Uniform Memory Access (NUMA) nodes of your host system.
|
||||
|
||||
To find out if the VT support is enabled or not, simply run:
|
||||
```
|
||||
$ lscpu
|
||||
|
||||
```
|
||||
|
||||
![][6]
|
||||
|
||||
For more details, check the man pages.
|
||||
```
|
||||
$ man lscpu
|
||||
|
||||
```
|
||||
|
||||
#### Method 3 – Using “Cpu-checker” utility
|
||||
|
||||
**Cpu-checker** is yet another useful utility to test your CPU for virtualization support. As far as I searched on the web, this utility is available for only Ubuntu-based systems. To install it, run:
|
||||
```
|
||||
$ sudo apt-get install cpu-checker
|
||||
|
||||
```
|
||||
|
||||
Once cpu-checker package is installed, run the following command to check whether VT support is enable or not:
|
||||
```
|
||||
$ sudo kvm-ok
|
||||
|
||||
```
|
||||
|
||||
If your CPU supports VT, you will get the following output:
|
||||
```
|
||||
INFO: /dev/kvm exists
|
||||
KVM acceleration can be used
|
||||
|
||||
```
|
||||
|
||||
If your CPU doesn’t support VT, you will see an output something like below.
|
||||
```
|
||||
INFO: Your CPU does not support KVM extensions
|
||||
KVM acceleration can NOT be used
|
||||
|
||||
```
|
||||
|
||||
#### Method 4 – Using “virt-host-validate ” tool
|
||||
|
||||
This tool is specifically for RHEL based distros like CentOS and Scientific Linux. The **libvirt-client** package provides **virt-host-validate** binary. So you need to install “libvert-client” package to use this tool.
|
||||
```
|
||||
$ sudo yum install libvirt-client
|
||||
|
||||
```
|
||||
|
||||
Now, run “virt-host-validate” command to find if VT is enabled or not in your RHEL-based systems.
|
||||
```
|
||||
$ sudo virt-host-validate
|
||||
|
||||
```
|
||||
|
||||
If you get **pass** for all results, your system supports VT.
|
||||
```
|
||||
QEMU: Checking for hardware virtualization : PASS
|
||||
QEMU: Checking if device /dev/vhost-net exists : PASS
|
||||
QEMU: Checking if device /dev/net/tun exists : PASS
|
||||
QEMU: Checking for cgroup 'memory' controller support : PASS
|
||||
QEMU: Checking for cgroup 'memory' controller mount-point : PASS
|
||||
QEMU: Checking for cgroup 'cpu' controller support : PASS
|
||||
QEMU: Checking for cgroup 'cpu' controller mount-point : PASS
|
||||
QEMU: Checking for cgroup 'cpuacct' controller support : PASS
|
||||
QEMU: Checking for cgroup 'cpuacct' controller mount-point : PASS
|
||||
QEMU: Checking for cgroup 'cpuset' controller support : PASS
|
||||
QEMU: Checking for cgroup 'cpuset' controller mount-point : PASS
|
||||
QEMU: Checking for cgroup 'devices' controller support : PASS
|
||||
QEMU: Checking for cgroup 'devices' controller mount-point : PASS
|
||||
QEMU: Checking for cgroup 'blkio' controller support : PASS
|
||||
QEMU: Checking for cgroup 'blkio' controller mount-point : PASS
|
||||
QEMU: Checking for device assignment IOMMU support : PASS
|
||||
LXC: Checking for Linux >= 2.6.26 : PASS
|
||||
LXC: Checking for namespace ipc : PASS
|
||||
LXC: Checking for namespace mnt : PASS
|
||||
LXC: Checking for namespace pid : PASS
|
||||
LXC: Checking for namespace uts : PASS
|
||||
LXC: Checking for namespace net : PASS
|
||||
LXC: Checking for namespace user : PASS
|
||||
LXC: Checking for cgroup 'memory' controller support : PASS
|
||||
LXC: Checking for cgroup 'memory' controller mount-point : PASS
|
||||
LXC: Checking for cgroup 'cpu' controller support : PASS
|
||||
LXC: Checking for cgroup 'cpu' controller mount-point : PASS
|
||||
LXC: Checking for cgroup 'cpuacct' controller support : PASS
|
||||
LXC: Checking for cgroup 'cpuacct' controller mount-point : PASS
|
||||
LXC: Checking for cgroup 'cpuset' controller support : PASS
|
||||
LXC: Checking for cgroup 'cpuset' controller mount-point : PASS
|
||||
LXC: Checking for cgroup 'devices' controller support : PASS
|
||||
LXC: Checking for cgroup 'devices' controller mount-point : PASS
|
||||
LXC: Checking for cgroup 'blkio' controller support : PASS
|
||||
LXC: Checking for cgroup 'blkio' controller mount-point : PASS
|
||||
|
||||
```
|
||||
|
||||
If your system doesn’t support VT, you will see an output like below.
|
||||
```
|
||||
QEMU: Checking for hardware virtualization : FAIL (Only emulated CPUs are available, performance will be significantly limited)
|
||||
[...]
|
||||
|
||||
```
|
||||
|
||||
And, that’s all for now folks. In this guide, we have discussed various methods to find if a CPU supports VT or not. As you can see, it was very easy. Hope this was useful. More good stuffs to come. Stay tuned!
|
||||
|
||||
Cheers!
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ostechnix.com/how-to-find-if-a-cpu-supports-virtualization-technology-vt/
|
||||
|
||||
作者:[SK][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.ostechnix.com/author/sk/
|
||||
[1]:https://www.ostechnix.com/check-linux-system-32-bit-64-bit/
|
||||
[2]:https://www.ostechnix.com/check-linux-system-physical-virtual-machine/
|
||||
[3]:https://www.ostechnix.com/the-grep-command-tutorial-with-examples-for-beginners/
|
||||
[4]:data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
||||
[5]:http://www.ostechnix.com/wp-content/uploads/2018/03/cpuinfo.png
|
||||
[6]:http://www.ostechnix.com/wp-content/uploads/2018/03/cpuinfo-1-2.png
|
@ -1,3 +1,4 @@
|
||||
translating by amwps290
|
||||
Simple Load Balancing with DNS on Linux
|
||||
======
|
||||
|
||||
|
@ -0,0 +1,78 @@
|
||||
快速了解基于 Arch 的独立 Linux 发行版:MagpieOS
|
||||
======
|
||||
目前使用的大多数 Linux 发行版都是在美国或欧洲创建和开发的。来自孟加拉国的年轻开发人员想要改变这一切。
|
||||
|
||||
### 谁是 Rizwan?
|
||||
|
||||
[Rizwan][1] 是来自孟加拉国的计算机科学专业的学生。他目前正在学习成为一名专业的 Python 程序员。他在 2015 年开始使用 Linux。使用 Linux 启发他创建了自己的 Linux 发行版。他还希望让世界其他地方知道孟加拉国正在升级到 Linux。
|
||||
|
||||
他还致力于从头创建[ Linux live 版本][2]。
|
||||
|
||||
## ![MagpieOS Linux][3]
|
||||
|
||||
### 什么是 MagpieOS?
|
||||
|
||||
Rizwan 的新发行版被命名为 MagpieOS。 [MagpieOS][4]非常简单。它基本上是 GNOME3 桌面环境的 Arch。 MagpieOS 还包括一个自定义的仓库,其中包含图标和主题(据称是),这在其他基于 Arch 的发行版或 AUR上 不可用。
|
||||
|
||||
下面是 MagpieOS 包含的软件列表:Firefox、LibreOffice、Uget、Bleachbit、Notepadqq、SUSE Studio Image Writer、Pamac 软件包管理器、Gparted、Gimp、Rhythmbox、简单屏幕录像机、包括 Totem 视频播放器在内的所有默认 GNOME 软件,以及一套新的定制壁纸。
|
||||
|
||||
目前,MagpieOS 仅支持 GNOME 桌面环境。Rizwan 选择它是因为这是他的最爱。但是,他计划在未来添加更多的桌面环境。
|
||||
|
||||
不幸的是,MagpieOS 不支持孟加拉语或任何其他当地语言。它支持 GNOME 的默认语言,如英语、印地语等。
|
||||
|
||||
Rizwan 命名他的发行为 MagpieOS,因为[喜鹊][5] (magpie) 是孟加拉国的官方鸟。
|
||||
|
||||
## ![MagpieOS Linux][6]
|
||||
|
||||
### 为什么选择 Arch?
|
||||
|
||||
和大多数人一样,Rizwan 通过使用 [Ubuntu][7] 开始了他的 Linux 旅程。一开始,他对此感到满意。但是,有时他想安装的软件在仓库中没有,他不得不通过 Google 寻找正确的 PPA。他决定切换到 [Arch][8],因为 Arch 有许多在 Ubuntu 上没有的软件包。Rizwan 也喜欢 Arch 是一个滚动版本,并且始终是最新的。
|
||||
|
||||
Arch 的问题在于它的安装非常复杂和耗时。所以,Rizwan 尝试了几个基于 Arch 的发行版,并且对任何一个都不满意。他不喜欢 [Manjaro][9],因为他们没有权限使用 Arch 的仓库。此外,Arch 仓库镜像比 Manjaro 更快并且拥有更多软件。他喜欢 [Antergos][10],但要安装需要一个持续的互联网连接。如果在安装过程中连接失败,则必须重新开始。
|
||||
|
||||
由于这些问题,Rizwan 决定创建一个简单的发行版,让他和其他人无需麻烦地安装 Arch。他还希望通过使用他的发行版让他的祖国的开发人员从 Ubuntu 切换到 Arch。
|
||||
|
||||
### 如何通过 MagpieOS 帮助 Rizwan
|
||||
|
||||
如果你有兴趣帮助 Rizwan 开发 MagpieOS,你可以通过[ MagpieOS 网站][4]与他联系。你也可以查看该项目的[ GitHub 页面][11]。Rizwan 表示,他目前不寻求财政支持。
|
||||
|
||||
## ![MagpieOS Linux][12]
|
||||
|
||||
### 最后的想法
|
||||
|
||||
我快速地一次安装完成 MagpieOS。它使用[ Calamares 安装程序][13],这意味着安装它相对快速和无痛。重新启动后,我听到一封欢迎我来到 MagpieOS 的音频消息。
|
||||
|
||||
说实话,这是我第一次听到安装后的问候。(Windows 10 可能也有,但我不确定。)屏幕底部还有一个 Mac OS 风格的应用程序停靠栏。除此之外,它感觉像我用过的其他任何 GNOME 3 桌面。
|
||||
|
||||
考虑到这是一个刚刚起步的独立项目,我不会推荐它作为你的主要操作系统。但是,如果你是一个发行版尝试者,你一定会试试看。
|
||||
|
||||
话虽如此,对于一个想把自己的国家放在技术地图上的学生来说,这是一个不错的尝试。做得很好,Rizwan。
|
||||
|
||||
你有没有听说过 MagpieOS?你最喜欢的地区或本地制作的 Linux 发行版是什么?请在下面的评论中告诉我们。
|
||||
|
||||
如果你发现这篇文章有趣,请花点时间在社交媒体上分享。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/magpieos/
|
||||
|
||||
作者:[John Paul][a]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/john/
|
||||
[1]:https://twitter.com/Linux_Saikat
|
||||
[2]:https://itsfoss.com/linux-from-scratch-live-cd/
|
||||
[3]:https://itsfoss.com/wp-content/uploads/2018/01/magpieos1.jpg
|
||||
[4]:http://www.magpieos.net
|
||||
[5]:https://en.wikipedia.org/wiki/Magpie
|
||||
[6]:https://itsfoss.com/wp-content/uploads/2018/01/magpieos2.jpg
|
||||
[7]:https://www.ubuntu.com
|
||||
[8]:https://www.archlinux.org
|
||||
[9]:http://manjaro.org
|
||||
[10]:https://antergos.com
|
||||
[11]:https://github.com/Rizwan-Hasan/MagpieOS
|
||||
[12]:https://itsfoss.com/wp-content/uploads/2018/01/magpieos3.png
|
||||
[13]:https://calamares.io
|
@ -1,26 +1,14 @@
|
||||
hankchow translating
|
||||
|
||||
Check Linux Distribution Name and Version
|
||||
查看 Linux 发行版名称和版本号的8种方法
|
||||
======
|
||||
You have joined new company and want to install some software’s which is requested by DevApp team, also want to restart few of the service after installation. What to do?
|
||||
如果你加入了一家新公司,要为开发团队安装所需的软件并重启服务,这个时候首先要弄清楚它们运行在什么发行版以及哪个版本的系统上,你才能正确完成后续的工作。作为系统管理员,充分了解系统信息是首要的任务。
|
||||
|
||||
In this situation at least you should know what Distribution & Version is running on it. It will help you perform the activity without any issue.
|
||||
查看 Linux 发行版名称和版本号有很多种方法。你可能会问,为什么要去了解这些基本信息呢?
|
||||
|
||||
Administrator should gather some of the information about the system before doing any activity, which is first task for him.
|
||||
因为对于诸如 RHEL、Debian、openSUSE、Arch Linux 这几种主流发行版来说,它们各自拥有不同的包管理器来管理系统上的软件包,如果不知道所使用的是哪一个发行版的系统,在包安装的时候就会无从下手,而且由于大多数发行版都是用 systemd 命令而不是 SysVinit 脚本,在重启服务的时候也难以执行正确的命令。
|
||||
|
||||
There are many ways to find the Linux distribution name and version. You might ask, why i want to know this basic things?
|
||||
下面来看看可以使用那些基本命令来查看 Linux 发行版名称和版本号。
|
||||
|
||||
We have four major distributions such as RHEL, Debian, openSUSE & Arch Linux. Each distribution comes with their own package manager which help us to install packages on the system.
|
||||
|
||||
If you don’t know the distribution name then you wont be able to perform the package installation.
|
||||
|
||||
Also you won’t able to run the proper command for service bounces because most of the distributions implemented systemd command instead of SysVinit script.
|
||||
|
||||
It’s good to have the basic commands which will helps you in many ways.
|
||||
|
||||
Use the following Methods to Check Your Linux Distribution Name and Version.
|
||||
|
||||
### List of methods
|
||||
### 方法总览
|
||||
|
||||
* lsb_release command
|
||||
* /etc/*-release file
|
||||
@ -33,9 +21,10 @@ Use the following Methods to Check Your Linux Distribution Name and Version.
|
||||
|
||||
|
||||
|
||||
### Method-1: lsb_release Command
|
||||
### 方法1: lsb_release 命令
|
||||
|
||||
LSB(Linux Standard Base,Linux 标准库)能够打印发行版的具体信息,包括发行版名称、版本号、代号等。
|
||||
|
||||
LSB stands for Linux Standard Base that prints distribution-specific information such as Distribution name, Release version and codename.
|
||||
```
|
||||
# lsb_release -a
|
||||
No LSB modules are available.
|
||||
@ -46,11 +35,10 @@ Codename: xenial
|
||||
|
||||
```
|
||||
|
||||
### Method-2: /etc/arch-release /etc/os-release File
|
||||
### 方法2: /etc/arch-release /etc/os-release File
|
||||
|
||||
release file typically known as Operating system identification. The `/etc` directory contains many files that contains various information about the distribution. Each distribution has their own set of files, which display this information.
|
||||
版本文件通常被视为操作系统的标识。在 `/etc` 目录下放置了很多记录着发行版各种信息的文件,每个发行版都各自有一套这样记录着相关信息的文件。下面是一组在 Ubuntu/Debian 系统上显示出来的文件内容。
|
||||
|
||||
The below set of files are present on Ubuntu/Debian system.
|
||||
```
|
||||
# cat /etc/issue
|
||||
Ubuntu 16.04.3 LTS \n \l
|
||||
@ -82,7 +70,7 @@ UBUNTU_CODENAME=xenial
|
||||
|
||||
```
|
||||
|
||||
The below set of files are present on RHEL/CentOS/Fedora system. The `/etc/redhat-release` & `/etc/system-release` files symlinks with `/etc/[distro]-release` file.
|
||||
下面这一组是在 RHEL/CentOS/Fedora 系统上显示出来的文件内容。其中 `/etc/redhat-release` 和 `/etc/system-release` 文件是指向 `/etc/[发行版名称]-release` 文件的一个连接。
|
||||
```
|
||||
# cat /etc/centos-release
|
||||
CentOS release 6.9 (Final)
|
||||
@ -115,34 +103,34 @@ Fedora release 27 (Twenty Seven)
|
||||
|
||||
```
|
||||
|
||||
### Method-3: uname Command
|
||||
### 方法3: uname 命令
|
||||
|
||||
uname (stands for unix name) is an utility that prints the system information like kernel name, version and other details about the system and the operating system running on it.
|
||||
uname(unix name) 是一个打印系统信息的工具,包括内核名称、版本号、系统详细信息以及所运行的操作系统等等。
|
||||
|
||||
**Suggested Read :** [6 Methods To Check The Running Linux Kernel Version On System][1]
|
||||
**建议阅读:** [6种查看系统 Linux 内核的方法][1]
|
||||
```
|
||||
# uname -a
|
||||
Linux localhost.localdomain 4.12.14-300.fc26.x86_64 #1 SMP Wed Sep 20 16:28:07 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
|
||||
|
||||
```
|
||||
|
||||
The above colored words describe the version of operating system as Fedora Core 26.
|
||||
以上运行结果说明使用的操作系统版本是 Fedora 26。
|
||||
|
||||
### Method-4: /proc/version File
|
||||
### 方法4: /proc/version File
|
||||
|
||||
This file specifies the version of the Linux kernel, the version of gcc used to compile the kernel, and the time of kernel compilation. It also contains the kernel compiler’s user name (in parentheses).
|
||||
这个文件记录了 Linux 内核的版本、用于编译内核的 gcc 的版本、内核编译的时间,以及内核编译者的用户名。
|
||||
```
|
||||
# cat /proc/version
|
||||
Linux version 4.12.14-300.fc26.x86_64 ([email protected]) (gcc version 7.2.1 20170915 (Red Hat 7.2.1-2) (GCC) ) #1 SMP Wed Sep 20 16:28:07 UTC 2017
|
||||
Linux version 4.12.14-300.fc26.x86_64 ([email protected]) (gcc version 7.2.1 20170915 (Red Hat 7.2.1-2) (GCC) ) #1 SMP Wed Sep 20 16:28:07 UTC 2017
|
||||
|
||||
```
|
||||
|
||||
### Method-5: dmesg Command
|
||||
### Method-5: dmesg 命令
|
||||
|
||||
dmesg (stands for display message or driver message) is a command on most Unix-like operating systems that prints the message buffer of the kernel.
|
||||
dmesg(display message/driver message,展示信息/驱动程序信息)是大多数类 Unix 操作系统上的一个命令,用于打印内核上消息缓冲区的信息。
|
||||
```
|
||||
# dmesg | grep "Linux"
|
||||
[ 0.000000] Linux version 4.12.14-300.fc26.x86_64 ([email protected]) (gcc version 7.2.1 20170915 (Red Hat 7.2.1-2) (GCC) ) #1 SMP Wed Sep 20 16:28:07 UTC 2017
|
||||
[ 0.000000] Linux version 4.12.14-300.fc26.x86_64 ([email protected]) (gcc version 7.2.1 20170915 (Red Hat 7.2.1-2) (GCC) ) #1 SMP Wed Sep 20 16:28:07 UTC 2017
|
||||
[ 0.001000] SELinux: Initializing.
|
||||
[ 0.001000] SELinux: Starting in permissive mode
|
||||
[ 0.470288] SELinux: Registering netfilter hooks
|
||||
@ -154,11 +142,11 @@ dmesg (stands for display message or driver message) is a command on most Unix-l
|
||||
|
||||
```
|
||||
|
||||
### Method-6: Yum/Dnf Command
|
||||
### Method-6: Yum/Dnf 命令
|
||||
|
||||
Yum (Yellowdog Updater Modified) is one of the package manager utility in Linux operating system. Yum command is used to install, update, search & remove packages on some Linux distributions based on RedHat.
|
||||
Yum(Yellowdog Updater Modified)是 Linux 操作系统上的一个包管理工具,而 `yum` 命令则是一些基于 RedHat 的 Linux 发行版上用于安装、更新、查找、删除软件包的命令。
|
||||
|
||||
**Suggested Read :** [YUM Command To Manage Packages on RHEL/CentOS Systems][2]
|
||||
**建议阅读:** [在 RHEL/CentOS 系统上使用 yum 命令管理软件包][2]
|
||||
```
|
||||
# yum info nano
|
||||
Loaded plugins: fastestmirror, ovl
|
||||
@ -180,7 +168,7 @@ Description : GNU nano is a small and friendly text editor.
|
||||
|
||||
```
|
||||
|
||||
The below yum repolist command shows that Base, Extras, and Updates repositories are coming from CentOS 7 repository.
|
||||
下面的 `yum repolist` 命令执行后显示了 yum 的基础源仓库、额外源仓库、更新源仓库都来自 CentOS 7 仓库。
|
||||
```
|
||||
# yum repolist
|
||||
Loaded plugins: fastestmirror, ovl
|
||||
@ -196,9 +184,9 @@ repolist: 11908
|
||||
|
||||
```
|
||||
|
||||
We can also use Dnf command to check distribution name and version.
|
||||
使用 `dnf` 命令也同样可以查看发行版名称和版本号。
|
||||
|
||||
**Suggested Read :** [DNF (Fork of YUM) Command To Manage Packages on Fedora System][3]
|
||||
**建议阅读:** [在 Fedora 系统上使用 DNF(YUM 的一个分支)命令管理软件包][3]
|
||||
```
|
||||
# dnf info nano
|
||||
Last metadata expiration check: 0:01:25 ago on Thu Feb 15 01:59:31 2018.
|
||||
@ -218,22 +206,22 @@ Description : GNU nano is a small and friendly text editor.
|
||||
|
||||
```
|
||||
|
||||
### Method-7: RPM Command
|
||||
### Method-7: RPM 命令
|
||||
|
||||
RPM stands for RedHat Package Manager is a powerful, command line Package Management utility for Red Hat based system such as CentOS, Oracle Linux & Fedora. This help us to identify the running system version.
|
||||
RPM(RedHat Package Manager, RedHat 包管理器)是在 CentOS、Oracle Linux、Fedora 这些基于 RedHat 的操作系统上的一个强大的命令行包管理工具,同样也可以帮助我们查看系统的版本信息。
|
||||
|
||||
**Suggested Read :** [RPM commands to manage packages on RHEL based systems][4]
|
||||
**建议阅读:** [在基于 RHEL 的系统上使用 RPM 命令管理软件包][4]
|
||||
```
|
||||
# rpm -q nano
|
||||
nano-2.8.7-1.fc27.x86_64
|
||||
|
||||
```
|
||||
|
||||
### Method-8: APT-GET Command
|
||||
### Method-8: APT-GET 命令
|
||||
|
||||
Apt-Get stands for Advanced Packaging Tool (APT). apg-get is a powerful command-line tool which is used to automatically download and install new software packages, upgrade existing software packages, update the package list index, and to upgrade the entire Debian based systems.
|
||||
Apt-Get(Advanced Packaging Tool)是一个强大的命令行工具,可以自动下载安装新软件包、更新已有的软件包、更新软件包列表索引,甚至更新整个 Debian 系统。
|
||||
|
||||
**Suggested Read :** [Apt-Get & Apt-Cache commands to manage packages on Debian Based Systems][5]
|
||||
**建议阅读:** [在基于 Debian 的系统上使用 Apt-Get 和 Apt-Cache 命令管理软件包][5]
|
||||
```
|
||||
# apt-cache policy nano
|
||||
nano:
|
||||
@ -253,7 +241,7 @@ nano:
|
||||
via: https://www.2daygeek.com/check-find-linux-distribution-name-and-version/
|
||||
|
||||
作者:[Magesh Maruthamuthu][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
译者:[HankChow](https://github.com/HankChow)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
@ -1,144 +0,0 @@
|
||||
|
||||
运行在 Windows 10 系统中绝对实用的 Linux 命令
|
||||
======
|
||||
|
||||
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/wsl-commands.png?itok=91oEXdO8)
|
||||
|
||||
在本系列早先的文章中,我们讨论了关于如何在 [Windows 10 上开启 WSL 之旅][1] 的内容。作为本系列的最后一篇文章,我们准备探讨一些能在 Windows 10 上广泛使用的 Linux 命令。
|
||||
|
||||
话题深入之前,请先让我们明确本教程所适用的人群。本文适用于使用 Windows 10 系统的初级开发者,帮助其了解学习关于 Azure、AWS 或是私有云的 Linux 平台。换句话说,就是为了帮助初次接触 Linux 系统的 Windows 10 用户。
|
||||
|
||||
您的工作量决定了您所需要的命令,而我的需求可能和您的不一样。本文旨在帮助您在 Windwos 10 上舒服的使用 Linux。不过请牢记,WSL 并不提供硬件访问的功能,比如声卡、GPU,至少官方是这么描述的。但是这可能并不能阻止 Linux 用户的折腾精神。很多用户不仅完成了硬件访问,甚至已经在 Windows 10 上安装上了 Linux 桌面程序。但是本文并不会涉及这些内容,我们可能会讨论这些,但不是现在。
|
||||
|
||||
下面是我们需要着手的任务。
|
||||
|
||||
### 如何让您的 Linux 系统保持到最新的版本
|
||||
|
||||
因为 Linux 运行在了 Windows 系统中,所以您将被剥夺 Linux 系统所提供的所有安全服务。另外,如果不及时给 Linux 系统打补丁,Windows 设备将被迫暴露在外界威胁中,所以还请保持您的 Linux 设备到最新版本。
|
||||
|
||||
WSL 官方支持 openSUSE、SUSE Linux Enterprise 和 Ubuntu。您也可以安装其他发行版,但是我只需要它们当中的两个就可以完成我的所有工作,毕竟,我只需要访问一些 Linux 基础程序。
|
||||
|
||||
**更新 openSUSE Leap:**
|
||||
```
|
||||
sudo zypper up
|
||||
|
||||
```
|
||||
|
||||
如果您想升级系统,您可以运行下面的命令:
|
||||
```
|
||||
sudo zypper dup
|
||||
|
||||
```
|
||||
|
||||
**更新 Ubuntu:**
|
||||
```
|
||||
sudo apt-get update
|
||||
|
||||
sudo apt-get dist-upgrade
|
||||
|
||||
```
|
||||
|
||||
由于 Linux 系统的更新是渐进式的,所以更新系统成为了我的日常。Windows 10 的更新通常需要重启系统,而 Linux 不同,一般只有 KB 或是 MB 级的更新,无需重启。
|
||||
|
||||
### 管理文件目录
|
||||
|
||||
系统更新之后,我们还剩余一些非必要或是不那么重要的任务。
|
||||
|
||||
系统更新之外的第二重要的任务是使用 Linux 管理本地和远程文件。我承认我更青睐图形界面程序,但是终端能提供更可靠、更有价值的服务。使用 Explorer 程序,尝试移动 1 TB 的文件,祝你好运。数据量大的话,我通常使用 rsync 命令来移动它们。如果中断任务,rsync 可以在上次停止的节点继续工作。
|
||||
|
||||
虽然您可能更习惯使用 cp 或是 mv 命令复制、移动文件,但是我还是喜欢灵活的 rsync 命令,了解 rsync 对远程文件传输也有帮助。使用 rsync 大半为了完成下面三个任务:
|
||||
|
||||
**使用 rsync 复制整个目录:**
|
||||
```
|
||||
rsync -avzP /source-directory /destination directory
|
||||
|
||||
```
|
||||
|
||||
**使用 rsync 移动文件:**
|
||||
```
|
||||
rsync --remove-source-files -avzP /source-directory /destination-directory
|
||||
|
||||
```
|
||||
|
||||
在成功复制目标目录之后,此命令将删除源文件。
|
||||
|
||||
**使用 rsync 同步文件:**
|
||||
|
||||
我的文件可能在多处存储。但是,我只会在主要位置中增加或是删除。如果不使用专业的软件,同步文件可能会给用户带来挑战,而 rsync 刚好可以简化这个过程。这个命令可以让两个目录文件内容同步,留个印象,也许用得上。
|
||||
```
|
||||
rsync --delete -avzP /source-directory /destination-directory
|
||||
|
||||
```
|
||||
|
||||
如果原目录中没有找到文件,上述命令将删除目标目录中的文件,并通过另一种方式创建源目录的镜像复制。
|
||||
|
||||
### 文件自动备份
|
||||
|
||||
保持文件备份是一项普通的工作。为了保持我的设备的完全同步,我运行了一个 cron 作业在夜间持续同步我的所有目录。保持一个外部驱动,每周我都会手动同步。由于可能删掉我不想删除的文件,所以我并没有使用 --delete 选项。
|
||||
|
||||
**创建 cron 作业, 打开 crontab:**
|
||||
```
|
||||
crontab -e
|
||||
|
||||
```
|
||||
|
||||
移动大文件时,我会选择在系统空闲的深夜执行该命令。此命令将在每天早上 1 点运行,您大概可以这样修改它:
|
||||
```
|
||||
# 0 1 * * * rsync -avzP /source-directory /destination-directory
|
||||
|
||||
```
|
||||
|
||||
这是使用 crontab 的定时作业的命令结构:
|
||||
```
|
||||
# m h dom mon dow command
|
||||
|
||||
```
|
||||
|
||||
在此,m = 分钟, h = 小时, dom= 本月的某天, mon= 月; dow= 本周的某天。
|
||||
|
||||
我们将在每天早上 1 点运行这条命令。您可以选择 dow 或是 dom(比如,每月 5 号)等。您可以在 [这里][2] 阅读更多相关内容。
|
||||
|
||||
### 管理远程服务器
|
||||
|
||||
在 Windows 系统上使用 WSL 的优势之一就是能方便管理远程 Linux 服务器,WSL 能提供原生的 Linux 工具给您。首先,您需要使用 ssh 命令登陆远程 Linux 服务器。
|
||||
|
||||
比如,我的服务器 ip 是 192.168.0.112;端口为 2018(不是默认的 22 端口);Linux 用户名是 swapnil,密码是 `就不告诉你`。
|
||||
```
|
||||
ssh -p2018 swapnil@192.168.0.112
|
||||
|
||||
```
|
||||
|
||||
它会向您请求用户密码,然后您就可以登陆到 Linux 服务器了。现在您可以执行任意您想执行的所有操作,且不需使用额外的 puTTY 程序。
|
||||
|
||||
使用 rsync ,您可以很轻易的将本地文件传输到远程设备。源文件还是目标目录取决于您是上传文件到服务器,还是下载文件到本地目录,您可以使用 [username@IP][3]。
|
||||
|
||||
如果我想在服务器中复制一些文本内容到 home 目录,参照这里的目录:
|
||||
```
|
||||
rsync -avzP /source-directory-on-local-machine ‘ssh -p2018’ swapnil@192.168.0.112:/home/swapnil/Documents/
|
||||
|
||||
```
|
||||
|
||||
这将会在远程服务器中复制文件到 `Documents` 目录。
|
||||
|
||||
### 总结
|
||||
|
||||
本教程主要是为了证明您可以通过 Windows 10 系统的 WSL 完成 Linux 系的很大一部分的任务。通常来说,它提高了生产效率。现在,Linux 的世界已经向 Windwos 10 系统打开怀抱了,尽情探索吧。如果您有任何疑问,或是想了解 WSL 涉及到的其他层面,欢迎在下方的评论区分享您的想法。
|
||||
|
||||
在 [Administering Linux on Azure (LFS205)][4] 课程中了解更多,可以在 [这里][5] 注册。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linux.com/blog/learn/2018/3/most-useful-linux-commands-you-can-run-windows-10
|
||||
|
||||
作者:[SAPNIL BHARTIYA][a]
|
||||
译者:[CYLeft](https://github.com/CYLeft)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.linux.com/users/arnieswap
|
||||
[1]:https://www.linux.com/blog/learn/2018/2/how-get-started-using-wsl-windows-10
|
||||
[2]:http://www.adminschoice.com/crontab-quick-reference
|
||||
[3]:mailto:username@IP
|
||||
[4]:https://training.linuxfoundation.org/linux-courses/system-administration-training/administering-linux-on-azure
|
||||
[5]:http://bit.ly/2FpFtPg
|
Loading…
Reference in New Issue
Block a user