mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-02-13 00:11:22 +08:00
commit
7507430747
@ -1,43 +1,43 @@
|
||||
# dpkg commands to manage packages on Debian Based Systems
|
||||
用 dpkg 命令在 Debian 系的 Linux 系统中管理软件包
|
||||
==================
|
||||
|
||||
[dpkg][7] stands for Debian package manager (dpkg). dpkg is a command-line tool to install, build, remove and manage Debian packages. dpkg uses Aptitude (primary and more user-friendly) as a front-end to perform all the actions.
|
||||
[dpkg][7] 意即 Debian 包管理器(Debian PacKaGe manager)。dpkg 是一个可以安装、构建、删除及管理 Debian 软件包的命令行工具。dpkg 将 Aptitude(首选而更用户友好)作为执行所有操作的前端界面。
|
||||
|
||||
Other utility such as dpkg-deb and dpkg-query uses dpkg as a front-end to perform some action.
|
||||
其它的一些工具如 dpkg-deb 和 dpkg-query 等也使用 dpkg 作为执行某些操作的前端。
|
||||
|
||||
Now a days most of the administrator using Apt, [Apt-Get][6] & Aptitude to manage packages easily without headache and its robust management too.
|
||||
现在大多数系统管理员使用 Apt、[Apt-Get][6] 及 Aptitude 等工具,不用费心就可以轻松地管理软件。
|
||||
|
||||
Even though still we need to use dpkg to perform some software installation where it’s necessary. Some other package manger utilities which are being used widely in Linux are [yum][5], [dnf][4], [apt-get][3], dpkg, [rpm][2], [Zypper][1], pacman, urpmi, etc.,
|
||||
尽管如此,必要的时候还是需要用 dpkg 来安装某些软件。其它的一些在 Linux 系统上广泛使用的包管理工具还有 [yum][5]、[dnf][4]、[apt-get][3]、dpkg、[rpm][2]、[Zypper][1]、pacman、urpmi 等等。
|
||||
|
||||
Now, i’m going to play on our Ubuntu 15.10 box to explain and cover mostly used dpkg commands with examples.
|
||||
现在,我要在装有 Ubuntu 15.10 的机器上用一些实例讲解最常用的 dpkg 命令。
|
||||
|
||||
#### 1) Common syntax/file location for dpkg
|
||||
### 1) dpkg 常见命令的语法及 dpkg 文件位置
|
||||
|
||||
See below for common syntax/ file location of dpkg which will help you if you want to check more about it.
|
||||
下面是 dpkg 常见命令的语法及 dpkg 相关文件的位置,如果想深入了解,这些对你肯定大有益处。
|
||||
|
||||
<iframe marginwidth="0" marginheight="0" scrolling="no" frameborder="0" height="90" width="728" id="_mN_gpt_827143833" style="border-width: 0px; border-style: initial; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline;"></iframe>
|
||||
```
|
||||
[General syntax for dpkg]
|
||||
### dpkg 命令的语法
|
||||
$ dpkg -[command] [.deb package name]
|
||||
|
||||
$ dpkg -[command] [package name]
|
||||
|
||||
[dpkg releated files location]
|
||||
### dpkg 相关文件的位置
|
||||
$ /var/lib/dpkg
|
||||
|
||||
[This file contain modified package info by dpkg command like (install, remove, etc..,)]
|
||||
### 这个文件包含了被 dpkg 命令(install、remove 等)所修改的包的信息
|
||||
$ /var/lib/dpkg/status
|
||||
|
||||
[This file contain available package list]
|
||||
### 这个文件包含了可用包的列表
|
||||
$ /var/lib/dpkg/status
|
||||
|
||||
```
|
||||
|
||||
#### 2) Install/Upgrade the package
|
||||
### 2) 安装/升级软件
|
||||
|
||||
Use the below command to install/upgrade .deb packge on Debian based systems such as Debian, Mint, Ubuntu & elementryOS, etc..,. Here i’m going to install Atom through atom-amd64.deb file. It will upgrade if it’s installed other wise install a fresh one.
|
||||
在基于 Debian 的系统里,比如 Debian、Mint、Ubuntu 和 elementryOS,用以下命令来安装/升级 .deb 软件包。这里我要用 `atom-amd64.deb` 文件安装 Atom。要是已经安装了 Atom,就会升级它。要么就会安装一个新的 Atom。
|
||||
|
||||
```
|
||||
[Install/Upgrade dpkg packages]
|
||||
### 安装或升级 dpkg 软件包
|
||||
$ sudo dpkg -i atom-amd64.deb
|
||||
Selecting previously unselected package atom.
|
||||
(Reading database ... 426102 files and directories currently installed.)
|
||||
@ -52,9 +52,9 @@ Processing triggers for mime-support (3.58ubuntu1) ...
|
||||
|
||||
```
|
||||
|
||||
#### 3) Install a package from folder
|
||||
### 3) 从文件夹里安装软件
|
||||
|
||||
Use the below command to install the packages recursively from directory on Debian based systems such as Debian, Mint, Ubuntu & elementryOS, etc,. This will install all the *.deb packages under the /opt/software directory.
|
||||
在基于 Debian 的系统里,用下列命令从目录中逐个安装软件。这会安装 `/opt/software` 目录下的所有以 .deb 为后缀的软件。
|
||||
|
||||
```
|
||||
$ sudo dpkg -iR /opt/software
|
||||
@ -70,9 +70,9 @@ Processing triggers for desktop-file-utils (0.22-1ubuntu3) ...
|
||||
Processing triggers for mime-support (3.58ubuntu1) ...
|
||||
```
|
||||
|
||||
#### 4) Print the Installed packages list
|
||||
### 4) 显示已安装软件列表
|
||||
|
||||
Use the below command to List all installed packages, along with package version and description on Debian based systems such as Debian, Mint, Ubuntu & elementryOS, etc..,.
|
||||
以下命令可以列出 Debian 系的系统中所有已安装的软件,同时会显示软件版本和描述信息。
|
||||
|
||||
```
|
||||
$ dpkg -l
|
||||
@ -92,11 +92,10 @@ ii account-plugin-salut 3.12.10-0ubuntu2 amd64
|
||||
|
||||
```
|
||||
|
||||
#### 5) Check particular Installed package
|
||||
### 5) 查看指定的已安装软件
|
||||
|
||||
Use the below command to List individual installed package, along with package version and description on Debian based systems such as Debian, Mint, Ubuntu & elementryOS, etc..,.
|
||||
用以下命令列出指定的一个已安装软件,同时会显示软件版本和描述信息。
|
||||
|
||||
<iframe marginwidth="0" marginheight="0" scrolling="no" frameborder="0" height="90" width="728" id="_mN_gpt_827143833" style="border-width: 0px; border-style: initial; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline;"></iframe>
|
||||
```
|
||||
$ dpkg -l atom
|
||||
Desired=Unknown/Install/Remove/Purge/Hold
|
||||
@ -108,9 +107,9 @@ ii atom 1.5.3 amd64 A hackable text editor for the 21st
|
||||
|
||||
```
|
||||
|
||||
#### 6) Check package Installed Location
|
||||
### 6) 查看软件安装目录
|
||||
|
||||
Use the below command to Check package Installed Location on Debian based systems such as Debian, Mint, Ubuntu & elementryOS, etc..,.
|
||||
以下命令可以在基于 Debian 的系统上查看软件的安装路径。
|
||||
|
||||
```
|
||||
$ dpkg -L atom
|
||||
@ -128,9 +127,9 @@ $ dpkg -L atom
|
||||
|
||||
```
|
||||
|
||||
#### 7) View deb package content
|
||||
### 7) 查看 deb 包内容
|
||||
|
||||
Use the below command to View deb package content, It will show list of files on inside .deb package.
|
||||
下列命令可以查看 deb 包内容。它会显示 .deb 包中的一系列文件。
|
||||
|
||||
```
|
||||
$ dpkg -c atom-amd64.deb
|
||||
@ -149,9 +148,9 @@ drwxr-xr-x root/root 0 2016-02-13 02:13 ./usr/share/doc/
|
||||
.
|
||||
```
|
||||
|
||||
#### 8) Display details about package
|
||||
### 8) 显示软件的详细信息
|
||||
|
||||
Use the below command to Display detailed information about package, package group, version, maintainer, Architecture, display depends packages, description, etc.,.
|
||||
以下命令可以显示软件的详细信息,如软件名、软件类别、版本、维护者、软件架构、依赖的软件、软件描述等等。
|
||||
|
||||
```
|
||||
$ dpkg -s atom
|
||||
@ -169,9 +168,9 @@ Description: A hackable text editor for the 21st Century.
|
||||
Atom is a free and open source text editor that is modern, approachable, and hackable to the core.</atom@github.com>
|
||||
```
|
||||
|
||||
#### 9) Find what package owns the file
|
||||
### 9) 查看文件属于哪个软件
|
||||
|
||||
Use the below command to find out what package does file belong.
|
||||
用以下命令来查看文件属于哪个软件。
|
||||
|
||||
```
|
||||
$ dpkg -S /usr/bin/atom
|
||||
@ -179,11 +178,11 @@ atom: /usr/bin/atom
|
||||
|
||||
```
|
||||
|
||||
#### 10) Remove/Delete package
|
||||
### 10) 移除/删除软件
|
||||
|
||||
以下命令可以用来移除/删除一个已经安装的软件,但不删除配置文件。
|
||||
|
||||
Use the below command to Remove/Delete an installed package except configuration files.
|
||||
|
||||
<iframe marginwidth="0" marginheight="0" scrolling="no" frameborder="0" height="90" width="728" id="_mN_gpt_827143833" style="border-width: 0px; border-style: initial; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline;"></iframe>
|
||||
```
|
||||
$ sudo dpkg -r atom
|
||||
(Reading database ... 426404 files and directories currently installed.)
|
||||
@ -196,9 +195,9 @@ Processing triggers for mime-support (3.58ubuntu1) ...
|
||||
|
||||
```
|
||||
|
||||
#### 11) Purge package
|
||||
### 11) 清除软件
|
||||
|
||||
Use the below command to Remove/Delete everything including configuration files.
|
||||
以下命令可以用来移除/删除包括配置文件在内的所有文件。
|
||||
|
||||
```
|
||||
$ sudo dpkg -P atom
|
||||
@ -212,28 +211,26 @@ Processing triggers for mime-support (3.58ubuntu1) ...
|
||||
|
||||
```
|
||||
|
||||
#### 12) Read more about dpkg
|
||||
### 12) 了解更多
|
||||
|
||||
Use the below commands to read more about dpkg command information.
|
||||
用以下命令来查看更多关于 dpkg 的信息。
|
||||
|
||||
```
|
||||
$ dpkg -help
|
||||
or
|
||||
或
|
||||
$ man dpkg
|
||||
|
||||
```
|
||||
|
||||
Enjoy….)
|
||||
开始体验 dpkg 吧。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.2daygeek.com/dpkg-command-examples/
|
||||
|
||||
作者:[MAGESH MARUTHAMUTHU ][a]
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
作者:[MAGESH MARUTHAMUTHU][a]
|
||||
译者:[GitFuture](https://github.com/GitFuture)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -0,0 +1,140 @@
|
||||
轻轻几个点击,在 AWS 和 Azure 上搭建 Docker 数据中心
|
||||
===================================================
|
||||
|
||||
通过几个点击即可在 “AWS 快速起步”和“Azure 市场”上高效搭建产品级 Docker 数据中心。
|
||||
|
||||
通过 AWS 快速起步的 CloudFormation 模板和在 Azure 市场上的预编译模板来部署 Docker 数据中心使得比以往在公有云基础设施下的部署企业级的 CaaS Docker 环境更加容易。
|
||||
|
||||
Docker 数据中心 CaaS 平台为各种规模的企业的敏捷应用部署提供了容器和集群的编排和管理,使之更简单、安全和可伸缩。使用新为 Docker 数据中心预编译的云模板,开发者和 IT 运维人员可以无缝的把容器化的应用迁移到亚马逊 EC2 或者微软的 Azure 环境而无需修改任何代码。现在,企业可以快速实现更高的计算和运营效率,可以通过短短几步操作实现支持 Docker 的容器管理和编排。
|
||||
|
||||
### 什么是 Docker 数据中心?
|
||||
|
||||
Docker 数据中心包括了 Docker 通用控制面板(Docker Universal Control Plane)(UCP),Docker 可信注册库( Docker Trusted Registry)(UTR)和商用版 Docker 引擎(CS Docker Engine),并带有与客户的应用服务等级协议相匹配的商业支持服务。
|
||||
|
||||
- Docker 通用控制面板(UCP),一种企业级的集群管理方案,帮助客户通过单个管理面板管理整个集群
|
||||
- Docker 可信注册库(DTR), 一种镜像存储管理方案,帮助客户安全存储和管理 Docker 镜像
|
||||
- 商用版的 Docker 引擎
|
||||
|
||||
![](http://img.scoop.it/lVraAJgJbjAKqfWCLtLuZLnTzqrqzN7Y9aBZTaXoQ8Q=)
|
||||
|
||||
### 在 AWS 上快速布置 Docker 数据中心
|
||||
|
||||
秉承 Docker 与 AWS 最佳实践,参照 AWS 快速起步教程来,你可以在 AWS 云上快速部署 Docker 容器。Docker 数据中心快速起步基于模块化和可定制的 CloudFormation 模板,客户可以在其之上增加额外功能或者为自己的 Docker 部署修改模板。
|
||||
|
||||
- [AWS 的 Docker 数据中心应用说明](https://youtu.be/aUx7ZdFSkXU)
|
||||
|
||||
#### 架构
|
||||
|
||||
![](http://img.scoop.it/sZ3_TxLba42QB-r_6vuApLnTzqrqzN7Y9aBZTaXoQ8Q=)
|
||||
|
||||
AWS Cloudformation 的安装过程始于创建 AWS 资源,这些 AWS 需要的资源包括:VPC、安全组、公有与私有子网、因特网网关、NAT 网关与 S3 bucket。
|
||||
|
||||
然后,AWS Cloudformation 启动第一个 UCP 控制器实例,紧接着,安装 Docker 引擎和 UCP 容器。它把第一个 UCP 控制器创建的根证书备份到 S3。一旦第一个 UCP 控制器成功运行,其他 UCP 控制器、UCP 集群节点和第一个 DTR 复制的进程就会被触发。和第一个 UCP 控制器节点类似,其他所有节点创建进程也都由商用版 Docker 引擎开始,然后安装并运行 UCP 和 DTR 容器以加入集群。两个弹性负载均衡器(ELB),一个分配给 UCP,另外一个为 DTR 服务,它们启动并自动完成配置来在两个可用区(AZ)之间提供弹性负载均衡。
|
||||
|
||||
除这些之外,如有需要,UCP 控制器和节点在 ASG 中启动并提供扩展功能。这种架构确保 UCP 和 DTR 两者都部署在两个 AZ 上以增强弹性与高可靠性。在公有或者私有 HostedZone 上,Route53 用来动态注册或者配置 UCP 和 DTR。
|
||||
|
||||
![](http://img.scoop.it/HM7Ag6RFvMXvZ_iBxRgKo7nTzqrqzN7Y9aBZTaXoQ8Q=)
|
||||
|
||||
#### 快速起步模板的核心功能如下:
|
||||
|
||||
- 创建 VPC、不同 AZ 上的私有和公有子网、ELB、NAT 网关、因特网网关、自动伸缩组,它们全部基于 AWS 最佳实践
|
||||
- 为 DDC 创建一个 S3 bucket,其用于证书备份和 DTR 映像存储(DTR 需要额外配置)
|
||||
- 在客户的 VPC 范畴,跨多 AZ 部署 3 个 UCP 控制器
|
||||
- 创建预配置正常检测的 UCP ELB
|
||||
- 创建一个 DNS 记录并关联到 UCP ELB
|
||||
- 创建可伸缩的 UCP 节点集群
|
||||
- 在 VPC 范畴内,跨多 AZ 创建 3 个 DTR 副本
|
||||
- 创建一个预配置正常检测的 DTR
|
||||
- 创建一个 DNS 记录,并关联到 DTR ELB
|
||||
|
||||
- [下载 AWS 快速指南](https://s3.amazonaws.com/quickstart-reference/docker/latest/doc/docker-datacenter-on-the-aws-cloud.pdf)
|
||||
|
||||
|
||||
### 在 AWS 使用 Docker 数据中心
|
||||
|
||||
1. 登录 [Docker Store][1] 获取 [30 天免费试用][2]或者[联系销售][4]
|
||||
2. 确认之后,看到提示“Launch Stack”后,客户会被重定向到 AWS Cloudformation 入口
|
||||
3. 确认启动 Docker 的 AWS 区域
|
||||
4. 提供启动参数
|
||||
5. 确认并启动
|
||||
6. 启动完成之后,点击输出标签可以看到 UCP/DTR 的 URL、缺省用户名、密码和 S3 bucket 的名称
|
||||
|
||||
- [Docker 数据中心需要 2000 美刀信用担保](https://aws.amazon.com/mp/contactdocker/)
|
||||
|
||||
### 在 Azure 使用 Azure 市场的预编译模板部署
|
||||
|
||||
在 Azure 市场上,Docker 数据中心是一个预先编译的模板,客户可以在 Azure 横跨全球的数据中心即起即用。客户可以根据自己需求从 Azure 提供的各种 VM 中选择适合自己的 VM 部署 Docker 数据中心。
|
||||
|
||||
#### 架构
|
||||
|
||||
![](http://img.scoop.it/V9SpuBCoAnUnkRL3J-FRFLnTzqrqzN7Y9aBZTaXoQ8Q=)
|
||||
|
||||
Azure 部署过程始于输入一些基本用户信息,如 ssh 登录的管理员用户名(系统级管理员)和资源组名称。你可以把资源组理解为一组有生命周期和部署边界的资源集合。你可以在这个链接了解更多关于资源组的信息: http://azure.microsoft.com/en-us/documentation/articles/resource-group-overview/ 。
|
||||
|
||||
下一步,输入集群详细信息,包括:UCP 控制器 VM 大小、控制器个数(缺省为 3 个)、UCP 节点 VM 大小、UCP 节点个数(缺省 1,最大值为 10)、DTR 节点 VM 大小、DTR 节点个数、虚拟网络名和地址(例如:10.0.0.1/19)。关于网络,客户可以配置 2 个子网:第一个子网分配给 UCP 控制器 ,第二个分配给 DTC 和 UCP 节点。
|
||||
|
||||
最后,点击 OK 完成部署。对于小集群,服务开通需要大约 15-19 分钟,大集群更久些。
|
||||
|
||||
![](http://img.scoop.it/DXPM5-GXP0j2kEhno0kdRLnTzqrqzN7Y9aBZTaXoQ8Q=)
|
||||
|
||||
![](http://img.scoop.it/321ElkCf6rqb7u_-nlGPtrnTzqrqzN7Y9aBZTaXoQ8Q=)
|
||||
|
||||
#### 如何在 Azure 部署
|
||||
|
||||
1. 注册 [Docker 数据中心 30 天试用][5]许可或者[联系销售][6]
|
||||
2. [跳转到微软 Azure 市场的 Docker 数据中心][7]
|
||||
3. [查看部署文档][8]
|
||||
|
||||
|
||||
---
|
||||
|
||||
通过注册获取 Docker 数据中心许可证开始,然后你就能够通过 AWS 或者 Azure 模板搭建自己的数据中心。
|
||||
|
||||
- [获取 30 天试用许可证][9]
|
||||
- [通过视频理解 Docker 数据中心架构][10]
|
||||
- [观看演示视频][11]
|
||||
- [获取 AWS 提供的部署 Docker 数据中心的 75 美元红包奖励][12]
|
||||
|
||||
了解有关 Docker 的更多信息:
|
||||
|
||||
- 初识 Docker? 尝试一下 10 分钟[在线学习课程][20]
|
||||
- 分享镜像,自动构建,或用一个[免费的 Docker Hub 账号][21]尝试更多
|
||||
- 阅读 [Docker 1.12 发行说明][22]
|
||||
- 订阅 [Docker Weekly][23]
|
||||
- 报名参加即将到来的 [Docker Online Meetups][24]
|
||||
- 参加即将发生的 [Docker Meetups][25]
|
||||
- 观看 [DockerCon EU2015][26]视频
|
||||
- 开始为 [Docker][27] 贡献力量
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://blog.docker.com/2016/06/docker-datacenter-aws-azure-cloud/
|
||||
|
||||
作者:[Trisha McCanna][a]
|
||||
译者:[firstadream](https://github.com/firstadream)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://blog.docker.com/author/trisha/
|
||||
[1]: https://store.docker.com/login?next=%2Fbundles%2Fdocker-datacenter%2Fpurchase?plan=free-trial
|
||||
[2]: https://store.docker.com/login?next=%2Fbundles%2Fdocker-datacenter%2Fpurchase?plan=free-trial
|
||||
[4]: https://goto.docker.com/contact-us.html
|
||||
[5]: https://store.docker.com/login?next=%2Fbundles%2Fdocker-datacenter%2Fpurchase?plan=free-trial
|
||||
[6]: https://goto.docker.com/contact-us.html
|
||||
[7]: https://azure.microsoft.com/en-us/marketplace/partners/docker/dockerdatacenterdocker-datacenter/
|
||||
[8]: https://success.docker.com/Datacenter/Apply/Docker_Datacenter_on_Azure
|
||||
[9]: http://www.docker.com/trial
|
||||
[10]: https://www.youtube.com/playlist?list=PLkA60AVN3hh8tFH7xzI5Y-vP48wUiuXfH
|
||||
[11]: https://www.youtube.com/playlist?list=PLkA60AVN3hh8a8JaIOA5Q757KiqEjPKWr
|
||||
[12]: https://aws.amazon.com/quickstart/promo/
|
||||
[20]: https://docs.docker.com/engine/understanding-docker/
|
||||
[21]: https://hub.docker.com/
|
||||
[22]: https://docs.docker.com/release-notes/
|
||||
[23]: https://www.docker.com/subscribe_newsletter/
|
||||
[24]: http://www.meetup.com/Docker-Online-Meetup/
|
||||
[25]: https://www.docker.com/community/meetup-groups
|
||||
[26]: https://www.youtube.com/playlist?list=PLkA60AVN3hh87OoVra6MHf2L4UR9xwJkv
|
||||
[27]: https://docs.docker.com/contributing/contributing/
|
||||
|
@ -0,0 +1,166 @@
|
||||
删除一个目录下部分类型之外的所有文件的三种方法
|
||||
=========
|
||||
|
||||
有的时候,你可能会遇到这种情况,你需要删除一个目录下的所有文件,或者只是简单的通过删除除了一些指定类型(以指定扩展名结尾)之外的文件来清理一个目录。
|
||||
|
||||
在这篇文章,我们将会向你展现如何通过 `rm`、 `find` 和 `globignore` 命令删除一个目录下除了指定文件扩展名或者类型的之外的文件。
|
||||
|
||||
在我们进一步深入之前,让我们开始简要的了解一下 Linux 中的一个重要的概念 —— 文件名模式匹配,它可以让我们解决眼前的问题。
|
||||
|
||||
在 Linux 下,一个 shell 模式是一个包含以下特殊字符的字符串,称为通配符或者元字符:
|
||||
|
||||
1. `*` – 匹配 0 个或者多个字符
|
||||
2. `?` – 匹配任意单个字符
|
||||
3. `[序列]` – 匹配序列中的任意一个字符
|
||||
4. `[!序列]` – 匹配任意一个不在序列中的字符
|
||||
|
||||
我们将在这儿探索三种可能的办法,包括:
|
||||
|
||||
### 使用扩展模式匹配操作符删除文件
|
||||
|
||||
下来列出了不同的扩展模式匹配操作符,这些模式列表是一个用 `|` 分割包含一个或者多个文件名的列表:
|
||||
|
||||
1. `*(模式列表)` – 匹配 0 个或者多个出现的指定模式
|
||||
2. `?(模式列表)` – 匹配 0 个或者 1 个出现的指定模式
|
||||
4. `@(模式列表)` – 匹配 1 个或者多个出现的指定模式
|
||||
5. `!(模式列表)` – 匹配除了一个指定模式之外的任何内容
|
||||
|
||||
为了使用它们,需要像下面一样打开 extglob shell 选项:
|
||||
|
||||
```
|
||||
# shopt -s extglob
|
||||
|
||||
```
|
||||
|
||||
**1. 输入以下命令,删除一个目录下除了 filename 之外的所有文件**
|
||||
|
||||
```
|
||||
$ rm -v !("filename")
|
||||
```
|
||||
![删除 Linux 下除了一个文件之外的所有文件](http://www.tecmint.com/wp-content/uploads/2016/10/DeleteAll-Files-Except-One-File-in-Linux.png)
|
||||
|
||||
*删除 Linux 下除了一个文件之外的所有文件*
|
||||
|
||||
**2. 删除除了 filename1 和 filename2 之外的所有文件**
|
||||
|
||||
```
|
||||
$ rm -v !("filename1"|"filename2")
|
||||
```
|
||||
![在 Linux 下删除除了一些文件之外的所有文件](http://www.tecmint.com/wp-content/uploads/2016/10/Delete-All-Files-Except-Few-Files-in-Linux.png)
|
||||
|
||||
*在 Linux 下删除除了一些文件之外的所有文件*
|
||||
|
||||
**3. 下面的例子显示如何通过交互模式删除除了 `.zip` 之外的所有文件**
|
||||
|
||||
```
|
||||
$ rm -i !(*.zip)
|
||||
```
|
||||
|
||||
![在 Linux 下删除除了 Zip 文件之外的所有文件](http://www.tecmint.com/wp-content/uploads/2016/10/Delete-All-Files-Except-Zip-Files-in-Linux.png)
|
||||
|
||||
*在 Linux 下删除除了 Zip 文件之外的所有文件*
|
||||
|
||||
**4. 接下来,通过如下的方式你可以删除一个目录下除了所有的`.zip` 和 `.odt` 文件的所有文件,并且在删除的时候,显示正在删除的文件:**
|
||||
|
||||
```
|
||||
$ rm -v !(*.zip|*.odt)
|
||||
```
|
||||
![删除除了指定文件扩展的所有文件](http://www.tecmint.com/wp-content/uploads/2016/10/Delete-All-Files-Except-Certain-File-Extensions.png)
|
||||
|
||||
*删除除了指定文件扩展的所有文件*
|
||||
|
||||
一旦你已经执行了所有需要的命令,你还可以使用如下的方式关闭 extglob shell 选项。
|
||||
|
||||
```
|
||||
$ shopt -u extglob
|
||||
```
|
||||
|
||||
### 使用 Linux 下的 find 命令删除文件
|
||||
|
||||
在这种方法下,我们可以[只使用 find 命令][5]的适当的选项或者采用管道配合 `xargs` 命令,如下所示:
|
||||
|
||||
```
|
||||
$ find /directory/ -type f -not -name 'PATTERN' -delete
|
||||
$ find /directory/ -type f -not -name 'PATTERN' -print0 | xargs -0 -I {} rm {}
|
||||
$ find /directory/ -type f -not -name 'PATTERN' -print0 | xargs -0 -I {} rm [options] {}
|
||||
```
|
||||
|
||||
**5. 下面的命令将会删除当前目录下除了 `.gz` 之外的所有文件**
|
||||
|
||||
```
|
||||
$ find . -type f -not -name '*.gz' -delete
|
||||
```
|
||||
![find 命令 —— 删除 .gz 之外的所有文件](http://www.tecmint.com/wp-content/uploads/2016/10/Remove-All-Files-Except-gz-Files.png)
|
||||
|
||||
*find 命令 —— 删除 .gz 之外的所有文件*
|
||||
|
||||
**6. 使用管道和 xargs,你可以通过如下的方式修改上面的例子:**
|
||||
|
||||
```
|
||||
$ find . -type f -not -name '*gz' -print0 | xargs -0 -I {} rm -v {}
|
||||
```
|
||||
![使用 find 和 xargs 命令删除文件](http://www.tecmint.com/wp-content/uploads/2016/10/Remove-Files-Using-Find-and-Xargs-Command.png)
|
||||
|
||||
*使用 find 和 xargs 命令删除文件*
|
||||
|
||||
**7. 让我们看一个额外的例子,下面的命令行将会删除掉当前目录下除了 `.gz`、 `.odt` 和 `.jpg` 之外的所有文件:**
|
||||
|
||||
```
|
||||
$ find . -type f -not \(-name '*gz' -or -name '*odt' -or -name '*.jpg' \) -delete
|
||||
```
|
||||
![删除除了指定扩展文件的所有文件](http://www.tecmint.com/wp-content/uploads/2016/10/Remove-All-Files-Except-File-Extensions.png)
|
||||
|
||||
*删除除了指定扩展文件的所有文件*
|
||||
|
||||
### 通过 bash 中的 GLOBIGNORE 变量删除文件
|
||||
|
||||
然而,最后的方法,只适用于 bash。 `GLOBIGNORE` 变量存储了一个路径名展开(pathname expansion)功能的忽略模式(或文件名)列表,以冒号分隔。
|
||||
|
||||
为了使用这种方法,切换到要删除文件的目录,像下面这样设置 `GLOBIGNORE` 变量:
|
||||
|
||||
```
|
||||
$ cd test
|
||||
$ GLOBIGNORE=*.odt:*.iso:*.txt
|
||||
```
|
||||
|
||||
在这种情况下,除了 `.odt`、 `.iso` 和 `.txt` 之外的所有文件,都将从当前目录删除。
|
||||
|
||||
现在,运行如下的命令清空这个目录:
|
||||
|
||||
```
|
||||
$ rm -v *
|
||||
```
|
||||
|
||||
之后,关闭 `GLOBIGNORE` 变量:
|
||||
|
||||
```
|
||||
$ unset GLOBIGNORE
|
||||
```
|
||||
![使用 bash 变量 GLOBIGNORE 删除文件](http://www.tecmint.com/wp-content/uploads/2016/10/Delete-Files-Using-Bash-GlobIgnore.png)
|
||||
|
||||
*使用 bash 变量 GLOBIGNORE 删除文件*
|
||||
|
||||
注:为了理解上面的命令行采用的标识的意思,请参考我们在每一个插图中使用的命令对应的 man 手册。
|
||||
|
||||
就这些了!如果你知道有实现相同目录的其他命令行技术,不要忘了通过下面的反馈部分分享给我们。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/delete-all-files-in-directory-except-one-few-file-extensions/
|
||||
|
||||
作者:[Aaron Kili][a]
|
||||
译者:[yangmingming](https://github.com/yangmingming)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: http://www.tecmint.com/author/aaronkili/
|
||||
[1]:http://www.tecmint.com/wp-content/uploads/2016/10/Delete-Files-Using-Bash-GlobIgnore.png
|
||||
[2]:http://www.tecmint.com/wp-content/uploads/2016/10/Remove-All-Files-Except-File-Extensions.png
|
||||
[3]:http://www.tecmint.com/wp-content/uploads/2016/10/Remove-Files-Using-Find-and-Xargs-Command.png
|
||||
[4]:http://www.tecmint.com/wp-content/uploads/2016/10/Remove-All-Files-Except-gz-Files.png
|
||||
[5]:http://www.tecmint.com/35-practical-examples-of-linux-find-command/
|
||||
[6]:http://www.tecmint.com/wp-content/uploads/2016/10/Delete-All-Files-Except-Certain-File-Extensions.png
|
||||
[7]:http://www.tecmint.com/wp-content/uploads/2016/10/Delete-All-Files-Except-Zip-Files-in-Linux.png
|
||||
[8]:http://www.tecmint.com/wp-content/uploads/2016/10/Delete-All-Files-Except-Few-Files-in-Linux.png
|
||||
[9]:http://www.tecmint.com/wp-content/uploads/2016/10/DeleteAll-Files-Except-One-File-in-Linux.png
|
@ -0,0 +1,27 @@
|
||||
98% 的开发者在工作中使用了开源软件
|
||||
==================
|
||||
|
||||
![developer using open source](http://i0.wp.com/opensourceforu.com/wp-content/uploads/2016/07/developer.jpg?resize=750%2C500)
|
||||
|
||||
开源每天都会达到新的高度。但是一个新的研究表明超过 98% 的开发者在工作中使用开源工具。
|
||||
|
||||
Git 仓库管理软件 [GitLab][1] 进行了一项调查披露了一些关于开源接受度的有趣事实。针对开发人员群体的调查表明 98% 的开发者更喜欢在工作中使用开源,91% 选择在工作和个人项目中选择使用相同的开发工具。此外,92% 的人认为分布式版本控制系统(Git 仓库)在工作中很重要。
|
||||
|
||||
在所有的偏好编程语言中,JavaScript 占了 51% 的受访者比例。它后面是 Python、PHP、Java、Swift 和Objective-C。86% 的开发者认为安全是代码的主要判断标准。
|
||||
|
||||
GitLab 首席执行官兼联合创始人 Sid Sijbrandij 在一次声明中表示:“尽管过程驱动的开发技术在过去已经取得了成功,但开发人员正在寻找一种更自然的软件开发革新以促进项目生命周期内的协作和信息共享。”
|
||||
|
||||
这份报告来自 GitLab 在 7 月 6 日和 27 日之间对使用其存储库平台的 362 家初创企业和企业的 CTO、开发人员和 DevOps 专业人士的调查。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://opensourceforu.com/2016/11/98-percent-developers-use-open-source-at-work/
|
||||
|
||||
作者:[JAGMEET SINGH][a]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: http://opensourceforu.com/author/jagmeet-singh/
|
||||
[1]:https://about.gitlab.com/2016/11/02/global-developer-survey-2016/
|
@ -1,148 +0,0 @@
|
||||
TOP 5 BEST VIDEO EDITING SOFTWARE FOR LINUX IN 2016
|
||||
=====================================================
|
||||
|
||||
![](https://itsfoss.com/wp-content/uploads/2016/06/linux-video-ditor-software.jpg)
|
||||
|
||||
Brief: Tiwo discusses the best video editors for Linux, their pros and cons and the installation method for Ubuntu-based distros in this article.
|
||||
|
||||
We have discussed [best photo management applications for Linux][1], [best code editors for Linux][2] in similar articles in the past. Today we shall see the best video editing software for Linux.
|
||||
|
||||
When asked about free video editing software, Windows Movie Maker and iMovie is what most people often suggest.
|
||||
|
||||
Unfortunately, both of them are not available for GNU/Linux. But you don’t need to worry about it, we have pooled together a list of best free video editors for you.
|
||||
|
||||
### BEST VIDEO EDITOR APPS FOR LINUX
|
||||
|
||||
Let’s have a look at the top 5 best free video editing software for Linux below :
|
||||
|
||||
#### 1. KDENLIVE
|
||||
|
||||
![](https://itsfoss.com/wp-content/uploads/2016/06/kdenlive-free-video-editor-on-ubuntu.jpg)
|
||||
|
||||
[Kdenlive][3] is a free and [open source][4] video editing software from KDE that provides dual video monitors, a multi-track timeline, clip list, customizable layout support, basic effects, and basic transitions.
|
||||
It supports wide variety of file formats and a wide range of camcorders and cameras including Low resolution camcorder (Raw and AVI DV editing), Mpeg2, mpeg4 and h264 AVCHD (small cameras and camcorders), High resolution camcorder files, including HDV and AVCHD camcorders, Professional camcorders, including XDCAM-HD™ streams, IMX™ (D10) streams, DVCAM (D10) , DVCAM, DVCPRO™, DVCPRO50™ streams and DNxHD™ streams.
|
||||
|
||||
You can install it from terminal by running the following command :
|
||||
|
||||
```
|
||||
sudo apt-get install kdenlive
|
||||
```
|
||||
|
||||
Or, open Ubuntu Software Center then search Kdenlive.
|
||||
|
||||
#### 2. OPENSHOT
|
||||
|
||||
![](https://itsfoss.com/wp-content/uploads/2016/06/openshot-free-video-editor-on-ubuntu.jpg)
|
||||
|
||||
[OpenShot][5] is the second choice in our list of Linux video editing software. OpenShot can help you create the film that supports for transitions, effects, adjusting audio levels, and of course, it support of most formats and codecs.
|
||||
|
||||
You can also export your film to DVD, upload to YouTube, Vimeo, Xbox 360, and many other common formats. OpenShot is simpler than kdenlive. So if you need a video editor with a simple UI OpenShot is a good choice.
|
||||
|
||||
The latest version is 2.0.7. You can install OpenShot video editor by run the following command from terminal window :
|
||||
|
||||
```
|
||||
sudo apt-get install openshot
|
||||
```
|
||||
|
||||
It needs to download 25 MB, and 70 MB disk space after installed.
|
||||
|
||||
#### 3. FLOWBLADE MOVIE EDITOR
|
||||
|
||||
![](https://itsfoss.com/wp-content/uploads/2016/06/flowblade-movie-editor-on-ubuntu.jpg)
|
||||
|
||||
[Flowblade Movie Editor][6] is a multitrack non-linear video editor for Linux. It is free and open source. It comes with a stylish and modern user interface.
|
||||
|
||||
Written in Python, it is designed to provide a fast, and precise. Flowblade has focused on providing the best possible experience on Linux and other free platforms. So there’s no Windows and OS X version for now.
|
||||
|
||||
To install Flowblade in Ubuntu and other Ubuntu based systems, use the command below:
|
||||
|
||||
```
|
||||
sudo apt-get install flowblade
|
||||
```
|
||||
|
||||
#### 4. LIGHTWORKS
|
||||
|
||||
![](https://itsfoss.com/wp-content/uploads/2016/06/lightworks-running-on-ubuntu-16.04.jpg)
|
||||
|
||||
If you looking for a video editor software that has more feature, this is the answer. [Lightworks][7] is a cross-platform professional video editor, available for Linux, Mac OS X and Windows.
|
||||
|
||||
It is an award winning professional [non-linear editing][8] (NLE) software that supports resolutions up to 4K as well as video in SD and HD formats.
|
||||
|
||||
This application has two versions: Lightworks Free and Lightworks Pro. While free version doesn’t support Vimeo (H.264 / MPEG-4) and YouTube (H.264 / MPEG-4)- Up to 2160p (4K UHD), Blu-ray, and H.264/MP4 export option with configurable bitrate setting, then pro version is.
|
||||
|
||||
- Lightworks Free
|
||||
- Lightworks Pro
|
||||
|
||||
Pro version has more features such as higher resolution support, 4K and Blue Ray support etc.
|
||||
|
||||
##### HOW TO INSTALL LIGHTWORKS?
|
||||
|
||||
Unlike the other video editors, installing Lightwork is not as straight forward as running a single command. Don’t worry, it’s not that complicated either.
|
||||
|
||||
- Step 1 – You can get the package from [Lightworks Downloads Page][9]. The package’s size about 79,5 MB.
|
||||
|
||||
>Please note: There’s no Linux 32-bit support.
|
||||
|
||||
- Step 2 – Once downloaded, you can install it using [Gdebi package installer][10]. Gdebi automatically downloads the dependency :
|
||||
|
||||
![](https://itsfoss.com/wp-content/uploads/2016/06/Installing-lightworks-on-ubuntu.jpg)
|
||||
|
||||
- Step 3 – Now you can open it from Ubuntu dashboard, or your Linux distro’s menu.
|
||||
|
||||
- Step 4 – It needs an account when you use it for first time. Click at Not Registerd? button to register. Don’t worry, it’s free!
|
||||
|
||||
- Step 5 – After your account has been verified, now login.
|
||||
|
||||
Now the Lightworks is ready to use.
|
||||
|
||||
Need Lightworks video tutorial? Get them at [Lightworks video tutorials Page][11].
|
||||
|
||||
#### 5. BLENDER
|
||||
|
||||
![](https://itsfoss.com/wp-content/uploads/2016/06/blender-running-on-ubuntu-16.04.jpg)
|
||||
|
||||
Blender is a professional, industry-grade open source, cross platform video editor. It is popular for 3D works. Blender has been used in several Hollywood movies including Spider Man series.
|
||||
|
||||
Although originally designed for produce 3D modeling, but it can also be used for video editing and input capabilities with a variety of formats. The Video Editor includes:
|
||||
|
||||
- Live preview, luma waveform, chroma vectorscope and histogram displays
|
||||
- Audio mixing, syncing, scrubbing and waveform visualization
|
||||
- Up to 32 slots for adding video, images, audio, scenes, masks and effects
|
||||
- Speed control, adjustment layers, transitions, keyframes, filters and more.
|
||||
|
||||
The latest version can be downloaded from [Blender Download Page][12].
|
||||
|
||||
### WHICH IS THE BEST VIDEO EDITING SOFTWARE?
|
||||
|
||||
If you need a simple video editor, OpenShot, Kdenlive or Flowblade is a good choice. These are suitable for beginners and a system with standard specification.
|
||||
|
||||
Then if you have a high-end computer, and need advanced features you can go out with Lightworks. If you are looking for more advanced features, Blender has got your back.
|
||||
|
||||
So that’s all I can write about 5 best video editing software for Linux such as Ubuntu, Linux Mint, Elementary, and other Linux distributions. Share with us which video editor you like the most.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/best-video-editing-software-linux/
|
||||
|
||||
作者:[Tiwo Satriatama][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/tiwo/
|
||||
[1]: https://itsfoss.com/linux-photo-management-software/
|
||||
[2]: https://itsfoss.com/best-modern-open-source-code-editors-for-linux/
|
||||
[3]: https://kdenlive.org/
|
||||
[4]: https://itsfoss.com/tag/open-source/
|
||||
[5]: http://www.openshot.org/
|
||||
[6]: http://jliljebl.github.io/flowblade/
|
||||
[7]: https://www.lwks.com/
|
||||
[8]: https://en.wikipedia.org/wiki/Non-linear_editing_system
|
||||
[9]: https://www.lwks.com/index.php?option=com_lwks&view=download&Itemid=206
|
||||
[10]: https://itsfoss.com/gdebi-default-ubuntu-software-center/
|
||||
[11]: https://www.lwks.com/videotutorials
|
||||
[12]: https://www.blender.org/download/
|
||||
|
||||
|
||||
|
@ -1,146 +0,0 @@
|
||||
# How to Convert Files to UTF-8 Encoding in Linux
|
||||
|
||||
In this guide, we will describe what character encoding and cover a few examples of converting files from one character encoding to another using a command line tool. Then finally, we will look at how to convert several files from any character set (charset) to UTF-8 encoding in Linux.
|
||||
|
||||
As you may probably have in mind already, a computer does not understand or store letters, numbers or anything else that we as humans can perceive except bits. A bit has only two possible values, that is either a `0` or `1`, `true` or `false`, `yes` or `no`. Every other thing such as letters, numbers, images must be represented in bits for a computer to process.
|
||||
|
||||
In simple terms, character encoding is a way of informing a computer how to interpret raw zeroes and ones into actual characters, where a character is represented by set of numbers. When we type text in a file, the words and sentences we form are cooked-up from different characters, and characters are organized into a charset.
|
||||
|
||||
There are various encoding schemes out there such as ASCII, ANSI, Unicode among others. Below is an example of ASCII encoding.
|
||||
|
||||
```
|
||||
Character bits
|
||||
A 01000001
|
||||
B 01000010
|
||||
|
||||
```
|
||||
|
||||
In Linux, the iconv command line tool is used to convert text from one form of encoding to another.
|
||||
|
||||
You can check the encoding of a file using the file command, by using the `-i` or `--mime` flag which enables printing of mime type string as in the examples below:
|
||||
|
||||
```
|
||||
$ file -i Car.java
|
||||
$ file -i CarDriver.java
|
||||
|
||||
```
|
||||
[
|
||||
![Check File Encoding in Linux](http://www.tecmint.com/wp-content/uploads/2016/10/Check-File-Encoding-in-Linux.png)
|
||||
][3]
|
||||
|
||||
Check File Encoding in Linux
|
||||
|
||||
The syntax for using iconv is as follows:
|
||||
|
||||
```
|
||||
$ iconv option
|
||||
$ iconv options -f from-encoding -t to-encoding inputfile(s) -o outputfile
|
||||
|
||||
```
|
||||
|
||||
Where `-f` or `--from-code` means input encoding and `-t` or `--to-encoding` specifies output encoding.
|
||||
|
||||
To list all known coded character sets, run the command below:
|
||||
|
||||
```
|
||||
$ iconv -l
|
||||
|
||||
```
|
||||
[
|
||||
![List Coded Charsets in Linux](http://www.tecmint.com/wp-content/uploads/2016/10/List-Coded-Charsets-in-Linux.png)
|
||||
][2]
|
||||
|
||||
List Coded Charsets in Linux
|
||||
|
||||
### Convert Files from UTF-8 to ASCII Encoding
|
||||
|
||||
Next, we will learn how to convert from one encoding scheme to another. The command below converts from ISO-8859-1 to UTF-8 encoding.
|
||||
|
||||
Consider a file named `input.file` which contains the characters:
|
||||
|
||||
```
|
||||
<EFBFBD> <20> <20> <20>
|
||||
|
||||
```
|
||||
|
||||
Let us start by checking the encoding of the characters in the file and then view the file contents. Closely, we can convert all the characters to ASCII encoding.
|
||||
|
||||
After running the iconv command, we then check the contents of the output file and the new encoding of the characters as below.
|
||||
|
||||
```
|
||||
$ file -i input.file
|
||||
$ cat input.file
|
||||
$ iconv -f ISO-8859-1 -t UTF-8//TRANSLIT input.file -o out.file
|
||||
$ cat out.file
|
||||
$ file -i out.file
|
||||
|
||||
```
|
||||
[
|
||||
![Convert UTF-8 to ASCII in Linux](http://www.tecmint.com/wp-content/uploads/2016/10/Converts-UTF8-to-ASCII-in-Linux.png)
|
||||
][1]
|
||||
|
||||
Convert UTF-8 to ASCII in Linux
|
||||
|
||||
Note: In case the string `//IGNORE` is added to to-encoding, characters that can’t be converted and an error is displayed after conversion.
|
||||
|
||||
Again, supposing the string `//TRANSLIT` is added to to-encoding as in the example above (ASCII//TRANSLIT), characters being converted are transliterated as needed and if possible. Which implies in the event that a character can’t be represented in the target character set, it can be approximated through one or more similar looking characters.
|
||||
|
||||
Consequently, any character that can’t be transliterated and is not in target character set is replaced with a question mark `(?)` in the output.
|
||||
|
||||
### Convert Multiple Files to UTF-8 Encoding
|
||||
|
||||
Coming back to our main topic, to convert multiple or all files in a directory to UTF-8 encoding, you can write a small shell script called encoding.sh as follows:
|
||||
|
||||
```
|
||||
#!/bin/bash
|
||||
#enter input encoding here
|
||||
FROM_ENCODING="value_here"
|
||||
#output encoding(UTF-8)
|
||||
TO_ENCODING="UTF-8"
|
||||
#convert
|
||||
CONVERT=" iconv -f $FROM_ENCODING -t $TO_ENCODING"
|
||||
#loop to convert multiple files
|
||||
for file in *.txt; do
|
||||
$CONVERT "$file" -o "${file%.txt}.utf8.converted"
|
||||
done
|
||||
exit 0
|
||||
|
||||
```
|
||||
|
||||
Save the file, then make the script executable. Run it from the directory where your files (`*.txt`) are located.
|
||||
|
||||
```
|
||||
$ chmod +x encoding.sh
|
||||
$ ./encoding.sh
|
||||
|
||||
```
|
||||
|
||||
Important: You can as well use this script for general conversion of multiple files from one given encoding to another, simply play around with the values of the `FROM_ENCODING` and `TO_ENCODING`variable, not forgetting the output file name `"${file%.txt}.utf8.converted"`.
|
||||
|
||||
For more information, look through the iconv man page.
|
||||
|
||||
```
|
||||
$ man iconv
|
||||
|
||||
```
|
||||
|
||||
To sum up this guide, understanding encoding and how to convert from one character encoding scheme to another is necessary knowledge for every computer user more so for programmers when it comes to dealing with text.
|
||||
|
||||
Lastly, you can get in touch with us by using the comment section below for any questions or feedback.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/convert-files-to-utf-8-encoding-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/wp-content/uploads/2016/10/Converts-UTF8-to-ASCII-in-Linux.png
|
||||
[2]:http://www.tecmint.com/wp-content/uploads/2016/10/List-Coded-Charsets-in-Linux.png
|
||||
[3]:http://www.tecmint.com/wp-content/uploads/2016/10/Check-File-Encoding-in-Linux.png
|
@ -1,3 +1,5 @@
|
||||
FSSlc translating
|
||||
|
||||
# 4 Easy Ways To Generate A Strong Password In Linux
|
||||
|
||||
![Generate a strong password in Linux](https://www.ostechnix.com/wp-content/uploads/2016/11/password-720x340.jpg)
|
||||
|
@ -1,3 +1,5 @@
|
||||
DockerChen翻译中
|
||||
|
||||
# A Practical Guide to Nmap (Network Security Scanner) in Kali Linux
|
||||
|
||||
In the second Kali Linux article, the network tool known as ‘[nmap][30]‘ will be discussed. While nmap isn’t a Kali only tool, it is one of the most [useful network mapping tools][29] in Kali.
|
||||
|
@ -1,145 +0,0 @@
|
||||
|
||||
聊聊Docker Datacenter在AWS和AZURE上的应用
|
||||
===================================================
|
||||
|
||||
|
||||
三言两语介绍一下AWS快速启动应用和Azure Marketplace上产品化和高可用性的Docker部署模板。
|
||||
|
||||
Docker Datacenter AWS快速启动应用使用CloudFormation模板和AZure Marketpalce上预编译的模板来简化企业CaaS Docker环境在公有云基础设施下的部署。
|
||||
|
||||
|
||||
为敏捷应用而生的CasS平台,为各种规模企业提供容器、集群编排和管理等各种简单、安全和可伸缩的服务。使用为Docker Datacenter预编译的崭新的云模板,开发者和IT运维人员可以无缝的把它们的应用迁移到亚马逊EC2或者微软的Azure环境而无需修改任何代码。现在,企业可以快速实现更高的计算和运营效率,Docker可以通过短短几步操作支持容器管理和编排。
|
||||
|
||||
### 什么是Docker Datacenter ?
|
||||
|
||||
|
||||
Docker Datacenter包括Docker通用控制平面,Docker可信注册表和与客户的应用服务等级协议相匹配的商用CS Docker引擎。
|
||||
|
||||
|
||||
- Docker通用控制平面(UCP),一种企业级的集群管理方案,帮助客户通过单个管理仪表盘管理整个集群
|
||||
- Docker可信注册表(DTR), 一种映像管理方案,帮助客户安全存储和管理Docker映像
|
||||
- 商用版的Docker引擎
|
||||
|
||||
![](http://img.scoop.it/lVraAJgJbjAKqfWCLtLuZLnTzqrqzN7Y9aBZTaXoQ8Q=)
|
||||
|
||||
### 在AWS上快速布置Docker Datacenter
|
||||
|
||||
秉承Docker与AWS最佳实践,参照AWS快速启动教程,你可以在AWS云上快速部署Docker容器。Docker Datacenter快速应用基于模块化和可定制的CloudFormation模板,客户可以在其之上增加额外功能或者为自己的Docker部署修改模板。
|
||||
|
||||
[AWS的Docker Datacenter应用说明](https://youtu.be/aUx7ZdFSkXU)
|
||||
|
||||
#### 架构
|
||||
|
||||
![](http://img.scoop.it/sZ3_TxLba42QB-r_6vuApLnTzqrqzN7Y9aBZTaXoQ8Q=)
|
||||
|
||||
AWS Cloudformation通过创建AWS资源开始安装进程,这些AWS需要的资源包括:VPC, 安全组,公有与私有子网,因特网网关,NAT网关与S3 bucket。
|
||||
|
||||
然后,AWS Cloudformation启动第一个UCP控制器实例,紧接着,安装Docker引擎和UCP容器。它把UCP控制器创建的根证书备份到S3。一旦第一个UCP控制器成功运行,其他UCP控制器,UCP集群结点和第一个DTR复制进程就会被触发。和第一个UCP控制器结点类似,其他所有结点创建进程也都由商业版的Docker引擎开始,然后安装并运行UCP和DTR容器以加入集群。两个弹性负载均衡器(ELB),一个分配给UCP,另外一个为DTR服务,它们启动、自动完成配置并在两个可用区(Availability Zone)之间提供弹性负载均衡。
|
||||
|
||||
除些之外,如有需要,UCP控制器和结点在ASG中启动并提供扩展功能。这种架构确保UCP和DTR两者都部署在两个AZ上以增强弹性与高可靠性。在公有或者私有HostedZone,Route53用来动态注册或者配置UCP和DTR 。
|
||||
|
||||
![](http://img.scoop.it/HM7Ag6RFvMXvZ_iBxRgKo7nTzqrqzN7Y9aBZTaXoQ8Q=)
|
||||
|
||||
### 快速启动模板的核心功能如下:
|
||||
|
||||
|
||||
- 创建VPC,不同AZ上的私有和公有子网,ELB,NAT网关,因特网网关,自动伸缩组,它们全部基于AWS最佳实践
|
||||
- 为DDC创建一个S3 bucket,其应用于证书备份和DTR映像存储(DTR需要额外配置)
|
||||
- 在客户的VPC范畴,跨多AZ部署3个UCP控制器
|
||||
- 创建预配置正常检测的UCP ELB
|
||||
- 创建一个DNS记录并关联到UCP ELB
|
||||
- 创建可伸缩的UCP结点集群
|
||||
- 在VPC范畴内,跨多AZ创建3个DTR副本
|
||||
- 创建一个预配置正常检测的DTR
|
||||
- 创建一个DNS记录,并关联到DTR ELB
|
||||
|
||||
[下载AWS快速指南](https://s3.amazonaws.com/quickstart-reference/docker/latest/doc/docker-datacenter-on-the-aws-cloud.pdf)
|
||||
|
||||
|
||||
### 在AWS使用Docker Datacenter
|
||||
|
||||
1. 登录[Docker Store][1]获取[30天免费试用][2]或者[联系销售][4]
|
||||
2. 确认之后,提示“Launch Stack”,客户会被重定向到AWS Cloudformation入口
|
||||
3. 确认启动Docker的AWS区域
|
||||
4. 提供启动参数
|
||||
5. 确认并启动
|
||||
6. 启动完成之后,点击输出分页标签可以看到UCP/DTR的 URL、缺省用户名、密码和S3 bucket的名称
|
||||
|
||||
[Docker Datacenter需要2000美刀信用担保](https://aws.amazon.com/mp/contactdocker/)
|
||||
|
||||
|
||||
### 在Azure使用Azure Marketplace上预编译的模板部署
|
||||
|
||||
在Azure Marketplace上,Docker Datacenter是一个预先编译的模板,客户可以在Azure全球不同的数据中心即起即用。客户可以根据自己需求从Azure提供的各种VM中选择部署适合自己的Docker Datacenter。
|
||||
|
||||
|
||||
#### 架构
|
||||
![](http://img.scoop.it/V9SpuBCoAnUnkRL3J-FRFLnTzqrqzN7Y9aBZTaXoQ8Q=)
|
||||
|
||||
|
||||
Azure部署进程开始于输入一些基本用户信息,如ssh-ing管理员用户名(系统级管理员)和资源组名称。你可以把资源组理解为一组有生命周期和部署边界的资源集合。你可以在这个链接了解更多关于资源组的信息:[azure.microsoft.com/en-us/documentation/articles/resource-group-overview/](azure.microsoft.com/en-us/documentation/articles/resource-group-overview/)
|
||||
|
||||
下一步,输入集群详细信息,包括:UCP控制器VM大小,控制器个数(缺省为3个),UCP结点VM大小,UCP结点个数(缺省1,最大值为10),DTR结点VM大小,DTR结点个数,虚拟网络名和地址(例如:10.0.0.1/19)。关于网络,客户可以配置2个子网:第一个子网分配给UCP控制器 ,第二个分配给DTC和UCP结点。
|
||||
|
||||
最后,点击OK完成部署。对于小集群,服务开通需要大约15-19分钟,大集群更久些。
|
||||
|
||||
![](http://img.scoop.it/DXPM5-GXP0j2kEhno0kdRLnTzqrqzN7Y9aBZTaXoQ8Q=)
|
||||
|
||||
![](http://img.scoop.it/321ElkCf6rqb7u_-nlGPtrnTzqrqzN7Y9aBZTaXoQ8Q=)
|
||||
|
||||
#### 如何在Azure部署
|
||||
|
||||
|
||||
1. 注册[Docker Datacenter30天试用][5]许可或者[联系销售][6]
|
||||
2. [跳转到微软Azure Markplace的Docker Datacenter][7]
|
||||
3. [评审部署文档][8]
|
||||
|
||||
如果客户注册获取Docker Datacenter许可证,那么他们将授权启动AWS或者Azure模板.
|
||||
- [获取30天试用许可证][9]
|
||||
- [通过视频理解Docker Datacenter架构][10]
|
||||
- [观看演示视频][11]
|
||||
- [获取AWS提供的部署Docker Datacenter的75美元红包奖励][12]
|
||||
|
||||
### 了解有关Docker的更多信息
|
||||
- 初识Docker? 尝试一下10分钟[在线学习课程][20]
|
||||
- 分享映像,自动构建,或用一个[免费的Docker Hub账号][21]尝试更多
|
||||
- 阅读[Docker 1.12 发行说明][22]
|
||||
- 订阅[Docker Weekly][23]
|
||||
- 报名参加即将到来的[Docker Online Meetups][24]
|
||||
- 参加即将发生的[Docker Meetups][25]
|
||||
- 观看[DockerCon EU2015][26]视频
|
||||
- 开始为[Docker][27]贡献力量
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://blog.docker.com/2016/06/docker-datacenter-aws-azure-cloud/
|
||||
|
||||
作者:[Trisha McCanna][a]
|
||||
译者:[firstadream](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://blog.docker.com/author/trisha/
|
||||
[1]: https://store.docker.com/login?next=%2Fbundles%2Fdocker-datacenter%2Fpurchase?plan=free-trial
|
||||
[2]: https://store.docker.com/login?next=%2Fbundles%2Fdocker-datacenter%2Fpurchase?plan=free-trial
|
||||
[4]: https://goto.docker.com/contact-us.html
|
||||
[5]: https://store.docker.com/login?next=%2Fbundles%2Fdocker-datacenter%2Fpurchase?plan=free-trial
|
||||
[6]: https://goto.docker.com/contact-us.html
|
||||
[7]: https://azure.microsoft.com/en-us/marketplace/partners/docker/dockerdatacenterdocker-datacenter/
|
||||
[8]: https://success.docker.com/Datacenter/Apply/Docker_Datacenter_on_Azure
|
||||
[9]: http://www.docker.com/trial
|
||||
[10]: https://www.youtube.com/playlist?list=PLkA60AVN3hh8tFH7xzI5Y-vP48wUiuXfH
|
||||
[11]: https://www.youtube.com/playlist?list=PLkA60AVN3hh8a8JaIOA5Q757KiqEjPKWr
|
||||
[12]: https://aws.amazon.com/quickstart/promo/
|
||||
[20]: https://docs.docker.com/engine/understanding-docker/
|
||||
[21]: https://hub.docker.com/
|
||||
[22]: https://docs.docker.com/release-notes/
|
||||
[23]: https://www.docker.com/subscribe_newsletter/
|
||||
[24]: http://www.meetup.com/Docker-Online-Meetup/
|
||||
[25]: https://www.docker.com/community/meetup-groups
|
||||
[26]: https://www.youtube.com/playlist?list=PLkA60AVN3hh87OoVra6MHf2L4UR9xwJkv
|
||||
[27]: https://docs.docker.com/contributing/contributing/
|
||||
|
@ -0,0 +1,148 @@
|
||||
TOP 5 2016年LINUX最佳视频编辑软件
|
||||
=====================================================
|
||||
|
||||
![](https://itsfoss.com/wp-content/uploads/2016/06/linux-video-ditor-software.jpg)
|
||||
|
||||
概要: 在这篇文章中,Tiwo讨论了Linux下最佳视频编辑器的优缺点和基于Ubuntu-based发行版的安装方法。
|
||||
|
||||
在过去,我们已经在类似的文章中讨论了[Linux下最佳图片管理应用软件][1], [Linux下最佳代码编辑器][2]。今天,我们来看看Linux下的最佳视频编辑软件。
|
||||
当谈及免费的视频编辑软件,Windows Movie Maker和iMovie是大多数人经常推荐的。
|
||||
|
||||
不幸的是,它们在GNU/Linux下都是不可用的。但是你不必担心这个,因为我们已经为你收集了一系列最佳的视频编辑器。
|
||||
### Linux下最佳的视频编辑应用程序
|
||||
|
||||
接下来,让我们来看看Linux下排名前五的最佳视频编辑软件:
|
||||
|
||||
#### 1. KDENLIVE
|
||||
|
||||
![](https://itsfoss.com/wp-content/uploads/2016/06/kdenlive-free-video-editor-on-ubuntu.jpg)
|
||||
|
||||
[Kdenlive][3] 是一款来自于KDE的免费 [开源][4] 的视频编辑软件,它提供双视频监视器,多轨时间轴,剪辑列表,可自定义布局支持,基本效果和基本转换的功能。
|
||||
|
||||
它支持各种文件格式和各种摄像机和相机,包括低分辨率摄像机(Raw和AVI DV编辑),Mpeg2,mpeg4和h264 AVCHD(小型摄像机和摄像机),高分辨率摄像机文件,包括HDV和AVCHD摄像机 ,专业摄像机,包括XDCAM-HD TM流,IMX TM(D10)流,DVCAM(D10),DVCAM,DVCPRO TM,DVCPRO50 TM流和DNxHD TM流。
|
||||
|
||||
你可以在命令行下运行下面的命令安装 :
|
||||
|
||||
```
|
||||
sudo apt-get install kdenlive
|
||||
```
|
||||
|
||||
或者,打开Ubuntu软件中心,然后搜索Kdenlive。
|
||||
|
||||
#### 2. OPENSHOT
|
||||
|
||||
![](https://itsfoss.com/wp-content/uploads/2016/06/openshot-free-video-editor-on-ubuntu.jpg)
|
||||
|
||||
[OpenShot][5] 是我们的Linux视频编辑软件列表的第二选择。 OpenShot可以帮助您创建支持过渡,效果,调整音频电平的电影,当然,它也支持大多数格式和编解码器。
|
||||
|
||||
您还可以将电影导出到DVD,上传到YouTube,Vimeo,Xbox 360和许多其他常见的格式。 OpenShot比kdenlive更简单。 所以如果你需要一个简单UI的视频编辑器,OpenShot会是一个不错的选择。
|
||||
|
||||
最新的版本是2.0.7. 您可以从终端窗口运行以下命令安装OpenShot视频编辑器:
|
||||
|
||||
```
|
||||
sudo apt-get install openshot
|
||||
```
|
||||
|
||||
它需要下载25 MB,安装后需要70 MB硬盘空间。
|
||||
|
||||
#### 3. FLOWBLADE MOVIE EDITOR
|
||||
|
||||
![](https://itsfoss.com/wp-content/uploads/2016/06/flowblade-movie-editor-on-ubuntu.jpg)
|
||||
|
||||
[Flowblade Movie Editor][6] 是一个用于Linux的多轨非线性视频编辑器。 它是免费和开源的。 它配备了一个时尚而现代的用户界面。
|
||||
|
||||
|
||||
是用Python编写的,它旨在提供一个快速,精确的服务。 Flowblade致力于在Linux和其他免费平台上提供最好的体验。 所以现在没有Windows和OS X版本。
|
||||
|
||||
|
||||
要在Ubuntu和其他基于Ubuntu的系统上安装Flowblade,请使用以下命令:
|
||||
|
||||
```
|
||||
sudo apt-get install flowblade
|
||||
```
|
||||
|
||||
#### 4. LIGHTWORKS
|
||||
|
||||
![](https://itsfoss.com/wp-content/uploads/2016/06/lightworks-running-on-ubuntu-16.04.jpg)
|
||||
|
||||
如果你要寻找一个有更多功能的视频编辑软件,这会是答案。 [Lightworks][7]是一个跨平台的专业的视频编辑器,在Linux,,Mac OS X和Windows系统下都可用。
|
||||
|
||||
它是一个获奖的专业的[非线性编辑] [8](NLE)软件,支持高达4K的分辨率以及SD和HD格式的视频。
|
||||
|
||||
|
||||
该应用程序有两个版本:Lightworks免费版和Lightworks专业版。虽然免费版本不支持Vimeo(H.264 / MPEG-4)和YouTube(H.264 / MPEG-4) - 高达2160p(4K UHD),蓝光和H.264 / MP4导出选项可配置的位速率设置,但是pro版本支持。
|
||||
|
||||
- Lightworks免费版
|
||||
- Lightworks专业版
|
||||
|
||||
专业版本有更多的功能,例如更高的分辨率支持,4K和Blu Ray支持等。
|
||||
|
||||
##### 怎么安装LIGHTWORKS?
|
||||
|
||||
不同于其他的视频编辑器,安装Lightwork不像运行单个命令那么直接。别担心,这不会很复杂。
|
||||
- 第1步 – 你可以从[Lightworks Downloads Page][9]下载安装包。这个安装包大约79.5MB。
|
||||
>请注意:这里
|
||||
没有Linux 32位的支持。
|
||||
|
||||
- 第2步 – 一旦下载,你可以使用[Gdebi package installer][10]来安装。Gdebi会自动下载依赖关系 :
|
||||
|
||||
![](https://itsfoss.com/wp-content/uploads/2016/06/Installing-lightworks-on-ubuntu.jpg)
|
||||
|
||||
- 第3步 – 现在你可以从Ubuntu仪表板或您的Linux发行版菜单中打开它。
|
||||
- 第4步 – 当你第一次使用它时,需要一个账号。点击未注册按钮来注册。别担心,它是免费的。
|
||||
- 第5步 – 在你的账号通过验证后,就可以登录了。
|
||||
现在,Lightworks可以使用了。
|
||||
|
||||
需要Lightworks的视频教程? 在[Lightworks video tutorials Page][11]得到它们。
|
||||
|
||||
#### 5. BLENDER
|
||||
|
||||
![](https://itsfoss.com/wp-content/uploads/2016/06/blender-running-on-ubuntu-16.04.jpg)
|
||||
|
||||
|
||||
Blender是一个专业的,行业级的开源,跨平台的视频编辑器。在3D作品的制作中,是非常受欢迎的。 Blender已被用于几部好莱坞电影的制作,包括蜘蛛侠系列。
|
||||
|
||||
|
||||
虽然最初是设计用于制作3D模型,但它也可以用于各种格式的视频编辑和输入能力。 该视频编辑器包括:
|
||||
|
||||
- 实时预览,亮度波形,色度矢量示波器和直方图显示
|
||||
- 音频混合,同步,擦除和波形可视化
|
||||
- 最多32个插槽用于添加视频,图像,音频,场景,面具和效果
|
||||
- 速度控制,调整图层,过渡,关键帧,过滤器等
|
||||
|
||||
最新的版本可以从[Blender Download Page][12]下载.
|
||||
|
||||
### 哪一个是最好的视频编辑软件?
|
||||
|
||||
如果你需要一个简单的视频编辑器, OpenShot, Kdenlive和 Flowblade是一个不错的选择。这些软件是适合初学者的,并且带有标准规范的系统。
|
||||
|
||||
如果你有一个高性能的计算机,并且需要高级功能,你可以使用Lightworks。如果你正在寻找更高级的功能,Blender可以帮助你。
|
||||
|
||||
这就是我写的5个最佳的视频编辑软件,它们可以在Ubuntu,Linux Mint,Elementary和其他Linux发行版下使用。 与我们分享您最喜欢的视频编辑器。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/best-video-editing-software-linux/
|
||||
|
||||
作者:[Tiwo Satriatama][a]
|
||||
译者:[DockerChen](https://github.com/DockerChen)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/tiwo/
|
||||
[1]: https://itsfoss.com/linux-photo-management-software/
|
||||
[2]: https://itsfoss.com/best-modern-open-source-code-editors-for-linux/
|
||||
[3]: https://kdenlive.org/
|
||||
[4]: https://itsfoss.com/tag/open-source/
|
||||
[5]: http://www.openshot.org/
|
||||
[6]: http://jliljebl.github.io/flowblade/
|
||||
[7]: https://www.lwks.com/
|
||||
[8]: https://en.wikipedia.org/wiki/Non-linear_editing_system
|
||||
[9]: https://www.lwks.com/index.php?option=com_lwks&view=download&Itemid=206
|
||||
[10]: https://itsfoss.com/gdebi-default-ubuntu-software-center/
|
||||
[11]: https://www.lwks.com/videotutorials
|
||||
[12]: https://www.blender.org/download/
|
||||
|
||||
|
||||
|
@ -1,178 +0,0 @@
|
||||
# 删除在一个目录下除了一个或者一些带扩展名文件的其他所有文件的三种方法
|
||||
|
||||
有的时候,你可能会遇到这种情况,你需要删除一个目录下的所有文件,或者只是简单的通过删除除了一些指定类型(以指定扩展名结尾)的文件来清空一个目录。
|
||||
|
||||
在这篇文章,我们将会向你展现如何通过 rm、 find 和 globignore 命令删除一个目录下除了指定文件后缀或者类型的的文件。
|
||||
|
||||
在我们进一步深入之前,让我们开始简要的了解一下 Linux 中的一个重要的概念 —— 文件名模式匹配,它可以让我们解决眼前的问题。
|
||||
|
||||
在 Linux 下,一个 shell 模式一个包含以下特殊字符的字符串,称为通配符或者元字符:
|
||||
|
||||
1. `*` – 匹配 0 个或者多个字符
|
||||
2. `?` – 匹配任意单个字符
|
||||
3. `[seq]` – 匹配序列中的任意一个字符
|
||||
4. `[!seq]` – 匹配任意一个不再序列中的字符
|
||||
|
||||
我们将在这儿探索三种可能的办法,包括:
|
||||
|
||||
### 使用扩展模式匹配操作符删除文件
|
||||
|
||||
下来列出了不同的扩展模式匹配操作符,这些模式列表是一个用 `|` 分割包含一个或者多个文件名的列表:
|
||||
|
||||
1. `*(pattern-list)` – 匹配 0 个或者多个出现的指定模式
|
||||
2. `?(pattern-list)` – 匹配 0 个或者 1 个出现的指定模式
|
||||
4. `@(pattern-list)` – 匹配 1 个或者多个出现的指定模式
|
||||
5. `!(pattern-list)` – 匹配除了一个指定模式之外的任何内容
|
||||
|
||||
为了使用它们,像下面一样打开 extglob shell 选项:
|
||||
|
||||
```
|
||||
# shopt -s extglob
|
||||
|
||||
```
|
||||
|
||||
#### 1. 输入以下命令,删除一个目录下除了 filename 之外的所有文件
|
||||
|
||||
```
|
||||
$ rm -v !("filename")
|
||||
|
||||
```
|
||||
[![删除 Linux 下除了一个文件之外的所有文件](http://www.tecmint.com/wp-content/uploads/2016/10/DeleteAll-Files-Except-One-File-in-Linux.png)][9]
|
||||
|
||||
删除 Linux 下除了一个文件之外的所有文件
|
||||
|
||||
#### 2. 删除除了 filename1 和 filename2 之外的所有文件
|
||||
|
||||
```
|
||||
$ rm -v !("filename1"|"filename2")
|
||||
|
||||
```
|
||||
[![在 Linux 下删除除了一些文件之外的所有文件](http://www.tecmint.com/wp-content/uploads/2016/10/Delete-All-Files-Except-Few-Files-in-Linux.png)][8]
|
||||
|
||||
在 Linux 下删除除了一些文件之外的所有文件
|
||||
|
||||
#### 3. 下面的例子显示如何通过交互模式删除除了 `.zip` 之外的所有文件
|
||||
|
||||
```
|
||||
$ rm -i !(*.zip)
|
||||
|
||||
```
|
||||
[![在 Linux 下删除除了 Zip 文件之外的所有文件](http://www.tecmint.com/wp-content/uploads/2016/10/Delete-All-Files-Except-Zip-Files-in-Linux.png)][7]
|
||||
|
||||
在 Linux 下删除除了 Zip 文件之外的所有文件
|
||||
|
||||
#### 4. 接下来,通过如下的方式你可以删除一个目录下除了所有的`.zip` 和 `.odt` 文件的所有文件,并且在删除的时候,显示正在删除的文件:
|
||||
|
||||
```
|
||||
$ rm -v !(*.zip|*.odt)
|
||||
|
||||
```
|
||||
[![删除除了指定文件扩展的所有文件](http://www.tecmint.com/wp-content/uploads/2016/10/Delete-All-Files-Except-Certain-File-Extensions.png)][6]
|
||||
|
||||
删除除了指定文件扩展的所有文件
|
||||
|
||||
一旦你已经执行了所有需要的命令,使用如下的方式关闭 extglob shell 选项。
|
||||
|
||||
```
|
||||
$ shopt -u extglob
|
||||
|
||||
```
|
||||
|
||||
### 使用 Linux 下的 find 命令删除文件
|
||||
|
||||
在这种方法下,我们可以[只使用 find 命令][5]的适当的选项或者采用管道配合 xargs 命令,如下所示:
|
||||
|
||||
```
|
||||
$ find /directory/ -type f -not -name 'PATTERN' -delete
|
||||
$ find /directory/ -type f -not -name 'PATTERN' -print0 | xargs -0 -I {} rm {}
|
||||
$ find /directory/ -type f -not -name 'PATTERN' -print0 | xargs -0 -I {} rm [options] {}
|
||||
|
||||
```
|
||||
|
||||
#### 5. 下面的命令将会删除当前目录下除了 `.gz` 之外的所有文件
|
||||
|
||||
```
|
||||
$ find . -type f -not -name '*.gz' -delete
|
||||
|
||||
```
|
||||
[![find 命令 —— 删除 .gz 之外的所有文件](http://www.tecmint.com/wp-content/uploads/2016/10/Remove-All-Files-Except-gz-Files.png)][4]
|
||||
|
||||
find 命令 —— 删除 .gz 之外的所有文件
|
||||
|
||||
#### 6. 使用管道和 xargs,你可以通过如下的方式修改上面的例子:
|
||||
|
||||
```
|
||||
$ find . -type f -not -name '*gz' -print0 | xargs -0 -I {} rm -v {}
|
||||
|
||||
```
|
||||
[![使用 find 和 xargs 命令删除文件](http://www.tecmint.com/wp-content/uploads/2016/10/Remove-Files-Using-Find-and-Xargs-Command.png)][3]
|
||||
|
||||
使用 find 和 xargs 命令删除文件
|
||||
|
||||
#### 7. 让我们看一个额外的例子,下面的命令行将会抹除掉当前目录下除了 `.gz`、 `.odt` 和 `.jpg` 之外的所有文件:
|
||||
|
||||
```
|
||||
$ find . -type f -not \(-name '*gz' -or -name '*odt' -or -name '*.jpg' \) -delete
|
||||
|
||||
```
|
||||
[![删除除了指定扩展文件的所有文件](http://www.tecmint.com/wp-content/uploads/2016/10/Remove-All-Files-Except-File-Extensions.png)][2]
|
||||
|
||||
删除除了指定扩展文件的所有文件
|
||||
|
||||
### 通过 bash 中的 GLOBIGNORE 变量删除文件
|
||||
|
||||
然而,最后的方法,只适用于 bash。 GLOBIGNORE 变量存储了一个通过路径名扩展忽略的分离的模式(或者文件名)列表。
|
||||
|
||||
为了使用这种方法,移动到要删除文件的目录,像下面这样设置 GLOBIGNORE 变量:
|
||||
|
||||
```
|
||||
$ cd test
|
||||
$ GLOBIGNORE=*.odt:*.iso:*.txt
|
||||
|
||||
```
|
||||
|
||||
在这种情况下,除了 `.odt`、 `.iso` 和 `.txt` 之外的所有文件,都将从当前目录删除。
|
||||
|
||||
现在,运行如下的命令清空这个目录:
|
||||
|
||||
```
|
||||
$ rm -v *
|
||||
|
||||
```
|
||||
|
||||
之后,关闭 GLOBIGNORE 变量:
|
||||
|
||||
```
|
||||
$ unset GLOBIGNORE
|
||||
|
||||
```
|
||||
[![使用 bash 变量 GLOBIGNORE 删除文件](http://www.tecmint.com/wp-content/uploads/2016/10/Delete-Files-Using-Bash-GlobIgnore.png)][1]
|
||||
|
||||
使用 bash 变量 GLOBIGNORE 删除文件
|
||||
|
||||
注:为了理解上面的命令行采用的标识的意思,请参考我们在每一个插图中使用的命令对应的 man 手册。
|
||||
|
||||
就这些了!如果你心里有实现相同目录的其他命令行技术,不要忘了通过下面的反馈部分分享给我们。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/delete-all-files-in-directory-except-one-few-file-extensions/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+tecmint+%28Tecmint%3A+Linux+Howto%27s+Guide%29
|
||||
|
||||
作者:[ Aaron Kili][a]
|
||||
|
||||
译者:[yangmingming](https://github.com/yangmingming)
|
||||
|
||||
校对:[校对者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/wp-content/uploads/2016/10/Delete-Files-Using-Bash-GlobIgnore.png
|
||||
[2]:http://www.tecmint.com/wp-content/uploads/2016/10/Remove-All-Files-Except-File-Extensions.png
|
||||
[3]:http://www.tecmint.com/wp-content/uploads/2016/10/Remove-Files-Using-Find-and-Xargs-Command.png
|
||||
[4]:http://www.tecmint.com/wp-content/uploads/2016/10/Remove-All-Files-Except-gz-Files.png
|
||||
[5]:http://www.tecmint.com/35-practical-examples-of-linux-find-command/
|
||||
[6]:http://www.tecmint.com/wp-content/uploads/2016/10/Delete-All-Files-Except-Certain-File-Extensions.png
|
||||
[7]:http://www.tecmint.com/wp-content/uploads/2016/10/Delete-All-Files-Except-Zip-Files-in-Linux.png
|
||||
[8]:http://www.tecmint.com/wp-content/uploads/2016/10/Delete-All-Files-Except-Few-Files-in-Linux.png
|
||||
[9]:http://www.tecmint.com/wp-content/uploads/2016/10/DeleteAll-Files-Except-One-File-in-Linux.png
|
@ -0,0 +1,138 @@
|
||||
# 如何在 Linux 中将文件编码转换为 UTF-8
|
||||
|
||||
在这篇教程中,我们将解释字符编码的含义,然后给出一些使用命令行工具将使用某种字符编码的文件转化为另一种编码的例子。最后,我们将一起看一看如何在 Linux 下将使用各种字符编码的文件转化为 UTF-8 编码。
|
||||
|
||||
你可能已经知道,计算机是不会理解和存储字符、数字或者任何人类能够理解的东西的,除了二进制数据。一个二进制位只有两种可能的值,也就是 `0` 或 `1`,`真`或`假`,`对`或`错`。其它的任何事物,比如字符、数据和图片,必须要以二进制的形式来表现,以供计算机处理。
|
||||
|
||||
简单来说,字符编码是一种可以指示电脑来将原始的 0 和 1 解释成实际字符的方式,在这些字符编码中,字符都可以用数字串来表示。
|
||||
|
||||
字符编码方案有很多种,比如 ASCII, ANCI, Unicode 等等。下面是 ASCII 编码的一个例子。
|
||||
|
||||
```
|
||||
字符 二进制
|
||||
A 01000001
|
||||
B 01000010
|
||||
```
|
||||
|
||||
在 Linux 中,命令行工具 `iconv` 用来将使用一种编码的文本转化为另一种编码。
|
||||
|
||||
你可以使用 `file` 命令,并添加 `-i` 或 `--mime` 参数来查看一个文件的字符编码,这个参数可以让程序像下面的例子一样输出字符串的 mime (Multipurpose Internet Mail Extensions) 数据:
|
||||
|
||||
```
|
||||
$ file -i Car.java
|
||||
$ file -i CarDriver.java
|
||||
```
|
||||
[
|
||||
![在 Linux 中查看文件的编码](http://www.tecmint.com/wp-content/uploads/2016/10/Check-File-Encoding-in-Linux.png)
|
||||
][3]
|
||||
|
||||
在 Linux 中查看文件的编码
|
||||
|
||||
iconv 工具的使用方法如下:
|
||||
|
||||
```
|
||||
$ iconv option
|
||||
$ iconv options -f from-encoding -t to-encoding inputfile(s) -o outputfile
|
||||
```
|
||||
|
||||
在这里,`-f` 或 `--from-code` 标明了输入编码,而 `-t` 或 `--to-encoding` 指定了输出编码。
|
||||
|
||||
为了列出所有已有编码的字符集,你可以使用以下命令:
|
||||
|
||||
```
|
||||
$ iconv -l
|
||||
```
|
||||
[
|
||||
![列出所有已有编码字符集](http://www.tecmint.com/wp-content/uploads/2016/10/List-Coded-Charsets-in-Linux.png)
|
||||
][2]
|
||||
|
||||
列出所有已有编码字符集
|
||||
|
||||
### 将文件从 ISO-8859-1 编码转换为 UTF-8 编码
|
||||
|
||||
下面,我们将学习如何将一种编码方案转换为另一种编码方案。下面的命令将会将 ISO-8859-1 编码转换为 UTF-8 编码。
|
||||
|
||||
Consider a file named `input.file` which contains the characters:
|
||||
考虑如下文件 `input.file`,其中包含这几个字符:
|
||||
|
||||
```
|
||||
<EFBFBD> <20> <20> <20>
|
||||
```
|
||||
|
||||
我们从查看这个文件的编码开始,然后来查看文件内容。最后,我们可以把所有字符转换为 UTF-8 编码。
|
||||
|
||||
在运行 `iconv` 命令之后,我们可以像下面这样检查输出文件的内容,和它使用的字符编码。
|
||||
|
||||
```
|
||||
$ file -i input.file
|
||||
$ cat input.file
|
||||
$ iconv -f ISO-8859-1 -t UTF-8//TRANSLIT input.file -o out.file
|
||||
$ cat out.file
|
||||
$ file -i out.file
|
||||
```
|
||||
[
|
||||
![在 Linux 中将 ISO-8859-1 转化为 UTF-8](http://www.tecmint.com/wp-content/uploads/2016/10/Converts-UTF8-to-ASCII-in-Linux.png)
|
||||
][1]
|
||||
|
||||
在 Linux 中将 ISO-8859-1 转化为 UTF-8
|
||||
|
||||
注意:如果输出编码后面添加了 `//IGNORE` 字符串,那些不能被转换的字符将不会被转换,并且在转换后,程序会显示一条错误信息。
|
||||
|
||||
好,如果字符串 `//TRANSLIT` 被添加到了上面例子中的输出编码之后 (UTF-8//TRANSLIT),待转换的字符会尽量采用形译原则。也就是说,如果某个字符在输出编码方案中不能被表示的话,它将会被替换为一个形状比较相似的字符。
|
||||
|
||||
而且,如果一个字符不在输出编码中,而且不能被形译,它将会在输出文件中被一个问号标记 `(?)` 代替。
|
||||
|
||||
### 将多个文件转换为 UTF-8 编码
|
||||
|
||||
回到我们的主题。如果你想将多个文件甚至某目录下所有文件转化为 UTF-8 编码,你可以像下面一样,编写一个简单的 shell 脚本,并将其命名为 `encoding.sh`:
|
||||
|
||||
```
|
||||
#!/bin/bash
|
||||
# 将 values_here 替换为输入编码
|
||||
FROM_ENCODING="value_here"
|
||||
# 输出编码 (UTF-8)
|
||||
TO_ENCODING="UTF-8"
|
||||
# 转换命令
|
||||
CONVERT=" iconv -f $FROM_ENCODING -t $TO_ENCODING"
|
||||
# 使用循环转换多个文件
|
||||
for file in *.txt; do
|
||||
$CONVERT "$file" -o "${file%.txt}.utf8.converted"
|
||||
done
|
||||
exit 0
|
||||
```
|
||||
|
||||
保存文件,然后为它添加可执行权限。在待转换文件 (*.txt) 所在的目录中运行这个脚本。
|
||||
|
||||
```
|
||||
$ chmod +x encoding.sh
|
||||
$ ./encoding.sh
|
||||
```
|
||||
|
||||
重要事项:你也可以使这个脚本变得更通用,比如转换任意特定的字符编码到另一种编码。为了达到这个目的,你只需要改变 `FROM_ENCODING` 及 `TO_ENCODING` 变量的值。别忘了改一下输出文件的文件名 `"${file%.txt}.utf8.converted"`.
|
||||
|
||||
若要了解更多信息,可以查看 `iconv` 的手册页 (man page)。
|
||||
|
||||
```
|
||||
$ man iconv
|
||||
```
|
||||
|
||||
将这篇指南总结一下,理解字符编码的概念、了解如何将一种编码方案转换为另一种,是一个电脑用户处理文本时必须要掌握的知识,程序员更甚。
|
||||
|
||||
最后,你可以在下面的评论部分中与我们联系,提出问题或反馈。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/convert-files-to-utf-8-encoding-in-linux/#
|
||||
|
||||
作者:[Aaron Kili][a]
|
||||
|
||||
译者:[StdioA](https://github.com/StdioA)
|
||||
|
||||
校对:[校对者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/wp-content/uploads/2016/10/Converts-UTF8-to-ASCII-in-Linux.png
|
||||
[2]:http://www.tecmint.com/wp-content/uploads/2016/10/List-Coded-Charsets-in-Linux.png
|
||||
[3]:http://www.tecmint.com/wp-content/uploads/2016/10/Check-File-Encoding-in-Linux.png
|
@ -1,29 +0,0 @@
|
||||
# 98%的开发者在工作中使用开源软件
|
||||
|
||||
![developer using open source](http://i0.wp.com/opensourceforu.com/wp-content/uploads/2016/07/developer.jpg?resize=750%2C500)
|
||||
|
||||
开源每天会达到新的高度。但是一个新的研究表明超过98%的开发者在工作中使用开源工具。
|
||||
|
||||
Git仓库管理[GitLab][1]进行了一项调查披露了一些关于开源接受度的有趣事实。由开发人员引导的调查声称98%的开发者更喜欢在工作中使用开源,91%选择在工作和个人项目中使用相同的开发工具。此外,92%的人认为分布式版本控制系统(Git仓库)在工作中很重要。
|
||||
|
||||
在所有的偏好编程语言中,JavaScript占了51%的受访者。它后面是Python、PHP、Java、Swift和Objective-C。86%的开发者认为安全是代码的主要判断标准。
|
||||
|
||||
GitLab首席执行官兼联合创始人Sid Sijbrandij在一次声明中表示:“尽管过程驱动的开发技术在过去已经取得了成功,但开发人员正在寻找一种更自然的软件开发演进以促进项目生命周期内的协作和信息共享”。
|
||||
|
||||
GitLab surveyed 362 startup and enterprise CTOs, developers and DevOps professionals who used its repository platform between July 6 and 27.
|
||||
GitLab调查了在7月6日和27日之间使用其存储库平台的362家创业和企业CTO,开发人员和DevOps专业人士。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://opensourceforu.com/2016/11/98-percent-developers-use-open-source-at-work/
|
||||
|
||||
作者:[JAGMEET SINGH ][a]
|
||||
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: http://opensourceforu.com/author/jagmeet-singh/
|
||||
[1]:https://about.gitlab.com/2016/11/02/global-developer-survey-2016/
|
Loading…
Reference in New Issue
Block a user