mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-03-21 02:10:11 +08:00
commit
a4f56169dc
@ -0,0 +1,157 @@
|
||||
Mhddfs:将多个小分区合并成一个大的虚拟存储
|
||||
================================================================================
|
||||
|
||||
让我们假定你有30GB的电影,并且你有3个驱动器,每个的大小为20GB。那么,你会怎么来存放东西呢?
|
||||
|
||||
很明显,你可以将你的视频分割成2个或者3个不同的卷,并将它们手工存储到驱动器上。这当然不是一个好主意,它成了一项费力的工作,它需要你手工干预,而且花费你大量时间。
|
||||
|
||||
另外一个解决方案是创建一个 [RAID磁盘阵列][1]。然而,RAID在存储可靠性,磁盘空间可用性差等方面声名狼藉。另外一个解决方案,就是mhddfs。
|
||||
|
||||

|
||||
|
||||
*Mhddfs——在Linux中合并多个分区*
|
||||
|
||||
mhddfs是一个用于Linux的设备驱动,它可以将多个挂载点合并到一个虚拟磁盘中。它是一个基于FUSE的驱动,提供了一个用于大数据存储的简单解决方案。它可以将所有小文件系统合并,创建一个单一的大虚拟文件系统,该文件系统包含其成员文件系统的所有内容,包括文件和空闲空间。
|
||||
|
||||
#### 你为什么需要Mhddfs? ####
|
||||
|
||||
你的所有存储设备会创建为一个单一的虚拟池,它可以在启动时被挂载。这个小工具可以智能地照看并处理哪个存储满了,哪个存储空着,以及将数据写到哪个存储中。当你成功创建虚拟驱动器后,你可以使用[SAMBA][2]来共享你的虚拟文件系统。你的客户端将在任何时候都看到一个巨大的驱动器和大量的空闲空间。
|
||||
|
||||
#### Mhddfs特性 ####
|
||||
|
||||
- 获取文件系统属性和系统信息。
|
||||
- 设置文件系统属性。
|
||||
- 创建、读取、移除和写入目录和文件。
|
||||
- 在单一设备上支持文件锁和硬链接。
|
||||
|
||||
|mhddfs的优点|mhddfs的缺点|
|
||||
|-----------|-----------|
|
||||
|适合家庭用户|mhddfs驱动没有内建在Linux内核中 |
|
||||
|运行简单|运行时需要大量处理能力|
|
||||
|没有明显的数据丢失|没有冗余解决方案|
|
||||
|不需要分割文件|不支持移动硬链接|
|
||||
|可以添加新文件到组成的虚拟文件系统||
|
||||
|可以管理文件保存的位置||
|
||||
|支持扩展文件属性||
|
||||
|
||||
### Linux中安装Mhddfs ###
|
||||
|
||||
在Debian及其类似的移植系统中,你可以使用下面的命令来安装mhddfs包。
|
||||
|
||||
# apt-get update && apt-get install mhddfs
|
||||
|
||||

|
||||
|
||||
*安装Mhddfs到基于Debian的系统中*
|
||||
|
||||
在RHEL/CentOS Linux系统中,你需要开启[epel仓库][3],然后执行下面的命令来安装mhddfs包。
|
||||
|
||||
# yum install mhddfs
|
||||
|
||||
在Fedora 22及以上系统中,你可以通过dnf包管理来获得它,就像下面这样。
|
||||
|
||||
# dnf install mhddfs
|
||||
|
||||

|
||||
|
||||
*安装Mhddfs到Fedora*
|
||||
|
||||
如果万一mhddfs包不能从epel仓库获取到,那么你需要解决下面的依赖,然后像下面这样来编译源码并安装。
|
||||
|
||||
- FUSE头文件
|
||||
- GCC
|
||||
- libc6头文件
|
||||
- uthash头文件
|
||||
- libattr1头文件(可选)
|
||||
|
||||
接下来,只需从下面建议的地址下载最新的源码包,然后编译。
|
||||
|
||||
# wget http://mhddfs.uvw.ru/downloads/mhddfs_0.1.39.tar.gz
|
||||
# tar -zxvf mhddfs*.tar.gz
|
||||
# cd mhddfs-0.1.39/
|
||||
# make
|
||||
|
||||
你应该可以在当前目录中看到mhddfs的二进制文件,以root身份将它移动到/usr/bin/和/usr/local/bin/中。
|
||||
|
||||
# cp mhddfs /usr/bin/
|
||||
# cp mhddfs /usr/local/bin/
|
||||
|
||||
一切搞定,mhddfs已经可以用了。
|
||||
|
||||
### 我怎么使用Mhddfs? ###
|
||||
|
||||
1、 让我们看看当前所有挂载到我们系统中的硬盘。
|
||||
|
||||
$ df -h
|
||||
|
||||

|
||||
|
||||
**样例输出**
|
||||
|
||||
Filesystem Size Used Avail Use% Mounted on
|
||||
|
||||
/dev/sda1 511M 132K 511M 1% /boot/efi
|
||||
/dev/sda2 451G 92G 336G 22% /
|
||||
/dev/sdb1 1.9T 161G 1.7T 9% /media/avi/BD9B-5FCE
|
||||
/dev/sdc1 555M 555M 0 100% /media/avi/Debian 8.1.0 M-A 1
|
||||
|
||||
注意这里的‘挂载点’名称,我们后面会使用到它们。
|
||||
|
||||
2、 创建目录‘/mnt/virtual_hdd’,所有这些文件系统将会在这里组织到一起。
|
||||
|
||||
# mkdir /mnt/virtual_hdd
|
||||
|
||||
3、 然后,挂载所有文件系统。你可以通过root或者FUSE组中的某个用户来完成。
|
||||
|
||||
# mhddfs /boot/efi, /, /media/avi/BD9B-5FCE/, /media/avi/Debian\ 8.1.0\ M-A\ 1/ /mnt/virtual_hdd -o allow_other
|
||||
|
||||

|
||||
|
||||
*在Linux中挂载所有文件系统*
|
||||
|
||||
**注意**:这里我们使用了所有硬盘的挂载点名称,很明显,你的挂载点名称会有所不同。也请注意“-o allow_other”选项可以让这个虚拟文件系统让其它所有人可见,而不仅仅是创建它的人。
|
||||
|
||||
4、 现在,运行“df -h”来看看所有文件系统。它应该包含了你刚才创建的那个。
|
||||
|
||||
$ df -h
|
||||
|
||||

|
||||
|
||||
*验证虚拟文件系统挂载*
|
||||
|
||||
你可以像对已挂在的驱动器那样给虚拟文件系统应用所有的选项。
|
||||
|
||||
5、 要在每次系统启动创建这个虚拟文件系统,你应该以root身份添加下面的这行代码(在你那里会有点不同,取决于你的挂载点)到/etc/fstab文件的末尾。
|
||||
|
||||
mhddfs# /boot/efi, /, /media/avi/BD9B-5FCE/, /media/avi/Debian\ 8.1.0\ M-A\ 1/ /mnt/virtual_hdd fuse defaults,allow_other 0 0
|
||||
|
||||
6、 如果在任何时候你想要添加/移除一个新的驱动器到/从虚拟硬盘,你可以挂载一个新的驱动器,拷贝/mnt/vritual_hdd的内容,卸载卷,弹出你要移除的的驱动器并/或挂载你要包含的新驱动器。使用mhddfs命令挂载全部文件系统到Virtual_hdd下,这样就全部搞定了。
|
||||
|
||||
#### 我怎么卸载Virtual_hdd? ####
|
||||
|
||||
卸载virtual_hdd相当简单,就像下面这样
|
||||
|
||||
# umount /mnt/virtual_hdd
|
||||
|
||||

