Merge pull request #70 from LCTT/master

translation
This commit is contained in:
struggling 2015-11-29 19:20:41 +08:00
commit 3b91ad6e95
6 changed files with 224 additions and 221 deletions

View File

@ -1,3 +1,5 @@
FSSlc translating
How to access Dropbox from the command line in Linux
================================================================================
Cloud storage is everywhere in today's multi-device environment, where people want to access content across multiple devices wherever they go. Dropbox is the most widely used cloud storage service thanks to its elegant UI and flawless multi-platform compatibility. The popularity of Dropbox has led to a flurry of official or unofficial Dropbox clients that are available across different operating system platforms.
@ -94,4 +96,4 @@ via: http://xmodulo.com/access-dropbox-command-line-linux.html
[a]:http://xmodulo.com/author/nanni
[1]:http://www.andreafabrizi.it/?dropbox_uploader
[2]:https://www.dropbox.com/developers/apps
[2]:https://www.dropbox.com/developers/apps

View File

@ -1,83 +0,0 @@
LNAV Ncurses based log file viewer
================================================================================
The Logfile Navigator, lnav for short, is a curses-based tool for viewing and analyzing log files. The value added by lnav over text viewers / editors is that it takes advantage of any semantic information that can be gleaned from the log file, such as timestamps and log levels. Using this extra semantic information, lnav can do things like: interleaving messages from different files; generate histograms of messages over time; and providing hotkeys for navigating through the file. It is hoped that these features will allow the user to quickly and efficiently zero-in on problems.
### lnav Features ###
#### Support for the following log file formats: ####
Syslog, Apache access log, strace, tcsh history, and generic log files with timestamps. The file format is automatically detected when the file is read in.
#### Histogram view: ####
Displays the number of log messages per bucket-of-time. Useful for getting an overview of what was happening over a long period of time.
#### Filters: ####
Display only lines that match or do not match a set of regular expressions. Useful for removing extraneous log lines that you are not interested in.
#### "Live" operation: ####
Searches are done as you type; new log lines are automatically loaded and searched as they are added; filters apply to lines as they are loaded; and, SQL queries are checked for correctness as you type.
#### Automatic tailing: ####
The log file view automatically scrolls down to follow new lines that are added to files. Simply scroll up to lock the view in place and then scroll down to the bottom to resume tailing.
#### Time-of-day ordering of lines: ####
The log lines from all the files are loaded and then sorted by time-of-day. Relieves you of having to manually line up log messages from different files.
#### Syntax highlighting: ####
Errors and warnings are colored in red and yellow, respectively. Highlights are also applied to: SQL keywords, XML tags, file and line numbers in Java backtraces, and quoted strings.
#### Navigation: ####
There are hotkeys for jumping to the next or previous error or warning and moving forward or backward by an amount of time.
#### Use SQL to query logs: ####
Each log file line is treated as a row in a database that can be queried using SQL. The columns that are available depend on logs file types being viewed.
#### Command and search history: ####
Your previously entered commands and searches are saved so you can access them between sessions.
#### Compressed files: ####
Compressed log files are automatically detected and uncompressed on the fly.
### Install lnav on ubuntu 15.10 ###
Open the terminal and run the following command
sudo apt-get install lnav
### Using lnav ###
If you want to view logs using lnav you can do using the following command by default it shows syslogs
lnav
![](http://www.ubuntugeek.com/wp-content/uploads/2015/11/51.png)
If you want to view specific logs provide the path
If you want to view CUPS logs run the following command from your terminal
lnav /var/log/cups
![](http://www.ubuntugeek.com/wp-content/uploads/2015/11/6.png)
--------------------------------------------------------------------------------
via: http://www.ubuntugeek.com/lnav-ncurses-based-log-file-viewer.html
作者:[ruchi][a]
译者:[zky001](https://github.com/zky001)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://www.ubuntugeek.com/author/ubuntufix

View File

@ -1,137 +0,0 @@
The tar command explained
================================================================================
The Linux [tar][1] command is the swiss army of the Linux admin when it comes to archiving or distributing files. Gnu Tar archives can contain multiple files and directories, file permissions can be preserved and it supports multiple compression formats. The name tar stands for "**T**ape **Ar**chiver", the format is an official POSIX standard.
### Tar file formats ###
A short introduction into tar compression levels.
- **No compression** Uncompressed files have the file ending .tar.
- **Gzip Compression** The Gzip format is the most widely used compression format for tar, it is fast for creating and extracting files. Files with gz compression have normally the file ending .tar.gz or .tgz. Here some examples on how to [create][2] and [extract][3] a tar.gz file.
- **Bzip2 Compression** The Bzip2 format offers a better compression then the Gzip format. Creating files is slower, the file ending is usually .tar.bz2.
- **Lzip (LZMA) Compression** The Lzip compression combines the speed of Gzip with a compression level that is similar to Bzip2 (or even better). Independently from these good attributes, this format is not widely used.
- **Lzop Compression** This compress option is probably the fastest compression format for tar, it has a compression level similar to gzip and is not widely used.
The common formats are tar.gz and tar.bz2. If you goal is fast compression, then use gzip. When the archive file size is critical, then use tar.bz2.
### What is the tar command used for? ###
Here a few common use cases of the tar command.
- Backup of Servers and Desktops.
- Document archiving.
- Software Distribution.
### Installing tar ###
The command is installed on most Linux Systems by default. Here are the instructions to install tar in case that the command is missing.
#### CentOS ####
Execute the following command as root user on the shell to install tar on CentOS.
yum install tar
#### Ubuntu ####
This command will install tar on Ubuntu. The "sudo" command ensures that the apt command is run with root privileges.
sudo apt-get install tar
#### Debian ####
The following apt command installs tar on Debian.
apt-get install tar
#### Windows ####
The tar command is available for Windows as well, you can download it from the Gunwin project. [http://gnuwin32.sourceforge.net/packages/gtar.htm][4]
### Create tar.gz Files ###
Here is the [tar command][5] that has to be run on the shell. I will explain the command line options below.
tar pczf myarchive.tar.gz /home/till/mydocuments
This command creates the archive myarchive.tar.gz which contains the files and folders from the path /home/till/mydocuments. **The command line options explained**:
- **[p]** This option stand for "preserve", it instructs tar to store details on file owner and file permissions in the archive.
- **[c]** Stands for create. This option is mandatory when a file is created.
- **[z]** The z option enables gzip compression.
- **[f]** The file option tells tar to create an archive file. Tar will send the output to stdout if this option is omitted.
#### Tar command examples ####
**Example 1: Backup the /etc Directory** Create a backup of the /etc config directory. The backup is stored in the root folder.
tar pczvf /root/etc.tar.gz /etc
![Backup the /etc directory with tar.](https://www.howtoforge.com/images/linux-tar-command/big/create-tar.png)
The command should be run as root to ensure that all files in /etc are included in the backup. This time, I've added the [v] option in the command. This option stands for verbose, it tells tar to show all file names that get added into the archive.
**Example 2: Backup your /home directory** Create a backup of your home directory. The backup will be stored in a directory /backup.
tar czf /backup/myuser.tar.gz /home/myuser
Replace myuser with your username. In this command, I've omitted the [p] switch, so the permissions get not preserved.
**Example 3: A file-based backup of MySQL databases** The MySQL databases are stored in /var/lib/mysql on most Linux distributions. You can check that with the command:
ls /var/lib/mysql
![File based MySQL backup with tar.](https://www.howtoforge.com/images/linux-tar-command/big/tar_backup_mysql.png)
Stop the database server to get a consistent MySQL file backup with tar. The backup will be written to the /backup folder.
1) Create the backup folder
mkdir /backup
chmod 600 /backup
2) Stop MySQL, run the backup with tar and start the database server again.
service mysql stop
tar pczf /backup/mysql.tar.gz /var/lib/mysql
service mysql start
ls -lah /backup
![File based MySQL backup.](https://www.howtoforge.com/images/linux-tar-command/big/tar-backup-mysql2.png)
### Extract tar.gz Files ###
The command to extract tar.gz files is:
tar xzf myarchive.tar.gz
#### The tar command options explained ####
- **[x]** The x stand for extract, it is mandatory when a tar file shall be extracted.
- **[z]** The z option tells tar that the archive that shall be unpacked is in gzip format.
- **[f]** This option instructs tar to read the archive content from a file, in this case the file myarchive.tar.gz.
The above tar command will silently extract that tar.gz file, it will show only error messages. If you like to see which files get extracted, then add the "v" option.
tar xzvf myarchive.tar.gz
The **[v]** option stands for verbose, it will show the file names while they get unpacked.
![Extract a tar.gz file.](https://www.howtoforge.com/images/linux-tar-command/big/tar-xfz.png)
--------------------------------------------------------------------------------
via: https://www.howtoforge.com/tutorial/linux-tar-command/
作者:[howtoforge][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.howtoforge.com/
[1]:https://en.wikipedia.org/wiki/Tar_(computing)
[2]:http://www.faqforge.com/linux/create-tar-gz/
[3]:http://www.faqforge.com/linux/extract-tar-gz/
[4]:http://gnuwin32.sourceforge.net/packages/gtar.htm
[5]:http://www.faqforge.com/linux/tar-command/

View File

@ -1,3 +1,4 @@
Translating by KnightJoker
How to Install Nginx as Reverse Proxy for Apache on FreeBSD 10.2
================================================================================
Nginx is free and open source HTTP server and reverse proxy, as well as an mail proxy server for IMAP/POP3. Nginx is high performance web server with rich of features, simple configuration and low memory usage. Originally written by Igor Sysoev on 2002, and until now has been used by a big technology company including Netflix, Github, Cloudflare, WordPress.com etc.

View File

@ -0,0 +1,83 @@
LNAV - 基于 Ncurses 的日志文件阅读器
================================================================================
日志文件导航器Logfile Navigator简称 lnav是一个基于 curses 用于查看和分析日志文件的工具。和文本阅读器/编辑器相比, lnav 的好处是它充分利用了可以从日志文件中获取的语义信息,例如时间戳和日志等级。利用这些额外的语义信息, lnav 可以处理类似事情:来自不同文件的交错信息;按照时间生成信息直方图;提供在文件中导航的关键字。它希望使用这些功能可以使得用户可以快速有效地定位和解决问题。
### lnav 功能 ###
#### 支持以下日志文件格式: ####
Syslog、Apache 访问日志、strace、tcsh 历史以及常见的带时间戳的日志文件。读入文件的时候回自动检测文件格式。
#### 直方图视图: ####
以时间为桶显示日志信息数量。这对于在一段长时间内大概了解发生了什么非常有用。
#### 过滤器: ####
只显示那些匹配或不匹配一些正则表达式的行。对于移除大量你不感兴趣的日志行非常有用。
#### 及时操作: ####
在你输入到时候会同时完成检索;当添加新日志行的时候回自动加载和搜索;加载行的时候会应用过滤器;另外,还会在你输入 SQL 查询的时候检查正确性。
#### 自动显示后文: ####
日志文件视图会自动往下滚动到新添加到文件中的行。只需要向上滚动就可以锁定当前视图,然后向下滚动到底部恢复显示后文。
#### 按照日期顺序排序行: ####
从所有文件中加载的日志行会按照日期进行排序。使得你不需要手动从不同文件中收集日志信息。
#### 语法高亮: ####
错误和警告会用红色和黄色显示。高亮还可用于: SQL 关键字、XML 标签、Java 文件行号和括起来的字符串。
#### 导航: ####
有快捷键用于跳转到下一个或上一个错误或警告,按照一定的时间向后或向前移动。
#### 用 SQL 查询日志: ####
每个日志文件行都被认为是数据库中可以使用 SQL 查询的一行。可以使用的列取决于查看的日志文件类型。
#### 命令和搜索历史: ####
会自动保存你之前输入的命令和搜素,因此你可以在会话之间使用它们。
#### 压缩文件: ####
会实时自动检测和解压压缩的日志文件。
### 在 ubuntu 15.10 上安装 lnav ####
打开终端运行下面的命令
sudo apt-get install lnav
### 使用 lnav ###
如果你想使用 lnav 查看日志,你可以使用下面的命令,默认它会显示 syslogs
lnav
![](http://www.ubuntugeek.com/wp-content/uploads/2015/11/51.png)
如果你想查看特定的日志,那么需要指定路径
如果你想看 CPU 日志,在你的终端里运行下面的命令
lnav /var/log/cups
![](http://www.ubuntugeek.com/wp-content/uploads/2015/11/6.png)
--------------------------------------------------------------------------------
via: http://www.ubuntugeek.com/lnav-ncurses-based-log-file-viewer.html
作者:[ruchi][a]
译者:[ictlyh](http://mutouxiaogui.cn/blog/)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://www.ubuntugeek.com/author/ubuntufix

View File

@ -0,0 +1,137 @@
tar 命令详解
================================================================================
Linux [tar][1] 命令是归档或分发文件时的强大武器。GNU tar 归档包可以包含多个文件和目录还能保留权限它还支持多种压缩格式。Tar 表示 "**T**ape **Ar**chiver",这是一种 POSIX 标准。
### Tar 文件格式 ###
tar 压缩等级简介。
- **无压缩** 没有压缩的文件用 .tar 结尾。
- **Gzip 压缩** Gzip 格式是 tar 使用最广泛的压缩格式,它能快速压缩和提取文件。用 gzip 压缩的文件通常用 .tar.gz 或 .tgz 结尾。这里有一些如何[创建][2]和[解压][3] tar.gz 文件的例子。
- **Bzip2 压缩** 和 Gzip格式相比 Bzip2 提供了更好的压缩比。创建压缩文件也比较慢,通常采用 .tar.bz2 结尾。
- **Lzip(LAMA)压缩** Lizp 压缩结合了 Gzip 快速的优势,以及和 Bzip2 类似(甚至更好) 的压缩率。尽管有这些好处,这个格式并没有得到广泛使用。
- **Lzop 压缩** 这个压缩选项也许是 tar 最快的压缩格式,它的压缩率和 gzip 类似,也没有广泛使用。
常见的格式是 tar.gz 和 tar.bz2。如果你想快速压缩那么就是用 gzip。如果归档文件大小比较重要就是用 tar.bz2。
### tar 命令用来干什么? ###
下面是一些使用 tar 命令的常见情形。
- 备份服务器或桌面系统
- 文档归档
- 软件分发
### 安装 tar ###
大部分 Linux 系统默认都安装了 tar。如果没有这里有安装 tar 的命令。
#### CentOS ####
在 CentOS 中,以 root 用户在 shell 中执行下面的命令安装 tar。
yum install tar
#### Ubuntu ####
下面的命令会在 Ubuntu 上安装 tar。“sudo” 命令确保 apt 命令是以 root 权限运行的。
sudo apt-get install tar
#### Debian ####
下面的 apt 命令在 Debian 上安装 tar。
apt-get install tar
#### Windows ####
tar 命令在 Windows 也可以使用,你可以从 Gunwin 项目[http://gnuwin32.sourceforge.net/packages/gtar.htm][4]中下载它。
### 创建 tar.gz 文件 ###
下面是在 shell 中运行 [tar 命令][5] 的一些例子。下面我会解释这些命令行选项。
tar pczf myarchive.tar.gz /home/till/mydocuments
这个命令会创建归档文件 myarchive.tar.gz其中包括了路径 /home/till/mydocuments 中的文件和目录。**命令行选项解释**
- **[p]** 这个选项表示 “preserve”它指示 tar 在归档文件中保留文件属主和权限信息。
- **[c]** 表示创建。要创建文件时不能缺少这个选项。
- **[z]** z 选项启用 gzip 压缩。
- **[f]** file 选项告诉 tar 创建一个归档文件。如果没有这个选项 tar 会把输出发送到 stdout。
#### Tar 命令事例 ####
**事例 1 备份 /etc 目录** 创建 /etc 配置目录的一个备份。备份保存在 root 目录。
tar pczvf /root/etc.tar.gz /etc
![用 tar 备份 /etc 目录](https://www.howtoforge.com/images/linux-tar-command/big/create-tar.png)
要以 root 用户运行命令确保 /etc 中的所有文件都会被包含在备份中。这次,我在命令中添加了 [v] 选项。这个选项表示 verbose它告诉 tar 显示所有被包含到归档文件中的文件名。
**事例 2 备份你的 /home 目录** 创建你的 home 目录的备份。备份会被保存到 /backup 目录。
tar czf /backup/myuser.tar.gz /home/myuser
用你的用户名替换 myuser。这个命令中我省略了 [p] 选项,也就不会保存权限。
**事例 3 基于文件的 MySQL 数据库备份** 在大部分 Linux 发行版中MySQL 数据库保存在 /var/lib/mysql。你可以使用下面的命令检查
ls /var/lib/mysql
![使用 tar 基于文件备份 MySQL](https://www.howtoforge.com/images/linux-tar-command/big/tar_backup_mysql.png)
用 tar 备份 MySQL 文件时为了保持一致性,首先停用数据库服务器。备份会被写到 /backup 目录。
1 创建 backup 目录
mkdir /backup
chmod 600 /backup
2 停止 MySQL用 tar 进行备份并重新启动数据库。
service mysql stop
tar pczf /backup/mysql.tar.gz /var/lib/mysql
service mysql start
ls -lah /backup
![基于文件的 MySQL 备份](https://www.howtoforge.com/images/linux-tar-command/big/tar-backup-mysql2.png)
### 提取 tar.gz 文件###
提取 tar.gz 文件的命令是:
tar xzf myarchive.tar.gz
#### tar 命令选项解释 ####
- **[x]** x 表示提取,提取 tar 文件时这个命令不可缺少。
- **[z]** z 选项告诉 tar 要解压的归档文件时 gzip 格式。
- **[f]** 该选项告诉 tar 从一个文件中读取归档内容,本例中是 myarchive.tar.gz。
上面的 tar 命令会安静地提取 tar.gz 文件,它只会显示错误信息。如果你想要看提取了哪些文件,那么添加 “v” 选项。
tar xzvf myarchive.tar.gz
**[v]** 选项表示 verbose它会向你显示解压的文件名。
![提取 tar.gz 文件](https://www.howtoforge.com/images/linux-tar-command/big/tar-xfz.png)
--------------------------------------------------------------------------------
via: https://www.howtoforge.com/tutorial/linux-tar-command/
作者:[howtoforge][a]
译者:[ictlyh](http://mutouxiaogui.cn/blog/)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.howtoforge.com/
[1]:https://en.wikipedia.org/wiki/Tar_(computing)
[2]:http://www.faqforge.com/linux/create-tar-gz/
[3]:http://www.faqforge.com/linux/extract-tar-gz/
[4]:http://gnuwin32.sourceforge.net/packages/gtar.htm
[5]:http://www.faqforge.com/linux/tar-command/