|
||||
|
||||
*卸载虚拟文件系统*
|
||||
|
||||
注意,是umount,而不是unmount,很多用户都输错了。
|
||||
|
||||
到现在为止全部结束了。我正在写另外一篇文章,你们一定喜欢读的。到那时,请保持连线。请在下面的评论中给我们提供有用的反馈吧。请为我们点赞并分享,帮助我们扩散。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/combine-partitions-into-one-in-linux-using-mhddfs/
|
||||
|
||||
作者:[Avishek Kumar][a]
|
||||
译者:[GOLinux](https://github.com/GOLinux)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/avishek/
|
||||
[1]:http://www.tecmint.com/understanding-raid-setup-in-linux/
|
||||
[2]:http://www.tecmint.com/mount-filesystem-in-linux/
|
||||
[3]:https://linux.cn/article-2324-1.html
|
126
published/20150901 How to Defragment Linux Systems.md
Normal file
126
published/20150901 How to Defragment Linux Systems.md
Normal file
@ -0,0 +1,126 @@
|
||||
如何在 Linux 中整理磁盘碎片
|
||||
================================================================================
|
||||
|
||||

|
||||
|
||||
有一神话是 linux 的磁盘从来不需要整理碎片。在大多数情况下这是真的,大多数因为是使用的是优秀的日志系统(ext2、3、4等等)来处理文件系统。然而,在一些特殊情况下,碎片仍旧会产生。如果正巧发生在你身上,解决方法很简单。
|
||||
|
||||
### 什么是磁盘碎片 ###
|
||||
|
||||
文件系统会按块更新文件,如果这些块没有连成一整块而是分布在磁盘的各个角落中时,就会形成磁盘碎片。这对于 FAT 和 FAT32 文件系统而言是这样的。在 NTFS 中这种情况有所减轻,但在 Linux(extX)中却几乎不会发生。下面是原因:
|
||||
|
||||
在像 FAT 和 FAT32 这类文件系统中,文件紧挨着写入到磁盘中。文件之间没有空间来用于增长或者更新:
|
||||
|
||||

|
||||
|
||||
NTFS 中在文件之间保留了一些空间,因此有空间进行增长。但因块之间的空间是有限的,碎片也会随着时间出现。
|
||||
|
||||

|
||||
|
||||
Linux 的日志型文件系统采用了一个不同的方案。与文件相互挨着不同,每个文件分布在磁盘的各处,每个文件之间留下了大量的剩余空间。这就给文件更新和增长留下了很大的空间,碎片很少会发生。
|
||||
|
||||

|
||||
|
||||
此外,碎片一旦出现了,大多数 Linux 文件系统会尝试将文件和块重新连续起来。
|
||||
|
||||
### Linux 中的磁盘整理 ###
|
||||
|
||||
除非你用的是一个很小的硬盘或者空间不够了,不然 Linux 很少会需要磁盘整理。一些可能需要磁盘整理的情况包括:
|
||||
|
||||
- 如果你编辑的是大型视频文件或者 RAW 照片,但磁盘空间有限
|
||||
- 如果你使用一个老式硬件,如旧笔记本,你的硬盘会很小
|
||||
- 如果你的磁盘开始满了(大约使用了85%)
|
||||
- 如果你的家目录中有许多小分区
|
||||
|
||||
最好的解决方案是购买一个大硬盘。如果不可能,磁盘碎片整理就很有用了。
|
||||
|
||||
### 如何检查碎片 ###
|
||||
|
||||
`fsck` 命令会为你做这个,换句话说,如果你可以在 LiveCD 中运行它,那么就可以用于**所有卸载的分区**。
|
||||
|
||||
这一点很重要:**在已经挂载的分区中运行 fsck 将会严重危害到你的数据和磁盘**。
|
||||
|
||||
你已经被警告过了。开始之前,先做一个完整的备份。
|
||||
|
||||
**免责声明**: 本文的作者与本站将不会对您的文件、数据、系统或者其他损害负责。你需要自己承担风险。如果你继续,你需要接受并了解这点。
|
||||
|
||||
你应该启动到一个 live 会话中(如使用安装磁盘,系统救援CD等)并在你**卸载**的分区上运行 `fsck` 。要检查是否有任何问题,请在使用 root 权限运行下面的命令:
|
||||
|
||||
fsck -fn [/path/to/your/partition]
|
||||
|
||||
您可以运行以下命令找到分区的路径
|
||||
|
||||
sudo fdisk -l
|
||||
|
||||
有一个在已挂载的分区中运行 `fsck`(相对)安全的方法是使用`-n`开关。这会对分区进行只读文件系统检查,而不会写入任何东西。当然,这并不能保证十分安全,你应该在创建备份之后进行。在 ext2 中,运行
|
||||
|
||||
sudo fsck.ext2 -fn /path/to/your/partition
|
||||
|
||||
这会产生大量的输出,大多数错误信息的原因是分区已经挂载了。最后会给出一个碎片相关的信息。
|
||||
|
||||

|
||||
|
||||
如果碎片率大于 20% 了,那么你应该开始整理你的磁盘碎片了。
|
||||
|
||||
### 如何简单地在 Linux 中整理碎片 ###
|
||||
|
||||
你要做的是备份你**所有**的文件和数据到另外一块硬盘中(手动**复制**他们),格式化分区,然后重新复制回去(不要使用备份软件)。日志型文件系统会把它们作为新的文件,并将它们整齐地放置到磁盘中而不产生碎片。
|
||||
|
||||
要备份你的文件,运行
|
||||
|
||||
cp -afv [/path/to/source/partition]/* [/path/to/destination/folder]
|
||||
|
||||
记住星号(*)是很重要的。
|
||||
|
||||
注意:通常认为复制大文件或者大量文件,使用 `dd` 或许是最好的。这是一个非常底层的操作,它会复制一切,包含空闲的空间甚至是留下的垃圾。这不是我们想要的,因此这里最好使用 `cp`。
|
||||
|
||||
现在你只需要删除源文件。
|
||||
|
||||
sudo rm -rf [/path/to/source/partition]/*
|
||||
|
||||
**可选**:你可以使用如下命令将空闲空间用零填充。也可以用格式化来达到这点,但是如果你并没有复制整个分区而仅仅是复制大文件(它通常会形成碎片)的话,就不应该使用格式化的方法了。
|
||||
|
||||
sudo dd if=/dev/zero of=[/path/to/source/partition]/temp-zero.txt
|
||||
|
||||
等待它结束。你可以用 `pv` 来监测进度。
|
||||
|
||||
sudo apt-get install pv
|
||||
sudo pv -tpreb | of=[/path/to/source/partition]/temp-zero.txt
|
||||
|
||||

|
||||
|
||||
这就完成了,只要删除这个用于填充的临时文件就行。
|
||||
|
||||
sudo rm [/path/to/source/partition]/temp-zero.txt
|
||||
|
||||
待你清零了空闲空间(或者跳过了这步)。重新复制回文件,将第一个`cp`命令翻转一下:
|
||||
|
||||
cp -afv [/path/to/original/destination/folder]/* [/path/to/original/source/partition]
|
||||
|
||||
### 使用 e4defrag ###
|
||||
|
||||
如果你想要简单的方法,安装 `e2fsprogs`,
|
||||
|
||||
sudo apt-get install e2fsprogs
|
||||
|
||||
用 root 权限在分区中运行 `e4defrag`。如果你不想或不能卸载该分区,你可以使用它的挂载点而不是路径。要整理整个系统的碎片,运行:
|
||||
|
||||
sudo e4defrag /
|
||||
|
||||
在挂载的情况下不保证成功(你也应该在它运行时不要使用你的系统),但是它比复制全部文件再重新复制回来简单多了。
|
||||
|
||||
### 总结 ###
|
||||
|
||||
linux 系统中由于它的日志型文件系统有效的数据处理很少会出现碎片。如果你因任何原因产生了碎片,简单的方法是重新分配你的磁盘,如复制出去所有文件并复制回来,或者使用`e4defrag`。然而重要的是保证你数据的安全,因此在进行任何可能影响你全部或者大多数文件的操作之前,确保你的文件已经被备份到了另外一个安全的地方去了。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.maketecheasier.com/defragment-linux/
|
||||
|
||||
作者:[Attila Orosz][a]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.maketecheasier.com/author/attilaorosz/
|
@ -1,12 +1,12 @@
|
||||
如何在linux中搭建FTP服务
|
||||
如何在 linux 中搭建 FTP 服务
|
||||
=====================================================================
|
||||

|
||||
|
||||
在本教程中,我将会解释如何搭建你自己的FTP服务。但是,首先我们应该来的学习一下FTP是什么。
|
||||
在本教程中,我将会介绍如何搭建你自己的FTP服务。但是,首先我们应该来的学习一下FTP是什么。
|
||||
|
||||
###FTP是什么?###
|
||||
|
||||
[FTP][1] 是文件传输协议(File Transfer Protocol)的缩写。顾名思义,FTP是用于计算机之间通过网络进行文件传输。你可以通过FTP在计算机账户间进行文件传输,也可以在账户和桌面计算机之间传输文件,或者访问在线软件文档。但是,需要注意的是多数的FTP站点的使用率非常高,并且在连接前需要进行多次尝试。
|
||||
[FTP][1] 是文件传输协议(File Transfer Protocol)的缩写。顾名思义,FTP用于计算机之间通过网络进行文件传输。你可以通过FTP在计算机账户间进行文件传输,也可以在账户和桌面计算机之间传输文件,或者访问在线软件归档。但是,需要注意的是多数的FTP站点的使用率非常高,可能需要多次重连才能连接上。
|
||||
|
||||
FTP地址和HTTP地址(即网页地址)非常相似,只是FTP地址使用ftp://前缀而不是http://
|
||||
|
||||
@ -16,23 +16,23 @@ FTP地址和HTTP地址(即网页地址)非常相似,只是FTP地址使用f
|
||||
|
||||
现在,我们来开始一个特别的冒险,我们将会搭建一个FTP服务用于和家人、朋友进行文件共享。在本教程,我们将以[vsftpd][2]作为ftp服务。
|
||||
|
||||
VSFTPD是一个自称为最安全的FTP服务端软件。事实上VSFTPD的前两个字母表示“非常安全的(very secure)”。该软件的构建绕开了FTP协议的漏洞。
|
||||
VSFTPD是一个自称为最安全的FTP服务端软件。事实上VSFTPD的前两个字母表示“非常安全的(very secure)”。该软件的构建绕开了FTP协议的漏洞。
|
||||
|
||||
尽管如此,你应该知道还有更安全的方法进行文件管理和传输,如:SFTP(使用[OpenSSH][3])。FTP协议对于共享非敏感数据是非常有用和可靠的。
|
||||
尽管如此,你应该知道还有更安全的方法进行文件管理和传输,如:SFTP(使用[OpenSSH][3])。FTP协议对于共享非敏感数据是非常有用和可靠的。
|
||||
|
||||
####在rpm distributions中安装VSFTPD:####
|
||||
####使用 rpm 安装VSFTPD:####
|
||||
|
||||
你可以使用如下命令在命令行界面中快捷的安装VSFTPD:
|
||||
|
||||
dnf -y install vsftpd
|
||||
|
||||
####在deb distributions中安装VSFTPD:####
|
||||
####使用 deb 安装VSFTPD:####
|
||||
|
||||
你可以使用如下命令在命令行界面中快捷的安装VSFTPD:
|
||||
|
||||
sudo apt-get install vsftpd
|
||||
|
||||
####在Arch distribution中安装VSFTPD:####
|
||||
####在Arch 中安装VSFTPD:####
|
||||
|
||||
你可以使用如下命令在命令行界面中快捷的安装VSFTPD:
|
||||
|
||||
@ -52,41 +52,41 @@ VSFTPD是一个自称为最安全的FTP服务端软件。事实上VSFTPD的前
|
||||
|
||||
write_enable=YES
|
||||
|
||||
**允许本地用户登陆:**
|
||||
**允许本地(系统)用户登录:**
|
||||
|
||||
为了允许文件/etc/passwd中记录的用户可以登陆ftp服务,“local_enable”标记必须设置为YES。
|
||||
为了允许文件/etc/passwd中记录的用户可以登录ftp服务,“local_enable”标记必须设置为YES。
|
||||
|
||||
local_enable=YES
|
||||
|
||||
**匿名用户登陆**
|
||||
**匿名用户登录**
|
||||
|
||||
下面配置内容控制匿名用户是否允许登陆:
|
||||
下面配置内容控制匿名用户是否允许登录:
|
||||
|
||||
# Allow anonymous login
|
||||
# 允许匿名用户登录
|
||||
anonymous_enable=YES
|
||||
# No password is required for an anonymous login (Optional)
|
||||
no_anon_password=YES
|
||||
# Maximum transfer rate for an anonymous client in Bytes/second (Optional)
|
||||
# 匿名登录不需要密码(可选)
|
||||
no_anon_password=YES
|
||||
# 匿名登录的最大传输速率,Bytes/second(可选)
|
||||
anon_max_rate=30000
|
||||
# Directory to be used for an anonymous login (Optional)
|
||||
# 匿名登录的目录(可选)
|
||||
anon_root=/example/directory/
|
||||
|
||||
**根目录限制(Chroot Jail)**
|
||||
|
||||
(译者注:chroot jail是类unix系统中的一种安全机制,用于修改进程运行的根目录环境,限制该线程不能感知到其根目录树以外的其他目录结构和文件的存在。详情参看[chroot jail][4])
|
||||
( LCTT 译注:chroot jail是类unix系统中的一种安全机制,用于修改进程运行的根目录环境,限制该线程不能感知到其根目录树以外的其他目录结构和文件的存在。详情参看[chroot jail][4])
|
||||
|
||||
有时我们需要设置根目录(chroot)环境来禁止用户离开他们的家(home)目录。在配置文件中增加/修改下面配置开启根目录限制(Chroot Jail):
|
||||
|
||||
chroot_list_enable=YES
|
||||
chroot_list_file=/etc/vsftpd.chroot_list
|
||||
|
||||
“chroot_list_file”变量指定根目录监狱所包含的文件/目录(译者注:即用户只能访问这些文件/目录)
|
||||
“chroot\_list\_file”变量指定根目录限制所包含的文件/目录( LCTT 译注:即用户只能访问这些文件/目录)
|
||||
|
||||
最后你必须重启ftp服务,在命令行中输入以下命令:
|
||||
|
||||
sudo systemctl restart vsftpd
|
||||
|
||||
到此为止,你的ftp服务已经搭建完成并且启动了
|
||||
到此为止,你的ftp服务已经搭建完成并且启动了。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -94,7 +94,7 @@ via: http://itsfoss.com/set-ftp-server-linux/
|
||||
|
||||
作者:[alimiracle][a]
|
||||
译者:[cvsher](https://github.com/cvsher)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -0,0 +1,174 @@
|
||||
如何在 Arch Linux 中安装 DNSCrypt 和 Unbound
|
||||
================================================================================
|
||||
|
||||
**DNSCrypt** 是一个用于对 DNS 客户端和 DNS 解析器之间通信进行加密和验证的协议。它可以阻止 DNS 欺骗或中间人攻击。 DNSCrypt 可用于大多数的操作系统,包括 Linux,Windows,MacOSX ,Android 和 iOS。而在本教程中我使用的是内核为4.1的 archlinux。
|
||||
|
||||
**Unbound** 是用来解析收到的任意 DNS 查询的 DNS 缓存服务器。如果用户请求一个新的查询,unbound 会将其存储到缓存中,并且当用户再次请求相同的请求时,unbound 将采用已经保存的缓存。这将比第一次请求查询更快。
|
||||
|
||||
现在我将尝试安装“DNSCrypt”,以确保 DNS 的通信的安全,并用“Unbound”加速。
|
||||
|
||||
### 第一步 - 安装 yaourt ###
|
||||
|
||||
Yaourt 是AUR(ARCH 用户仓库)的辅助工具之一,它可以使用户能够很容易地从 AUR 安装程序。 Yaourt 和 pacman 使用相同的语法,你可以使用 yaourt 安装该程序。下面是安装 yaourt 的简单方法:
|
||||
|
||||
1、 用 nano 或者 vi 编辑 arch 仓库配置文件,存放在“/etc/pacman.conf”中。
|
||||
|
||||
$ nano /etc/pacman.conf
|
||||
|
||||
2、 在 yaourt 仓库底部添加,粘贴下面的脚本:
|
||||
|
||||
[archlinuxfr]
|
||||
SigLevel = Never
|
||||
Server = http://repo.archlinux.fr/$arch
|
||||
|
||||
3、 用“Ctrl + x”,接着用“Y”保存。
|
||||
|
||||
4、 接着升级仓库数据库并用pacman安装yaourt:
|
||||
|
||||
$ sudo pacman -Sy yaourt
|
||||
|
||||
### 第二步 - 安装 DNSCrypt 和 Unbound ###
|
||||
|
||||
DNSCrypt 和 unbound 就在 archlinux 仓库中,你可以用下面的 pacman 命令安装:
|
||||
|
||||
$ sudo pacman -S dnscrypt-proxy unbound
|
||||
|
||||
接着在安装的过程中按下“Y”。
|
||||
|
||||
### 第三步 - 安装 dnscrypt-autoinstall ###
|
||||
|
||||
Dnscrypt-autoinstall 是一个在基于 Linux 的系统上自动安装和配置 DNSCrypt 的脚本。DNSCrypt 在 AUR 中,因此你必须使用“yaourt”命令来安装它。
|
||||
|
||||
$ yaourt -S dnscrypt-autoinstall
|
||||
|
||||
注意 :
|
||||
|
||||
-S = 这和 pacman -S 安装程序一样。
|
||||
|
||||
### 第四步 - 运行 dnscrypt-autoinstall ###
|
||||
|
||||
用 root 权限运行“dnscrypt-autoinstall”来自动配置 DNSCrypt。
|
||||
|
||||
$ sudo dnscrypt-autoinstall
|
||||
|
||||
下一步中按下“回车”,接着输入"Y"来选择你想使用的 DNS 提供者,我这里使用不带日志和 DNSSEC 的 DNSCrypt.eu。
|
||||
|
||||

|
||||
|
||||
### 第五步 - 配置 DNSCrypt 和 Unbound ###
|
||||
|
||||
1、 打开 dnscrypt 的“/etc/conf.d/dnscrypt-config” ,确认配置文件中“DNSCRYPT_LOCALIP”指向**本地ip**,“DNSCRYPT_LOCALPORT”根据你本人的意愿配置,我是用的是**40**端口。
|
||||
|
||||
$ nano /etc/conf.d/dnscrypt-config
|
||||
|
||||
DNSCRYPT_LOCALIP=127.0.0.1
|
||||
DNSCRYPT_LOCALIP2=127.0.0.2
|
||||
DNSCRYPT_LOCALPORT=40
|
||||
|
||||

|
||||
|
||||
保存并退出。
|
||||
|
||||
2、 现在你用 nano 编辑器编辑“/etc/unbound/”下 unbound 的配置文件:
|
||||
|
||||
$ nano /etc/unbound/unbound.conf
|
||||
|
||||
3、 在脚本最后添加下面的行:
|
||||
|
||||
do-not-query-localhost: no
|
||||
forward-zone:
|
||||
name: "."
|
||||
forward-addr: 127.0.0.1@40
|
||||
|
||||
确保**forward-addr**和DNSCrypt中的“**DNSCRYPT_LOCALPORT**”一致。如你所见,用的是**40**端口。
|
||||
|
||||

|
||||
|
||||
接着保存并退出。
|
||||
|
||||
### 第六步 - 运行 DNSCrypt 和 Unbound,接着添加到开机启动中 ###
|
||||
|
||||
请用 root 权限运行 DNSCrypt 和 unbound,你可以用 systemctl 命令来运行:
|
||||
|
||||
$ sudo systemctl start dnscrypt-proxy unbound
|
||||
|
||||
将服务添加到启动中。你可以运行“systemctl enable”:
|
||||
|
||||
$ sudo systemctl enable dnscrypt-proxy unbound
|
||||
|
||||
命令将会创建软链接到“/usr/lib/systemd/system/”目录的服务。
|
||||
|
||||
### 第七步 - 配置 resolv.conf 并重启所有服务 ###
|
||||
|
||||
resolv.conf 是一个在 linux 中用于配置 DNS 解析器的文件。它是一个由管理员创建的纯文本,因此你必须用 root 权限编辑并让它不能被其他人修改。
|
||||
|
||||
用 nano 编辑器编辑:
|
||||
|
||||
$ nano /etc/resolv.conf
|
||||
|
||||
并添加本地IP “**127.0.0.1**”。现在用“chattr”命令使他只读:
|
||||
|
||||
$ chattr +i /etc/resolv.conf
|
||||
|
||||
注意:
|
||||
|
||||
如果你想要重新编辑,用“chattr -i /etc/resolv.conf”加入写权限。
|
||||
|
||||
现在你需要重启 DNSCrypt 和 unbound 和网络;
|
||||
|
||||
$ sudo systemctl restart dnscrypt-proxy unbound netctl
|
||||
|
||||
如果你看到错误,检查配置文件。
|
||||
|
||||
### 测试 ###
|
||||
|
||||
1、 测试 DNSCrypt
|
||||
|
||||
你可以通过 https://dnsleaktest.com/ 来确认 DNSCrypt,点击“标准测试”或者“扩展测试”,然后等待程序运行结束。
|
||||
|
||||
现在你可以看到 DNSCrypt.eu 就已经与作为 DNS 提供商的 DNSCrypt 协同工作了。
|
||||
|
||||

|
||||
|
||||
|
||||
2、 测试 Unbound
|
||||
|
||||
现在你应该确保 unbound 可以正确地与“dig”和“drill”命令一起工作。
|
||||
|
||||
这是 dig 命令的结果:
|
||||
|
||||
$ dig linoxide.com
|
||||
|
||||
我们现在看下结果,“Query time”是“533 msec”:
|
||||
|
||||
;; Query time: 533 msec
|
||||
;; SERVER: 127.0.0.1#53(127.0.0.1)
|
||||
;; WHEN: Sun Aug 30 14:48:19 WIB 2015
|
||||
;; MSG SIZE rcvd: 188
|
||||
|
||||
再次输入命令,我们看到“Query time”是“0 msec”。
|
||||
|
||||
;; Query time: 0 msec
|
||||
;; SERVER: 127.0.0.1#53(127.0.0.1)
|
||||
;; WHEN: Sun Aug 30 14:51:05 WIB 2015
|
||||
;; MSG SIZE rcvd: 188
|
||||
|
||||

|
||||
|
||||
DNSCrypt 对 DNS 客户端和解析端之间的通讯加密做的很好,并且 Unbound 通过缓存让相同的请求在另一次请求同速度更快。
|
||||
|
||||
### 总结 ###
|
||||
|
||||
DNSCrypt 是一个可以加密 DNS 客户端和 DNS 解析器之间的数据流的协议。 DNSCrypt 可以在不同的操作系统上运行,无论是移动端或桌面端。选择 DNS 提供商还包括一些重要的事情,应选择那些提供 DNSSEC 同时没有日志的。Unbound 可被用作 DNS 缓存,从而加快解析过程,因为 Unbound 将请求缓存,那么接下来客户端请求相同的查询时,unbound 将从缓存中取出保存的值。 DNSCrypt 和 Unbound 是针对安全性和速度的一个强大的组合。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://linoxide.com/tools/install-dnscrypt-unbound-archlinux/
|
||||
|
||||
作者:[Arul][a]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://linoxide.com/author/arulm/
|
@ -1,8 +1,9 @@
|
||||
如何在Ubuntu中安装QGit浏览器
|
||||
如何在 Ubuntu 中安装 QGit 客户端
|
||||
================================================================================
|
||||
QGit是一款Marco Costalba用Qt和C++写的开源GUI Git浏览器。它是一款在GUI环境下更好地提供浏览历史记录、提交记录和文件补丁的浏览器。它利用git命令行来执行并显示输出。它有一些常规的功能像浏览历史、比较、文件历史、文件标注、档案树。我们可以格式化并用选中的提交应用补丁,在两个实例之间拖拽并提交等等。它允许我们创建自定义的按钮来用它内置的生成器来执行特定的命令。
|
||||
|
||||
这里有简单的几步在Ubuntu 14.04 LTS "Trusty"中编译并安装QGit浏览器。
|
||||
QGit是一款由Marco Costalba用Qt和C++写的开源的图形界面 Git 客户端。它是一款可以在图形界面环境下更好地提供浏览版本历史、查看提交记录和文件补丁的客户端。它利用git命令行来执行并显示输出。它有一些常规的功能像浏览版本历史、比较、文件历史、文件标注、归档树。我们可以格式化并用选中的提交应用补丁,在两个或多个实例之间拖拽并提交等等。它允许我们用它内置的生成器来创建自定义的按钮去执行特定的命令。
|
||||
|
||||
这里有简单的几步在Ubuntu 14.04 LTS "Trusty"中编译并安装QGit客户端。
|
||||
|
||||
### 1. 安装 QT4 库 ###
|
||||
|
||||
@ -16,7 +17,7 @@ QGit是一款Marco Costalba用Qt和C++写的开源GUI Git浏览器。它是一
|
||||
|
||||
$ sudo apt-get install git
|
||||
|
||||
现在,我们要使用下面的git命令来克隆仓库。
|
||||
现在,我们要使用下面的git命令来克隆QGit客户端的仓库。
|
||||
|
||||
$ git clone git://repo.or.cz/qgit4/redivivus.git
|
||||
|
||||
@ -30,25 +31,25 @@ QGit是一款Marco Costalba用Qt和C++写的开源GUI Git浏览器。它是一
|
||||
|
||||
### 3. 编译 QGit ###
|
||||
|
||||
克隆之后,我们现在进入redivivus的目录,并创建我们编译需要的makefile文件。因此,要进入目录,我们要运行下面的命令。
|
||||
克隆之后,我们现在进入redivivus的目录,并创建我们编译需要的makefile文件。进入目录,运行下面的命令。
|
||||
|
||||
$ cd redivivus
|
||||
|
||||
接下来,我们运行下面的命令从qmake项目也就是qgit.pro来生成新的Makefile。
|
||||
接下来,我们运行下面的命令从qmake项目文件(qgit.pro)来生成新的Makefile。
|
||||
|
||||
$ qmake qgit.pro
|
||||
|
||||
生成Makefile之后,我们现在终于要编译qgit的源代码并得到二进制的输出。首先我们要安装make和g++包用于编译,因为这是一个用C++写的程序。
|
||||
生成Makefile之后,我们现在终于可以编译qgit的源代码并生成二进制。首先我们要安装make和g++包用于编译,因为这是一个用C++写的程序。
|
||||
|
||||
$ sudo apt-get install make g++
|
||||
|
||||
现在,我们要用make命令来编译代码了
|
||||
现在,我们要用make命令来编译代码了。
|
||||
|
||||
$ make
|
||||
|
||||
### 4. 安装 QGit ###
|
||||
|
||||
成功编译QGit的源码之后,我们就要在Ubuntu 14.04中安装它了,这样就可以在系统中执行它。因此我们将运行下面的命令、
|
||||
成功编译QGit的源码之后,我们就要在Ubuntu 14.04中安装它了,这样就可以在系统中执行它。因此我们将运行下面的命令。
|
||||
|
||||
$ sudo make install
|
||||
|
||||
@ -75,30 +76,30 @@ QGit是一款Marco Costalba用Qt和C++写的开源GUI Git浏览器。它是一
|
||||
|
||||
[Desktop Entry]
|
||||
Name=qgit
|
||||
GenericName=git GUI viewer
|
||||
GenericName=git 图形界面 viewer
|
||||
Exec=qgit
|
||||
Icon=qgit
|
||||
Type=Application
|
||||
Comment=git GUI viewer
|
||||
Comment=git 图形界面 viewer
|
||||
Terminal=false
|
||||
MimeType=inode/directory;
|
||||
Categories=Qt;Development;RevisionControl;
|
||||
|
||||
完成之后,保存并退出。
|
||||
|
||||
### 6. 运行 QGit 浏览器 ###
|
||||
### 6. 运行 QGit 客户端 ###
|
||||
|
||||
QGit安装完成之后,我们现在就可以从任何启动器或者程序菜单中启动它了。要在终端下面运行QGit,我们可以像下面那样。
|
||||
|
||||
$ qgit
|
||||
|
||||
这会打开基于Qt4框架GUI模式的QGit。
|
||||
这会打开基于Qt4框架图形界面模式的QGit。
|
||||
|
||||

|
||||
|
||||
### 总结 ###
|
||||
|
||||
QGit是一个很棒的基于QT的git浏览器。它可以在Linux、MAC OSX和 Microsoft Windows所有这三个平台中运行。它帮助我们很容易地浏览历史、版本、分支等等git仓库提供的信息。它减少了使用命令行的方式去执行诸如浏览版本、历史、比较功能的需求,并用图形化的方式来简化了这些任务。最新的qgit版本也在默认仓库中,你可以使用 **apt-get install qgit** 命令来安装。因此。qgit用它简单的GUI使得我们的工作更加简单和快速。
|
||||
QGit是一个很棒的基于QT的git客户端。它可以在Linux、MAC OSX和 Microsoft Windows所有这三个平台中运行。它帮助我们很容易地浏览历史、版本、分支等等git仓库提供的信息。它减少了使用命令行的方式去执行诸如浏览版本、历史、比较功能的需求,并用图形化的方式来简化了这些任务。最新的qgit版本也在默认仓库中,你可以使用 **apt-get install qgit** 命令来安装。因此,QGit用它简单的图形界面使得我们的工作更加简单和快速。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -106,7 +107,7 @@ via: http://linoxide.com/ubuntu-how-to/install-qgit-viewer-ubuntu-14-04/
|
||||
|
||||
作者:[Arun Pyasi][a]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,19 +1,21 @@
|
||||
使用tuptime工具查看Linux服务器系统历史开机时间统计
|
||||
使用 tuptime 工具查看 Linux 服务器系统的开机时间的历史和统计
|
||||
================================================================================
|
||||
你们可以使用下面的工具来查看Linux或者类Unix系统运行了多长时间:
|
||||
- uptime : 告诉你服务器运行了多长的时间。
|
||||
- lastt : 显示重启和关机时间。
|
||||
- tuptime : 报告系统的历史运行时间和统计运行时间,这是指重启之间的运行时间。和uptime命令类似,不过输出结果更有意思。
|
||||
|
||||
#### 找出系统上次重启时间和日期 ####
|
||||
你可以使用下面的工具来查看 Linux 或类 Unix 系统运行了多长时间:
|
||||
|
||||
- uptime : 告诉你服务器运行了多长的时间。
|
||||
- lastt : 显示重启和关机时间。
|
||||
- tuptime : 报告系统的运行时间历史和运行时间统计,这是指重启之间的运行时间。和 uptime 命令类似,不过输出结果更有意思。
|
||||
|
||||
### 找出系统上次重启时间和日期 ###
|
||||
|
||||
你[可以使用下面的命令来获取Linux操作系统的上次重启和关机时间及日期][1](在OSX/类Unix系统上也可以用):
|
||||
|
||||
## Just show system reboot and shutdown date and time ###
|
||||
### 显示系统重启和关机时间
|
||||
who -b
|
||||
last reboot
|
||||
last shutdown
|
||||
## Uptime info ##
|
||||
### 开机信息
|
||||
uptime
|
||||
cat /proc/uptime
|
||||
awk '{ print "up " $1 /60 " minutes"}' /proc/uptime
|
||||
@ -23,23 +25,24 @@
|
||||
|
||||

|
||||
|
||||
图像01:用于找出服务器开机时间的多个Linux命令
|
||||
*图01:用于找出服务器开机时间的多个Linux命令*
|
||||
|
||||
**跟tuptime问打个招呼吧**
|
||||
###跟 tuptime 问打个招呼吧###
|
||||
|
||||
tuptime 命令行工具可以报告基于 Linux 的系统上的下列信息:
|
||||
|
||||
tuptime命令行工具可以报告基于Linux的系统上的下列信息:
|
||||
1. 系统启动次数统计
|
||||
2. 注册首次启动时间(也就是安装时间)
|
||||
1. 正常关机和意外关机统计
|
||||
1. 平均开机时间和故障停机时间
|
||||
1. 当前开机时间
|
||||
1. 首次启动以来的开机和故障停机率
|
||||
1. 累积系统开机时间、故障停机时间和合计
|
||||
1. 报告每次启动、开机时间、关机和故障停机时间
|
||||
3. 正常关机和意外关机统计
|
||||
4. 平均开机时间和故障停机时间
|
||||
5. 当前开机时间
|
||||
6. 首次启动以来的开机和故障停机率
|
||||
7. 累积系统开机时间、故障停机时间和合计
|
||||
8. 报告每次启动、开机时间、关机和故障停机时间
|
||||
|
||||
#### 安装 ####
|
||||
|
||||
输入[下面的命令来克隆git仓库到Linux系统中][2]:
|
||||
输入[下面的命令来克隆 git 仓库到 Linux 系统中][2]:
|
||||
|
||||
$ cd /tmp
|
||||
$ git clone https://github.com/rfrail3/tuptime.git
|
||||
@ -51,17 +54,17 @@ tuptime命令行工具可以报告基于Linux的系统上的下列信息:
|
||||
|
||||

|
||||
|
||||
图像02:克隆git仓库
|
||||
*图02:克隆git仓库*
|
||||
|
||||
确保你随sys,optparse,os,re,string,sqlite3,datetime,disutils安装了Python v2.7和本地模块。
|
||||
确保你安装了带有 sys,optparse,os,re,string,sqlite3,datetime,disutils 和 locale 模块的 Python v2.7。
|
||||
|
||||
你可以像下面这样来安装:
|
||||
|
||||
$ sudo tuptime-install.sh
|
||||
|
||||
或者,可以手工安装(根据基于systemd或非systemd的Linux的推荐方法):
|
||||
或者,可以手工安装(基于 systemd 或非 systemd ):
|
||||
|
||||
$ sudo cp /tmp/tuptime/latest/cron.d/tuptime /etc/cron.d/tuptime
|
||||
$ sudo cp /tmp/tuptime/latest/cron.d/tuptime /etc/cron.d/tuptime
|
||||
|
||||
如果系统是systemd的,拷贝服务文件并启用:
|
||||
|
||||
@ -73,7 +76,7 @@ $ sudo cp /tmp/tuptime/latest/cron.d/tuptime /etc/cron.d/tuptime
|
||||
$ sudo cp /tmp/tuptime/latest/init.d/tuptime.init.d-debian7 /etc/init.d/tuptime
|
||||
$ sudo update-rc.d tuptime defaults
|
||||
|
||||
**运行**
|
||||
####运行####
|
||||
|
||||
只需输入以下命令:
|
||||
|
||||
@ -83,9 +86,9 @@ $ sudo cp /tmp/tuptime/latest/cron.d/tuptime /etc/cron.d/tuptime
|
||||
|
||||

|
||||
|
||||
图像03:tuptime工作中
|
||||
*图03:tuptime工作中*
|
||||
|
||||
在更新内核后,我重启了系统,然后再次输入了同样的命令:
|
||||
在一次更新内核后,我重启了系统,然后再次输入了同样的命令:
|
||||
|
||||
$ sudo tuptime
|
||||
System startups: 2 since 03:52:16 PM 08/21/2015
|
||||
@ -142,7 +145,7 @@ via: http://www.cyberciti.biz/hardware/howto-see-historical-statistical-uptime-o
|
||||
|
||||
作者:Vivek Gite
|
||||
译者:[GOLinux](https://github.com/GOLinux)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,4 +1,4 @@
|
||||
开启Ubuntu系统自动升级
|
||||
开启 Ubuntu 系统自动升级
|
||||
================================================================================
|
||||
在学习如何开启Ubuntu系统自动升级之前,先解释下为什么需要自动升级。
|
||||
|
||||
@ -40,7 +40,7 @@ via: http://itsfoss.com/automatic-system-updates-ubuntu/
|
||||
|
||||
作者:[Abhishek][a]
|
||||
译者:[Vic020/VicYu](http://vicyu.net)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,16 +1,16 @@
|
||||
Linux 有问必答--如何找出哪个 CPU 内核正在运行进程
|
||||
Linux 有问必答:如何知道进程运行在哪个 CPU 内核上?
|
||||
================================================================================
|
||||
>问题:我有个 Linux 进程运行在多核处理器系统上。怎样才能找出哪个 CPU 内核正在运行该进程?
|
||||
|
||||
当你运行需要较高性能的 HPC 程序或非常消耗网络资源的程序在 [多核 NUMA 处理器上][1],CPU/memory 的亲和力是限度其发挥最大性能的重要因素之一。在同一 NUMA 节点上调整程序的亲和力可以减少远程内存访问。像英特尔 Sandy Bridge 处理器,该处理器有一个集成的 PCIe 控制器,要调整同一 NUMA 节点的网络 I/O 负载可以使用 网卡控制 PCI 和 CPU 亲和力。
|
||||
当你在 [多核 NUMA 处理器上][1]运行需要较高性能的 HPC(高性能计算)程序或非常消耗网络资源的程序时,CPU/memory 的亲和力是限度其发挥最大性能的重要因素之一。在同一 NUMA 节点上调度最相关的进程可以减少缓慢的远程内存访问。像英特尔 Sandy Bridge 处理器,该处理器有一个集成的 PCIe 控制器,你可以在同一 NUMA 节点上调度网络 I/O 负载(如网卡)来突破 PCI 到 CPU 亲和力限制。
|
||||
|
||||
由于性能优化和故障排除只是一部分,你可能想知道哪个 CPU 内核(或 NUMA 节点)被调度运行特定的进程。
|
||||
作为性能优化和故障排除的一部分,你可能想知道特定的进程被调度到哪个 CPU 内核(或 NUMA 节点)上运行。
|
||||
|
||||
这里有几种方法可以 **找出哪个 CPU 内核被调度来运行 给定的 Linux 进程或线程**。
|
||||
这里有几种方法可以 **找出哪个 CPU 内核被调度来运行给定的 Linux 进程或线程**。
|
||||
|
||||
### 方法一 ###
|
||||
|
||||
如果一个进程明确的被固定到 CPU 的特定内核,如使用 [taskset][2] 命令,你可以使用 taskset 命令找出被固定的 CPU 内核:
|
||||
如果一个进程使用 [taskset][2] 命令明确的被固定(pinned)到 CPU 的特定内核上,你可以使用 taskset 命令找出被固定的 CPU 内核:
|
||||
|
||||
$ taskset -c -p <pid>
|
||||
|
||||
@ -22,19 +22,18 @@ Linux 有问必答--如何找出哪个 CPU 内核正在运行进程
|
||||
|
||||
pid 5357's current affinity list: 5
|
||||
|
||||
输出显示这个过程被固定在 CPU 内核 5。
|
||||
输出显示这个过程被固定在 CPU 内核 5上。
|
||||
|
||||
但是,如果你没有明确固定进程到任何 CPU 内核,你会得到类似下面的亲和力列表。
|
||||
|
||||
pid 5357's current affinity list: 0-11
|
||||
|
||||
输出表明,该进程可能会被安排在从0到11中的任何一个 CPU 内核。在这种情况下,taskset 不会识别该进程当前被分配给哪个 CPU 内核,你应该使用如下所述的方法。
|
||||
输出表明该进程可能会被安排在从0到11中的任何一个 CPU 内核。在这种情况下,taskset 不能识别该进程当前被分配给哪个 CPU 内核,你应该使用如下所述的方法。
|
||||
|
||||
### 方法二 ###
|
||||
|
||||
ps 命令可以告诉你每个进程/线程目前分配到的 (在“PSR”列)CPU ID。
|
||||
|
||||
|
||||
$ ps -o pid,psr,comm -p <pid>
|
||||
|
||||
----------
|
||||
@ -42,7 +41,7 @@ ps 命令可以告诉你每个进程/线程目前分配到的 (在“PSR”列
|
||||
PID PSR COMMAND
|
||||
5357 10 prog
|
||||
|
||||
输出表示进程的 PID 为 5357(名为"prog")目前在CPU 内核 10 上运行着。如果该过程没有被固定,PSR 列可以保持随着时间变化,内核可能调度该进程到不同位置。
|
||||
输出表示进程的 PID 为 5357(名为"prog")目前在CPU 内核 10 上运行着。如果该过程没有被固定,PSR 列会根据内核可能调度该进程到不同内核而改变显示。
|
||||
|
||||
### 方法三 ###
|
||||
|
||||
@ -72,11 +71,11 @@ via: http://ask.xmodulo.com/cpu-core-process-is-running.html
|
||||
|
||||
作者:[Dan Nanni][a]
|
||||
译者:[strugglingyouth](https://github.com/strugglingyouth)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://ask.xmodulo.com/author/nanni
|
||||
[1]:http://xmodulo.com/identify-cpu-processor-architecture-linux.html
|
||||
[2]:http://xmodulo.com/run-program-process-specific-cpu-cores-linux.html
|
||||
[3]:http://ask.xmodulo.com/install-htop-centos-rhel.html
|
||||
[3]:https://linux.cn/article-3141-1.html
|
@ -1,16 +1,16 @@
|
||||
RHCSA 系列: 安装,配置及加固一个 Web 和 FTP 服务器 – Part 9
|
||||
RHCSA 系列(九): 安装、配置及加固一个 Web 和 FTP 服务器
|
||||
================================================================================
|
||||
Web 服务器(也被称为 HTTP 服务器)是在网络中将内容(最为常见的是网页,但也支持其他类型的文件)进行处理并传递给客户端的服务。
|
||||
Web 服务器(也被称为 HTTP 服务器)是在网络中将内容(最为常见的是网页,但也支持其他类型的文件)进行处理并传递给客户端的服务。
|
||||
|
||||
FTP 服务器是最为古老且最常使用的资源之一(即便到今天也是这样),在身份认证不是必须的情况下,它可使得在一个网络里文件对于客户端可用,因为 FTP 使用没有加密的用户名和密码。
|
||||
FTP 服务器是最为古老且最常使用的资源之一(即便到今天也是这样),在身份认证不是必须的情况下,它可通过客户端在一个网络访问文件,因为 FTP 使用没有加密的用户名和密码,所以有些情况下不需要验证也行。
|
||||
|
||||
在 RHEL 7 中可用的 web 服务器是版本号为 2.4 的 Apache HTTP 服务器。至于 FTP 服务器,我们将使用 Very Secure Ftp Daemon (又名 vsftpd) 来建立用 TLS 加固的连接。
|
||||
|
||||

|
||||
|
||||
RHCSA: 安装,配置及加固 Apache 和 FTP 服务器 – Part 9
|
||||
*RHCSA: 安装,配置及加固 Apache 和 FTP 服务器 – Part 9*
|
||||
|
||||
在这篇文章中,我们将解释如何在 RHEL 7 中安装,配置和加固 web 和 FTP 服务器。
|
||||
在这篇文章中,我们将解释如何在 RHEL 7 中安装、配置和加固 web 和 FTP 服务器。
|
||||
|
||||
### 安装 Apache 和 FTP 服务器 ###
|
||||
|
||||
@ -35,7 +35,7 @@ RHCSA: 安装,配置及加固 Apache 和 FTP 服务器 – Part 9
|
||||
|
||||

|
||||
|
||||
确认 Apache Web 服务器
|
||||
*确认 Apache Web 服务器*
|
||||
|
||||
对于 ftp 服务器,在确保它如期望中的那样工作之前,我们必须进一步地配置它,我们将在几分钟后来做这件事。
|
||||
|
||||
@ -43,7 +43,7 @@ RHCSA: 安装,配置及加固 Apache 和 FTP 服务器 – Part 9
|
||||
|
||||
Apache 的主要配置文件位于 `/etc/httpd/conf/httpd.conf` 中,但它可能依赖 `/etc/httpd/conf.d` 中的其他文件。
|
||||
|
||||
尽管默认的配置对于大多数的情形是充分的,熟悉描述在 [官方文档][1] 中的所有可用选项是一个不错的主意。
|
||||
尽管默认的配置对于大多数的情形都够用了,但熟悉在 [官方文档][1] 中介绍的所有可用选项是一个不错的主意。
|
||||
|
||||
同往常一样,在编辑主配置文件前先做一个备份:
|
||||
|
||||
@ -51,14 +51,14 @@ Apache 的主要配置文件位于 `/etc/httpd/conf/httpd.conf` 中,但它可
|
||||
|
||||
然后用你钟爱的文本编辑器打开它,并查找下面这些变量:
|
||||
|
||||
- ServerRoot: 服务器的配置,错误和日志文件保存的目录。
|
||||
- Listen: 通知 Apache 去监听特定的 IP 地址或端口。
|
||||
- Include: 允许包含其他配置文件,这个必须存在,否则,服务器将会崩溃。它恰好与 IncludeOptional 相反,假如特定的配置文件不存在,它将静默地忽略掉它们。
|
||||
- User 和 Group: 运行 httpd 服务的用户/组的名称。
|
||||
- DocumentRoot: Apache 为你的文档服务的目录。默认情况下,所有的请求将在这个目录中被获取,但符号链接和别名可能会被用于指向其他位置。
|
||||
- ServerName: 这个指令将设定用于识别它自身的主机名(或 IP 地址)和端口。
|
||||
- `ServerRoot`: 服务器的配置,错误和日志文件保存的目录。
|
||||
- `Listen`: 通知 Apache 去监听特定的 IP 地址或端口。
|
||||
- `Include`: 允许包含其他配置文件,要包含的文件必须存在,否则,服务器将会失败。它恰好与 IncludeOptional 相反,假如特定的配置文件不存在,它将静默地忽略掉它们。
|
||||
- `User` 和 `Group`: 运行 httpd 服务的用户/组的名称。
|
||||
- `DocumentRoot`: Apache 为你的文档所服务的目录。默认情况下,所有的请求将在这个目录中被获取,但符号链接和别名可能会被用于指向其他位置。
|
||||
- `ServerName`: 这个指令将设定用于识别它自身的主机名(或 IP 地址)和端口。
|
||||
|
||||
安全措施的第一步将包含创建一个特定的用户和组(如 tecmint/tecmint)来运行 web 服务器以及更改默认的端口为一个更高的端口(在这个例子中为 9000):
|
||||
安全措施的第一步将包含创建一个特定的用户和组(如 tecmint/tecmint)来运行 web 服务器,以及更改默认的端口为一个更高的端口(在这个例子中为 9000) (LCTT 译注:如果你的 Web 服务器对外公开提供服务,则不建议修改为非默认端口。):
|
||||
|
||||
ServerRoot "/etc/httpd"
|
||||
Listen 192.168.0.18:9000
|
||||
@ -75,47 +75,46 @@ Apache 的主要配置文件位于 `/etc/httpd/conf/httpd.conf` 中,但它可
|
||||
|
||||
# systemctl restart httpd
|
||||
|
||||
并别忘了在防火墙中开启新的端口(和禁用旧的端口):
|
||||
|
||||
并别忘了在防火墙中开启新的端口(并禁用旧的端口):
|
||||
|
||||
# firewall-cmd --zone=public --remove-port=80/tcp --permanent
|
||||
# firewall-cmd --zone=public --add-port=9000/tcp --permanent
|
||||
# firewall-cmd --reload
|
||||
|
||||
请注意,由于 SELinux 的策略,你只可使用如下命令所返回的端口来分配给 web 服务器。
|
||||
请注意,由于 SELinux 策略,你只能给给 web 服务器使用如下命令所返回的端口。
|
||||
|
||||
# semanage port -l | grep -w '^http_port_t'
|
||||
|
||||
假如你想使用另一个端口(如 TCP 端口 8100)来给 httpd 服务,你必须将它加到 SELinux 的端口上下文:
|
||||
假如你想让 httpd 服务使用另一个端口(如 TCP 端口 8100),你必须将它加到 SELinux 的端口上下文:
|
||||
|
||||
# semanage port -a -t http_port_t -p tcp 8100
|
||||
|
||||

|
||||
|
||||
添加 Apache 端口到 SELinux 策略
|
||||
*添加 Apache 端口到 SELinux 策略*
|
||||
|
||||
为了进一步加固你安装的 Apache,请遵循以下步骤:
|
||||
|
||||
1. 运行 Apache 的用户不应该拥有访问 shell 的能力:
|
||||
|
||||
# usermod -s /sbin/nologin tecmint
|
||||
# usermod -s /sbin/nologin tecmint
|
||||
|
||||
2. 禁用目录列表功能,为的是阻止浏览器展示一个未包含 index.html 文件的目录里的内容。
|
||||
2. 禁用目录列表功能,这是为了阻止浏览器展示一个未包含 index.html 文件的目录里的内容。
|
||||
|
||||
编辑 `/etc/httpd/conf/httpd.conf` (和虚拟主机的配置文件,假如有的话),并确保 Options 指令在顶级和目录块级别中(注:感觉这里我的翻译不对)都被设置为 None:
|
||||
编辑 `/etc/httpd/conf/httpd.conf` (以及虚拟主机的配置文件,假如有的话),并确保出现在顶层的和Directory 块中的 Options 指令都被设置为 None:
|
||||
|
||||
Options None
|
||||
Options None
|
||||
|
||||
3. 在 HTTP 回应中隐藏有关 web 服务器和操作系统的信息。像下面这样编辑文件 `/etc/httpd/conf/httpd.conf`:
|
||||
3. 在 HTTP 响应中隐藏有关 web 服务器和操作系统的信息。像下面这样编辑文件 `/etc/httpd/conf/httpd.conf`:
|
||||
|
||||
ServerTokens Prod
|
||||
ServerSignature Off
|
||||
ServerTokens Prod
|
||||
ServerSignature Off
|
||||
|
||||
现在,你已经做好了从 `/var/www/html` 目录开始服务内容的准备了。
|
||||
|
||||
### 配置并加固 FTP 服务器 ###
|
||||
|
||||
和 Apache 的情形类似, Vsftpd 的主配置文件 `(/etc/vsftpd/vsftpd.conf)` 带有详细的注释,且虽然对于大多数的应用实例,默认的配置应该足够了,但为了更有效率地操作 ftp 服务器,你应该开始熟悉相关的文档和 man 页 `(man vsftpd.conf)`(对于这点,再多的强调也不为过!)。
|
||||
和 Apache 的情形类似, Vsftpd 的主配置文件 `/etc/vsftpd/vsftpd.conf` 带有详细的注释,且虽然对于大多数的应用实例,默认的配置应该足够了,但为了更有效率地操作 ftp 服务器,你应该开始熟悉相关的文档和 man 页 `man vsftpd.conf`(对于这点,再多的强调也不为过!)。
|
||||
|
||||
在我们的示例中,使用了这些指令:
|
||||
|
||||
@ -135,7 +134,7 @@ Apache 的主要配置文件位于 `/etc/httpd/conf/httpd.conf` 中,但它可
|
||||
userlist_enable=YES
|
||||
tcp_wrappers=YES
|
||||
|
||||
通过使用 `chroot_local_user=YES`,(默认情况下)本地用户在登陆之后,将马上被置于一个位于用户家目录的 chroot 环境中(注:这里的翻译也不准确)。这意味着本地用户将不能访问除其家目录之外的任何文件。
|
||||
通过使用 `chroot_local_user=YES`,(默认情况下)本地用户在登录之后,将被限制在以用户的家目录为 chroot 监狱的环境中。这意味着本地用户将不能访问除其家目录之外的任何文件。
|
||||
|
||||
最后,为了让 ftp 能够在用户的家目录中读取文件,设置如下的 SELinux 布尔值:
|
||||
|
||||
@ -145,19 +144,19 @@ Apache 的主要配置文件位于 `/etc/httpd/conf/httpd.conf` 中,但它可
|
||||
|
||||

|
||||
|
||||
查看 FTP 连接
|
||||
*查看 FTP 连接*
|
||||
|
||||
注意, `/var/log/xferlog` 日志将会记录下载和上传的情况,这与上图的目录列表一致:
|
||||
|
||||

|
||||
|
||||
监视 FTP 的下载和上传情况
|
||||
*监视 FTP 的下载和上传情况*
|
||||
|
||||
另外请参考: [在 Linux 系统中使用 Trickle 来限制应用使用的 FTP 网络带宽][2]
|
||||
|
||||
### 总结 ###
|
||||
|
||||
在本教程中,我们解释了如何设置 web 和 ftp 服务器。由于这个主题的广泛性,涵盖这些话题的所有方面是不可能的(如虚拟网络主机)。因此,我推荐你也阅读这个网站中有关 [Apache][3] 的其他卓越的文章。
|
||||
在本教程中,我们解释了如何设置 web 和 ftp 服务器。由于这个主题的广泛性,涵盖这些话题的所有方面是不可能的(如虚拟主机)。因此,我推荐你也阅读这个网站中有关 [Apache][3] 的其他卓越的文章。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -165,11 +164,11 @@ via: http://www.tecmint.com/rhcsa-series-install-and-secure-apache-web-server-an
|
||||
|
||||
作者:[Gabriel Cánepa][a]
|
||||
译者:[FSSlc](https://github.com/FSSlc)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/gacanepa/
|
||||
[1]:http://httpd.apache.org/docs/2.4/
|
||||
[2]:http://www.tecmint.com/manage-and-limit-downloadupload-bandwidth-with-trickle-in-linux/
|
||||
[2]:https://linux.cn/article-5517-1.html
|
||||
[3]:http://www.google.com/cse?cx=partner-pub-2601749019656699:2173448976&ie=UTF-8&q=virtual+hosts&sa=Search&gws_rd=cr&ei=Dy9EVbb0IdHisASnroG4Bw#gsc.tab=0&gsc.q=apache
|
@ -0,0 +1,199 @@
|
||||
RHCSA 系列(九): Yum 包管理、Cron 自动任务计划和监控系统日志
|
||||
================================================================================
|
||||
|
||||
在这篇文章中,我们将回顾如何在 RHEL7 中安装,更新和删除软件包。我们还将介绍如何使用 cron 进行任务自动化,并完成如何查找和监控系统日志文件,以及为什么这些技能是系统管理员必备技能。
|
||||
|
||||

|
||||
|
||||
*RHCSA: Yum包管理、任务计划和系统监控 – Part 10*
|
||||
|
||||
### 使用yum 管理包 ###
|
||||
|
||||
要安装一个包以及所有尚未安装的依赖包,您可以使用:
|
||||
|
||||
# yum -y install package_name(s)
|
||||
|
||||
package_name(s) 需要是至少一个真实的软件包名
|
||||
|
||||
例如,安装 httpd 和 mlocate(按顺序),输入。
|
||||
|
||||
# yum -y install httpd mlocate
|
||||
|
||||
**注意**: 字符 y 表示绕过执行下载和安装前的确认提示。如果需要提示,你可以不用它。
|
||||
|
||||
默认情况下,yum 将安装与操作系统体系结构相匹配的包,除非通过在包名加入架构名。
|
||||
|
||||
例如,在 64 位系统上,`yum install package`将安装包的 x86_64 版本,而 `yum install package.x86`(如果有的话)将安装 32 位的。
|
||||
|
||||
有时,你想安装一个包,但不知道它的确切名称。`search all` 选项可以在当前启用的软件库中的包名称和包描述中搜索它,或者`search`选项可以在包名称中搜索。
|
||||
|
||||
比如,
|
||||
|
||||
# yum search log
|
||||
|
||||
将搜索安装的软件库中名字和摘要与该词(log)类似的软件,而
|
||||
|
||||
# yum search all log
|
||||
|
||||
也将在包描述和网址中寻找寻找相同的关键字。
|
||||
|
||||
一旦搜索返回包列表,您可能希望在安装前显示一些信息。这时 info 选项派上了用场:
|
||||
|
||||
# yum info logwatch
|
||||
|
||||

|
||||
|
||||
*搜索包信息*
|
||||
|
||||
您可以定期用以下命令检查更新:
|
||||
|
||||
# yum check-update
|
||||
|
||||
上述命令将返回可以更新的所有已安装的软件包。在下图所示的例子中,只有 rhel-7-server-rpms 有可用更新:
|
||||
|
||||

|
||||
|
||||
*检查包更新*
|
||||
|
||||
然后,您可以更新该包,
|
||||
|
||||
# yum update rhel-7-server-rpms
|
||||
|
||||
如果有几个包可以一同更新,可以使用 ` yum update` 一次性更新所有的包。
|
||||
|
||||
当你知道一个可执行文件的名称,如 ps2pdf,但不知道那个包提供了它?你可以通过 `yum whatprovides “*/[executable]”`找到:
|
||||
|
||||
# yum whatprovides “*/ps2pdf”
|
||||
|
||||

|
||||
|
||||
*查找文件属于哪个包*
|
||||
|
||||
当删除包时,你可以使用 `yum remove Package` ,很简单吧?Yum 是一个完整而强大的包管理器。
|
||||
|
||||
# yum remove httpd
|
||||
|
||||
- 参见: [20 个管理 RHEL 7 软件包的 Yum 命令][1]
|
||||
|
||||
### 文本式 RPM 工具 ###
|
||||
|
||||
RPM(又名 RPM 包管理器,原意是 RedHat 软件包管理器)也可用于安装或更新独立的`rpm`格式的软件包。
|
||||
|
||||
往往使用 `-Uvh` 表明如果这个包没有安装就安装它,如果已存在就尝试更新。这里`-U`表示更新、`-v`表示显示详细输出,用`-h`显示进度条。例如
|
||||
|
||||
# rpm -Uvh package.rpm
|
||||
|
||||
rpm 的另一个典型的使用方法是列出所有安装的软件包,
|
||||
|
||||
# rpm -qa
|
||||
|
||||

|
||||
|
||||
*查询所有包*
|
||||
|
||||
- 参见: [20 个管理 RHEL 7 软件包的 RPM 命令][2]
|
||||
|
||||
### 使用 Cron 调度任务 ###
|
||||
|
||||
Linux 和 UNIX 类操作系统包括一个称为 Cron 的工具,允许你周期性调度任务(即命令或 shell 脚本)。cron 会每分钟定时检查 /var/spool/cron 目录中有在 /etc/passwd 帐户文件中指定用户名的文件。
|
||||
|
||||
执行命令时,命令输出是发送到该 crontab 的所有者(或者可以在 /etc/crontab,通过 MAILTO 环境变量中指定用户)。
|
||||
|
||||
crontab 文件(可以通过键入 `crontab -e`并按 Enter 键创建)的格式如下:
|
||||
|
||||

|
||||
|
||||
*crontab条目*
|
||||
|
||||
因此,如果我们想在每个月第二天上午2:15更新本地文件数据库(用于按名字或通配模式定位文件),我们需要添加以下 crontab 条目:
|
||||
|
||||
15 02 2 * * /bin/updatedb
|
||||
|
||||
以上的条目的意思是:”每年每月第二天的凌晨 2:15 运行 /bin/updatedb,无论是周几”,我想你也猜到了。星号作为通配符。
|
||||
|
||||
正如我们前面所提到的,添加一个 cron 任务后,你可以看到一个名为 root 的文件被添加在 /var/spool/cron。该文件列出了所有的 crond 守护进程应该运行的任务:
|
||||
|
||||
# ls -l /var/spool/cron
|
||||
|
||||

|
||||
|
||||
*检查所有cron任务*
|
||||
|
||||
在上图中,显示当前用户的 crontab 可以使用 `cat /var/spool/cron` 或
|
||||
|
||||
# crontab -l
|
||||
|
||||
如果你需要在一个更精细的时间上运行的任务(例如,一天两次或每月三次),cron 也可以做到。
|
||||
|
||||
例如,每个月1号和15号运行 /my/script 并将输出导出到 /dev/null (丢弃输出),您可以添加如下两个crontab 条目:
|
||||
|
||||
01 00 1 * * /myscript > /dev/null 2>&1
|
||||
01 00 15 * * /my/script > /dev/null 2>&1
|
||||
|
||||
不过为了简单,你可以将他们合并:
|
||||
|
||||
01 00 1,15 * * /my/script > /dev/null 2>&1
|
||||
|
||||
跟着前面的例子,我们可以在每三个月的第一天的凌晨1:30运行 /my/other/script。
|
||||
|
||||
30 01 1 1,4,7,10 * /my/other/script > /dev/null 2>&1
|
||||
|
||||
但是当你必须每隔某分钟、小时、天或月来重复某个任务时,你可以通过所需的频率来划分正确的时间。以下与前一个 crontab 条目具有相同的意义:
|
||||
|
||||
30 01 1 */3 * /my/other/script > /dev/null 2>&1
|
||||
|
||||
或者也许你需要在一个固定的频率或系统启动后运行某个固定的工作,你可以使用下列五个字符串中的一个字符串来指示你想让你的任务计划工作的确切时间:
|
||||
|
||||
@reboot 仅系统启动时运行
|
||||
@yearly 一年一次, 类似与 00 00 1 1 *
|
||||
@monthly 一月一次, 类似与 00 00 1 * *
|
||||
@weekly 一周一次, 类似与 00 00 * * 0
|
||||
@daily 一天一次, 类似与 00 00 * * *
|
||||
@hourly 一小时一次, 类似与 00 * * * *
|
||||
|
||||
- 参见:[11 个在 RHEL7 中调度任务的命令][3]
|
||||
|
||||
### 定位和查看日志###
|
||||
|
||||
系统日志存放(并轮转)在 /var/log 目录。根据 Linux 的文件系统层次标准(Linux Filesystem Hierarchy Standard),这个目录包括各种日志文件,并包含一些必要的子目录(如 audit、 httpd 或 samba ,如下图),并由相应的系统守护进程操作:
|
||||
|
||||
# ls /var/log
|
||||
|
||||

|
||||
|
||||
*Linux 日志的位置*
|
||||
|
||||
其他感兴趣的日志比如 [dmesg][4](包括了所有内核层缓冲区的消息),secure(记录要求用户认证的连接请求),messages(系统级信息),和 wtmp(记录了所有用户的登录、登出)。
|
||||
|
||||
日志是非常重要的,它们让你可以看到任何时刻发生在你的系统的事情,以及已经过去的事情。他们是无价的工具,可以排错和监测一个 Linux 服务器,通常使用 `tail -f` 命令来实时显示正在发生和写入日志的事件。
|
||||
|
||||
举个例子,如果你想看你的内核相关的日志,你需要输入如下命令:
|
||||
|
||||
# tail -f /var/log/dmesg
|
||||
|
||||
同样的,如果你想查看你的 Web 服务器日志,你需要输入如下命令:
|
||||
|
||||
# tail -f /var/log/httpd/access.log
|
||||
|
||||
### 总结 ###
|
||||
|
||||
如果你知道如何有效的管理包、调度任务、以及知道在哪寻找系统当前和过去操作的信息,你可以放松工作而不会总被吓到。我希望这篇文章能够帮你学习或回顾这些基础知识。
|
||||
|
||||
如果你有任何问题或意见,请使用下面的表单反馈给我们。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/yum-package-management-cron-job-scheduling-monitoring-linux-logs/
|
||||
|
||||
作者:[Gabriel Cánepa][a]
|
||||
译者:[xiqingongzi](https://github.com/xiqingongzi)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/gacanepa/
|
||||
[1]:http://www.tecmint.com/20-linux-yum-yellowdog-updater-modified-commands-for-package-mangement/
|
||||
[2]:http://www.tecmint.com/20-practical-examples-of-rpm-commands-in-linux/
|
||||
[3]:http://www.tecmint.com/11-cron-scheduling-task-examples-in-linux/
|
||||
[4]:http://www.tecmint.com/dmesg-commands/
|
||||
|
@ -0,0 +1,37 @@
|
||||
Red Hat CEO Optimistic on OpenStack Revenue Opportunity
|
||||
================================================================================
|
||||
Red Hat continues to accelerate its growth thanks to an evolving mix of platform and infrastructure technology revolving around Linux and the cloud. Red Hat announced its second quarter fiscal 2016 financial results on September 21, once again exceeding expectations.
|
||||
|
||||

|
||||
|
||||
For the quarter, Red Hat reported revenue of $504 million for a 13 percent year-over-year gain. Net Income was reported at $51 million, up from $47 Red Hatmillion in the second quarter of fiscal 2015. Looking forward, Red Hat provided some aggressive guidance for the coming quarter and the full year. For the third quarter, Red Hat provided guidance for revenue to be in the range of $519 million to $523 million, which is a 15 percent year-over-year gain.
|
||||
|
||||
On a full year basis, Red Hat's full year guidance is for fiscal 2016 revenue of $2.044 billion, for a 14 percent year-over-year gain.
|
||||
|
||||
Red Hat CFO Frank Calderoni commented during the earnings call that all of Red Hat's top 30 largest deals were approximately $1 million or more. He noted that Red Hat had four deals that were in excess of $5 million and one deal that was well over $10 million. As has been the case in recent years, cross selling across Red Hat products is strong with 65 percent of all deals including one or more components from Red Hat's group of application development and emerging technologies offerings.
|
||||
|
||||
"We expect the growing adoption of these technologies, like Middleware, the RHEL OpenStack platform, OpenShift, cloud management and storage, to continue to drive revenue growth," Calderoni said.
|
||||
|
||||
### OpenStack ###
|
||||
|
||||
During the earnings call, Red Hat CEO Jim Whitehurst was repeatedly asked about the revenue prospects for OpenStack. Whitehurst said that the recently released Red Hat OpenStack Platform 7.0 is a big jump forward thanks to the improved installer.
|
||||
|
||||
"It does a really good job of kind of identifying hardware and lighting it up," Whitehurst said. "Of course, that means there's a lot of work to do around certifying that hardware, making sure it lights up appropriately."
|
||||
|
||||
Whitehurst said that he's starting to see a lot more production application start to move to the OpenStack cloud. He cautioned however that it's still largely the early adopters moving to OpenStack in production and it isn't quite mainstream, yet.
|
||||
|
||||
From a competitive perspective, Whitehurst talked specifically about Microsoft, HP and Mirantis. In Whitehurst's view many organizations will continue to use multiple operating systems and if they choose Microsoft for one part, they are more likely to choose an open-source option,as the alternative option. Whitehurst said he doesn't see a lot of head-to-head competition against HP in cloud, but he does see Mirantis.
|
||||
|
||||
"We've had several wins or people who were moving away from Mirantis to RHEL," Whitehurst said.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.serverwatch.com/server-news/red-hat-ceo-optimistic-on-openstack-revenue-opportunity.html
|
||||
|
||||
作者:[Sean Michael Kerner][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.serverwatch.com/author/Sean-Michael-Kerner-101580.htm
|
@ -1,3 +1,5 @@
|
||||
alim0x translating
|
||||
|
||||
The history of Android
|
||||
================================================================================
|
||||

|
||||
@ -68,4 +70,4 @@ via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-histor
|
||||
[1]:http://arstechnica.com/gadgets/2011/05/hands-on-grooving-on-the-go-with-impressive-google-music-beta/
|
||||
[2]:http://cdn.arstechnica.net/wp-content/uploads/2014/02/32.png
|
||||
[a]:http://arstechnica.com/author/ronamadeo
|
||||
[t]:https://twitter.com/RonAmadeo
|
||||
[t]:https://twitter.com/RonAmadeo
|
||||
|
@ -1,84 +0,0 @@
|
||||
(translating by runningwater)
|
||||
Best command line tools for linux performance monitoring
|
||||
================================================================================
|
||||
Sometimes a system can be slow and many reasons can be the root cause. To identify the process that is consuming memory, disk I/O or processor capacity you need to use tools to see what is happening in an operation system.
|
||||
|
||||
There are many tools to monitor a GNU/Linux server. In this article, I am providing 7 monitoring tools and i hope it will help you.
|
||||
|
||||
###Htop
|
||||
Htop is an alternative of top command but it provides interactive system-monitor process-viewer and more user friendly output than top.
|
||||
|
||||
htop also provides a better way to navigate to any process using keyboard Up/Down keys as well as we can also operate it using mouse.
|
||||
|
||||
For Check our previous post:[How to install and use htop on RHEL/Centos and Fedora linux][1]
|
||||

|
||||
###dstat
|
||||
Dstat is a versatile replacement for vmstat, iostat, netstat and ifstat. Dstat overcomes some of their limitations and adds some extra features, more counters and flexibility. Dstat is handy for monitoring systems during performance tuning tests, benchmarks or troubleshooting.
|
||||
|
||||
Dstat allows you to view all of your system resources in real-time, you can eg. compare disk utilization in combination with interrupts from your IDE controller, or compare the network bandwidth numbers directly with the disk throughput (in the same interval).
|
||||
Dstat gives you detailed selective information in columns and clearly indicates in what magnitude and unit the output is displayed. Less confusion, less mistakes. And most importantly, it makes it very easy to write plugins to collect your own counters and extend in ways you never expected.
|
||||
|
||||
Dstat’s output by default is designed for being interpreted by humans in real-time, however you can export details to CSV output to a file to be imported later into Gnumeric or Excel to generate graphs.
|
||||
Check our previous post:[How to install and use dstat on RHEL/CentOS,Fedora and Debian/Ubuntu based distribution][2]
|
||||

|
||||
###Collectl
|
||||
Collectl is a light-weight performance monitoring tool capable of reporting interactively as well as logging to disk. It reports statistics on cpu, disk, infiniband, lustre, memory, network, nfs, process, quadrics, slabs and more in easy to read format.
|
||||
In this article i will show you how to install and sample usage Collectl on Debian/Ubuntu and RHEL/Centos and Fedora linux.
|
||||
|
||||
Check our previous post:[Collectl-Monitoring system resources][3]
|
||||

|
||||
|
||||
###Nmon
|
||||
nmon is a beutiful tool to monitor linux system performance. It works on Linux, IBM AIX Unix, Power,x86, amd64 and ARM based system such as Raspberry Pi. The nmon command displays and recordslocal system information. The command can run either in interactive or recording mode.
|
||||
|
||||
Check our previous post: [Nmon – linux monitoring tools][4]
|
||||

|
||||
###Saidar
|
||||
Saidar is a curses-based application to display system statistics. It use the libstatgrab library, which provides cross platform access to statistics about the system on which it’s run. Reported statistics includeCPU, load, processes, memory, swap, network input and output and disks activities along with their free space.
|
||||
|
||||
Check our previous post:[Saidar – system monitoring tool][5]
|
||||

|
||||
###Sar
|
||||
The sar utility, which is part of the systat package, can be used to review history performance data on your server. System resource utilization can be seen for given time frames to help troubleshoot performance issues, or to optimize performance.
|
||||
|
||||
Check our previous post:[Using Sar To Monitor System Performance][6]
|
||||

|
||||
|
||||
###Glances
|
||||
Glances is a cross-platform curses-based command line monitoring tool writen in Python which use the psutil library to grab informations from the system. Glance monitoring CPU, Load Average, Memory, Network Interfaces, Disk I/O, Processesand File System spaces utilization.
|
||||
|
||||
Glances can adapt dynamically the displayed information depending on the terminal siwrize. It can also work in a client/server mode for remote monitoring.
|
||||
|
||||
Check our previous post: [Glances – Real Time System Monitoring Tool for Linux][7]
|
||||

|
||||
|
||||
###Atop
|
||||
[Atop](http://www.atoptool.nl/) is an interactive monitor to view the load on a Linux system. It shows the occupation of the most critical hardware resources on system level, i.e. cpu, memory, disk and network. It also shows which processes are responsible for the indicated load with respect to cpu- and memory load on process level. Disk load is shown if per process “storage accounting” is active in the kernel or if the kernel patch ‘cnt’ has been installed. Network load is only shown per process if the kernel patch ‘cnt’ has been installed.
|
||||

|
||||
For more about Atop check next post:[Atop - monitor system resources in linux][8]
|
||||
So, if you come across any other similar tool then let us know in the comment box below.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://lintut.com/best-command-line-tools-for-linux-performance-monitring/
|
||||
|
||||
作者:[rasho][a]
|
||||
译者:[runningwater](https://github.com/runningwater)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:
|
||||
[1]:http://lintut.com/install-htop-in-rhel-centos-fedora-linux/
|
||||
[2]:http://lintut.com/dstat-linux-monitoring-tools/
|
||||
[3]:http://lintut.com/collectl-monitoring-system-resources/
|
||||
[4]:http://lintut.com/nmon-linux-monitoring-tools/
|
||||
[5]:http://lintut.com/saidar-system-monitoring-tool/
|
||||
[6]:http://lintut.com/using-sar-to-monitor-system-performance/
|
||||
[7]:http://lintut.com/glances-an-eye-on-your-system/
|
||||
[8]:http://lintut.com/atop-linux-system-resource-monitor/
|
@ -1,174 +0,0 @@
|
||||
How to Install DNSCrypt and Unbound in Arch Linux
|
||||
================================================================================
|
||||
**DNSCrypt** is a protocol that encrypt and authenticate communications between a DNS client and a DNS resolver. Prevent from DNS spoofing or man in the middle-attack. DNSCrypt are available for most operating system, including Linux, Windows, MacOSX android and iOS. And in this tutorial I'm using archlinux with kernel 4.1.
|
||||
|
||||
Unbound is a DNS cache server used to resolve any DNS query received. If the user requests a new query, then unbound will store it as a cache, and when the user requests the same query for the second time, then unbound would take from the cache that have been saved. This will be faster than the first request query.
|
||||
|
||||
And now I will try to install "DNSCrypt" to secure the dns communication, and make it faster with dns cache "Unbound".
|
||||
|
||||
### Step 1 - Install yaourt ###
|
||||
|
||||
Yaourt is one of AUR(Arch User Repository) helper that make archlinux users easy to install a program from AUR. Yaourt use same syntax as pacman, so you can install the program with yaourt. and this is easy way to install yaourt :
|
||||
|
||||
1. Edit the arch repository configuration file with nano or vi, stored in a file "/etc/pacman.conf".
|
||||
|
||||
$ nano /etc/pacman.conf
|
||||
|
||||
2. Add at the bottom line yaourt repository, just paste script below :
|
||||
|
||||
[archlinuxfr]
|
||||
SigLevel = Never
|
||||
Server = http://repo.archlinux.fr/$arch
|
||||
|
||||
3. Save it with press "Ctrl + x" and then "Y".
|
||||
|
||||
4. Now update the repository database and install yaourt with pacman command :
|
||||
|
||||
$ sudo pacman -Sy yaourt
|
||||
|
||||
### Step 2 - Install DNSCrypt and Unbound ###
|
||||
|
||||
DNSCrypt and unbound available on archlinux repository, then you can install it with pacman command :
|
||||
|
||||
$ sudo pacman -S dnscrypt-proxy unbound
|
||||
|
||||
wait it and press "Y" for proceed with installation.
|
||||
|
||||
### Step 3 - Install dnscrypt-autoinstall ###
|
||||
|
||||
Dnscrypt-autoinstall is A script for installing and automatically configuring DNSCrypt on Linux-based systems. Dnscrypt-autoinstall available in AUR(Arch User Repository), and you must use "yaourt" command to install it :
|
||||
|
||||
$ yaourt -S dnscrypt-autoinstall
|
||||
|
||||
Note :
|
||||
|
||||
-S = it is same as pacman -S to install a software/program.
|
||||
|
||||
### Step 4 - Run dnscrypt-autoinstall ###
|
||||
|
||||
run the command "dnscrypt-autoinstall" with root privileges to configure DNSCrypt automatically :
|
||||
|
||||
$ sudo dnscrypt-autoinstall
|
||||
|
||||
Press "Enter" for the next configuration, and then type "y" and choose the DNS provider you want to use, I'm here use DNSCrypt.eu featured with no logs and DNSSEC.
|
||||
|
||||

|
||||
|
||||
### Step 5 - Configure DNSCrypt and Unbound ###
|
||||
|
||||
1. Open the dnscrypt configuration file "/etc/conf.d/dnscrypt-config" and make sure the configuration of "DNSCRYPT_LOCALIP" point to **localhost IP**, and for port configuration "DNSCRYPT_LOCALPORT" it's up to you, I`m here use port **40**.
|
||||
|
||||
$ nano /etc/conf.d/dnscrypt-config
|
||||
|
||||
DNSCRYPT_LOCALIP=127.0.0.1
|
||||
DNSCRYPT_LOCALIP2=127.0.0.2
|
||||
DNSCRYPT_LOCALPORT=40
|
||||
|
||||

|
||||
|
||||
Save and exit.
|
||||
|
||||
2. Now you can edit unbound configuration in "/etc/unbound/". edit the file configuration with nano editor :
|
||||
|
||||
$ nano /etc/unbound/unbound.conf
|
||||
|
||||
3. Add the following script in the end of line :
|
||||
|
||||
do-not-query-localhost: no
|
||||
forward-zone:
|
||||
name: "."
|
||||
forward-addr: 127.0.0.1@40
|
||||
|
||||
Make sure the "**forward-addr**" port is same with "**DNSCRYPT_LOCALPORT**" configuration in DNSCrypt. You can see the I`m use port **40**.
|
||||
|
||||

|
||||
|
||||
and then save and exit.
|
||||
|
||||
### Step 6 - Run DNSCrypt and Unbound, then Add to startup/Boot ###
|
||||
|
||||
Please run DNSCrypt and unbound with root privileges, you can run with systemctl command :
|
||||
|
||||
$ sudo systemctl start dnscrypt-proxy unbound
|
||||
|
||||
Add the service at the boot time/startup. You can do it by running "systemctl enable" :
|
||||
|
||||
$ sudo systemctl enable dnscrypt-proxy unbound
|
||||
|
||||
the command will create the symlink of the service to "/usr/lib/systemd/system/" directory.
|
||||
|
||||
### Step 7 - Configure resolv.conf and restart all services ###
|
||||
|
||||
Resolv.conf is a file used by linux to configure Domain Name Server(DNS) resolver. it is just plain-text created by administrator, so you must edit by root privileges and make it immutable/no one can edit it.
|
||||
|
||||
Edit it with nano editor :
|
||||
|
||||
$ nano /etc/resolv.conf
|
||||
|
||||
and add the localhost IP "**127.0.0.1**". and now make it immutable with "chattr" command :
|
||||
|
||||
$ chattr +i /etc/resolv.conf
|
||||
|
||||
Note :
|
||||
|
||||
If you want to edit it again, make it writable with command "chattr -i /etc/resolv.conf".
|
||||
|
||||
Now yo need to restart the DNSCrypt, unbound and the network :
|
||||
|
||||
$ sudo systemctl restart dnscrypt-proxy unbound netctl
|
||||
|
||||
If you see the error, check your configuration file.
|
||||
|
||||
### Testing ###
|
||||
|
||||
1. Test DNSCrypt
|
||||
|
||||
You can be sure that DNSCrypt had acted correctly by visiting https://dnsleaktest.com/, then click on "Standard Test" or "Extended Test" and wait the process running.
|
||||
|
||||
And now you can see that DNSCrypt is working with DNSCrypt.eu as your DNS provider.
|
||||
|
||||

|
||||
|
||||
And now you can see that DNSCrypt is working with DNSCrypt.eu as your DNS provider.
|
||||
|
||||
2. Test Unbound
|
||||
|
||||
Now you should ensure that the unbound is working correctly with "dig" or "drill" command.
|
||||
|
||||
This is the results for dig command :
|
||||
|
||||
$ dig linoxide.com
|
||||
|
||||
Now see in the results, the "Query time" is "533 msec" :
|
||||
|
||||
;; Query time: 533 msec
|
||||
;; SERVER: 127.0.0.1#53(127.0.0.1)
|
||||
;; WHEN: Sun Aug 30 14:48:19 WIB 2015
|
||||
;; MSG SIZE rcvd: 188
|
||||
|
||||
and try again with the same command. And you will see the "Query time" is "0 msec".
|
||||
|
||||
;; Query time: 0 msec
|
||||
;; SERVER: 127.0.0.1#53(127.0.0.1)
|
||||
;; WHEN: Sun Aug 30 14:51:05 WIB 2015
|
||||
;; MSG SIZE rcvd: 188
|
||||
|
||||

|
||||
|
||||
And in the end DNSCrypt secure communications between the DNS clients and DNS resolver is working perfectly, and then Unbound make it faster if there is the same request in another time by taking the cache that have been saved.
|
||||
|
||||
### Conclusion ###
|
||||
|
||||
DNSCrypt is a protocol that can encrypt data flow between the DNS client and DNS resolver. DNSCrypt can run on various operating systems, either mobile or desktop. Choose DNS provider also includes something important, choose which provide a DNSSEC and no logs. Unbound can be used as a DNS cache, thus speeding up the resolve process resolv, because Unbound will store a request as the cache, then when a client request same query in the next time, then unbound would take from the cache that have been saved. DNSCrypt and Unbound is a powerful combination for the safety and speed.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://linoxide.com/tools/install-dnscrypt-unbound-archlinux/
|
||||
|
||||
作者:[Arul][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://linoxide.com/author/arulm/
|
@ -1,250 +0,0 @@
|
||||
10 Useful Linux Command Line Tricks for Newbies – Part 2
|
||||
================================================================================
|
||||
I remember when I first started using Linux and I was used to the graphical interface of Windows, I truly hated the Linux terminal. Back then I was finding the commands hard to remember and proper use of each one of them. With time I realised the beauty, flexibility and usability of the Linux terminal and to be honest a day doesn’t pass without using. Today, I would like to share some useful tricks and tips for Linux new comers to ease their transition to Linux or simply help them learn something new (hopefully).
|
||||
|
||||

|
||||
|
||||
10 Linux Commandline Tricks – Part 2
|
||||
|
||||
- [5 Interesting Command Line Tips and Tricks in Linux – Part 1][1]
|
||||
- [5 Useful Commands to Manage Linux File Types – Part 3][2]
|
||||
|
||||
This article intends to show you some useful tricks how to use the Linux terminal like a pro with minimum amount of skills. All you need is a Linux terminal and some free time to test these commands.
|
||||
|
||||
### 1. Find the right command ###
|
||||
|
||||
Executing the right command can be vital for your system. However in Linux there are so many different command lines that they are often hard to remember. So how do you search for the right command you need? The answer is apropos. All you need to run is:
|
||||
|
||||
# apropos <description>
|
||||
|
||||
Where you should change the “description” with the actual description of the command you are looking for. Here is a good example:
|
||||
|
||||
# apropos "list directory"
|
||||
|
||||
dir (1) - list directory contents
|
||||
ls (1) - list directory contents
|
||||
ntfsls (8) - list directory contents on an NTFS filesystem
|
||||
vdir (1) - list directory contents
|
||||
|
||||
On the left you can see the commands and on the right their description.
|
||||
|
||||
### 2. Execute Previous Command ###
|
||||
|
||||
Many times you will need to execute the same command over and over again. While you can repeatedly press the Up key on your keyboard, you can use the history command instead. This command will list all commands you entered since you launched the terminal:
|
||||
|
||||
# history
|
||||
|
||||
1 fdisk -l
|
||||
2 apt-get install gnome-paint
|
||||
3 hostname tecmint.com
|
||||
4 hostnamectl tecmint.com
|
||||
5 man hostnamectl
|
||||
6 hostnamectl --set-hostname tecmint.com
|
||||
7 hostnamectl -set-hostname tecmint.com
|
||||
8 hostnamectl set-hostname tecmint.com
|
||||
9 mount -t "ntfs" -o
|
||||
10 fdisk -l
|
||||
11 mount -t ntfs-3g /dev/sda5 /mnt
|
||||
12 mount -t rw ntfs-3g /dev/sda5 /mnt
|
||||
13 mount -t -rw ntfs-3g /dev/sda5 /mnt
|
||||
14 mount -t ntfs-3g /dev/sda5 /mnt
|
||||
15 mount man
|
||||
16 man mount
|
||||
17 mount -t -o ntfs-3g /dev/sda5 /mnt
|
||||
18 mount -o ntfs-3g /dev/sda5 /mnt
|
||||
19 mount -ro ntfs-3g /dev/sda5 /mnt
|
||||
20 cd /mnt
|
||||
...
|
||||
|
||||
As you will see from the output above, you will receive a list of all commands that you have ran. On each line you have number indicating the row in which you have entered the command. You can recall that command by using:
|
||||
|
||||
!#
|
||||
|
||||
Where # should be changed with the actual number of the command. For better understanding, see the below example:
|
||||
|
||||
!501
|
||||
|
||||
Is equivalent to:
|
||||
|
||||
# history
|
||||
|
||||
### 3. Use midnight Commander ###
|
||||
|
||||
If you are not used to using commands such cd, cp, mv, rm than you can use the midnight command. It is an easy to use visual shell in which you can also use mouse:
|
||||
|
||||

|
||||
|
||||
Midnight Commander in Action
|
||||
|
||||
Thanks to the F1 – F12 keys, you can easy perform different tasks. Simply check the legend at the bottom. To select a file or folder click the “Insert” button.
|
||||
|
||||
In short the midnight command is called “mc“. To install mc on your system simply run:
|
||||
|
||||
$ sudo apt-get install mc [On Debian based systems]
|
||||
|
||||
----------
|
||||
|
||||
# yum install mc [On Fedora based systems]
|
||||
|
||||
Here is a simple example of using midnight commander. Open mc by simply typing:
|
||||
|
||||
# mc
|
||||
|
||||
Now use the TAB button to switch between windows – left and right. I have a LibreOffice file that I will move to “Software” folder:
|
||||
|
||||

|
||||
|
||||
Midnight Commander Move Files
|
||||
|
||||
To move the file in the new directory press F6 button on your keyboard. MC will now ask you for confirmation:
|
||||
|
||||

|
||||
|
||||
Move Files to New Directory
|
||||
|
||||
Once confirmed, the file will be moved in the new destination directory.
|
||||
|
||||
Read More: [How to Use Midnight Commander File Manager in Linux][4]
|
||||
|
||||
### 4. Shutdown Computer at Specific Time ###
|
||||
|
||||
Sometimes you will need to shutdown your computer some hours after your work hours have ended. You can configure your computer to shut down at specific time by using:
|
||||
|
||||
$ sudo shutdown 21:00
|
||||
|
||||
This will tell your computer to shut down at the specific time you have provided. You can also tell the system to shutdown after specific amount of minutes:
|
||||
|
||||
$ sudo shutdown +15
|
||||
|
||||
That way the system will shut down in 15 minutes.
|
||||
|
||||
### 5. Show Information about Known Users ###
|
||||
|
||||
You can use a simple command to list your Linux system users and some basic information about them. Simply use:
|
||||
|
||||
# lslogins
|
||||
|
||||
This should bring you the following output:
|
||||
|
||||
UID USER PWD-LOCK PWD-DENY LAST-LOGIN GECOS
|
||||
0 root 0 0 Apr29/11:35 root
|
||||
1 bin 0 1 bin
|
||||
2 daemon 0 1 daemon
|
||||
3 adm 0 1 adm
|
||||
4 lp 0 1 lp
|
||||
5 sync 0 1 sync
|
||||
6 shutdown 0 1 Jul19/10:04 shutdown
|
||||
7 halt 0 1 halt
|
||||
8 mail 0 1 mail
|
||||
10 uucp 0 1 uucp
|
||||
11 operator 0 1 operator
|
||||
12 games 0 1 games
|
||||
13 gopher 0 1 gopher
|
||||
14 ftp 0 1 FTP User
|
||||
23 squid 0 1
|
||||
25 named 0 1 Named
|
||||
27 mysql 0 1 MySQL Server
|
||||
47 mailnull 0 1
|
||||
48 apache 0 1 Apache
|
||||
...
|
||||
|
||||
### 6. Search for Files ###
|
||||
|
||||
Searching for files can sometimes be not as easy as you think. A good example for searching for files is:
|
||||
|
||||
# find /home/user -type f
|
||||
|
||||
This command will search for all files located in /home/user. The find command is extremely powerful one and you can pass more options to it to make your search even more detailed. If you want to search for files larger than given size, you can use:
|
||||
|
||||
# find . -type f -size 10M
|
||||
|
||||
The above command will search from current directory for all files that are larger than 10 MB. Make sure not to run the command from the root directory of your Linux system as this may cause high I/O on your machine.
|
||||
|
||||
One of the most frequently used combinations that I use find with is “exec” option, which basically allows you to run some actions on the results of the find command.
|
||||
|
||||
For example, lets say that we want to find all files in a directory and change their permissions. This can be easily done with:
|
||||
|
||||
# find /home/user/files/ -type f -exec chmod 644 {} \;
|
||||
|
||||
The above command will search for all files in the specified directory recursively and will executed chmod command on the found files. I am sure you will find many more uses on this command in future, for now read [35 Examples of Linux ‘find’ Command and Usage][5].
|
||||
|
||||
### 7. Build Directory Trees with one Command ###
|
||||
|
||||
You probably know that you can create new directories by using the mkdir command. So if you want to create a new folder you will run something like this:
|
||||
|
||||
# mkdir new_folder
|
||||
|
||||
But what, if you want to create 5 subfolders within that folder? Running mkdir 5 times in a row is not a good solution. Instead you can use -p option like that:
|
||||
|
||||
# mkdir -p new_folder/{folder_1,folder_2,folder_3,folder_4,folder_5}
|
||||
|
||||
In the end you should have 5 folders located in new_folder:
|
||||
|
||||
# ls new_folder/
|
||||
|
||||
folder_1 folder_2 folder_3 folder_4 folder_5
|
||||
|
||||
### 8. Copy File into Multiple Directories ###
|
||||
|
||||
File copying is usually performed with the cp command. Copying a file usually looks like this:
|
||||
|
||||
# cp /path-to-file/my_file.txt /path-to-new-directory/
|
||||
|
||||
Now imagine that you need to copy that file in multiple directories:
|
||||
|
||||
# cp /home/user/my_file.txt /home/user/1
|
||||
# cp /home/user/my_file.txt /home/user/2
|
||||
# cp /home/user/my_file.txt /home/user/3
|
||||
|
||||
This is a bit absurd. Instead you can solve the problem with a simple one line command:
|
||||
|
||||
# echo /home/user/1/ /home/user/2/ /home/user/3/ | xargs -n 1 cp /home/user/my_file.txt
|
||||
|
||||
### 9. Deleting Larger Files ###
|
||||
|
||||
Sometimes files can grow extremely large. I have seen cases where a single log file went over 250 GB large due to poor administrating skills. Removing the file with rm utility might not be sufficient in such cases due to the fact that there is extremely large amount of data that needs to be removed. The operation will be a “heavy” one and should be avoided. Instead, you can go with a really simple solution:
|
||||
|
||||
# > /path-to-file/huge_file.log
|
||||
|
||||
Where of course you will need to change the path and the file names with the exact ones to match your case. The above command will simply write an empty output to the file. In more simpler words it will empty the file without causing high I/O on your system.
|
||||
|
||||
### 10. Run Same Command on Multiple Linux Servers ###
|
||||
|
||||
Recently one of our readers asked in our [LinuxSay forum][6], how to execute single command to multiple Linux boxes at once using SSH. He had his machines IP addresses looking like this:
|
||||
|
||||
10.0.0.1
|
||||
10.0.0.2
|
||||
10.0.0.3
|
||||
10.0.0.4
|
||||
10.0.0.5
|
||||
|
||||
So here is a simple solution of this issue. Collect the IP addresses of the servers in a one file called list.txt one under other just as shown above. Then you can run:
|
||||
|
||||
# for in $i(cat list.txt); do ssh user@$i 'bash command'; done
|
||||
|
||||
In the above example you will need to change “user” with the actual user with which you will be logging and “bash command” with the actual bash command you wish to execute. The method is better working when you are [using passwordless authentication with SSH key][7] to your machines as that way you will not need to enter the password for your user over and over again.
|
||||
|
||||
Note that you may need to pass some additional parameters to the SSH command depending on your Linux boxes setup.
|
||||
|
||||
### Conclusion ###
|
||||
|
||||
The above examples are really simple ones and I hope they have helped you to find some of the beauty of Linux and how you can easily perform different operations that can take much more time on other operating systems.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/10-useful-linux-command-line-tricks-for-newbies/
|
||||
|
||||
作者:[Marin Todorov][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/marintodorov89/
|
||||
[1]:http://www.tecmint.com/5-linux-command-line-tricks/
|
||||
[2]:http://www.tecmint.com/manage-file-types-and-set-system-time-in-linux/
|
||||
[3]:http://www.tecmint.com/history-command-examples/
|
||||
[4]:http://www.tecmint.com/midnight-commander-a-console-based-file-manager-for-linux/
|
||||
[5]:http://www.tecmint.com/35-practical-examples-of-linux-find-command/
|
||||
[6]:http://www.linuxsay.com/
|
||||
[7]:http://www.tecmint.com/ssh-passwordless-login-using-ssh-keygen-in-5-easy-steps/
|
@ -1,280 +0,0 @@
|
||||
ictlyh Translating
|
||||
5 Useful Commands to Manage File Types and System Time in Linux – Part 3
|
||||
================================================================================
|
||||
Adapting to using the command line or terminal can be very hard for beginners who want to learn Linux. Because the terminal gives more control over a Linux system than GUIs programs, one has to get a used to running commands on the terminal. Therefore to memorize different commands in Linux, you should use the terminal on a daily basis to understand how commands are used with different options and arguments.
|
||||
|
||||

|
||||
|
||||
Manage File Types and Set Time in Linux – Part 3
|
||||
|
||||
Please go through our previous parts of this [Linux Tricks][1] series.
|
||||
|
||||
- [5 Interesting Command Line Tips and Tricks in Linux – Part 1][2]
|
||||
- [ Useful Commandline Tricks for Newbies – Part 2][3]
|
||||
|
||||
In this article, we are going to look at some tips and tricks of using 10 commands to work with files and time on the terminal.
|
||||
|
||||
### File Types in Linux ###
|
||||
|
||||
In Linux, everything is considered as a file, your devices, directories and regular files are all considered as files.
|
||||
|
||||
There are different types of files in a Linux system:
|
||||
|
||||
- Regular files which may include commands, documents, music files, movies, images, archives and so on.
|
||||
- Device files: which are used by the system to access your hardware components.
|
||||
|
||||
There are two types of device files block files that represent storage devices such as harddisks, they read data in blocks and character files read data in a character by character manner.
|
||||
|
||||
- Hardlinks and softlinks: they are used to access files from any where on a Linux filesystem.
|
||||
- Named pipes and sockets: allow different processes to communicate with each other.
|
||||
|
||||
#### 1. Determining the type of a file using ‘file’ command ####
|
||||
|
||||
You can determine the type of a file by using the file command as follows. The screenshot below shows different examples of using the file command to determine the types of different files.
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ dir
|
||||
BACKUP master.zip
|
||||
crossroads-stable.tar.gz num.txt
|
||||
EDWARD-MAYA-2011-2012-NEW-REMIX.mp3 reggea.xspf
|
||||
Linux-Security-Optimization-Book.gif tmp-link
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ file BACKUP/
|
||||
BACKUP/: directory
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ file master.zip
|
||||
master.zip: Zip archive data, at least v1.0 to extract
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ file crossroads-stable.tar.gz
|
||||
crossroads-stable.tar.gz: gzip compressed data, from Unix, last modified: Tue Apr 5 15:15:20 2011
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ file Linux-Security-Optimization-Book.gif
|
||||
Linux-Security-Optimization-Book.gif: GIF image data, version 89a, 200 x 259
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ file EDWARD-MAYA-2011-2012-NEW-REMIX.mp3
|
||||
EDWARD-MAYA-2011-2012-NEW-REMIX.mp3: Audio file with ID3 version 2.3.0, contains: MPEG ADTS, layer III, v1, 192 kbps, 44.1 kHz, JntStereo
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ file /dev/sda1
|
||||
/dev/sda1: block special
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ file /dev/tty1
|
||||
/dev/tty1: character special
|
||||
|
||||
#### 2. Determining the file type using ‘ls’ and ‘dir’ commands ####
|
||||
|
||||
Another way of determining the type of a file is by performing a long listing using the ls and [dir][4] commands.
|
||||
|
||||
Using ls -l to determine the type of a file.
|
||||
|
||||
When you view the file permissions, the first character shows the file type and the other charcters show the file permissions.
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ ls -l
|
||||
total 6908
|
||||
drwxr-xr-x 2 tecmint tecmint 4096 Sep 9 11:46 BACKUP
|
||||
-rw-r--r-- 1 tecmint tecmint 1075620 Sep 9 11:47 crossroads-stable.tar.gz
|
||||
-rwxr----- 1 tecmint tecmint 5916085 Sep 9 11:49 EDWARD-MAYA-2011-2012-NEW-REMIX.mp3
|
||||
-rw-r--r-- 1 tecmint tecmint 42122 Sep 9 11:49 Linux-Security-Optimization-Book.gif
|
||||
-rw-r--r-- 1 tecmint tecmint 17627 Sep 9 11:46 master.zip
|
||||
-rw-r--r-- 1 tecmint tecmint 5 Sep 9 11:48 num.txt
|
||||
-rw-r--r-- 1 tecmint tecmint 0 Sep 9 11:46 reggea.xspf
|
||||
-rw-r--r-- 1 tecmint tecmint 5 Sep 9 11:47 tmp-link
|
||||
|
||||
Using ls -l to determine block and character files.
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ ls -l /dev/sda1
|
||||
brw-rw---- 1 root disk 8, 1 Sep 9 10:53 /dev/sda1
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ ls -l /dev/tty1
|
||||
crw-rw---- 1 root tty 4, 1 Sep 9 10:54 /dev/tty1
|
||||
|
||||
Using dir -l to determine the type of a file.
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ dir -l
|
||||
total 6908
|
||||
drwxr-xr-x 2 tecmint tecmint 4096 Sep 9 11:46 BACKUP
|
||||
-rw-r--r-- 1 tecmint tecmint 1075620 Sep 9 11:47 crossroads-stable.tar.gz
|
||||
-rwxr----- 1 tecmint tecmint 5916085 Sep 9 11:49 EDWARD-MAYA-2011-2012-NEW-REMIX.mp3
|
||||
-rw-r--r-- 1 tecmint tecmint 42122 Sep 9 11:49 Linux-Security-Optimization-Book.gif
|
||||
-rw-r--r-- 1 tecmint tecmint 17627 Sep 9 11:46 master.zip
|
||||
-rw-r--r-- 1 tecmint tecmint 5 Sep 9 11:48 num.txt
|
||||
-rw-r--r-- 1 tecmint tecmint 0 Sep 9 11:46 reggea.xspf
|
||||
-rw-r--r-- 1 tecmint tecmint 5 Sep 9 11:47 tmp-link
|
||||
|
||||
#### 3. Counting number of files of a specific type ####
|
||||
|
||||
Next we shall look at tips on counting number of files of a specific type in a given directory using the ls, [grep][5] and [wc][6] commands. Communication between the commands is achieved through named piping.
|
||||
|
||||
- grep – command to search according to a given pattern or regular expression.
|
||||
- wc – command to count lines, words and characters.
|
||||
|
||||
Counting number of regular files
|
||||
|
||||
In Linux, regular files are represented by the `–` symbol.
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ ls -l | grep ^- | wc -l
|
||||
7
|
||||
|
||||
**Counting number of directories**
|
||||
|
||||
In Linux, directories are represented by the `d` symbol.
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ ls -l | grep ^d | wc -l
|
||||
1
|
||||
|
||||
**Counting number of symbolic and hard links**
|
||||
|
||||
In Linux, symblic and hard links are represented by the l symbol.
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ ls -l | grep ^l | wc -l
|
||||
0
|
||||
|
||||
**Counting number of block and character files**
|
||||
|
||||
In Linux, block and character files are represented by the `b` and `c` symbols respectively.
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ ls -l /dev | grep ^b | wc -l
|
||||
37
|
||||
tecmint@tecmint ~/Linux-Tricks $ ls -l /dev | grep ^c | wc -l
|
||||
159
|
||||
|
||||
#### 4. Finding files on a Linux system ####
|
||||
|
||||
Next we shall look at some commands one can use to find files on a Linux system, these include the locate, find, whatis and which commands.
|
||||
|
||||
**Using the locate command to find files**
|
||||
|
||||
In the output below, I am trying to locate the [Samba server configuration][7] for my system.
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ locate samba.conf
|
||||
/usr/lib/tmpfiles.d/samba.conf
|
||||
/var/lib/dpkg/info/samba.conffiles
|
||||
|
||||
**Using the find command to find files**
|
||||
|
||||
To learn how to use the find command in Linux, you can read our following article that shows more than 30+ practical examples and usage of find command in Linux.
|
||||
|
||||
- [35 Examples of ‘find’ Command in Linux][8]
|
||||
|
||||
**Using the whatis command to locate commands**
|
||||
|
||||
The whatis command is mostly used to locate commands and it is special because it gives information about a command, it also finds configurations files and manual entries for a command.
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ whatis bash
|
||||
bash (1) - GNU Bourne-Again SHell
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ whatis find
|
||||
find (1) - search for files in a directory hierarchy
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ whatis ls
|
||||
ls (1) - list directory contents
|
||||
|
||||
**Using which command to locate commands**
|
||||
|
||||
The which command is used to locate commands on the filesystem.
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ which mkdir
|
||||
/bin/mkdir
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ which bash
|
||||
/bin/bash
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ which find
|
||||
/usr/bin/find
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ $ which ls
|
||||
/bin/ls
|
||||
|
||||
#### 5. Working with time on your Linux system ####
|
||||
|
||||
When working in a networked environment, it is a good practice to keep the correct time on your Linux system. There are certain services on Linux systems that require correct time to work efficiently on a network.
|
||||
|
||||
We shall look at commands you can use to manage time on your machine. In Linux, time is managed in two ways: system time and hardware time.
|
||||
|
||||
The system time is managed by a system clock and the hardware time is managed by a hardware clock.
|
||||
|
||||
To view your system time, date and timezone, use the date command as follows.
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ date
|
||||
Wed Sep 9 12:25:40 IST 2015
|
||||
|
||||
Set your system time using date -s or date –set=”STRING” as follows.
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ sudo date -s "12:27:00"
|
||||
Wed Sep 9 12:27:00 IST 2015
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ sudo date --set="12:27:00"
|
||||
Wed Sep 9 12:27:00 IST 2015
|
||||
|
||||
You can also set time and date as follows.
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ sudo date 090912302015
|
||||
Wed Sep 9 12:30:00 IST 2015
|
||||
|
||||
Viewing current date from a calendar using cal command.
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ cal
|
||||
September 2015
|
||||
Su Mo Tu We Th Fr Sa
|
||||
1 2 3 4 5
|
||||
6 7 8 9 10 11 12
|
||||
13 14 15 16 17 18 19
|
||||
20 21 22 23 24 25 26
|
||||
27 28 29 30
|
||||
|
||||
View hardware clock time using the hwclock command.
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ sudo hwclock
|
||||
Wednesday 09 September 2015 06:02:58 PM IST -0.200081 seconds
|
||||
|
||||
To set the hardware clock time, use hwclock –set –date=”STRING” as follows.
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ sudo hwclock --set --date="09/09/2015 12:33:00"
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ sudo hwclock
|
||||
Wednesday 09 September 2015 12:33:11 PM IST -0.891163 seconds
|
||||
|
||||
The system time is set by the hardware clock during booting and when the system is shutting down, the hardware time is reset to the system time.
|
||||
|
||||
Therefore when you view system time and hardware time, they are the same unless when you change the system time. Your hardware time may be incorrect when the CMOS battery is weak.
|
||||
|
||||
You can also set your system time using time from the hardware clock as follows.
|
||||
|
||||
$ sudo hwclock --hctosys
|
||||
|
||||
It is also possible to set hardware clock time using the system clock time as follows.
|
||||
|
||||
$ sudo hwclock --systohc
|
||||
|
||||
To view how long your Linux system has been running, use the uptime command.
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ uptime
|
||||
12:36:27 up 1:43, 2 users, load average: 1.39, 1.34, 1.45
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ uptime -p
|
||||
up 1 hour, 43 minutes
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ uptime -s
|
||||
2015-09-09 10:52:47
|
||||
|
||||
### Summary ###
|
||||
|
||||
Understanding file types is Linux is a good practice for begginers, and also managing time is critical especially on servers to manage services reliably and efficiently. Hope you find this guide helpful. If you have any additional information, do not forget to post a comment. Stay connected to Tecmint.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/manage-file-types-and-set-system-time-in-linux/
|
||||
|
||||
作者:[Aaron Kili][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/aaronkili/
|
||||
[1]:http://www.tecmint.com/tag/linux-tricks/
|
||||
[2]:http://www.tecmint.com/free-online-linux-learning-guide-for-beginners/
|
||||
[3]:http://www.tecmint.com/10-useful-linux-command-line-tricks-for-newbies/
|
||||
[4]:http://www.tecmint.com/linux-dir-command-usage-with-examples/
|
||||
[5]:http://www.tecmint.com/12-practical-examples-of-linux-grep-command/
|
||||
[6]:http://www.tecmint.com/wc-command-examples/
|
||||
[7]:http://www.tecmint.com/setup-samba-file-sharing-for-linux-windows-clients/
|
||||
[8]:http://www.tecmint.com/35-practical-examples-of-linux-find-command/
|
@ -1,89 +0,0 @@
|
||||
How to Setup IonCube Loaders on Ubuntu 14.04 / 15.04
|
||||
================================================================================
|
||||
IonCube Loaders is an encryption/decryption utility for PHP applications which assists in speeding up the pages that are served. It also protects your website's PHP code from being viewed and ran on unlicensed computers. Using ionCube encoded and secured PHP files requires a file called ionCube Loader to be installed on the web server and made available to PHP which is often required for a lot of PHP based applications. It handles the reading and execution of encoded files at run time. PHP can use the loader with one line added to a PHP configuration file that ‘php.ini’.
|
||||
|
||||
### Prerequisites ###
|
||||
|
||||
In this article we will setup the installation of Ioncube Loader on Ubuntu 14.04/15.04, so that it can be used in all PHP Modes. The only requirement for this tutorial is to have "php.ini" file exists in your system with LEMP stack installed on the server.
|
||||
|
||||
### Download IonCube Loader ###
|
||||
|
||||
Login to your ubuntu server to download the latest IonCube loader package according to your operating system architecture whether your are using a 32 Bit or 64 Bit OS. You can get its package by issuing the following command with super user privileges or root user.
|
||||
|
||||
# wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
|
||||
|
||||

|
||||
|
||||
After Downloading unpack the archive into the "/usr/local/src/" folder by issuing the following command.
|
||||
|
||||
# tar -zxvf ioncube_loaders_lin_x86-64.tar.gz -C /usr/local/src/
|
||||
|
||||

|
||||
|
||||
After extracting the archive, we can see the list of all modules present in it. But we needs only the relevant with the version of PHP installed on our system.
|
||||
|
||||
To check your PHP version, you can run the below command to find the relevant modules.
|
||||
|
||||
# php -v
|
||||
|
||||

|
||||
|
||||
With reference to the output of above command we came to know that the PHP version installed on the system is 5.6.4, so we need to copy the appropriate module to the PHP modules folder.
|
||||
|
||||
To do so we will create a new folder with name "ioncube" within the "/usr/local/" directory and copy the required ioncube loader modules into it.
|
||||
|
||||
root@ubuntu-15:/usr/local/src/ioncube# mkdir /usr/local/ioncube
|
||||
root@ubuntu-15:/usr/local/src/ioncube# cp ioncube_loader_lin_5.6.so ioncube_loader_lin_5.6_ts.so /usr/local/ioncube/
|
||||
|
||||
### PHP Configuration ###
|
||||
|
||||
Now we need to put the following line into the configuration file of PHP file "php.ini" which is located in "/etc/php5/cli/" folder then restart your web server’s services and php module.
|
||||
|
||||
# vim /etc/php5/cli/php.ini
|
||||
|
||||

|
||||
|
||||
In our scenario we have Nginx web server installed, so we will run the following commands to start its services.
|
||||
|
||||
# service php5-fpm restart
|
||||
# service nginx restart
|
||||
|
||||

|
||||
|
||||
### Testing IonCube Loader ###
|
||||
|
||||
To test the ioncube loader in the PHP configuration for your website, create a test file called "info.php" with the following content and place it into the web directory of your web server.
|
||||
|
||||
# vim /usr/share/nginx/html/info.php
|
||||
|
||||
Then save the changes after placing phpinfo script and access "info.php" in your browser with your domain name or server’s IP address after reloading the web server services.
|
||||
|
||||
You will be able to see the below section at the bottom of your php modules information.
|
||||
|
||||

|
||||
|
||||
From the terminal issue the following command to verify the php version that shows the ionCube PHP Loader is Enabled.
|
||||
|
||||
# php -v
|
||||
|
||||

|
||||
|
||||
The output shown in the PHP version's command clearly indicated that IonCube loader has been successfully integrated with PHP.
|
||||
|
||||
### Conclusion ###
|
||||
|
||||
At the end of this tutorial you learnt about the installation and configuration of ionCube Loader on Ubuntu with Nginx web server there will be no such difference if you are using any other web server. So, installing Loaders is simple when its done correctly, and on most servers its installation will work without a problem. However there is no such thing as a "standard PHP installation", and servers can be setup in many different ways, and with different features enabled or disabled.
|
||||
|
||||
If you are on a shared server, then make sure that you have run the ioncube-loader-helper.php script, and click the link to test run time installation. If you still face as such issue while doing your setup, feel free to contact us and leave us a comment.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://linoxide.com/ubuntu-how-to/setup-ioncube-loaders-ubuntu-14-04-15-04/
|
||||
|
||||
作者:[Kashif Siddique][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://linoxide.com/author/kashifs/
|
@ -0,0 +1,120 @@
|
||||
struggling 翻译中
|
||||
|
||||
HTTP/2 Now Fully Supported in NGINX Plus
|
||||
================================================================================
|
||||
Earlier this week we released [NGINX Plus R7][1] with support for HTTP/2. As the latest standard for the HTTP protocol, HTTP/2 is designed to bring increased performance and security to modern web applications.
|
||||
|
||||
The HTTP/2 implementation in NGINX Plus works seamlessly with existing sites and applications. Minimal changes are required, as NGINX Plus delivers HTTP/1.x and HTTP/2 traffic in parallel for the best experience, no matter what browser your users choose.
|
||||
|
||||
HTTP/2 support is available in the optional **nginx‑plus‑http2** package only. The **nginx‑plus** and **nginx‑plus‑extras** packages provide SPDY support and are currently recommended for production sites because of wider browser support and code maturity.
|
||||
|
||||
### Why Move to HTTP/2? ###
|
||||
|
||||
HTTP/2 makes data transfer more efficient and more secure for your applications. HTTP/2 adds five key features that improve performance when compared to HTTP/1.x:
|
||||
|
||||
- **True multiplexing** – HTTP/1.1 enforces strict in-order completion of requests that come in over a keepalive connection. A request must be satisfied before processing on the next one can begin. HTTP/2 eliminates this requirement and allows requests to be satisfied in parallel and out of order.
|
||||
- **Single, persistent connection** – As HTTP/2 allows for true multiplexing of requests, all objects on a web page can now be downloaded in parallel over a single connection. WIth HTTP/1.x, multiple connections are used to download resources in parallel, leading to inefficient use of the underlying TCP protocol.
|
||||
- **Binary encoding** – Header information is sent in compact, binary format, rather than plain text, saving bytes on the wire.
|
||||
- **Header compression** – Headers are compressed using a purpose-built algorithm, HPACK compression, which further reduces the amount of data crossing the network.
|
||||
- **SSL/TLS encryption** – With HTTP/2, SSL/TLS encryption is mandatory. This is not enforced in the [RFC][2], which allows for plain-text HTTP/2, but rather by all web browsers that currently implement HTTP/2. SSL/TLS makes your site more secure, and with all the performance improvements in HTTP/2, the performance penalty from encryption and decryption is mitigated.
|
||||
|
||||
To learn more about HTTP/2:
|
||||
|
||||
- Please read our [white paper][3], which covers everything you need to know about HTTP/2.
|
||||
- Download our [special edition of the High Performance Browser Networking ebook][4] by Ilya Grigorik of Google.
|
||||
|
||||
### How NGINX Plus Implements HTTP/2 ###
|
||||
|
||||
Our implementation of HTTP/2 is based on our support for SPDY, which is widely deployed (nearly 75% of websites that use SPDY use NGINX or NGINX Plus). With NGINX Plus, you can deploy HTTP/2 with very little change to your application infrastructure. This section discusses how NGINX Plus implements support for HTTP/2.
|
||||
|
||||
#### An HTTP/2 Gateway ####
|
||||
|
||||

|
||||
|
||||
NGINX Plus acts an HTTP/2 gateway. It talks HTTP/2 to client web browsers that support it, but translates HTTP/2 requests back to HTTP/1.x (or FastCGI, SCGI, uWSGI, etc. – whatever protocol you are currently using) for communication with back-end servers.
|
||||
|
||||
#### Backward Compatibility ####
|
||||
|
||||

|
||||
|
||||
For the foreseeable future you’ll need to support HTTP/2 and HTTP/1.x side by side. As of this writing, over 50% of users already run a web browser that [supports HTTP/2][5], but this also means almost 50% don’t.
|
||||
|
||||
To support both HTTP/1.x and HTTP/2 side by side, NGINX Plus implements the Next Protocol Negotiation (NPN) extension to TLS. When a web browser connects to a server, it sends a list of supported protocols to the server. If the browser includes h2 – that is, HTTP/2 – in the list of supported protocols, NGINX Plus uses HTTP/2 for connections to that browser. If the browser doesn’t implement NPN, or doesn’t send h2 in its list of supported protocols, NGINX Plus falls back to HTTP/1.x.
|
||||
|
||||
### Moving to HTTP/2 ###
|
||||
|
||||
NGINX, Inc. aims to make the transition to HTTP/2 as seamless as possible. This section goes through the changes that need to be made to enable HTTP/2 for your applications, which include just a few changes to the configuration of NGINX Plus.
|
||||
|
||||
#### Prerequisites ####
|
||||
|
||||
Upgrade to the NGINX Plus R7 **nginx‑plus‑http2** package. Note that an HTTP/2-enabled version of the **nginx‑plus‑extras** package is not available at this time.
|
||||
|
||||
#### Redirecting All Traffic to SSL/TLS ####
|
||||
|
||||
If your app is not already encrypted with SSL/TLS, now would be a good time to make that move. Encrypting your app protects you from spying as well as from man-in-the-middle attacks. Some search engines even reward encrypted sites with [improved rankings][6] in search results. The following configuration block redirects all plain HTTP requests to the encrypted version of the site.
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
location / {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
}
|
||||
|
||||
#### Enabling HTTP/2 ####
|
||||
|
||||
To enable HTTP/2 support, simply add the http2 parameter to all [listen][7] directives. Also include the ssl parameter, required because browsers do not support HTTP/2 without encryption.
|
||||
|
||||
server {
|
||||
listen 443 ssl http2 default_server;
|
||||
|
||||
ssl_certificate server.crt;
|
||||
ssl_certificate_key server.key;
|
||||
…
|
||||
}
|
||||
|
||||
If necessary, restart NGINX Plus, for example by running the nginx -s reload command. To verify that HTTP/2 translation is working, you can use the “HTTP/2 and SPDY indicator” plug-in available for [Google Chrome][8] and [Firefox][9].
|
||||
|
||||
### Caveats ###
|
||||
|
||||
- Before installing the **nginx‑plus‑http2** package, you must remove the spdy parameter on all listen directives in your configuration (replace it with the http2 and ssl parameters to enable support for HTTP/2). With this package, NGINX Plus fails to start if any listen directives have the spdy parameter.
|
||||
- If you are using a web application firewall (WAF) that is sitting in front of NGINX Plus, ensure that it is capable of parsing HTTP/2, or move it behind NGINX Plus.
|
||||
- The “Server Push” feature defined in the HTTP/2 RFC is not supported in this release. Future releases of NGINX Plus might include it.
|
||||
- NGINX Plus R7 supports both SPDY and HTTP/2. In a future release we will deprecate support for SPDY. Google is [deprecating SPDY][10] in early 2016, making it unnecessary to support both protocols at that point.
|
||||
- If [ssl_prefer_server_ciphers][11] is set to on and/or a list of [ssl_ciphers][12] that are defined in [Appendix A: TLS 1.2 Ciper Suite Black List][13] is used, the browser will experience handshake-errors and not work. Please refer to [section 9.2.2 of the HTTP/2 RFC][14] for more details.-
|
||||
|
||||
### Special Thanks ###
|
||||
|
||||
NGINX, Inc. would like to thank [Dropbox][15] and [Automattic][16], who are heavy users of our software and graciously cosponsored the development of our HTTP/2 implementation. Their contributions have helped accelerate our ability to bring this software to you, and we hope you are able to support them in turn.
|
||||
|
||||

|
||||
|
||||
[O'REILLY'S BOOK ABOUT HTTP/2 & PERFORMANCE TUNING][17]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.nginx.com/blog/http2-r7/
|
||||
|
||||
作者:[Faisal Memon][a]
|
||||
译者:[struggling](https://github.com/struggling)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.nginx.com/blog/author/fmemon/
|
||||
[1]:https://www.nginx.com/blog/nginx-plus-r7-released/
|
||||
[2]:https://tools.ietf.org/html/rfc7540
|
||||
[3]:https://www.nginx.com/wp-content/uploads/2015/09/NGINX_HTTP2_White_Paper_v4.pdf
|
||||
[4]:https://www.nginx.com/http2-ebook/
|
||||
[5]:http://caniuse.com/#feat=http2
|
||||
[6]:http://googlewebmastercentral.blogspot.co.uk/2014/08/https-as-ranking-signal.html
|
||||
[7]:http://nginx.org/en/docs/http/ngx_http_core_module.html#listen
|
||||
[8]:https://chrome.google.com/webstore/detail/http2-and-spdy-indicator/mpbpobfflnpcgagjijhmgnchggcjblin?hl=en
|
||||
[9]:https://addons.mozilla.org/en-us/firefox/addon/spdy-indicator/
|
||||
[10]:http://blog.chromium.org/2015/02/hello-http2-goodbye-spdy-http-is_9.html
|
||||
[11]:http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_prefer_server_ciphers
|
||||
[12]:http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_ciphers
|
||||
[13]:https://tools.ietf.org/html/rfc7540#appendix-A
|
||||
[14]:https://tools.ietf.org/html/rfc7540#section-9.2.2
|
||||
[15]:http://dropbox.com/
|
||||
[16]:http://automattic.com/
|
||||
[17]:https://www.nginx.com/http2-ebook/
|
@ -1,115 +1,113 @@
|
||||
Translating by KnightJoker
|
||||
Translated by KnightJoker
|
||||
|
||||
Learn with Linux: Master Your Math with These Linux Apps
|
||||
用Linux学习:使用这些Linux应用来征服你的数学
|
||||
================================================================================
|
||||

|
||||
|
||||
This article is part of the [Learn with Linux][1] series:
|
||||
这篇文章是[用Linux学习][1]系列的一部分:
|
||||
|
||||
- [Learn with Linux: Learning to Type][2]
|
||||
- [Learn with Linux: Physics Simulation][3]
|
||||
- [Learn with Linux: Learning Music][4]
|
||||
- [Learn with Linux: Two Geography Apps][5]
|
||||
- [Learn with Linux: Master Your Math with These Linux Apps][6]
|
||||
- [用Linux学习: 学习类型][2]
|
||||
- [用Linux学习: 物理模拟][3]
|
||||
- [用Linux学习: 学习音乐][4]
|
||||
- [用Linux学习: 两个地理应用程序][5]
|
||||
- [用Linux学习: 用这些Linux应用来征服你的数学][6]
|
||||
|
||||
Linux offers great educational software and many excellent tools to aid students of all grades and ages in learning and practicing a variety of topics, often interactively. The “Learn with Linux” series of articles offers an introduction to a variety of educational apps and software.
|
||||
|
||||
Mathematics is the core of computing. If one would expect a great operating system, such as GNU/Linux, to excel in and discipline, it would be Math. If you seek mathematical applications, you will not be disappointed. Linux offers many excellent tools that will make Mathematics look as intimidating as it ever did, but at least they will simplify your way of using it.
|
||||
Linux提供了大量的教育软件和许多优秀的工具来帮助所有年龄段的学生学习和练习各种各样的话题,常常以交互的方式。与Linux一起学习这一系列的文章则为这些各种各样的教育软件和应用提供了一个介绍。
|
||||
|
||||
数学是计算机的核心。如果有人用精益求精和纪律来预期一个伟大的操作系统,比如GNU/ Linux,那么这将是数学。如果你在寻求一些数学应用程序,那么你将不会感到失望。Linux提供了很多优秀的工具使得数学看起来和你曾经做过的一样令人畏惧,但实际上他们会简化你使用它的方式。
|
||||
### Gnuplot ###
|
||||
|
||||
Gnuplot is a command-line scriptable and versatile graphing utility for different platforms. Despite its name, it is not part of the GNU operating system. Although it is not freely licensed, it’s free-ware (meaning it’s copyrighted but free to use).
|
||||
|
||||
To install `gnuplot` on an Ubuntu (or derivative) system, type
|
||||
Gnuplot 是一个适用于不同平台的命令行脚本化和多功能的图形工具。尽管它的名字,并不是GNU操作系统的一部分。也没有免费授权,但它是免费软件(这意味着它受版权保护,但免费使用)。
|
||||
|
||||
要在Ubuntu系统(或者衍生系统)上安装 `gnuplot`,输入:
|
||||
sudo apt-get install gnuplot gnuplot-x11
|
||||
|
||||
into a terminal window. To start the program, type
|
||||
进入一个终端窗口。启动该程序,输入:
|
||||
|
||||
gnuplot
|
||||
|
||||
You will be presented with a simple command line interface
|
||||
你会看到一个简单的命令行界面:
|
||||
|
||||

|
||||
|
||||
into which you can start typing functions directly. The plot command will draw a graph.
|
||||
在其中您可以直接开始输入函数。绘图命令将绘制一个曲线图。
|
||||
|
||||
Typing, for instance,
|
||||
输入内容,例如,
|
||||
|
||||
plot sin(x)/x
|
||||
|
||||
into the `gnuplot` prompt, will open another window, wherein the graph is presented.
|
||||
随着`gnuplot的`提示,将会打开一个新的窗口,图像便会在里面呈现。
|
||||
|
||||

|
||||
|
||||
You can also set different attributes of the graphs in-line. For example, specifying “title” will give them just that.
|
||||
你也可以在线这个图设置不同的属性,比如像这样指定“title”
|
||||
|
||||
plot sin(x) title 'Sine Function', tan(x) title 'Tangent'
|
||||
|
||||

|
||||
|
||||
You can give things a bit more depth and draw 3D graphs with the `splot` command.
|
||||
使用`splot`命令,你可以给的东西更深入一点并且绘制3D图形
|
||||
|
||||
splot sin(x*y/20)
|
||||
|
||||

|
||||
|
||||
The plot window has a few basic configuration options,
|
||||
这个窗口有几个基本的配置选项,
|
||||
|
||||

|
||||
|
||||
but the true power of `gnuplot` lies within its command line and scripting capabilities. The extensive full documentation of `gnuplot` can be found [here][7] with a great tutorial for the previous version [on the Duke University’s website][8].
|
||||
但是`gnuplot`的真正力量在于在它的命令行和脚本功能,`gnuplot`广泛完整的文档可在这里找到,并在[Duke大学网站][8]上面看见这个了不起的教程[7]的原始版本。
|
||||
|
||||
### Maxima ###
|
||||
|
||||
[Maxima][9] is a computer algebra system developed from the original sources of Macsyma. According to its SourceForge page,
|
||||
[Maxima][9]是从Macsyma原始资料开发的一个计算机代数系统,根据它的 SourceForge 页面,
|
||||
|
||||
> “Maxima is a system for the manipulation of symbolic and numerical expressions, including differentiation, integration, Taylor series, Laplace transforms, ordinary differential equations, systems of linear equations, polynomials, sets, lists, vectors, matrices and tensors. Maxima yields high precision numerical results by using exact fractions, arbitrary-precision integers and variable-precision floating-point numbers. Maxima can plot functions and data in two and three dimensions.”
|
||||
> “Maxima是符号和数值的表达,包括微分,积分,泰勒级数,拉普拉斯变换,常微分方程,线性方程组,多项式,集合,列表,向量,矩阵和张量系统的操纵系统。Maxima通过精确的分数,任意精度的整数和可变精度浮点数产生高精度的计算结果。Maxima可以二维和三维中绘制函数和数据。“
|
||||
|
||||
You will have binary packages for Maxima in most Ubuntu derivatives as well as the Maxima graphical interface. To install them all, type
|
||||
你将会获得二进制包用于大多数Ubuntu衍生系统的Maxima以及它的图形界面中,插入所有包,输入:
|
||||
|
||||
sudo apt-get install maxima xmaxima wxmaxima
|
||||
|
||||
into a terminal window. Maxima is a command line utility with not much of a UI, but if you start `wxmaxima`, you’ll get into a simple, yet powerful GUI.
|
||||
在终端窗口中,Maxima是一个没有太多UI的命令行工具,但如果你开始wxmaxima,你会进入一个简单但功能强大的图形用户界面。
|
||||
|
||||

|
||||
|
||||
You can start using this by simply starting to type. (Hint: Enter will add more lines; if you want to evaluate an expression, use “Shift + Enter.”)
|
||||
你可以开始输入这个来简单的一个开始。(提示:如果你想计算一个表达式,使用“Shift + Enter”回车后会增加更多的方法)
|
||||
|
||||
Maxima can be used for very simple problems, as it also acts as a calculator,
|
||||
Maxima可以用于一些简单的问题,因此也可以作为一个计算器,
|
||||
|
||||

|
||||
|
||||
and much more complex ones as well.
|
||||
以及一些更复杂的问题,
|
||||
|
||||

|
||||
|
||||
It uses `gnuplot` to draw simple
|
||||
它使用`gnuplot`使得绘制简单,
|
||||
|
||||

|
||||
|
||||
and more elaborate graphs.
|
||||
或者绘制一些复杂的图形.
|
||||
|
||||

|
||||
|
||||
(It needs the `gnuplot-x11` package to display them.)
|
||||
(它需要gnuplot-X11的包,来显示它们。)
|
||||
|
||||
Besides beautifying the expressions, Maxima makes it possible to export them in latex format, or do some operations on the highlighted functions with a right-click context menu,
|
||||
除了美化一些图形,Maxima也尽可能用latex格式导出它们,或者通过右键是捷菜单进行一些突出的操作.
|
||||
|
||||

|
||||
|
||||
while its main menus offer an overwhelming amount of functionality. Of course, Maxima is capable of much more than this. It has an extensive documentation [available online][10].
|
||||
然而其主菜单还是提供了大量压倒性的功能,当然Maxima的功能远不止如此,这里也有一个广泛使用的在线文档。
|
||||
|
||||
### Conclusion ###
|
||||
|
||||
Mathematics is not an easy subject, and the excellent math software on Linux does not make it look easier, yet these applications make using Mathematics much more straightforward and productive. The above two applications are just an introduction to what Linux has to offer. If you are seriously engaged in math and need even more functionality with great documentation, you should check out the [Mathbuntu project][11].
|
||||
### 总结 ###
|
||||
|
||||
数学不是一个简单的学科,这些在Linux上的优秀软件也没有使得数学更加简单,但是这些应用使得使用数学变得更加的简单和工程化。以上两种应用都只是介绍一下Linux的所提供的。如果你是认真从事数学和需要更多的功能与丰富的文档,那你更应该看看这些Mathbuntu项目。
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.maketecheasier.com/learn-linux-maths/
|
||||
|
||||
作者:[Attila Orosz][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
译者:[KnightJoker](https://github.com/KnightJoker/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,3 +1,5 @@
|
||||
FSSlc translating
|
||||
|
||||
RHCSA Series: Setting Up LDAP-based Authentication in RHEL 7 – Part 14
|
||||
================================================================================
|
||||
We will begin this article by outlining some LDAP basics (what it is, where it is used and why) and show how to set up a LDAP server and configure a client to authenticate against it using Red Hat Enterprise Linux 7 systems.
|
||||
@ -272,4 +274,4 @@ via: http://www.tecmint.com/setup-ldap-server-and-configure-client-authenticatio
|
||||
[a]:http://www.tecmint.com/author/gacanepa/
|
||||
[1]:http://www.tecmint.com/automatic-rhel-installations-using-kickstart/
|
||||
[2]:http://www.tecmint.com/manage-services-using-systemd-and-systemctl-in-linux/
|
||||
[3]:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/ch-Directory_Servers.html
|
||||
[3]:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/ch-Directory_Servers.html
|
||||
|
@ -0,0 +1,86 @@
|
||||
Xenlism WildFire: 一个精美的 Linux 桌面版主题
|
||||
================================================================================
|
||||

|
||||
|
||||
有那么一段时间,我一直使用一个主题,没有更换过。可能是在最近的一段时间都没有一款主题能满足我的需求。有那么一些我认为是[Ubuntu 上最好的图标主题][1],比如 Numix 和 Moka,并且,我一直也对 Numix 比较满意。
|
||||
|
||||
但是,一段时间后,我使用了[Xenslim WildFire][2],并且我必须承认,他看起来太好了。Minimail 是当前比较流行的设计趋势。并且 Xenlism 完美的表现了它。平滑和美观。Xenlism 收到了诺基亚的 Meego 和苹果图标的影响。
|
||||
|
||||
让我们来看一下他的几个不同应用的图标:
|
||||
|
||||

|
||||
|
||||
文件夹图标看起来像这样:
|
||||
|
||||

|
||||
|
||||
主题开发者,[Nattapong Pullkhow][3], 说,这个图标主题最适合 GNOME,但是在 Unity 和 KDE,Mate 上也表现良好。
|
||||
|
||||
### 安装 Xenlism Wildfire ###
|
||||
|
||||
Xenlism Theme 大约有 230 MB, 对于一个主题来说确实很大,但是考虑到它支持的庞大的软件数量,这个大小,确实也不是那么令人吃惊。
|
||||
|
||||
#### 在 Ubuntu/Debian 上安装 Xenlism ####
|
||||
|
||||
在 Ubuntu 的变种中安装前,用以下的命令添加 GPG 秘钥:
|
||||
|
||||
sudo apt-key adv --keyserver keys.gnupg.net --recv-keys 90127F5B
|
||||
|
||||
添加完成之后,输入如下的命令进行安装:
|
||||
|
||||
echo "deb http://downloads.sourceforge.net/project/xenlism-wildfire/repo deb/" | sudo tee -a /etc/apt/sources.list
|
||||
sudo apt-get update
|
||||
sudo apt-get install xenlism-wildfire-icon-theme
|
||||
|
||||
除了主题之外,你也可以选择是否下载配套的桌面背景图:
|
||||
|
||||
sudo apt-get install xenlism-artwork-wallpapers
|
||||
|
||||
#### 在 Arch 上安装 Xenlism ####
|
||||
|
||||
你需要编辑 Pacman 软件仓库。在终端中使用如下命令:
|
||||
|
||||
sudo nano /etc/pacman.conf
|
||||
|
||||
添加如下的代码块,在配置文件中:
|
||||
|
||||
[xenlism-arch]
|
||||
SigLevel = Never
|
||||
Server = http://downloads.sourceforge.net/project/xenlism-wildfire/repo/arch
|
||||
|
||||
更新系统并且安装:
|
||||
|
||||
sudo pacman -Syyu
|
||||
sudo pacman -S xenlism-wildfire
|
||||
|
||||
#### 使用 Xenlism 主题 ####
|
||||
|
||||
在 Ubuntu Unity, [可以使用 Unity Tweak Tool 来改变主题][4]. In GNOME, [使用 Gnome Tweak Tool 改变主题][5]. 我确信你会接下来的步骤,如果你不会,请来信通知我,我会继续完善这篇文章。
|
||||
|
||||
这就是 Xenlism 在 Ubuntu 15.04 Unity 中的截图。同时也使用了 Xenlism 桌面背景。
|
||||
|
||||

|
||||
|
||||
这看来真棒,不是吗?如果你试用了,并且喜欢他,你可以感谢他的开发者:
|
||||
|
||||
> [Xenlism is a stunning minimal icon theme for Linux. Thanks @xenatt for this beautiful theme.][6]
|
||||
|
||||
我希望你喜欢他。同时也希望你分享你对这个主题的看法,或者你喜欢的主题。Xenlism 真的很棒,可能会替换掉你最喜欢的主题。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://itsfoss.com/xenlism-wildfire-theme/
|
||||
|
||||
作者:[Abhishek][a]
|
||||
译者:[MikeCoder](https://github.com/MikeCoder)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://itsfoss.com/author/abhishek/
|
||||
[1]:http://itsfoss.com/best-icon-themes-ubuntu-1404/
|
||||
[2]:http://xenlism.github.io/wildfire/
|
||||
[3]:https://plus.google.com/+NattapongPullkhow
|
||||
[4]:http://itsfoss.com/install-numix-ubuntu/
|
||||
[5]:http://itsfoss.com/install-switch-themes-gnome-shell/
|
||||
[6]:https://twitter.com/share?text=Xenlism+is+a+stunning+minimal+icon+theme+for+Linux.+Thanks+%40xenatt+for+this+beautiful+theme.&via=itsfoss&related=itsfoss&url=http://itsfoss.com/xenlism-wildfire-theme/
|
@ -1,183 +0,0 @@
|
||||
Mhddfs——将多个小分区合并成一个大的虚拟存储
|
||||
================================================================================
|
||||
|
||||
让我们假定你有30GB的电影,并且你有3个驱动器,每个的大小为20GB。那么,你会怎么来存放东西呢?
|
||||
|
||||
很明显,你可以将你的视频分割成2个或者3个不同的卷,并将它们手工存储到驱动器上。这当然不是一个好主意,它成了一项费力的工作,它需要你手工干预,而且花费你大量时间。
|
||||
|
||||
另外一个解决方案是创建一个[RAID磁盘阵列][1]。然而,RAID在缺乏存储可靠性,磁盘空间可用性差等方面声名狼藉。另外一个解决方案,就是mhddfs。
|
||||
|
||||

|
||||
Mhddfs——在Linux中合并多个分区
|
||||
|
||||
mhddfs是一个用于Linux的驱动,它可以将多个挂载点合并到一个虚拟磁盘中。它是一个基于FUSE的驱动,提供了一个用于大数据存储的简单解决方案。它将所有小文件系统合并,以创建一个单一的大虚拟文件系统,该文件系统包含其成员文件系统的所有颗粒,包括文件和空闲空间。
|
||||
|
||||
#### 你为什么需要Mhddfs? ####
|
||||
|
||||
你所有存储设备创建了一个单一的虚拟池,它可以在启动时被挂载。这个小工具可以智能地照看并处理哪个驱动器满了,哪个驱动器空着,将数据写到哪个驱动器中。当你成功创建虚拟驱动器后,你可以使用[SAMBA][2]来共享你的虚拟文件系统。你的客户端将在任何时候都看到一个巨大的驱动器和大量的空闲空间。
|
||||
|
||||
#### Mhddfs特性 ####
|
||||
|
||||
- 获取文件系统属性和系统信息。
|
||||
- 设置文件系统属性。
|
||||
- 创建、读取、移除和写入目录和文件。
|
||||
- 支持文件锁和单一设备上的硬链接。
|
||||
|
||||
注:表格
|
||||
<table cellspacing="0" border="0">
|
||||
<colgroup width="472"></colgroup>
|
||||
<colgroup width="491"></colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td height="29" align="center" style="border: 1px solid #000000;"><b><span style="color: black; font-size: large;">mhddfs的优点</span></b></td>
|
||||
<td align="center" style="border: 1px solid #000000;"><b><span style="color: black; font-size: large;">mhddfs的缺点</span></b></td>
|
||||
</tr>
|
||||
<tr class="alt">
|
||||
<td height="25" align="left" style="border: 1px solid #000000;"><span style="color: black; font-size: medium;"> 适合家庭用户</span></td>
|
||||
<td align="left" style="border: 1px solid #000000;"><span style="color: black; font-size: medium;">mhddfs驱动没有内建在Linux内核中 </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="25" align="left" style="border: 1px solid #000000;"><span style="color: black; font-size: medium;"> 运行简单</span></td>
|
||||
<td align="left" style="border: 1px solid #000000;"><span style="color: black; font-size: medium;"> 运行时需要大量处理能力</span></td>
|
||||
</tr>
|
||||
<tr class="alt">
|
||||
<td height="25" align="left" style="border: 1px solid #000000;"><span style="color: black; font-size: medium;"> 没有明显的数据丢失</span></td>
|
||||
<td align="left" style="border: 1px solid #000000;"><span style="color: black; font-size: medium;"> 没有冗余解决方案</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="25" align="left" style="border: 1px solid #000000;"><span style="color: black; font-size: medium;"> 不分割文件</span></td>
|
||||
<td align="left" style="border: 1px solid #000000;"><span style="color: black; font-size: medium;"> 不支持移动硬链接</span></td>
|
||||
</tr>
|
||||
<tr class="alt">
|
||||
<td height="25" align="left" style="border: 1px solid #000000;"><span style="color: black; font-size: medium;"> 添加新文件到合并的虚拟文件系统</span></td>
|
||||
<td align="left" style="border: 1px solid #000000;"><span style="font-size: medium;"> </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="25" align="left" style="border: 1px solid #000000;"><span style="color: black; font-size: medium;"> 管理文件保存的位置</span></td>
|
||||
<td align="left" style="border: 1px solid #000000;"><span style="font-size: medium;"> </span></td>
|
||||
</tr>
|
||||
<tr class="alt">
|
||||
<td height="25" align="left" style="border: 1px solid #000000;"><span style="color: black; font-size: medium;"> 扩展文件属性</span></td>
|
||||
<td align="left" style="border: 1px solid #000000;"><span style="font-size: medium;"> </span></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
### Linux中安装Mhddfs ###
|
||||
|
||||
在Debian及其类似的移植系统中,你可以使用下面的命令来安装mhddfs包。
|
||||
|
||||
# apt-get update && apt-get install mhddfs
|
||||
|
||||

|
||||
安装Mhddfs到基于Debian的系统中
|
||||
|
||||
在RHEL/CentOS Linux系统中,你需要开启[epel仓库][3],然后执行下面的命令来安装mhddfs包。
|
||||
|
||||
# yum install mhddfs
|
||||
|
||||
在Fedora 22及以上系统中,你可以通过dnf包管理来获得它,就像下面这样。
|
||||
|
||||
# dnf install mhddfs
|
||||
|
||||

|
||||
安装Mhddfs到Fedora
|
||||
|
||||
如果万一mhddfs包不能从epel仓库获取到,那么你需要解决下面的依赖,然后像下面这样来编译源码并安装。
|
||||
|
||||
- FUSE头文件
|
||||
- GCC
|
||||
- libc6头文件
|
||||
- uthash头文件
|
||||
- libattr1头文件(可选)
|
||||
|
||||
接下来,只需从下面建议的地址下载最新的源码包,然后编译。
|
||||
|
||||
# wget http://mhddfs.uvw.ru/downloads/mhddfs_0.1.39.tar.gz
|
||||
# tar -zxvf mhddfs*.tar.gz
|
||||
# cd mhddfs-0.1.39/
|
||||
# make
|
||||
|
||||
你应该可以在当前目录中看到mhddfs的二进制文件,以root身份将它移动到/usr/bin/和/usr/local/bin/中。
|
||||
|
||||
# cp mhddfs /usr/bin/
|
||||
# cp mhddfs /usr/local/bin/
|
||||
|
||||
一切搞定,mhddfs已经可以用了。
|
||||
|
||||
### 我怎么使用Mhddfs? ###
|
||||
|
||||
1.让我们看看当前所有挂载到我们系统中的硬盘。
|
||||
|
||||
|
||||
$ df -h
|
||||
|
||||

|
||||
**样例输出**
|
||||
|
||||
Filesystem Size Used Avail Use% Mounted on
|
||||
|
||||
/dev/sda1 511M 132K 511M 1% /boot/efi
|
||||
/dev/sda2 451G 92G 336G 22% /
|
||||
/dev/sdb1 1.9T 161G 1.7T 9% /media/avi/BD9B-5FCE
|
||||
/dev/sdc1 555M 555M 0 100% /media/avi/Debian 8.1.0 M-A 1
|
||||
|
||||
注意这里的‘挂载点’名称,我们后面会使用到它们。
|
||||
|
||||
2.创建目录‘/mnt/virtual_hdd’,在这里,所有这些文件系统将被组成组。
|
||||
|
||||
|
||||
# mkdir /mnt/virtual_hdd
|
||||
|
||||
3.然后,挂载所有文件系统。你可以通过root或者FUSE组中的某个成员来完成。
|
||||
|
||||
|
||||
# mhddfs /boot/efi, /, /media/avi/BD9B-5FCE/, /media/avi/Debian\ 8.1.0\ M-A\ 1/ /mnt/virtual_hdd -o allow_other
|
||||
|
||||

|
||||
在Linux中挂载所有文件系统
|
||||
|
||||
**注意**:这里我们使用了所有硬盘的挂载点名称,很明显,你的挂载点名称会有所不同。也请注意“-o allow_other”选项可以让这个虚拟文件系统让其它所有人可见,而不仅仅是创建它的人。
|
||||
|
||||
4.现在,运行“df -h”来看看所有文件系统。它应该包含了你刚才创建的那个。
|
||||
|
||||
|
||||
$ df -h
|
||||
|
||||

|
||||
验证虚拟文件系统挂载
|
||||
|
||||
你可以像对已挂在的驱动器那样给虚拟文件系统部署所有的选项。
|
||||
|
||||
5.要在每次系统启动创建这个虚拟文件系统,你应该以root身份添加下面的这行代码(在你那里会有点不同,取决于你的挂载点)到/etc/fstab文件的末尾。
|
||||
|
||||
mhddfs# /boot/efi, /, /media/avi/BD9B-5FCE/, /media/avi/Debian\ 8.1.0\ M-A\ 1/ /mnt/virtual_hdd fuse defaults,allow_other 0 0
|
||||
|
||||
6.如果在任何时候你想要添加/移除一个新的驱动器到/从虚拟硬盘,你可以挂载一个新的驱动器,拷贝/mnt/vritual_hdd的内容,卸载卷,弹出你要移除的的驱动器并/或挂载你要包含的新驱动器。使用mhddfs命令挂载全部文件系统到Virtual_hdd下,这样就全部搞定了。
|
||||
#### 我怎么卸载Virtual_hdd? ####
|
||||
|
||||
卸载virtual_hdd相当简单,就像下面这样
|
||||
|
||||
# umount /mnt/virtual_hdd
|
||||
|
||||

|
||||
卸载虚拟文件系统
|
||||
|
||||
注意,是umount,而不是unmount,很多用户都输错了。
|
||||
|
||||
到现在为止全部结束了。我正在写另外一篇文章,你们一定喜欢读的。到那时,请保持连线到Tecmint。请在下面的评论中给我们提供有用的反馈吧。请为我们点赞并分享,帮助我们扩散。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/combine-partitions-into-one-in-linux-using-mhddfs/
|
||||
|
||||
作者:[Avishek Kumar][a]
|
||||
译者:[GOLinux](https://github.com/GOLinux)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/avishek/
|
||||
[1]:http://www.tecmint.com/understanding-raid-setup-in-linux/
|
||||
[2]:http://www.tecmint.com/mount-filesystem-in-linux/
|
||||
[3]:http://www.tecmint.com/how-to-enable-epel-repository-for-rhel-centos-6-5/
|
@ -1,125 +0,0 @@
|
||||
如何在Linux中整理磁盘碎片
|
||||
================================================================================
|
||||

|
||||
|
||||
有一神话是linux的磁盘从来不需要整理碎片。在大多数情况下这是真的,大多数因为是使用的是优秀的日志系统(ext2、3、4等等)来处理文件系统。然而,在一些特殊情况下,碎片仍旧会产生。如果正巧发生在你身上,解决方法很简单。
|
||||
|
||||
### 什么是磁盘碎片 ###
|
||||
|
||||
碎片发生在不同的小块中更新文件时,但是这些快没有形成连续完整的文件而是分布在磁盘的各个角落中。这对于FAT和FAT32文件系统而言是这样的。这在NTFS中有所减轻,在Linux(extX)中几乎不会发生。下面是原因。
|
||||
|
||||
在像FAT和FAT32这类文件系统中,文件紧挨着写入到磁盘中。文件之间没有空间来用于增长或者更新:
|
||||
|
||||

|
||||
|
||||
NTFS中在文件之间保留了一些空间,因此有空间进行增长。因为块之间的空间是有限的,碎片也会随着时间出现。
|
||||
|
||||

|
||||
|
||||
Linux的日志文件系统采用了一个不同的方案。与文件之间挨着不同,每个文件分布在磁盘的各处,每个文件之间留下了大量的剩余空间。这里有很大的空间用于更新和增长,并且碎片很少会发生。
|
||||
|
||||

|
||||
|
||||
此外,碎片一旦出现了,大多数Linux文件系统会尝试将文件和块重新连续起来。
|
||||
|
||||
### Linux中的磁盘整理 ###
|
||||
|
||||
除非你用的是一个很小的硬盘或者空间不够了,不然Linux很少会需要磁盘整理。一些可能需要磁盘整理的情况包括:
|
||||
|
||||
- 如果你编辑的是大型视频文件或者原生照片,但磁盘空间有限
|
||||
- if you use older hardware like an old laptop, and you have a small hard drive
|
||||
- 如果你的磁盘开始满了(大约使用了85%)
|
||||
- 如果你的家目录中有许多小分区
|
||||
|
||||
最好的解决方案是购买一个大硬盘。如果不可能,磁盘碎片整理就很有用了。
|
||||
|
||||
### 如何检查碎片 ###
|
||||
|
||||
`fsck`命令会为你做这个 -也就是说如果你可以在liveCD中运行它,那么就可以**卸载所有的分区**。
|
||||
|
||||
这一点很重要:**在已经挂载的分区中运行fsck将会严重危害到你的数据和磁盘**。
|
||||
|
||||
你已经被警告过了。开始之前,先做一个完整的备份。
|
||||
|
||||
**免责声明**: 本文的作者与Make Tech Easier将不会对您的文件、数据、系统或者其他损害负责。你需要自己承担风险。如果你继续,你需要接收并了解这点。
|
||||
|
||||
你应该启动到一个live会话中(如安装磁盘,系统救援CD等)并运行`fsck`卸载分区。要检查是否有任何问题,请在运行root权限下面的命令:
|
||||
|
||||
fsck -fn [/path/to/your/partition]
|
||||
|
||||
您可以检查一下运行中的分区的路径
|
||||
|
||||
sudo fdisk -l
|
||||
|
||||
有一个(相对)安全地在已挂载的分区中运行`fsck`的方法是使用‘-n’开关。这会让分区处在只读模式而不能创建任何文件。当然,这里并不能保证安全,你应该在创建备份之后进行。在ext2中,运行
|
||||
|
||||
sudo fsck.ext2 -fn /path/to/your/partition
|
||||
|
||||
会产生大量的输出-- 大多数错误信息的原因是分区已经挂载了。最后会给出一个碎片相关的信息。
|
||||
|
||||

|
||||
|
||||
如果碎片大于20%了,那么你应该开始整理你的磁盘碎片了。
|
||||
|
||||
### 如何简单地在Linux中整理碎片 ###
|
||||
|
||||
你要做的是备份你**所有**的文件和数据到另外一块硬盘中(手动**复制**他们)。格式化分区然后重新复制回去(不要使用备份软件)。日志系统会把它们作为新的文件,并将它们整齐地放置到磁盘中而不产生碎片。
|
||||
|
||||
要备份你的文件,运行
|
||||
|
||||
cp -afv [/path/to/source/partition]/* [/path/to/destination/folder]
|
||||
|
||||
记住星号(*)是很重要的。
|
||||
|
||||
注意:通常认为复制大文件或者大量文件,使用dd或许是最好的。这是一个非常底层的操作,它会复制一切,包含空闲的空间甚至是留下的垃圾。这不是我们想要的,因此这里最好使用`cp`。
|
||||
|
||||
现在你只需要删除源文件。
|
||||
|
||||
sudo rm -rf [/path/to/source/partition]/*
|
||||
|
||||
**可选**:你可以将空闲空间置零。你也可以用格式化来达到这点,但是例子中你并没有复制整个分区而仅仅是大文件(这很可能会造成碎片)。这恐怕不能成为一个选项。
|
||||
|
||||
sudo dd if=/dev/zero of=[/path/to/source/partition]/temp-zero.txt
|
||||
|
||||
等待它结束。你可以用`pv`来监测进程。
|
||||
|
||||
sudo apt-get install pv
|
||||
sudo pv -tpreb | of=[/path/to/source/partition]/temp-zero.txt
|
||||
|
||||

|
||||
|
||||
这就完成了,只要删除临时文件就行。
|
||||
|
||||
sudo rm [/path/to/source/partition]/temp-zero.txt
|
||||
|
||||
待你清零了空闲空间(或者跳过了这步)。重新复制回文件,将第一个cp命令翻转一下:
|
||||
|
||||
cp -afv [/path/to/original/destination/folder]/* [/path/to/original/source/partition]
|
||||
|
||||
### 使用 e4defrag ###
|
||||
|
||||
如果你想要简单的方法,安装`e2fsprogs`,
|
||||
|
||||
sudo apt-get install e2fsprogs
|
||||
|
||||
用root权限在分区中运行 `e4defrag`。如果你不想卸载分区,你可以使用它的挂载点而不是路径。要整理整个系统的碎片,运行:
|
||||
|
||||
sudo e4defrag /
|
||||
|
||||
在挂载的情况下不保证成功(你也应该保证在它运行时停止使用你的系统),但是它比服务全部文件再重新复制回来简单多了。
|
||||
|
||||
### 总结 ###
|
||||
|
||||
linux系统中很少会出现碎片因为它的文件系统有效的数据处理。如果你因任何原因产生了碎片,简单的方法是重新分配你的磁盘如复制所有文件并复制回来,或者使用`e4defrag`。然而重要的是保证你数据的安全,因此在进行任何可能影响你全部或者大多数文件的操作之前,确保你的文件已经被备份到了另外一个安全的地方去了。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.maketecheasier.com/defragment-linux/
|
||||
|
||||
作者:[Attila Orosz][a]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.maketecheasier.com/author/attilaorosz/
|
@ -0,0 +1,253 @@
|
||||
给新手的 10 个有用 Linux 命令行技巧 - 第二部分
|
||||
================================================================================
|
||||
我记得我第一次使用 Linux 的时候,我还习惯于 Windows 的图形界面,我真的很讨厌 Linux 终端。那时候我觉得命令难以记忆,不能正确使用它们。随着时间推移,我意识到了 Linux 终端的优美、灵活和可用性,说实话,我没有一天不使用它。今天,我很高兴和刚开始接触 Linux 的人一起来分享一些有用的技巧和提示,希望能帮助他们更好的向 Linux 过度,并帮助他们学到一些新的东西(希望如此)。
|
||||
|
||||

|
||||
|
||||
10 个 Linux 命令行技巧 - 第二部分
|
||||
|
||||
|
||||
- [Linux 中 5 个有趣的命令行提示和技巧 - 第一部分][1]
|
||||
- [管理 Linux 文件类型的 5 个有用命令 – 第三部分][2]
|
||||
|
||||
这篇文章希望向你展示一些不需要很高的技术而可以像一个高手一样使用 Linux 终端的有用技巧。你只需要一个 Linux 终端和一些自由时间来体会这些命令。
|
||||
|
||||
### 1. 找到正确的命令 ###
|
||||
|
||||
执行正确的命令对你的系统来说非常重要。然而在 Linux 中有很多通常难以记忆的不同的命令行。那么怎样才能找到你需要的正确命令呢?答案是 apropos。你只需要运行:
|
||||
|
||||
# apropos <description>
|
||||
|
||||
其中你要用真正描述你要查找的命令的语句代替 “description”。这里有一个例子:
|
||||
|
||||
# apropos "list directory"
|
||||
|
||||
dir (1) - list directory contents
|
||||
ls (1) - list directory contents
|
||||
ntfsls (8) - list directory contents on an NTFS filesystem
|
||||
vdir (1) - list directory contents
|
||||
|
||||
左边你看到的是命令,右边是它们的描述。
|
||||
|
||||
### 2. 执行之前的命令 ###
|
||||
|
||||
很多时候你需要一遍又一遍执行相同的命令。尽管你可以重复按你键盘上的 Up 键,你也可以用 history 命令。这个命令会列出自从你上次启动终端以来所有输入过的命令:
|
||||
|
||||
# history
|
||||
|
||||
1 fdisk -l
|
||||
2 apt-get install gnome-paint
|
||||
3 hostname tecmint.com
|
||||
4 hostnamectl tecmint.com
|
||||
5 man hostnamectl
|
||||
6 hostnamectl --set-hostname tecmint.com
|
||||
7 hostnamectl -set-hostname tecmint.com
|
||||
8 hostnamectl set-hostname tecmint.com
|
||||
9 mount -t "ntfs" -o
|
||||
10 fdisk -l
|
||||
11 mount -t ntfs-3g /dev/sda5 /mnt
|
||||
12 mount -t rw ntfs-3g /dev/sda5 /mnt
|
||||
13 mount -t -rw ntfs-3g /dev/sda5 /mnt
|
||||
14 mount -t ntfs-3g /dev/sda5 /mnt
|
||||
15 mount man
|
||||
16 man mount
|
||||
17 mount -t -o ntfs-3g /dev/sda5 /mnt
|
||||
18 mount -o ntfs-3g /dev/sda5 /mnt
|
||||
19 mount -ro ntfs-3g /dev/sda5 /mnt
|
||||
20 cd /mnt
|
||||
...
|
||||
|
||||
正如你上面看到的,你会得到一个你运行过的命令的列表。每一行中有一个数字表示你在第几行输入了命令。你可以通过以下方法重新调用该命令:
|
||||
|
||||
!#
|
||||
|
||||
其中要用命令的实际编号代替 #。为了更好的理解,请看下面的例子:
|
||||
|
||||
!501
|
||||
|
||||
等价于:
|
||||
|
||||
# history
|
||||
|
||||
### 3. 使用 midnight 命令 ###
|
||||
|
||||
如果你不习惯使用类似 cd、cp、mv、rm 等命令,你可以使用 midnight 命令。它是一个简单的可视化 shell,你可以在上面使用鼠标:
|
||||
|
||||
|
||||

|
||||
|
||||
Midnight 命令
|
||||
|
||||
多亏了 F1 到 F12 键,你可以轻易地执行不同任务。只需要在底部选择对应的命令。要选择文件或者目录,点击 “Insert” 按钮。
|
||||
|
||||
简而言之 midnight 就是所谓的 “mc”。要安装 mc,只需要运行:
|
||||
|
||||
$ sudo apt-get install mc [On Debian based systems]
|
||||
|
||||
----------
|
||||
|
||||
# yum install mc [On Fedora based systems]
|
||||
|
||||
下面是一个使用 midnight 命令器的简单例子。通过输入以下命令打开 mc:
|
||||
|
||||
# mc
|
||||
|
||||
现在使用 TAB 键选择不同的窗口 - 左和右。我有一个想要移动到 “Software” 目录的 LibreOffice 文件:
|
||||
|
||||

|
||||
|
||||
Midnight 命令移动文件
|
||||
|
||||
按 F6 按钮移动文件到新的目录。MC 会请求你确认:
|
||||
|
||||

|
||||
|
||||
移动文件到新目录
|
||||
|
||||
确认了之后,文件就会被移动到新的目标目录。
|
||||
|
||||
扩展阅读:[如何在 Linux 中使用 Midnight 命令文件管理器][4]
|
||||
|
||||
### 4. 在指定时间关闭计算机 ###
|
||||
|
||||
有时候你需要在结束工作几个小时后再关闭计算机。你可以通过使用下面的命令在指定时间关闭你的计算机:
|
||||
|
||||
$ sudo shutdown 21:00
|
||||
|
||||
这会告诉你在你指定的时间关闭计算机。你也可以告诉系统在指定分钟后关闭:
|
||||
|
||||
$ sudo shutdown +15
|
||||
|
||||
这表示计算机会在 15 分钟后关闭。
|
||||
|
||||
### 5. 显示已知用户的信息 ###
|
||||
|
||||
你可以使用一个简单的命令列出你 Linux 系统的用户以及一些关于它们的基本信息。
|
||||
|
||||
# lslogins
|
||||
|
||||
这会输出下面的结果:
|
||||
|
||||
UID USER PWD-LOCK PWD-DENY LAST-LOGIN GECOS
|
||||
0 root 0 0 Apr29/11:35 root
|
||||
1 bin 0 1 bin
|
||||
2 daemon 0 1 daemon
|
||||
3 adm 0 1 adm
|
||||
4 lp 0 1 lp
|
||||
5 sync 0 1 sync
|
||||
6 shutdown 0 1 Jul19/10:04 shutdown
|
||||
7 halt 0 1 halt
|
||||
8 mail 0 1 mail
|
||||
10 uucp 0 1 uucp
|
||||
11 operator 0 1 operator
|
||||
12 games 0 1 games
|
||||
13 gopher 0 1 gopher
|
||||
14 ftp 0 1 FTP User
|
||||
23 squid 0 1
|
||||
25 named 0 1 Named
|
||||
27 mysql 0 1 MySQL Server
|
||||
47 mailnull 0 1
|
||||
48 apache 0 1 Apache
|
||||
...
|
||||
|
||||
### 6. 查找文件 ###
|
||||
### 6. Search for Files ###
|
||||
|
||||
查找文件有时候并不像你想象的那么简单。一个搜索文件的好例子是:
|
||||
|
||||
# find /home/user -type f
|
||||
|
||||
这个命令会搜索 /home/user 目录下的所有文件。find 命令真的很强大,你可以传递更多选项给它使得你的搜索更加详细。如果你想搜索比特定大小大的文件,可以使用:
|
||||
|
||||
# find . -type f -size 10M
|
||||
|
||||
上面的命令会搜索当前目录中所有大于 10M 的文件。确保不要在你 Linux 系统的根目录运行该命令,因为这可能导致你的机器 I/O 瓶颈。
|
||||
|
||||
我最经常和 find 命令一起使用的选项之一是 “exec”,这允许你对 find 命令的结果运行一些操作。
|
||||
|
||||
例如,假如我们想查找一个目录中的所有文件并更改权限。可以通过以下简单命令完成:
|
||||
|
||||
# find /home/user/files/ -type f -exec chmod 644 {} \;
|
||||
|
||||
上面的命令会递归搜索指定目录内的所有文件,并对找到的文件执行 chmod 命令。推荐你阅读 [35 个 Linux ‘find’ 命令的使用方法][5],我肯定你会发现这个命令更多的使用方法。
|
||||
|
||||
### 7. 用一个命令创建目录树 ###
|
||||
|
||||
你很可能知道可以使用 mkdir 命令创建新的目录。因此如果你想创建一个新的目录,你可能会运行:
|
||||
|
||||
# mkdir new_folder
|
||||
|
||||
但如果你想在该目录下创建 5 个子目录呢?运行 5 次 mkdir 命令并非是一个好的选择。相反你可以类似下面这样使用 -p 选项:
|
||||
|
||||
# mkdir -p new_folder/{folder_1,folder_2,folder_3,folder_4,folder_5}
|
||||
|
||||
最后你会在 new_folder 中有 5 个目录:
|
||||
|
||||
# ls new_folder/
|
||||
|
||||
folder_1 folder_2 folder_3 folder_4 folder_5
|
||||
|
||||
### 8. 复制文件到多个目录 ###
|
||||
|
||||
通常使用 cp 命令进行文件复制。复制文件通常看起来类似:
|
||||
|
||||
# cp /path-to-file/my_file.txt /path-to-new-directory/
|
||||
|
||||
现在假设你需要复制该文件到多个目录:
|
||||
|
||||
# cp /home/user/my_file.txt /home/user/1
|
||||
# cp /home/user/my_file.txt /home/user/2
|
||||
# cp /home/user/my_file.txt /home/user/3
|
||||
|
||||
这有点荒唐。相反,你可以用简单的一行命令解决问题:
|
||||
|
||||
# echo /home/user/1/ /home/user/2/ /home/user/3/ | xargs -n 1 cp /home/user/my_file.txt
|
||||
|
||||
### 9. 删除大文件 ###
|
||||
|
||||
有时候文件可能会变得很大。我看过由于缺乏管理技能一个日志文件就超过 250G 的例子。用 rm 命令可能不足以删除该文件,因为有大量的数据需要移除。应该避免这个很“笨重”的操作。相反,你可以使用一个简单的方法解决这个问题:
|
||||
|
||||
# > /path-to-file/huge_file.log
|
||||
|
||||
当然你需要根据你实际情况替换路径和文件名。上面的命令写一个空输出到该文件。用更简单的话说它会清空文件而不会导致你的系统产生大的 I/O 消耗。
|
||||
|
||||
### 10. 在多个 Linux 服务器上运行相同命令 ###
|
||||
|
||||
最近我们的一个读者在 [LinuxSay 论坛][6]提问说如何通过 ssh 在多个 Linux 服务器上执行一个命令。他机器的 IP 地址是:
|
||||
|
||||
10.0.0.1
|
||||
10.0.0.2
|
||||
10.0.0.3
|
||||
10.0.0.4
|
||||
10.0.0.5
|
||||
|
||||
这里有一个简单的解决方法。收集服务器的 IP 地址到文件 list.txt 中,像上面那样一行一个。然后运行:
|
||||
|
||||
# for in $i(cat list.txt); do ssh user@$i 'bash command'; done
|
||||
|
||||
上面的命令中你需要用实际登录的用户替换 “user”,用你希望执行的实际命令替换 “bash command”。这个方法非常适用于通过[使用 SSH 密钥进行无密码验证][7],因为这样你不需要每次都为用户输入密码。
|
||||
|
||||
注意取决于你 Linux 系统的设置,你可能还需要传递一些额外的参数给 SSH 命令。
|
||||
|
||||
### 总结 ###
|
||||
|
||||
上面的例子都很简单,我希望它们能帮助你发现 Linux 的优美之处,你如何能简单实现在其它操作系统上需要更多时间的不同操作。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/10-useful-linux-command-line-tricks-for-newbies/
|
||||
|
||||
作者:[Marin Todorov][a]
|
||||
译者:[ictlyh](http://mutouxiaogui.cn/blog/)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/marintodorov89/
|
||||
[1]:http://www.tecmint.com/5-linux-command-line-tricks/
|
||||
[2]:http://www.tecmint.com/manage-file-types-and-set-system-time-in-linux/
|
||||
[3]:http://www.tecmint.com/history-command-examples/
|
||||
[4]:http://www.tecmint.com/midnight-commander-a-console-based-file-manager-for-linux/
|
||||
[5]:http://www.tecmint.com/35-practical-examples-of-linux-find-command/
|
||||
[6]:http://www.linuxsay.com/
|
||||
[7]:http://www.tecmint.com/ssh-passwordless-login-using-ssh-keygen-in-5-easy-steps/
|
@ -0,0 +1,279 @@
|
||||
Linux 中管理文件类型和系统时间的 5 个有用命令 - 第三部分
|
||||
================================================================================
|
||||
对于想学习 Linux 的初学者来说要适应使用命令行或者终端可能非常困难。由于终端比图形用户界面程序更能帮助用户控制 Linux 系统,我们必须习惯在终端中运行命令。因此为了有效记忆 Linux 不同的命令,你应该每天使用终端并明白怎样将命令和不同选项以及参数一同使用。
|
||||
|
||||

|
||||
|
||||
在 Linux 中管理文件类型并设置时间 - 第三部分
|
||||
|
||||
请先查看我们 [Linux 小技巧][1]系列之前的文章。
|
||||
|
||||
- [Linux 中 5 个有趣的命令行提示和技巧 - 第一部分][2]
|
||||
- [给新手的有用命令行技巧 - 第二部分][3]
|
||||
|
||||
在这篇文章中,我们打算看看终端中 10 个和文件以及时间相关的提示和技巧。
|
||||
|
||||
### Linux 中的文件类型 ###
|
||||
|
||||
在 Linux 中,一切皆文件,你的设备、目录以及普通文件都认为是文件。
|
||||
|
||||
Linux 系统中文件有不同的类型:
|
||||
|
||||
- 普通文件:可能包含命令、文档、音频文件、视频、图像,归档文件等。
|
||||
- 设备文件:系统用于访问你硬件组件。
|
||||
|
||||
这里有两种表示存储设备的设备文件块文件,例如硬盘,它们以快读取数据,字符文件,以逐个字符读取数据。
|
||||
|
||||
- 硬链接和软链接:用于在 Linux 文件系统的任意地方访问文件。
|
||||
- 命名管道和套接字:允许不同的进程彼此之间交互。
|
||||
|
||||
#### 1. 用 ‘file’ 命令确定文件类型 ####
|
||||
|
||||
你可以像下面这样使用 file 命令确定文件的类型。下面的截图显示了用 file 命令确定不同文件类型的例子。
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ dir
|
||||
BACKUP master.zip
|
||||
crossroads-stable.tar.gz num.txt
|
||||
EDWARD-MAYA-2011-2012-NEW-REMIX.mp3 reggea.xspf
|
||||
Linux-Security-Optimization-Book.gif tmp-link
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ file BACKUP/
|
||||
BACKUP/: directory
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ file master.zip
|
||||
master.zip: Zip archive data, at least v1.0 to extract
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ file crossroads-stable.tar.gz
|
||||
crossroads-stable.tar.gz: gzip compressed data, from Unix, last modified: Tue Apr 5 15:15:20 2011
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ file Linux-Security-Optimization-Book.gif
|
||||
Linux-Security-Optimization-Book.gif: GIF image data, version 89a, 200 x 259
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ file EDWARD-MAYA-2011-2012-NEW-REMIX.mp3
|
||||
EDWARD-MAYA-2011-2012-NEW-REMIX.mp3: Audio file with ID3 version 2.3.0, contains: MPEG ADTS, layer III, v1, 192 kbps, 44.1 kHz, JntStereo
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ file /dev/sda1
|
||||
/dev/sda1: block special
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ file /dev/tty1
|
||||
/dev/tty1: character special
|
||||
|
||||
#### 2. 用 ‘ls’ 和 ‘dir’ 命令确定文件类型 ####
|
||||
|
||||
确定文件类型的另一种方式是用 ls 和 [dir][4] 命令显示一长串结果。
|
||||
|
||||
用 ls -l 确定一个文件的类型。
|
||||
|
||||
当你查看文件权限时,第一个字符显示了文件类型,其它字符显示文件权限。
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ ls -l
|
||||
total 6908
|
||||
drwxr-xr-x 2 tecmint tecmint 4096 Sep 9 11:46 BACKUP
|
||||
-rw-r--r-- 1 tecmint tecmint 1075620 Sep 9 11:47 crossroads-stable.tar.gz
|
||||
-rwxr----- 1 tecmint tecmint 5916085 Sep 9 11:49 EDWARD-MAYA-2011-2012-NEW-REMIX.mp3
|
||||
-rw-r--r-- 1 tecmint tecmint 42122 Sep 9 11:49 Linux-Security-Optimization-Book.gif
|
||||
-rw-r--r-- 1 tecmint tecmint 17627 Sep 9 11:46 master.zip
|
||||
-rw-r--r-- 1 tecmint tecmint 5 Sep 9 11:48 num.txt
|
||||
-rw-r--r-- 1 tecmint tecmint 0 Sep 9 11:46 reggea.xspf
|
||||
-rw-r--r-- 1 tecmint tecmint 5 Sep 9 11:47 tmp-link
|
||||
|
||||
使用 ls -l 确定块和字符文件
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ ls -l /dev/sda1
|
||||
brw-rw---- 1 root disk 8, 1 Sep 9 10:53 /dev/sda1
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ ls -l /dev/tty1
|
||||
crw-rw---- 1 root tty 4, 1 Sep 9 10:54 /dev/tty1
|
||||
|
||||
使用 dir -l 确定一个文件的类型。
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ dir -l
|
||||
total 6908
|
||||
drwxr-xr-x 2 tecmint tecmint 4096 Sep 9 11:46 BACKUP
|
||||
-rw-r--r-- 1 tecmint tecmint 1075620 Sep 9 11:47 crossroads-stable.tar.gz
|
||||
-rwxr----- 1 tecmint tecmint 5916085 Sep 9 11:49 EDWARD-MAYA-2011-2012-NEW-REMIX.mp3
|
||||
-rw-r--r-- 1 tecmint tecmint 42122 Sep 9 11:49 Linux-Security-Optimization-Book.gif
|
||||
-rw-r--r-- 1 tecmint tecmint 17627 Sep 9 11:46 master.zip
|
||||
-rw-r--r-- 1 tecmint tecmint 5 Sep 9 11:48 num.txt
|
||||
-rw-r--r-- 1 tecmint tecmint 0 Sep 9 11:46 reggea.xspf
|
||||
-rw-r--r-- 1 tecmint tecmint 5 Sep 9 11:47 tmp-link
|
||||
|
||||
#### 3. 统计指定类型文件的数目 ####
|
||||
|
||||
下面我们来看看在一个目录中用 ls,[grep][5] 和 [wc][6] 命令统计指定类型文件数目的技巧。命令之间的交互通过命名管道完成。
|
||||
|
||||
- grep – 用户根据给定模式或正则表达式进行搜索的命令。
|
||||
- wc – 用于统计行、字和字符的命令。
|
||||
|
||||
**统计普通文件的数目**
|
||||
|
||||
在 Linux 中,普通文件用符号 `-` 表示。
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ ls -l | grep ^- | wc -l
|
||||
7
|
||||
|
||||
**统计目录的数目**
|
||||
|
||||
在 Linux 中,目录用符号 `d` 表示。
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ ls -l | grep ^d | wc -l
|
||||
1
|
||||
|
||||
**统计符号链接和硬链接的数目**
|
||||
|
||||
在 Linux 中,符号链接和硬链接用符号 `l` 表示。
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ ls -l | grep ^l | wc -l
|
||||
0
|
||||
|
||||
**统计块文件和字符文件的数目**
|
||||
|
||||
在 Linux 中,块和字符文件用符号 `b` 和 `c` 表示。
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ ls -l /dev | grep ^b | wc -l
|
||||
37
|
||||
tecmint@tecmint ~/Linux-Tricks $ ls -l /dev | grep ^c | wc -l
|
||||
159
|
||||
|
||||
#### 4. 在 Linux 系统中查找文件 ####
|
||||
|
||||
下面我们来看看在 Linux 系统中查找文件一些命令,它们包括 locate、find、whatis 和 which 命令。
|
||||
|
||||
**用 locate 命令查找文件**
|
||||
|
||||
在下面的输出中,我想要定位系统中的 [Samba 服务器配置文件][7]
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ locate samba.conf
|
||||
/usr/lib/tmpfiles.d/samba.conf
|
||||
/var/lib/dpkg/info/samba.conffiles
|
||||
|
||||
**用 find 命令查找文件**
|
||||
|
||||
想要学习如何在 Linux 中使用 find 命令,你可以阅读我们以下的文章,里面列出了 find 命令的 30 多个例子和使用方法。
|
||||
|
||||
- [Linux 中 35 个 ‘find’ 命令示例][8]
|
||||
|
||||
**用 whatis 命令定位命令**
|
||||
|
||||
whatis 命令通常用于定位命令,它很特殊,因为它给出关于一个命令的信息,它还能查找配置文件和命令的帮助手册条目。
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ whatis bash
|
||||
bash (1) - GNU Bourne-Again SHell
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ whatis find
|
||||
find (1) - search for files in a directory hierarchy
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ whatis ls
|
||||
ls (1) - list directory contents
|
||||
|
||||
**用 which 命令定位命令**
|
||||
|
||||
which 命令用于定位文件系统中的命令。
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ which mkdir
|
||||
/bin/mkdir
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ which bash
|
||||
/bin/bash
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ which find
|
||||
/usr/bin/find
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ $ which ls
|
||||
/bin/ls
|
||||
|
||||
#### 5.处理 Linux 系统的时间 ####
|
||||
|
||||
在联网环境中,保持你 Linux 系统时间准确是一个好的习惯。Linux 系统中有很多服务要求时间正确才能在联网条件下正常工作。
|
||||
|
||||
让我们来看看你可以用来管理你机器时间的命令。在 Linux 中,有两种方式管理时间:系统时间和硬件时间。
|
||||
|
||||
系统时间由系统时钟管理,硬件时间由硬件时钟管理。
|
||||
|
||||
要查看你的系统时间、日期和时区,像下面这样使用 date 命令。
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ date
|
||||
Wed Sep 9 12:25:40 IST 2015
|
||||
|
||||
像下面这样用 date -s 或 date -set=“STRING” 设置系统时间。
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ sudo date -s "12:27:00"
|
||||
Wed Sep 9 12:27:00 IST 2015
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ sudo date --set="12:27:00"
|
||||
Wed Sep 9 12:27:00 IST 2015
|
||||
|
||||
你也可以像下面这样设置时间和日期。
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ sudo date 090912302015
|
||||
Wed Sep 9 12:30:00 IST 2015
|
||||
|
||||
使用 cal 命令从日历中查看当前日期。
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ cal
|
||||
September 2015
|
||||
Su Mo Tu We Th Fr Sa
|
||||
1 2 3 4 5
|
||||
6 7 8 9 10 11 12
|
||||
13 14 15 16 17 18 19
|
||||
20 21 22 23 24 25 26
|
||||
27 28 29 30
|
||||
|
||||
使用 hwclock 命令查看硬件始终时间。
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ sudo hwclock
|
||||
Wednesday 09 September 2015 06:02:58 PM IST -0.200081 seconds
|
||||
|
||||
要设置硬件时钟时间,像下面这样使用 hwclock –set –date=“STRING” 命令。
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ sudo hwclock --set --date="09/09/2015 12:33:00"
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ sudo hwclock
|
||||
Wednesday 09 September 2015 12:33:11 PM IST -0.891163 seconds
|
||||
|
||||
系统时间是由硬件始终时间在启动时设置的,系统关闭时,硬件时间被重置为系统时间。
|
||||
|
||||
因此你查看系统时间和硬件时间时,它们是一样的,除非你更改了系统时间。当你的 CMOS 电量不足时,硬件时间可能不正确。
|
||||
|
||||
你也可以像下面这样使用硬件时钟的时间设置系统时间。
|
||||
|
||||
$ sudo hwclock --hctosys
|
||||
|
||||
也可以像下面这样用系统时钟时间设置硬件时钟时间。
|
||||
|
||||
$ sudo hwclock --systohc
|
||||
|
||||
要查看你的 Linux 系统已经运行了多长时间,可以使用 uptime 命令。
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ uptime
|
||||
12:36:27 up 1:43, 2 users, load average: 1.39, 1.34, 1.45
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ uptime -p
|
||||
up 1 hour, 43 minutes
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ uptime -s
|
||||
2015-09-09 10:52:47
|
||||
|
||||
### 总结 ###
|
||||
|
||||
对于初学者来说理解 Linux 中的文件类型是一个好的尝试,同时时间管理也非常重要,尤其是在需要可靠有效地管理服务的服务器上。希望这篇指南能对你有所帮助。如果你有任何反馈,别忘了给我们写评论。和 Tecmint 保持联系。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/manage-file-types-and-set-system-time-in-linux/
|
||||
|
||||
作者:[Aaron Kili][a]
|
||||
译者:[ictlyh](http://www.mutouxiaogui.cn/blog/)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/aaronkili/
|
||||
[1]:http://www.tecmint.com/tag/linux-tricks/
|
||||
[2]:http://www.tecmint.com/free-online-linux-learning-guide-for-beginners/
|
||||
[3]:http://www.tecmint.com/10-useful-linux-command-line-tricks-for-newbies/
|
||||
[4]:http://www.tecmint.com/linux-dir-command-usage-with-examples/
|
||||
[5]:http://www.tecmint.com/12-practical-examples-of-linux-grep-command/
|
||||
[6]:http://www.tecmint.com/wc-command-examples/
|
||||
[7]:http://www.tecmint.com/setup-samba-file-sharing-for-linux-windows-clients/
|
||||
[8]:http://www.tecmint.com/35-practical-examples-of-linux-find-command/
|
@ -0,0 +1,91 @@
|
||||
如何在Ubuntu 14.04 / 15.04中设置IonCube Loaders
|
||||
================================================================================
|
||||
IonCube Loaders是PHP中用于辅助加速页面的加解密工具。它保护你的PHP代码不会被在未授权的计算机上查看。使用ionCube编码并加密PHP需要一个叫ionCube Loader的文件安装在web服务器上并提供给需要大量访问的PHP用。它在运行时处理并执行编码。PHP只需在‘php.ini’中添加一行就可以使用这个loader。
|
||||
|
||||
### 前提条件 ###
|
||||
|
||||
在这篇文章中,我们将在Ubuntu14.04/15.04安装Ioncube Loader ,以便它可以在所有PHP模式中使用。本教程的唯一要求就是你系统安装了LEMP,并有“的php.ini”文件。
|
||||
|
||||
### 下载 IonCube Loader ###
|
||||
|
||||
根据你系统的架构是32位或者64位来下载最新的IonCube loader包。你可以用超级用户权限或者root用户运行下面的命令。
|
||||
|
||||
# wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
|
||||
|
||||

|
||||
|
||||
下载完成后用下面的命令解压到"/usr/local/src/"。
|
||||
|
||||
# tar -zxvf ioncube_loaders_lin_x86-64.tar.gz -C /usr/local/src/
|
||||
|
||||

|
||||
|
||||
解压完成后我们就可以看到所有的存在的模块。但是我们只需要我们安装的PHP版本的相关模块。
|
||||
|
||||
要检查PHP版本,你可以运行下面的命令来找出相关的模块。
|
||||
|
||||
# php -v
|
||||
|
||||

|
||||
|
||||
根据上面的命令我们知道我们安装的是PHP 5.6.4,因此我们需要拷贝合适的模块到PHP模块目录下。
|
||||
|
||||
首先我们在“/usr/local/”创建一个叫“ioncube”的目录并复制需要的ioncube loader到这里。
|
||||
|
||||
root@ubuntu-15:/usr/local/src/ioncube# mkdir /usr/local/ioncube
|
||||
root@ubuntu-15:/usr/local/src/ioncube# cp ioncube_loader_lin_5.6.so ioncube_loader_lin_5.6_ts.so /usr/local/ioncube/
|
||||
|
||||
### PHP 配置 ###
|
||||
|
||||
我们要在位于"/etc/php5/cli/"文件夹下的"php.ini"中加入下面的配置行并重启web服务和php模块。
|
||||
|
||||
# vim /etc/php5/cli/php.ini
|
||||
|
||||

|
||||
|
||||
此时我们安装的是nginx,因此我们用下面的命令来重启服务。
|
||||
|
||||
# service php5-fpm restart
|
||||
# service nginx restart
|
||||
|
||||

|
||||
|
||||
### 测试 IonCube Loader ###
|
||||
|
||||
要为我们的网站测试ioncube loader。用下面的内容创建一个"info.php"文件并放在网站的web目录下。
|
||||
|
||||
|
||||
# vim /usr/share/nginx/html/info.php
|
||||
|
||||
加入phpinfo的脚本后重启web服务后用域名或者ip地址访问“info.php”。
|
||||
|
||||
你会在最下面的php模块信息里看到下面这段。
|
||||
|
||||

|
||||
|
||||
From the terminal issue the following command to verify the php version that shows the ionCube PHP Loader is Enabled.
|
||||
在终端中运行下面的命令来验证php版本并显示PHP Loader已经启用了。
|
||||
|
||||
# php -v
|
||||
|
||||

|
||||
|
||||
上面的php版本输出明显地显示了IonCube loader已经成功与PHP集成了。
|
||||
|
||||
### 总结 ###
|
||||
|
||||
教程的最后你已经了解了在安装有nginx的Ubuntu中安装和配置ionCube Loader,如果你正在使用其他的web服务,这与其他服务没有明显的差别。因此做完这些安装Loader是很简单的,并且在大多数服务器上的安装都不会有问题。然而并没有一个所谓的“标准PHP安装”,服务可以通过许多方式安装,并启用或者禁用功能。
|
||||
|
||||
如果你是在共享服务器上,那么确保运行了ioncube-loader-helper.php脚本,并点击链接来测试运行时安装。如果安装时你仍然遇到了问题,欢迎联系我们及给我们留下评论。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://linoxide.com/ubuntu-how-to/setup-ioncube-loaders-ubuntu-14-04-15-04/
|
||||
|
||||
作者:[Kashif Siddique][a]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://linoxide.com/author/kashifs/
|
@ -0,0 +1,165 @@
|
||||
如何将 Oracle 11g 升级到 Orcale 12c
|
||||
================================================================================
|
||||
大家好。
|
||||
|
||||
今天我们来学习一下如何将 Oracle 11g 升级到 Oracle 12c。开始吧。
|
||||
|
||||
在此,我使用的是 CentOS 7 64 位 Linux 发行版。
|
||||
|
||||
我假设你已经在你的系统上安装了 Oracle 11g。这里我会展示一下安装 Oracle 11g 时我的操作步骤。
|
||||
|
||||
我在 Oracle 11g 上选择 “Create and configure a database”,如下图所示。
|
||||
|
||||

|
||||
|
||||
然后我选择安装 Oracle 11g “Decktop Class”。如果是生产环境,你必须选择 “Server Class”。
|
||||
|
||||

|
||||
|
||||
然后你输入安装 Oracle 11g 的所有路径以及密码。下面是我自己的 Oracle 11g 安装配置。确保你正确输入了 Oracle 的密码。
|
||||
|
||||

|
||||
|
||||
下一步,我按照如下设置 Inventory Directory。
|
||||
|
||||

|
||||
|
||||
到这里,我已经向你展示了我安装 Oracle 11g 所做的工作,因为我们开始想升级到 12c。
|
||||
|
||||
让我们将 Oracle 11g 升级到 Oracle 12c 吧。
|
||||
|
||||
你需要从该[链接][1]上下载两个 zip 文件。下载并解压两个文件到相同目录。文件名为 **linuxamd64_12c_database_1of2.zip** & **linuxamd64_12c_database_2of2.zip**。提取或解压完后,它会创建一个名为 database 的文件夹。
|
||||
|
||||
注意:升级到 12c 之前,请确保在你的 CentOS 上已经安装了所有必须的软件包并且 path 环境变量也已经正确配置,还有其它前提条件也已经满足。
|
||||
|
||||
下面是必须使用正确版本安装的一些软件包
|
||||
|
||||
- binutils
|
||||
- compat-libstdc++
|
||||
- gcc
|
||||
- glibc
|
||||
- libaio
|
||||
- libgcc
|
||||
- libstdc++
|
||||
- make
|
||||
- sysstat
|
||||
- unixodbc
|
||||
|
||||
在因特网上搜索正确的 rpm 版本。
|
||||
|
||||
你也可以用一个查询处理多个软件包,然后在输出中查找正确版本。例如:
|
||||
|
||||
在终端中输入下面的命令
|
||||
|
||||
rpm -q binutils compat-libstdc++ gcc glibc libaio libgcc libstdc++ make sysstat unixodbc
|
||||
|
||||
你的系统中必须安装了以下软件包(版本可能较新会旧)
|
||||
|
||||
- binutils-2.23.52.0.1-12.el7.x86_64
|
||||
- compat-libcap1-1.10-3.el7.x86_64
|
||||
- gcc-4.8.2-3.el7.x86_64
|
||||
- gcc-c++-4.8.2-3.el7.x86_64
|
||||
- glibc-2.17-36.el7.i686
|
||||
- glibc-2.17-36.el7.x86_64
|
||||
- glibc-devel-2.17-36.el7.i686
|
||||
- glibc-devel-2.17-36.el7.x86_64
|
||||
- ksh
|
||||
- libaio-0.3.109-9.el7.i686
|
||||
- libaio-0.3.109-9.el7.x86_64
|
||||
- libaio-devel-0.3.109-9.el7.i686
|
||||
- libaio-devel-0.3.109-9.el7.x86_64
|
||||
- libgcc-4.8.2-3.el7.i686
|
||||
- libgcc-4.8.2-3.el7.x86_64
|
||||
- libstdc++-4.8.2-3.el7.i686
|
||||
- libstdc++-4.8.2-3.el7.x86_64
|
||||
- libstdc++-devel-4.8.2-3.el7.i686
|
||||
- libstdc++-devel-4.8.2-3.el7.x86_64
|
||||
- libXi-1.7.2-1.el7.i686
|
||||
- libXi-1.7.2-1.el7.x86_64
|
||||
- libXtst-1.2.2-1.el7.i686
|
||||
- libXtst-1.2.2-1.el7.x86_64
|
||||
- make-3.82-19.el7.x86_64
|
||||
- sysstat-10.1.5-1.el7.x86_64
|
||||
|
||||
你也需要 unixODBC-2.3.1 或更新版本的驱动。
|
||||
|
||||
我希望你安装 Oracle 11g 的时候已经在你的 CentOS 7 上创建了名为 oracle 的用户。
|
||||
|
||||
让我们以用户 oracle 登录 CentOS。
|
||||
|
||||
以用户 oracle 登录到 CentOS 之后,在你的 CentOS上打开一个终端。
|
||||
|
||||
使用终端更改工作目录并导航到你解压两个 zip 文件的目录。在终端中输入以下命令开始安装 12c。
|
||||
|
||||
./runInstaller
|
||||
|
||||

|
||||
|
||||
如果一切顺利,你会看到类似下面的截图,已经开始安装 12c。
|
||||
|
||||

|
||||
|
||||
然后你可以选择跳过更新或者下载最近更新。如果是生产服务器,建议你必须更新。我这里选择跳过。
|
||||
|
||||

|
||||
|
||||
现在,选择升级现有数据库。
|
||||
|
||||

|
||||
|
||||
对于语言,这里已经有 English。点击下一步继续,或者你可以根据你的需要添加语言。
|
||||
|
||||

|
||||
|
||||
现在,选择企业版。你可以根据你的需求选择。
|
||||
|
||||

|
||||
|
||||
然后选择软件位置路径,这些都是不言自明的。
|
||||
|
||||

|
||||
|
||||
第七步,像下面这样使用默认的选择继续下一步。
|
||||
|
||||

|
||||
|
||||
在第九步,你会看到一个类似下面这样的总结报告。
|
||||
|
||||

|
||||
|
||||
如果一切正常,你可以点击步骤九中的 install 开始安装,进入步骤十。
|
||||
|
||||

|
||||
|
||||
其中你可能会遇到一些错误,你需要通过谷歌找到这些错误的解决方法。你可能遇到的问题会有很多,因此我没有在这里详细介绍。
|
||||
|
||||
要有耐心,一步一步走下来最后它会告诉你成功了。否则,在谷歌上搜索做必要的操作解决问题。再一次说明,由于你可能会遇到的错误有很多,我无法在这里提供所有详细介绍。
|
||||
|
||||
现在,只需要按照下面屏幕指令配置监听器
|
||||
|
||||
配置完监听器之后,它会启动数据库升级助手(Database Upgrade Assistant)。选择 Upgrade Oracle Database。
|
||||
|
||||

|
||||
|
||||
在第二步,你会发现它显示了 11g 的位置路径以及 12c 的位置路径。同时你也会发现它指示说从原来的 Oracle Home Release 11 安装 Oracle Home Release 12.点击下一步进入步骤三。
|
||||
|
||||

|
||||
|
||||
按照屏幕上的说明完成安装。
|
||||
|
||||
在最后一步,你会看到一个成功窗口,其中你会看到成功升级了 oracle 数据库。
|
||||
|
||||
**一个忠告**:对于你的生产服务器,在升级到 12c 之前,请确保你已经在其它平台上测试过,以便你能修复升级过程中遇到的所有错误。永远不要尝试一无所知的时候就升级生产服务器。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.unixmen.com/upgrade-from-oracle-11g-to-oracle-12c/
|
||||
|
||||
作者:[Mohammad Forhad Iftekher][a]
|
||||
译者:[ictlyh](http://www.mutouxiaogui.cn/blog/)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.unixmen.com/author/forhad/
|
||||
[1]:http://www.oracle.com/technetwork/database/enterprise-edition/downloads/database12c-linux-download-1959253.html
|
@ -0,0 +1,126 @@
|
||||
Translated by KnightJoker
|
||||
|
||||
用Linux学习:使用这些Linux应用来征服你的数学
|
||||
================================================================================
|
||||

|
||||
|
||||
这篇文章是[用Linux学习][1]系列的一部分:
|
||||
|
||||
- [用Linux学习: 学习类型][2]
|
||||
- [用Linux学习: 物理模拟][3]
|
||||
- [用Linux学习: 学习音乐][4]
|
||||
- [用Linux学习: 两个地理应用程序][5]
|
||||
- [用Linux学习: 用这些Linux应用来征服你的数学][6]
|
||||
|
||||
|
||||
Linux提供了大量的教育软件和许多优秀的工具来帮助所有年龄段的学生学习和练习各种各样的话题,常常以交互的方式。与Linux一起学习这一系列的文章则为这些各种各样的教育软件和应用提供了一个介绍。
|
||||
|
||||
数学是计算机的核心。如果有人用精益求精和纪律来预期一个伟大的操作系统,比如GNU/ Linux,那么这将是数学。如果你在寻求一些数学应用程序,那么你将不会感到失望。Linux提供了很多优秀的工具使得数学看起来和你曾经做过的一样令人畏惧,但实际上他们会简化你使用它的方式。
|
||||
### Gnuplot ###
|
||||
|
||||
Gnuplot 是一个适用于不同平台的命令行脚本化和多功能的图形工具。尽管它的名字,并不是GNU操作系统的一部分。也没有免费授权,但它是免费软件(这意味着它受版权保护,但免费使用)。
|
||||
|
||||
要在Ubuntu系统(或者衍生系统)上安装 `gnuplot`,输入:
|
||||
sudo apt-get install gnuplot gnuplot-x11
|
||||
|
||||
进入一个终端窗口。启动该程序,输入:
|
||||
|
||||
gnuplot
|
||||
|
||||
你会看到一个简单的命令行界面:
|
||||
|
||||

|
||||
|
||||
在其中您可以直接开始输入函数。绘图命令将绘制一个曲线图。
|
||||
|
||||
输入内容,例如,
|
||||
|
||||
plot sin(x)/x
|
||||
|
||||
随着`gnuplot的`提示,将会打开一个新的窗口,图像便会在里面呈现。
|
||||
|
||||

|
||||
|
||||
你也可以在线这个图设置不同的属性,比如像这样指定“title”
|
||||
|
||||
plot sin(x) title 'Sine Function', tan(x) title 'Tangent'
|
||||
|
||||

|
||||
|
||||
使用`splot`命令,你可以给的东西更深入一点并且绘制3D图形
|
||||
|
||||
splot sin(x*y/20)
|
||||
|
||||

|
||||
|
||||
这个窗口有几个基本的配置选项,
|
||||
|
||||

|
||||
|
||||
但是`gnuplot`的真正力量在于在它的命令行和脚本功能,`gnuplot`广泛完整的文档可在这里找到,并在[Duke大学网站][8]上面看见这个了不起的教程[7]的原始版本。
|
||||
|
||||
### Maxima ###
|
||||
|
||||
[Maxima][9]是从Macsyma原始资料开发的一个计算机代数系统,根据它的 SourceForge 页面,
|
||||
|
||||
> “Maxima是符号和数值的表达,包括微分,积分,泰勒级数,拉普拉斯变换,常微分方程,线性方程组,多项式,集合,列表,向量,矩阵和张量系统的操纵系统。Maxima通过精确的分数,任意精度的整数和可变精度浮点数产生高精度的计算结果。Maxima可以二维和三维中绘制函数和数据。“
|
||||
|
||||
你将会获得二进制包用于大多数Ubuntu衍生系统的Maxima以及它的图形界面中,插入所有包,输入:
|
||||
|
||||
sudo apt-get install maxima xmaxima wxmaxima
|
||||
|
||||
在终端窗口中,Maxima是一个没有太多UI的命令行工具,但如果你开始wxmaxima,你会进入一个简单但功能强大的图形用户界面。
|
||||
|
||||

|
||||
|
||||
你可以开始输入这个来简单的一个开始。(提示:如果你想计算一个表达式,使用“Shift + Enter”回车后会增加更多的方法)
|
||||
|
||||
Maxima可以用于一些简单的问题,因此也可以作为一个计算器,
|
||||
|
||||

|
||||
|
||||
以及一些更复杂的问题,
|
||||
|
||||

|
||||
|
||||
它使用`gnuplot`使得绘制简单,
|
||||
|
||||

|
||||
|
||||
或者绘制一些复杂的图形.
|
||||
|
||||

|
||||
|
||||
(它需要gnuplot-X11的包,来显示它们。)
|
||||
|
||||
除了美化一些图形,Maxima也尽可能用latex格式导出它们,或者通过右键是捷菜单进行一些突出的操作.
|
||||
|
||||

|
||||
|
||||
然而其主菜单还是提供了大量压倒性的功能,当然Maxima的功能远不止如此,这里也有一个广泛使用的在线文档。
|
||||
|
||||
### 总结 ###
|
||||
|
||||
数学不是一个简单的学科,这些在Linux上的优秀软件也没有使得数学更加简单,但是这些应用使得使用数学变得更加的简单和工程化。以上两种应用都只是介绍一下Linux的所提供的。如果你是认真从事数学和需要更多的功能与丰富的文档,那你更应该看看这些Mathbuntu项目。
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.maketecheasier.com/learn-linux-maths/
|
||||
|
||||
作者:[Attila Orosz][a]
|
||||
译者:[KnightJoker](https://github.com/KnightJoker/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.maketecheasier.com/author/attilaorosz/
|
||||
[1]:https://www.maketecheasier.com/series/learn-with-linux/
|
||||
[2]:https://www.maketecheasier.com/learn-to-type-in-linux/
|
||||
[3]:https://www.maketecheasier.com/linux-physics-simulation/
|
||||
[4]:https://www.maketecheasier.com/linux-learning-music/
|
||||
[5]:https://www.maketecheasier.com/linux-geography-apps/
|
||||
[6]:https://www.maketecheasier.com/learn-linux-maths/
|
||||
[7]:http://www.gnuplot.info/documentation.html
|
||||
[8]:http://people.duke.edu/~hpgavin/gnuplot.html
|
||||
[9]:http://maxima.sourceforge.net/
|
||||
[10]:http://maxima.sourceforge.net/documentation.html
|
||||
[11]:http://www.mathbuntu.org/
|
@ -1,195 +0,0 @@
|
||||
[xiqingongzi translating]
|
||||
RHCSA Series: Yum 包管理, 自动任务计划和系统监控日志 – Part 10
|
||||
================================================================================
|
||||
在这篇文章中,我们将回顾如何在REHL7中安装,更新和删除软件包。我们还将介绍如何使用cron任务的自动化,并完成如何查找和监控系统日志文件以及为什么这些技能是系统管理员必备技能
|
||||
|
||||

|
||||
|
||||
RHCSA: Yum包管理, 任务计划和系统监控 – 第十章
|
||||
|
||||
### 使用yum 管理包 ###
|
||||
|
||||
要安装一个包以及所有尚未安装的依赖包,您可以使用:
|
||||
|
||||
# yum -y install package_name(s)
|
||||
|
||||
package_name(s) 需要是一个存在的包名
|
||||
|
||||
例如,安装httpd和mlocate(按顺序),类型。
|
||||
|
||||
# yum -y install httpd mlocate
|
||||
|
||||
**注意**: 字符y表示绕过执行下载和安装前的确认提示,如果需要,你可以删除它
|
||||
|
||||
默认情况下,yum将安装与操作系统体系结构相匹配的包,除非通过在包名加入架构名
|
||||
|
||||
例如,在64位系统上,使用yum安装包将安装包的x86_64版本,而package.x86 yum安装(如果有的话)将安装32位。
|
||||
|
||||
有时,你想安装一个包,但不知道它的确切名称。搜索可以在当前启用的存储库中去搜索包名称或在它的描述中搜索,并分别进行。
|
||||
|
||||
比如,
|
||||
|
||||
# yum search log
|
||||
|
||||
将搜索安装的软件包中名字与该词类似的软件,而
|
||||
|
||||
# yum search all log
|
||||
|
||||
也将在包描述和网址中寻找寻找相同的关键字
|
||||
|
||||
一旦搜索返回包列表,您可能希望在安装前显示一些信息。这时info选项派上用场:
|
||||
|
||||
# yum info logwatch
|
||||
|
||||

|
||||
|
||||
搜索包信息
|
||||
|
||||
您可以定期用以下命令检查更新:
|
||||
|
||||
# yum check-update
|
||||
|
||||
上述命令将返回可以更新的所有安装包。在下图所示的例子中,只有rhel-7-server-rpms有可用更新:
|
||||
|
||||

|
||||
检查包更新
|
||||
|
||||
然后,您可以更新该包,
|
||||
|
||||
# yum update rhel-7-server-rpms
|
||||
|
||||
如果有几个包,可以一同更新,yum update 将一次性更新所有的包
|
||||
|
||||
现在,当你知道一个可执行文件的名称,如ps2pdf,但不知道那个包提供了它?你可以通过 `yum whatprovides “*/[executable]”`找到:
|
||||
|
||||
# yum whatprovides “*/ps2pdf”
|
||||
|
||||

|
||||
|
||||
查找文件属于哪个包
|
||||
|
||||
现在,当删除包时,你可以使用 yum remove Package ,很简单吧?Yum 是一个完整的强大的包管理器。
|
||||
|
||||
# yum remove httpd
|
||||
|
||||
Read Also: [20 Yum Commands to Manage RHEL 7 Package Management][1]
|
||||
|
||||
### 文本式RPM工具 ###
|
||||
|
||||
RPM(又名RPM包管理器,或原本RedHat软件包管理器)也可用于安装或更新软件包来当他们在独立`rpm`包装形式。
|
||||
|
||||
往往使用`-Uvh` 表面这个包应该被安装而不是已存在或尝试更新。安装是`-U` ,显示详细输出用`-v`,显示进度条用`-h` 例如
|
||||
# rpm -Uvh package.rpm
|
||||
|
||||
另一个典型的使用rpm 是产生一个列表,目前安装的软件包的code > rpm -qa(缩写查询所有)
|
||||
|
||||
# rpm -qa
|
||||
|
||||

|
||||
|
||||
查询所有包
|
||||
|
||||
Read Also: [20 RPM Commands to Install Packages in RHEL 7][2]
|
||||
|
||||
### Cron任务计划 ###
|
||||
|
||||
Linux和UNIX类操作系统包括其他的工具称为Cron允许你安排任务(即命令或shell脚本)运行在周期性的基础上。每分钟定时检查/var/spool/cron目录中有在/etc/passwd帐户文件中指定名称的文件。
|
||||
|
||||
执行命令时,输出是发送到crontab的所有者(或者在/etc/crontab,在MailTO环境变量中指定的用户,如果它存在的话)。
|
||||
|
||||
crontab文件(这是通过键入crontab e和按Enter键创建)的格式如下:
|
||||
|
||||

|
||||
|
||||
crontab条目
|
||||
|
||||
因此,如果我们想更新本地文件数据库(这是用于定位文件或图案)每个初二日上午2:15,我们需要添加以下crontab条目:
|
||||
|
||||
15 02 2 * * /bin/updatedb
|
||||
|
||||
以上的条目写着:”每年每月第二天的凌晨2:15运行 /bin/updatedb“ 无论是周几”,我想你也猜到了。星号作为通配符
|
||||
|
||||
添加一个cron作业后,你可以看到一个文件名为root被添加在/var/spool/cron,正如我们前面所提到的。该文件列出了所有的crond守护进程运行的任务:
|
||||
|
||||
# ls -l /var/spool/cron
|
||||
|
||||

|
||||
|
||||
检查所有cron工作
|
||||
|
||||
在上图中,显示当前用户的crontab可以使用 cat /var/spool/cron 或
|
||||
|
||||
# crontab -l
|
||||
|
||||
如果你需要在一个更精细的时间上运行的任务(例如,一天两次或每月三次),cron也可以帮助你。
|
||||
|
||||
例如,每个月1号和15号运行 /my/script 并将输出导出到 /dev/null,您可以添加如下两个crontab条目:
|
||||
|
||||
01 00 1 * * /myscript > /dev/null 2>&1
|
||||
01 00 15 * * /my/script > /dev/null 2>&1
|
||||
|
||||
不过为了简单,你可以将他们合并
|
||||
|
||||
01 00 1,15 * * /my/script > /dev/null 2>&1
|
||||
在前面的例子中,我们可以在每三个月的第一天的凌晨1:30运行 /my/other/script .
|
||||
|
||||
30 01 1 1,4,7,10 * /my/other/script > /dev/null 2>&1
|
||||
|
||||
但是当你必须每一个“十”分钟,数小时,数天或数月的重复某个任务时,你可以通过所需的频率来划分正确的时间。以下为前一个crontab条目具有相同的意义:
|
||||
|
||||
30 01 1 */3 * /my/other/script > /dev/null 2>&1
|
||||
|
||||
或者也许你需要在一个固定的时间段或系统启动后运行某个固定的工作,例如。你可以使用下列五个字符串中的一个字符串来指示你想让你的任务计划工作的确切时间:
|
||||
|
||||
@reboot 仅系统启动时运行.
|
||||
@yearly 一年一次, 类似与 00 00 1 1 *.
|
||||
@monthly 一月一次, 类似与 00 00 1 * *.
|
||||
@weekly 一周一次, 类似与 00 00 * * 0.
|
||||
@daily 一天一次, 类似与 00 00 * * *.
|
||||
@hourly 一小时一次, 类似与 00 * * * *.
|
||||
|
||||
Read Also: [11 Commands to Schedule Cron Jobs in RHEL 7][3]
|
||||
|
||||
### 定位和查看日志###
|
||||
|
||||
系统日志存放在 /var/log 目录.根据Linux的文件系统层次标准,这个目录包括各种日志文件,并包含一些必要的子目录(如 audit, httpd, 或 samba ,如下图),并由相应的系统守护进程操作
|
||||
|
||||
# ls /var/log
|
||||
|
||||

|
||||
|
||||
Linux 日志定位
|
||||
|
||||
其他有趣的日志比如 [dmesg][4](包括了所有内核缓冲区的信息),安全(用户认证尝试链接),信息(系统信息),和wtmp(记录了所有用户的登录登出)
|
||||
|
||||
日志是非常重要的,他们让你可以看到是任何时刻发生在你的系统的事情,甚至是已经过去的事情。他们是无价的工具,解决和监测一个Linux服务器,并因此经常使用的 “tail -f command ”来实时显示正在发生并实时写入的事件。
|
||||
|
||||
举个例子,如果你想看你的内核的日志,你需要输入如下命令
|
||||
|
||||
# tail -f /var/log/dmesg
|
||||
|
||||
同样的,如果你想查看你的网络服务器日志,你需要输入如下命令
|
||||
|
||||
# tail -f /var/log/httpd/access.log
|
||||
|
||||
### 总结 ###
|
||||
|
||||
如果你知道如何有效的管理包,安排任务,以及知道在哪寻找系统当前和过去操作的信息,你可以放心你将不会总是有太多的惊喜。我希望这篇文章能够帮你学习或回顾这些基础知识。
|
||||
|
||||
如果你有任何问题或意见,请使用下面的表格反馈给我们。
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/yum-package-management-cron-job-scheduling-monitoring-linux-logs/
|
||||
|
||||
作者:[Gabriel Cánepa][a]
|
||||
译者:[xiqingongzi](https://github.com/xiqingongzi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/gacanepa/
|
||||
[1]:http://www.tecmint.com/20-linux-yum-yellowdog-updater-modified-commands-for-package-mangement/
|
||||
[2]:http://www.tecmint.com/20-practical-examples-of-rpm-commands-in-linux/
|
||||
[3]:http://www.tecmint.com/11-cron-scheduling-task-examples-in-linux/
|
||||
[4]:http://www.tecmint.com/dmesg-commands/
|
||||
|
Loading…
Reference in New Issue
Block a user