Merge pull request #98 from LCTT/master

更新至2015年12月31日
This commit is contained in:
struggling 2015-12-31 16:54:27 +08:00
commit 471d6fa895
21 changed files with 941 additions and 932 deletions

View File

@ -0,0 +1,55 @@
在 Linux 终端下看《星球大战》
================================================================================
![](http://itsfoss.com/wp-content/uploads/2015/12/Star-Wars-Linux-Terminal-2.png)
《星球大战Star Wars》已经席卷世界。最新一期的 [《星球大战》系列, 《星球大战7原力觉醒》打破了有史以来的记录][1]。
虽然我不能帮你得到一张最新的《星球大战》的电影票,但我可以提供给你一种方式,看[星球大战第四集][2]它是非常早期的《星球大战》电影1977 年)。
不,它不会是高清,也不是蓝光版。相反,它将是 ASCII 版的《星球大战》第四集,你可以在 Linux 终端看它,这才是真正的极客的方式 :)
### 在 Linux 终端看星球大战 ###
打开一个终端,使用以下命令:
telnet towel.blinkenlights.nl
等待几秒钟你可以在终端看到类似于以下这样的动画ASCII艺术
LCTT 译注:有时候会解析到效果更好 IPv6 版本上,如果你没有 IPv6 地址,可以重新连接试试;另外似乎线路不稳定,出现卡顿时稍等。)
![](http://itsfoss.com/wp-content/uploads/2015/12/Star-Wars-Linux-Terminal.png)
它将继续播映……
![](http://itsfoss.com/wp-content/uploads/2015/12/Star-Wars-Linux-Terminal-1.png)
![](http://itsfoss.com/wp-content/uploads/2015/12/Star-Wars-Linux-Terminal-2.png)
![](http://itsfoss.com/wp-content/uploads/2015/12/Star-Wars-Linux-Terminal-3.png)
![](http://itsfoss.com/wp-content/uploads/2015/12/Star-Wars-Linux-Terminal-5.png)
要停止动画,按 ctrl +],在这之后输入 quit 来退出 telnet 程序。
### 更多有趣的终端 ###
事实上,看《星球大战》并不是你在 Linux 终端下唯一能做有趣的事情。您可以运行[终端里的列车][3]或[通过ASCII艺术得到Linux标志][4]。
希望你能享受在 Linux 下看《星球大战》。
--------------------------------------------------------------------------------
via: http://itsfoss.com/star-wars-linux/
作者:[Abhishek][a]
译者:[zky001](https://github.com/zky001)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[1]:http://www.gamespot.com/articles/star-wars-7-breaks-thursday-night-movie-opening-re/1100-6433246/
[2]:http://www.imdb.com/title/tt0076759/
[3]:http://itsfoss.com/ubuntu-terminal-train/
[4]:http://itsfoss.com/display-linux-logo-in-ascii/

View File

@ -1,196 +0,0 @@
translating by fw8899
Optimize Web Delivery with these Open Source Tools
================================================================================
Web proxy software forwards HTTP requests without modifying traffic in any way. They can be configured as a transparent proxy with no client-side configuration required. They can also be used as a reverse proxy front-end to websites; here the cache serves an unlimited number of clients for one or some web servers.
Web proxies are versatile tools. They have a wide variety of uses, from caching web, DNS and other lookups, to speeding up the delivery of a web server / reducing bandwidth consumption. Web proxy software can also harden security by filtering traffic and anonymizing connections, and offer media-range limitations. This software is used by high-profile, high-traffic websites such as The New York Times, The Guardian, and social media and content sites such as Twitter, Facebook, and Wikipedia.
Web caches have become a vital mechanism for optimising the amount of data that is delivered in a given period of time. Good web caches also help to minimise latency, serving pages as quickly as possible. This helps to prevent the end user from becoming impatient having to wait for content to be delivered. Web caches optimise the data flow between client and server. They also help to converse bandwidth by caching frequently-delivered content. If you need to reduce server load and improve delivery speed of your content, it is definitely worth exploring the benefits offered by web cache software.
To provide an insight into the quality of software available for Linux, I feature below 5 excellent open source web proxy tools. Some of the them are full-featured; a couple of them have very modest resource needs.
### Squid ###
Squid is a high-performance open source proxy caching server and web cache daemon. It supports FTP, Internet Gopher, HTTPS, TLS, and SSL. It handles all requests in a single, non-blocking, I/O-driven process over IPv4 or IPv6.
Squid consists of a main server program squid, a Domain Name System lookup program dnsserver, some optional programs for rewriting requests and performing authentication, together with some management and client tools.
Squid offers a rich access control, authorization and logging environment to develop web proxy and content serving applications.
Features include:
- Web proxy:
- Caching to reduce access time and bandwidth use
- Keeps meta data and especially hot objects cached in RAM
- Caches DNS lookups
- Supports non-blocking DNS lookups
- Implements negative chacking of failed requests
- Squid caches can be arranged in a hierarchy or mesh for additional bandwidth savings
- Enforce site-usage policies with extensive access controls
- Anonymize connections, such as disabling or changing specific header fields in a client's HTTP request
- Reverse proxy
- Media-range limitations
- Supports SSL
- Support for IPv6
- Error Page Localization - error pages presented by Squid may now be localized per-request to match the visitors local preferred language
- Connection Pinning (for NTLM Auth Passthrough) - a workaround which permits Web servers to use Microsoft NTLM Authentication instead of HTTP standard authentication through a web proxy
- Quality of Service (QoS) Flow support
- Select a TOS/Diffserv value to mark local hits
- Select a TOS/Diffserv value to mark peer hits
- Selectively mark only sibling or parent requests
- Allows any HTTP response towards clients to have the TOS value of the response coming from the remote server preserved
- Mask certain bits in the TOS received from the remote server, before copying the value to the TOS send towards clients
- SSL Bump (for HTTPS Filtering and Adaptation) - Squid-in-the-middle decryption and encryption of CONNECT tunneled SSL traffic, using configurable client- and server-side certificates
- eCAP Adaptation Module support
- ICAP Bypass and Retry enhancements - ICAP is now extended with full bypass and dynamic chain routing to handle multiple adaptation services.
- ICY streaming protocol support - commonly known as SHOUTcast multimedia streams
- Dynamic SSL Certificate Generation
- Support for the Internet Content Adaptation Protocol (ICAP)
- Full request logging
- Anonymize connections
- Website: [www.squid-cache.org][1]
- Developer: National Laboratory for Applied Networking Research (NLANR) and Internet volunteers
- License: GNU GPL v2
- Version Number: 4.0.1
### Privoxy ###
Privoxy (Privacy Enhancing Proxy) is a non-caching Web proxy with advanced filtering capabilities for enhancing privacy, modifying web page data and HTTP headers, controlling access, and removing ads and other obnoxious Internet junk. Privoxy has a flexible configuration and can be customized to suit individual needs and tastes. It supports both stand-alone systems and multi-user networks.
Privoxy uses the concept of actions in order to manipulate the data stream between the browser and remote sites.
Features include:
- Highly configurable - completely personalize your installation
- Ad blocking
- Cookie management
- Supports "Connection: keep-alive". Outgoing connections can be kept alive independently from the client
- Supports IPv6
- Tagging which allows to change the behaviour based on client and server headers
- Run as an "intercepting" proxy
- Sophisticated actions and filters for manipulating both server and client headers
- Can be chained with other proxies
- Integrated browser-based configuration and control utility. Browser-based tracing of rule and filter effects. Remote toggling
- Web page filtering (text replacements, removes banners based on size, invisible "web-bugs" and HTML annoyances, etc)
- Modularized configuration that allows for standard settings and user settings to reside in separate files, so that installing updated actions files won't overwrite individual user settings
- Support for Perl Compatible Regular Expressions in the configuration files, and a more sophisticated and flexible configuration syntax
- GIF de-animation
- Bypass many click-tracking scripts (avoids script redirection)
- User-customizable HTML templates for most proxy-generated pages (e.g. "blocked" page)
- Auto-detection and re-reading of config file changes
- Most features are controllable on a per-site or per-location basis
- Website: [www.privoxy.org][2]
- Developer: Fabian Keil (lead developer), David Schmidt, and many other contributors
- License: GNU GPL v2
- Version Number: 3.4.2
### Varnish Cache ###
Varnish Cache is a web accelerator written with performance and flexibility in mind. It's modern architecture offers significantly better performance. It typically speeds up delivery with a factor of 300 - 1000x, depending on your architecture. Varnish stores web pages in memory so the web servers do not have to create the same web page repeatedly. The web server only recreates a page when it is changed. When content is served from memory this happens a lot faster then anything.
Additionally Varnish can serve web pages much faster then any application server is capable of - giving the website a significant speed enhancement.
For a cost-effective configuration, Varnish Cache uses between 1-16GB and a SSD disk.
Features include:
- Modern design
- VCL - a very flexible configuration language. The VCL configuration is translated to C, compiled, loaded and executed giving flexibility and speed
- Load balancing using both a round-robin and a random director, both with a per-backend weighting
- DNS, Random, Hashing and Client IP based Directors
- Load balance between multiple backends
- Support for Edge Side Includes including stitching together compressed ESI fragments
- Heavily threaded
- URL rewriting
- Cache multiple vhosts with a single Varnish
- Log data is stored in shared memory
- Basic health-checking of backends
- Graceful handling of "dead" backends
- Administered by a command line interface
- Use In-line C to extend Varnish
- Can be used on the same system as Apache
- Run multiple Varnish on the same system
- Support for HAProxy's PROXY protocol. This is a protocol adds a small header on each incoming TCP connection that describes who the real client is, added by (for example) an SSL terminating process
- Warm and cold VCL states
- Plugin support with Varnish Modules, called VMODs
- Backends defined through VMODs
- Gzip Compression and Decompression
- HTTP Streaming Pass & Fetch
- Saint and Grace mode. Saint Mode allows for unhealthy backends to be blacklisted for a period of time, preventing them from serving traffic when using Varnish as a load balancer. Grace mode allows Varnish to serve an expired version of a page or other asset in cases where Varnish is unable to retrieve a healthy response from the backend
- Experimental support for Persistent Storage, without LRU eviction
- Website: [www.varnish-cache.org][3]
- Developer: Varnish Software
- License: FreeBSD
- Version Number: 4.1.0
### Polipo ###
Polipo is an open source caching HTTP proxy which has modest resource needs.
It listens to requests for web pages from your browser and forwards them to web servers, and forwards the servers replies to your browser. In the process, it optimises and cleans up the network traffic. It is similar in spirit to WWWOFFLE, but the implementation techniques are more like the ones ones used by Squid.
Polipo aims at being a compliant HTTP/1.1 proxy. It should work with any web site that complies with either HTTP/1.1 or the older HTTP/1.0.
Features include:
- HTTP 1.1, IPv4 & IPv6, traffic filtering and privacy-enhancement
- Uses HTTP/1.1 pipelining if it believes that the remote server supports it, whether the incoming requests are pipelined or come in simultaneously on multiple connections
- Cache the initial segment of an instance if the download has been interrupted, and, if necessary, complete it later using Range requests
- Upgrade client requests to HTTP/1.1 even if they come in as HTTP/1.0, and up- or downgrade server replies to the client's capabilities
- Complete support for IPv6 (except for scoped (link-local) addresses)
- Use as a bridge between the IPv4 and IPv6 Internets
- Content-filtering
- Can use a technique known as Poor Man's Multiplexing to reduce latency
- SOCKS 4 and SOCKS 5 protocol support
- HTTPS proxying
- Behaves as a transparent proxy
- Run Polipo together with Privoxy or tor
- Website: [www.pps.univ-paris-diderot.fr/~jch/software/polipo/][4]
- Developer: Juliusz Chroboczek, Christopher Davis
- License: MIT License
- Version Number: 1.1.1
### Tinyproxy ###
Tinyproxy is a lightweight open source web proxy daemon. It is designed to be fast and yet small. It is useful for cases such as embedded deployments where a full featured HTTP proxy is required, but the system resources for a larger proxy are unavailable.
Tinyproxy is very useful in a small network setting, where a larger proxy would either be too resource intensive, or a security risk. One of the key features of Tinyproxy is the buffering connection concept. In effect, Tinyproxy will buffer a high speed response from a server, and then relay it to a client at the highest speed the client will accept. This feature greatly reduces the problems with sluggishness on the net.
Features:
- Easy to modify
- Anonymous mode - allows specification of individual HTTP headers that should be allowed through, and which should be blocked
- HTTPS support - Tinyproxy allows forwarding of HTTPS connections without modifying traffic in any way through the CONNECT method
- Remote monitoring - access proxy statistics from afar, letting you know exactly how busy the proxy is
- Load average monitoring - configure software to refuse connections after the server load reaches a certain point
- Access control - configure to only allow connections from certain subnets or IP addresses
- Secure - run without any special privileges, thus minimizing the chance of system compromise
- URL based filtering - allows domain and URL-based black- and whitelisting
- Transparent proxying - configure as a transparent proxy, so that a proxy can be used without any client-side configuration
- Proxy chaining - use an upstream proxy server for outbound connections, instead of direct connections to the target server, creating a so-called proxy chain
- Privacy features - restrict both what data comes to your web browser from the HTTP server (e.g., cookies), and to restrict what data is allowed through from your web browser to the HTTP server (e.g., version information)
- Small footprint - the memory footprint is about 2MB with glibc, and the CPU load increases linearly with the number of simultaneous connections (depending on the speed of the connection). Tinyproxy can be run on an old machine without affecting performance
- Website: [banu.com/tinyproxy][5]
- Developer: Robert James Kaes and contributors
- License: GNU GPL v2
- Version Number: 1.8.3
--------------------------------------------------------------------------------
via: http://www.linuxlinks.com/article/20151101020309690/WebDelivery.html
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[1]:http://www.squid-cache.org/
[2]:http://www.privoxy.org/
[3]:https://www.varnish-cache.org/
[4]:http://www.pps.univ-paris-diderot.fr/%7Ejch/software/polipo/
[5]:https://banu.com/tinyproxy/

View File

@ -1,3 +1,5 @@
kylepeng93正在翻译
Running a mainline kernel on a cellphone
================================================================================

View File

@ -1,101 +0,0 @@
Monitor Linux System Performance Using Nmon
================================================================================
Nmon (also known as Nigels Monitor) is a computer performance system monitor tool for the AIX and Linux operating systems developed by IBM employee Nigel Griffiths. The tool displays onscreen or saves to a data file the operating system statistics to aid in the understanding of computer resource use, tuning options and bottlenecks. This system benchmark tool gives you a huge amount of important performance information in one go with a single command. You can easily monitor your systems CPU, memory, network, disks, file systems, NFS, top processes, resources and power micro-partition information using Nmon.
### Installing Nmon ###
By default nmon is available in the Ubuntu repository. You can easily install nmon by running the following command:
sudo apt-get install nmon
How to Use Nmon to Monitor Linux Performance
Once the installation has been finished, you can launch it by typing the `nmon` command in the terminal.
nmon
You wIll see the following output:
![nmon-output](https://www.maketecheasier.com/assets/uploads/2015/12/nmon-output.png)
You can see from the above screenshot that the nmon command-line utility runs completely in interactive mode, and you can easily toggle statistics using shortcut keys.
You can use the following nmon keyboard shortcuts to display different system stats:
- `q` : to stop and exit Nmon
- `h` : to see help screen
- `c` : see CPU stats
- `m` : see memory stats
- `d` : see disk stats
- `k` : see kernel stats
- `n` : see network stats
- `N` : see NFS stats
- `j` : see file system stats
- `t` : see top process
- `V` : see virtual memory stats
- `v` : verbose mode
### Check CPU by Processor ###
If you would like to collect some statistics on CPU performance, you should hit the c key on the keyboard.
After hitting the c key you wIll see the following output.
![nmon_cpu_output](https://www.maketecheasier.com/assets/uploads/2015/12/nmon_cpu_output.png)
### Check Top Process Statistics ###
To get stats on top processes that are running on your system, press the t key on your keyboard.
You will see the following output.
![nmon_process_output](https://www.maketecheasier.com/assets/uploads/2015/12/nmon_process_output.jpg)
### Check Network Statistics ###
To get the network stats of your Linux system, just press the n key on your keyboard.
You wIll see the following output:
![n_network_output](https://www.maketecheasier.com/assets/uploads/2015/12/nmon_network_output.png)
### Disk I/O Graphs ###
Use the `d` key to get information about disks.
You wIll see the following output:
![nmon_disk_output](https://www.maketecheasier.com/assets/uploads/2015/12/nmon_disk_output.png)
### Check Kernel Information ###
A most important key to use with this tool is `k;` it is used to display some brief information on the kernel of your system.
You will see the following output after hitting the `k` key on your keyboard.
![nmon_kernel_output](https://www.maketecheasier.com/assets/uploads/2015/12/nmon_kernel_output.png)
### Get System Information ###
A very useful key for every system admin is the `r` key which is used to give information on different resources such as machine architecture, operating system version, Linux version and CPU.
You will see the following output by hitting the `r` key.
![nmon_system_output](https://www.maketecheasier.com/assets/uploads/2015/12/nmon_system_output.png)
### Conclusion ###
There are many other tools that can do the same job of the Nmon, but Nmon is so usee friendly for a Linux beginner. Please feel free to comment if you have any questions.
--------------------------------------------------------------------------------
via: https://www.maketecheasier.com/monitor-linux-system-performance/
作者:[Hitesh Jethva][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.maketecheasier.com/author/hiteshjethva/

View File

@ -1,3 +1,4 @@
zky001翻译中
What are the best plugins to increase productivity on Emacs
================================================================================
Over a year ago now, I went looking for the best plugins to [turn Vim into a full-fledged IDE][1]. Interestingly, a lot of the comments on that post were about how Emacs already has most of these plugins built in, and was already a great IDE. Although I can only agree about Emacs' incredible versatility, it is still not the ultimate editor when it comes out of the box. Thankfully, its vast plugin library is here to fix that. But among the plethora of options available to you, it is sometimes hard to know where to start. So for now, let me try to assemble a short list of the indispensable plugins to increase your productivity while using Emacs. Although I am heavily geared towards programming related productivity, most of these plugins would be useful to anyone for any usage.
@ -67,7 +68,7 @@ To conclude, Emacs is a fantastic tool. Probably not a shocker. Try these plugin
via: http://xmodulo.com/best-plugins-to-increase-productivity-on-emacs.html
作者:[Adrien Brochard][a]
译者:[译者ID](https://github.com/译者ID)
译者:[zky001](https://github.com/zky001)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -1,3 +1,4 @@
翻译中。。。。。
Grub 2: Heal your bootloader
================================================================================
**There are few things as irritating as a broken bootloader. Get the best out of Grub 2 and keep it shipshape.**

View File

@ -1,53 +0,0 @@
Watch Star Wars In Linux Terminal
================================================================================
![](http://itsfoss.com/wp-content/uploads/2015/12/Star-Wars-Linux-Terminal-2.png)
Star Wars fever has gripped the world. The latest installment in the [Star Wars series, Star Wars: The Force Awakens, has broken the opening records][1].
While I cannot help you to get a ticket of the latest Star Wars movie, I can certainly provide you a way to watch [Star Wars episode IV][2], the original and very first Star Wars movie.
No, it wont be HD, Blue Ray edition. Instead, it will be the ASCII version of Star Wars episode IV and you can watch it in Linux Terminal, in true geek way :)
### Watch Star Wars in Linux Terminal ###
Open a terminal and use the following command:
telnet towel.blinkenlights.nl
Wait for a few seconds and you can see animated ASCII art in the terminal like this:
![](http://itsfoss.com/wp-content/uploads/2015/12/Star-Wars-Linux-Terminal.png)
And it will keep on going:
![](http://itsfoss.com/wp-content/uploads/2015/12/Star-Wars-Linux-Terminal-1.png)
![](http://itsfoss.com/wp-content/uploads/2015/12/Star-Wars-Linux-Terminal-2.png)
![](http://itsfoss.com/wp-content/uploads/2015/12/Star-Wars-Linux-Terminal-3.png)
![](http://itsfoss.com/wp-content/uploads/2015/12/Star-Wars-Linux-Terminal-5.png)
To stop the animation, press ctrl+]. After that type quit to come out of telnet command.
### More terminal fun ###
In fact, watching Star Wars is not the only fun thing you can do in Linux terminal. You can run a [train in terminal][3] or [get Linux logo in ASCII art][4].
I let you enjoy Star Wars in Linux :)
--------------------------------------------------------------------------------
via: http://itsfoss.com/star-wars-linux/
作者:[Abhishek][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://itsfoss.com/author/abhishek/
[1]:http://www.gamespot.com/articles/star-wars-7-breaks-thursday-night-movie-opening-re/1100-6433246/
[2]:http://www.imdb.com/title/tt0076759/
[3]:http://itsfoss.com/ubuntu-terminal-train/
[4]:http://itsfoss.com/display-linux-logo-in-ascii/

View File

@ -1,3 +1,4 @@
Being translated by hittlle......
Part 10 - LFCS: Understanding & Learning Basic Shell Scripting and Linux Filesystem Troubleshooting
================================================================================
The Linux Foundation launched the LFCS certification (Linux Foundation Certified Sysadmin), a brand new initiative whose purpose is to allow individuals everywhere (and anywhere) to get certified in basic to intermediate operational support for Linux systems, which includes supporting running systems and services, along with overall monitoring and analysis, plus smart decision-making when it comes to raising issues to upper support teams.
@ -312,4 +313,4 @@ via: http://www.tecmint.com/linux-basic-shell-scripting-and-linux-filesystem-tro
[1]:http://www.tecmint.com/sed-command-to-create-edit-and-manipulate-files-in-linux/
[2]:http://www.tecmint.com/vi-editor-usage/
[3]:http://www.tecmint.com/learning-shell-scripting-language-a-guide-from-newbies-to-system-administrator/
[4]:http://www.tecmint.com/basic-shell-programming-part-ii/
[4]:http://www.tecmint.com/basic-shell-programming-part-ii/

View File

@ -1,384 +0,0 @@
GHLandy Translateing
Part 3 - LFCS: How to Archive/Compress Files & Directories, Setting File Attributes and Finding Files in Linux
================================================================================
Recently, the Linux Foundation started the LFCS (Linux Foundation Certified Sysadmin) certification, a brand new program whose purpose is allowing individuals from all corners of the globe to have access to an exam, which if approved, certifies that the person is knowledgeable in performing basic to intermediate system administration tasks on Linux systems. This includes supporting already running systems and services, along with first-level troubleshooting and analysis, plus the ability to decide when to escalate issues to engineering teams.
![Linux Foundation Certified Sysadmin Part 3](http://www.tecmint.com/wp-content/uploads/2014/10/lfcs-Part-3.png)
Linux Foundation Certified Sysadmin Part 3
Please watch the below video that gives the idea about The Linux Foundation Certification Program.
youtube 视频
<iframe width="720" height="405" frameborder="0" allowfullscreen="allowfullscreen" src="//www.youtube.com/embed/Y29qZ71Kicg"></iframe>
This post is Part 3 of a 10-tutorial series, here in this part, we will cover how to archive/compress files and directories, set file attributes, and find files on the filesystem, that are required for the LFCS certification exam.
### Archiving and Compression Tools ###
A file archiving tool groups a set of files into a single standalone file that we can backup to several types of media, transfer across a network, or send via email. The most frequently used archiving utility in Linux is tar. When an archiving utility is used along with a compression tool, it allows to reduce the disk size that is needed to store the same files and information.
#### The tar utility ####
tar bundles a group of files together into a single archive (commonly called a tar file or tarball). The name originally stood for tape archiver, but we must note that we can use this tool to archive data to any kind of writeable media (not only to tapes). Tar is normally used with a compression tool such as gzip, bzip2, or xz to produce a compressed tarball.
**Basic syntax:**
# tar [options] [pathname ...]
Where … represents the expression used to specify which files should be acted upon.
#### Most commonly used tar commands ####
注:表格
<table cellspacing="0" border="0">
<colgroup width="150">
</colgroup>
<colgroup width="109">
</colgroup>
<colgroup width="351">
</colgroup>
<tbody>
<tr>
<td bgcolor="#999999" height="18" align="CENTER" style="border: 1px solid #000001;"><b>Long option</b></td>
<td bgcolor="#999999" align="CENTER" style="border: 1px solid #000001;"><b>Abbreviation</b></td>
<td bgcolor="#999999" align="CENTER" style="border: 1px solid #000001;"><b>Description</b></td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000001;">&nbsp;&ndash;create</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;c</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;Creates a tar archive</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000001;">&nbsp;&ndash;concatenate</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;A</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;Appends tar files to an archive</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000001;">&nbsp;&ndash;append</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;r</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;Appends files to the end of an archive</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000001;">&nbsp;&ndash;update</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;u</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;Appends files newer than copy in archive</td>
</tr>
<tr class="alt">
<td height="20" align="LEFT" style="border: 1px solid #000001;">&nbsp;&ndash;diff or &ndash;compare</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;d</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;Find differences between archive and file system</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000001;">&nbsp;&ndash;file archive</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;f</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;Use archive file or device ARCHIVE</td>
</tr>
<tr class="alt">
<td height="20" align="LEFT" style="border: 1px solid #000001;">&nbsp;&ndash;list</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;t</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;Lists the contents of a tarball</td>
</tr>
<tr>
<td height="20" align="LEFT" style="border: 1px solid #000001;">&nbsp;&ndash;extract or &ndash;get</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;x</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;Extracts files from an archive</td>
</tr>
</tbody>
</table>
#### Normally used operation modifiers ####
注:表格
<table cellspacing="0" border="0">
<colgroup width="162">
</colgroup>
<colgroup width="109">
</colgroup>
<colgroup width="743">
</colgroup>
<tbody>
<tr class="alt">
<td bgcolor="#999999" height="18" align="CENTER" style="border: 1px solid #000001;"><b><span style="font-family: Droid Sans;">Long option</span></b></td>
<td bgcolor="#999999" align="CENTER" style="border: 1px solid #000001;"><b><span style="font-family: Droid Sans;">Abbreviation</span></b></td>
<td bgcolor="#999999" align="CENTER" style="border: 1px solid #000001;"><b><span style="font-family: Droid Sans;">Description</span></b></td>
</tr>
<tr>
<td height="20" align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;&ndash;directory dir</span></td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;C</span></td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;Changes to directory dir before performing operations</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;&ndash;same-permissions</span></td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;p</span></td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Droid Sans;">&nbsp;Preserves original permissions</span></td>
</tr>
<tr>
<td height="38" align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;&ndash;verbose</span></td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;v</span></td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;Lists all files read or extracted. When this flag is used along with &ndash;list, the file sizes, ownership, and time stamps are displayed.</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;&ndash;verify</span></td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;W</span></td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Droid Sans;">&nbsp;Verifies the archive after writing it</span></td>
</tr>
<tr>
<td height="20" align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;&ndash;exclude file</span></td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;&mdash;</span></td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;Excludes file from the archive</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;&ndash;exclude=pattern</span></td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;X</span></td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Droid Sans;">&nbsp;Exclude files, given as a PATTERN</span></td>
</tr>
<tr>
<td height="20" align="LEFT" style="border: 1px solid #000001;">&nbsp;&ndash;gzip or &ndash;gunzip</td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;z</span></td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;Processes an archive through gzip</td>
</tr>
<tr class="alt">
<td height="20" align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;&ndash;bzip2</span></td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;j</span></td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;Processes an archive through bzip2</td>
</tr>
<tr>
<td height="20" align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;&ndash;xz</span></td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;J</span></td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;Processes an archive through xz</td>
</tr>
</tbody>
</table>
Gzip is the oldest compression tool and provides the least compression, while bzip2 provides improved compression. In addition, xz is the newest but (usually) provides the best compression. This advantages of best compression come at a price: the time it takes to complete the operation, and system resources used during the process.
Normally, tar files compressed with these utilities have .gz, .bz2, or .xz extensions, respectively. In the following examples we will be using these files: file1, file2, file3, file4, and file5.
**Grouping and compressing with gzip, bzip2 and xz**
Group all the files in the current working directory and compress the resulting bundle with gzip, bzip2, and xz (please note the use of a regular expression to specify which files should be included in the bundle this is to prevent the archiving tool to group the tarballs created in previous steps).
# tar czf myfiles.tar.gz file[0-9]
# tar cjf myfiles.tar.bz2 file[0-9]
# tar cJf myfile.tar.xz file[0-9]
![Compress Multiple Files Using tar](http://www.tecmint.com/wp-content/uploads/2014/10/Compress-Multiple-Files.png)
Compress Multiple Files
**Listing the contents of a tarball and updating / appending files to the bundle**
List the contents of a tarball and display the same information as a long directory listing. Note that update or append operations cannot be applied to compressed files directly (if you need to update or append a file to a compressed tarball, you need to uncompress the tar file and update / append to it, then compress again).
# tar tvf [tarball]
![Check Files in tar Archive](http://www.tecmint.com/wp-content/uploads/2014/10/List-Archive-Content.png)
List Archive Content
Run any of the following commands:
# gzip -d myfiles.tar.gz [#1]
# bzip2 -d myfiles.tar.bz2 [#2]
# xz -d myfiles.tar.xz [#3]
Then
# tar --delete --file myfiles.tar file4 (deletes the file inside the tarball)
# tar --update --file myfiles.tar file4 (adds the updated file)
and
# gzip myfiles.tar [ if you choose #1 above ]
# bzip2 myfiles.tar [ if you choose #2 above ]
# xz myfiles.tar [ if you choose #3 above ]
Finally,
# tar tvf [tarball] #again
and compare the modification date and time of file4 with the same information as shown earlier.
**Excluding file types**
Suppose you want to perform a backup of users home directories. A good sysadmin practice would be (may also be specified by company policies) to exclude all video and audio files from backups.
Maybe your first approach would be to exclude from the backup all files with an .mp3 or .mp4 extension (or other extensions). What if you have a clever user who can change the extension to .txt or .bkp, your approach wont do you much good. In order to detect an audio or video file, you need to check its file type with file. The following shell script will do the job.
#!/bin/bash
# Pass the directory to backup as first argument.
DIR=$1
# Create the tarball and compress it. Exclude files with the MPEG string in its file type.
# -If the file type contains the string mpeg, $? (the exit status of the most recently executed command) expands to 0, and the filename is redirected to the exclude option. Otherwise, it expands to 1.
# -If $? equals 0, add the file to the list of files to be backed up.
tar X <(for i in $DIR/*; do file $i | grep -i mpeg; if [ $? -eq 0 ]; then echo $i; fi;done) -cjf backupfile.tar.bz2 $DIR/*
![Exclude Files in tar Archive](http://www.tecmint.com/wp-content/uploads/2014/10/Exclude-Files-in-Tar.png)
Exclude Files in tar
**Restoring backups with tar preserving permissions**
You can then restore the backup to the original users home directory (user_restore in this example), preserving permissions, with the following command.
# tar xjf backupfile.tar.bz2 --directory user_restore --same-permissions
![Restore Files from tar Archive](http://www.tecmint.com/wp-content/uploads/2014/10/Restore-tar-Backup-Files.png)
Restore Files from Archive
**Read Also:**
- [18 tar Command Examples in Linux][1]
- [Dtrx An Intelligent Archive Tool for Linux][2]
### Using find Command to Search for Files ###
The find command is used to search recursively through directory trees for files or directories that match certain characteristics, and can then either print the matching files or directories or perform other operations on the matches.
Normally, we will search by name, owner, group, type, permissions, date, and size.
#### Basic syntax: ####
# find [directory_to_search] [expression]
**Finding files recursively according to Size**
Find all files (-f) in the current directory (.) and 2 subdirectories below (-maxdepth 3 includes the current working directory and 2 levels down) whose size (-size) is greater than 2 MB.
# find . -maxdepth 3 -type f -size +2M
![Find Files by Size in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Find-Files-Based-on-Size.png)
Find Files Based on Size
**Finding and deleting files that match a certain criteria**
Files with 777 permissions are sometimes considered an open door to external attackers. Either way, it is not safe to let anyone do anything with files. We will take a rather aggressive approach and delete them! ({} + is used to “collect” the results of the search).
# find /home/user -perm 777 -exec rm '{}' +
![Find all 777 Permission Files](http://www.tecmint.com/wp-content/uploads/2014/10/Find-Files-with-777-Permission.png)
Find Files with 777Permission
**Finding files per atime or mtime**
Search for configuration files in /etc that have been accessed (-atime) or modified (-mtime) more (+180) or less (-180) than 6 months ago or exactly 6 months ago (180).
Modify the following command as per the example below:
# find /etc -iname "*.conf" -mtime -180 -print
![Find Files by Modification Time](http://www.tecmint.com/wp-content/uploads/2014/10/Find-Modified-Files.png)
Find Modified Files
- Read Also: [35 Practical Examples of Linux find Command][3]
### File Permissions and Basic Attributes ###
The first 10 characters in the output of ls -l are the file attributes. The first of these characters is used to indicate the file type:
- : a regular file
- -d : a directory
- -l : a symbolic link
- -c : a character device (which treats data as a stream of bytes, i.e. a terminal)
- -b : a block device (which handles data in blocks, i.e. storage devices)
The next nine characters of the file attributes are called the file mode and represent the read (r), write (w), and execute (x) permissions of the files owner, the files group owner, and the rest of the users (commonly referred to as “the world”).
Whereas the read permission on a file allows the same to be opened and read, the same permission on a directory allows its contents to be listed if the execute permission is also set. In addition, the execute permission in a file allows it to be handled as a program and run, while in a directory it allows the same to be cded into it.
File permissions are changed with the chmod command, whose basic syntax is as follows:
# chmod [new_mode] file
Where new_mode is either an octal number or an expression that specifies the new permissions.
The octal number can be converted from its binary equivalent, which is calculated from the desired file permissions for the owner, the group, and the world, as follows:
The presence of a certain permission equals a power of 2 (r=22, w=21, x=20), while its absence equates to 0. For example:
![Linux File Permissions](http://www.tecmint.com/wp-content/uploads/2014/10/File-Permissions.png)
File Permissions
To set the files permissions as above in octal form, type:
# chmod 744 myfile
You can also set a files mode using an expression that indicates the owners rights with the letter u, the group owners rights with the letter g, and the rest with o. All of these “individuals” can be represented at the same time with the letter a. Permissions are granted (or revoked) with the + or signs, respectively.
**Revoking execute permission for a shell script to all users**
As we explained earlier, we can revoke a certain permission prepending it with the minus sign and indicating whether it needs to be revoked for the owner, the group owner, or all users. The one-liner below can be interpreted as follows: Change mode for all (a) users, revoke () execute permission (x).
# chmod a-x backup.sh
Granting read, write, and execute permissions for a file to the owner and group owner, and read permissions for the world.
When we use a 3-digit octal number to set permissions for a file, the first digit indicates the permissions for the owner, the second digit for the group owner and the third digit for everyone else:
- Owner: (r=22 + w=21 + x=20 = 7)
- Group owner: (r=22 + w=21 + x=20 = 7)
- World: (r=22 + w=0 + x=0 = 4),
# chmod 774 myfile
In time, and with practice, you will be able to decide which method to change a file mode works best for you in each case. A long directory listing also shows the files owner and its group owner (which serve as a rudimentary yet effective access control to files in a system):
![Linux File Listing](http://www.tecmint.com/wp-content/uploads/2014/10/Linux-File-Listing.png)
Linux File Listing
File ownership is changed with the chown command. The owner and the group owner can be changed at the same time or separately. Its basic syntax is as follows:
# chown user:group file
Where at least user or group need to be present.
**Few Examples**
Changing the owner of a file to a certain user.
# chown gacanepa sent
Changing the owner and group of a file to an specific user:group pair.
# chown gacanepa:gacanepa TestFile
Changing only the group owner of a file to a certain group. Note the colon before the groups name.
# chown :gacanepa email_body.txt
### Conclusion ###
As a sysadmin, you need to know how to create and restore backups, how to find files in your system and change their attributes, along with a few tricks that can make your life easier and will prevent you from running into future issues.
I hope that the tips provided in the present article will help you to achieve that goal. Feel free to add your own tips and ideas in the comments section for the benefit of the community. Thanks in advance!
Reference Links
- [About the LFCS][4]
- [Why get a Linux Foundation Certification?][5]
- [Register for the LFCS exam][6]
--------------------------------------------------------------------------------
via: http://www.tecmint.com/compress-files-and-finding-files-in-linux/
作者:[Gabriel Cánepa][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/gacanepa/
[1]:http://www.tecmint.com/18-tar-command-examples-in-linux/
[2]:http://www.tecmint.com/dtrx-an-intelligent-archive-extraction-tar-zip-cpio-rpm-deb-rar-tool-for-linux/
[3]:http://www.tecmint.com/35-practical-examples-of-linux-find-command/
[4]:https://training.linuxfoundation.org/certification/LFCS
[5]:https://training.linuxfoundation.org/certification/why-certify-with-us
[6]:https://identity.linuxfoundation.org/user?destination=pid/1

View File

@ -1,191 +0,0 @@
Part 4 - LFCS: Partitioning Storage Devices, Formatting Filesystems and Configuring Swap Partition
================================================================================
Last August, the Linux Foundation launched the LFCS certification (Linux Foundation Certified Sysadmin), a shiny chance for system administrators to show, through a performance-based exam, that they can perform overall operational support of Linux systems: system support, first-level diagnosing and monitoring, plus issue escalation if needed to other support teams.
![Linux Foundation Certified Sysadmin Part 4](http://www.tecmint.com/wp-content/uploads/2014/10/lfcs-Part-4.png)
Linux Foundation Certified Sysadmin Part 4
Please aware that Linux Foundation certifications are precise, totally based on performance and available through an online portal anytime, anywhere. Thus, you no longer have to travel to a examination center to get the certifications you need to establish your skills and expertise.
Please watch the below video that explains The Linux Foundation Certification Program.
youtube 视频
<iframe width="720" height="405" frameborder="0" allowfullscreen="allowfullscreen" src="//www.youtube.com/embed/Y29qZ71Kicg"></iframe>
This post is Part 4 of a 10-tutorial series, here in this part, we will cover the Partitioning storage devices, Formatting filesystems and Configuring swap partition, that are required for the LFCS certification exam.
### Partitioning Storage Devices ###
Partitioning is a means to divide a single hard drive into one or more parts or “slices” called partitions. A partition is a section on a drive that is treated as an independent disk and which contains a single type of file system, whereas a partition table is an index that relates those physical sections of the hard drive to partition identifications.
In Linux, the traditional tool for managing MBR partitions (up to ~2009) in IBM PC compatible systems is fdisk. For GPT partitions (~2010 and later) we will use gdisk. Each of these tools can be invoked by typing its name followed by a device name (such as /dev/sdb).
#### Managing MBR Partitions with fdisk ####
We will cover fdisk first.
# fdisk /dev/sdb
A prompt appears asking for the next operation. If you are unsure, you can press the m key to display the help contents.
![fdisk Help Menu](http://www.tecmint.com/wp-content/uploads/2014/10/fdisk-help.png)
fdisk Help Menu
In the above image, the most frequently used options are highlighted. At any moment, you can press p to display the current partition table.
![Check Partition Table in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Show-Partition-Table.png)
Show Partition Table
The Id column shows the partition type (or partition id) that has been assigned by fdisk to the partition. A partition type serves as an indicator of the file system, the partition contains or, in simple words, the way data will be accessed in that partition.
Please note that a comprehensive study of each partition type is out of the scope of this tutorial as this series is focused on the LFCS exam, which is performance-based.
**Some of the options used by fdisk as follows:**
You can list all the partition types that can be managed by fdisk by pressing the l option (lowercase l).
Press d to delete an existing partition. If more than one partition is found in the drive, you will be asked which one should be deleted.
Enter the corresponding number, and then press w (write modifications to partition table) to apply changes.
In the following example, we will delete /dev/sdb2, and then print (p) the partition table to verify the modifications.
![fdisk Command Options](http://www.tecmint.com/wp-content/uploads/2014/10/fdisk-options.png)
fdisk Command Options
Press n to create a new partition, then p to indicate it will be a primary partition. Finally, you can accept all the default values (in which case the partition will occupy all the available space), or specify a size as follows.
![Create New Partition in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Create-New-Partition.png)
Create New Partition
If the partition Id that fdisk chose is not the right one for our setup, we can press t to change it.
![Change Partition Name in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Change-Partition-Name.png)
Change Partition Name
When youre done setting up the partitions, press w to commit the changes to disk.
![Save Partition Changes](http://www.tecmint.com/wp-content/uploads/2014/10/Save-Partition-Changes.png)
Save Partition Changes
#### Managing GPT Partitions with gdisk ####
In the following example, we will use /dev/sdb.
# gdisk /dev/sdb
We must note that gdisk can be used either to create MBR or GPT partitions.
![Create GPT Partitions in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Create-GPT-Partitions.png)
Create GPT Partitions
The advantage of using GPT partitioning is that we can create up to 128 partitions in the same disk whose size can be up to the order of petabytes, whereas the maximum size for MBR partitions is 2 TB.
Note that most of the options in fdisk are the same in gdisk. For that reason, we will not go into detail about them, but heres a screenshot of the process.
![gdisk Command Options](http://www.tecmint.com/wp-content/uploads/2014/10/gdisk-options.png)
gdisk Command Options
### Formatting Filesystems ###
Once we have created all the necessary partitions, we must create filesystems. To find out the list of filesystems supported in your system, run.
# ls /sbin/mk*
![Check Filesystems Type in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Check-Filesystems.png)
Check Filesystems Type
The type of filesystem that you should choose depends on your requirements. You should consider the pros and cons of each filesystem and its own set of features. Two important attributes to look for in a filesystem are.
- Journaling support, which allows for faster data recovery in the event of a system crash.
- Security Enhanced Linux (SELinux) support, as per the project wiki, “a security enhancement to Linux which allows users and administrators more control over access control”.
In our next example, we will create an ext4 filesystem (supports both journaling and SELinux) labeled Tecmint on /dev/sdb1, using mkfs, whose basic syntax is.
# mkfs -t [filesystem] -L [label] device
or
# mkfs.[filesystem] -L [label] device
![Create ext4 Filesystems in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Create-ext4-Filesystems.png)
Create ext4 Filesystems
### Creating and Using Swap Partitions ###
Swap partitions are necessary if we need our Linux system to have access to virtual memory, which is a section of the hard disk designated for use as memory, when the main system memory (RAM) is all in use. For that reason, a swap partition may not be needed on systems with enough RAM to meet all its requirements; however, even in that case its up to the system administrator to decide whether to use a swap partition or not.
A simple rule of thumb to decide the size of a swap partition is as follows.
Swap should usually equal 2x physical RAM for up to 2 GB of physical RAM, and then an additional 1x physical RAM for any amount above 2 GB, but never less than 32 MB.
So, if:
M = Amount of RAM in GB, and S = Amount of swap in GB, then
If M < 2
S = M *2
Else
S = M + 2
Remember this is just a formula and that only you, as a sysadmin, have the final word as to the use and size of a swap partition.
To configure a swap partition, create a regular partition as demonstrated earlier with the desired size. Next, we need to add the following entry to the /etc/fstab file (X can be either b or c).
/dev/sdX1 swap swap sw 0 0
Finally, lets format and enable the swap partition.
# mkswap /dev/sdX1
# swapon -v /dev/sdX1
To display a snapshot of the swap partition(s).
# cat /proc/swaps
To disable the swap partition.
# swapoff /dev/sdX1
For the next example, well use /dev/sdc1 (=512 MB, for a system with 256 MB of RAM) to set up a partition with fdisk that we will use as swap, following the steps detailed above. Note that we will specify a fixed size in this case.
![Create-Swap-Partition in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Create-Swap-Partition.png)
Create Swap Partition
![Add Swap Partition in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Enable-Swap-Partition.png)
Enable Swap Partition
### Conclusion ###
Creating partitions (including swap) and formatting filesystems are crucial in your road to Sysadminship. I hope that the tips given in this article will guide you to achieve your goals. Feel free to add your own tips & ideas in the comments section below, for the benefit of the community.
Reference Links
- [About the LFCS][1]
- [Why get a Linux Foundation Certification?][2]
- [Register for the LFCS exam][3]
--------------------------------------------------------------------------------
via: http://www.tecmint.com/create-partitions-and-filesystems-in-linux/
作者:[Gabriel Cánepa][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/gacanepa/
[1]:https://training.linuxfoundation.org/certification/LFCS
[2]:https://training.linuxfoundation.org/certification/why-certify-with-us
[3]:https://identity.linuxfoundation.org/user?destination=pid/1

View File

@ -1,3 +1,5 @@
GHLandy Translating
Part 5 - LFCS: How to Mount/Unmount Local and Network (Samba & NFS) Filesystems in Linux
================================================================================
The Linux Foundation launched the LFCS certification (Linux Foundation Certified Sysadmin), a brand new program whose purpose is allowing individuals from all corners of the globe to get certified in basic to intermediate system administration tasks for Linux systems, which includes supporting running systems and services, along with overall monitoring and analysis, plus smart decision-making when it comes to raising issues to upper support teams.
@ -229,4 +231,4 @@ via: http://www.tecmint.com/mount-filesystem-in-linux/
[2]:http://www.tecmint.com/how-to-setup-nfs-server-in-linux/
[3]:https://training.linuxfoundation.org/certification/LFCS
[4]:https://training.linuxfoundation.org/certification/why-certify-with-us
[5]:https://identity.linuxfoundation.org/user?destination=pid/1
[5]:https://identity.linuxfoundation.org/user?destination=pid/1

View File

@ -1,3 +1,4 @@
[Translating by cposture 15-12-31]
Part 6 - LFCS: Assembling Partitions as RAID Devices Creating & Managing System Backups
================================================================================
Recently, the Linux Foundation launched the LFCS (Linux Foundation Certified Sysadmin) certification, a shiny chance for system administrators everywhere to demonstrate, through a performance-based exam, that they are capable of performing overall operational support on Linux systems: system support, first-level diagnosing and monitoring, plus issue escalation, when required, to other support teams.
@ -273,4 +274,4 @@ via: http://www.tecmint.com/creating-and-managing-raid-backups-in-linux/
[1]:http://www.tecmint.com/understanding-raid-setup-in-linux/
[2]:http://www.tecmint.com/create-partitions-and-filesystems-in-linux/
[3]:http://www.tecmint.com/compress-files-and-finding-files-in-linux/
[4]:http://www.tecmint.com/rsync-local-remote-file-synchronization-commands/
[4]:http://www.tecmint.com/rsync-local-remote-file-synchronization-commands/

View File

@ -1,3 +1,5 @@
Translating by Flowsnow
Part 7 - LFCS: Managing System Startup Process and Services (SysVinit, Systemd and Upstart)
================================================================================
A couple of months ago, the Linux Foundation announced the LFCS (Linux Foundation Certified Sysadmin) certification, an exciting new program whose aim is allowing individuals from all ends of the world to get certified in performing basic to intermediate system administration tasks on Linux systems. This includes supporting already running systems and services, along with first-hand problem-finding and analysis, plus the ability to decide when to raise issues to engineering teams.
@ -364,4 +366,4 @@ via: http://www.tecmint.com/linux-boot-process-and-manage-services/
[3]:http://www.tecmint.com/chkconfig-command-examples/
[4]:http://www.tecmint.com/remove-unwanted-services-from-linux/
[5]:http://www.tecmint.com/chkconfig-command-examples/
[6]:http://upstart.ubuntu.com/cookbook/
[6]:http://upstart.ubuntu.com/cookbook/

View File

@ -1,3 +1,5 @@
GHLandy Translating
Part 8 - LFCS: Managing Users & Groups, File Permissions & Attributes and Enabling sudo Access on Accounts
================================================================================
Last August, the Linux Foundation started the LFCS certification (Linux Foundation Certified Sysadmin), a brand new program whose purpose is to allow individuals everywhere and anywhere take an exam in order to get certified in basic to intermediate operational support for Linux systems, which includes supporting running systems and services, along with overall monitoring and analysis, plus intelligent decision-making to be able to decide when its necessary to escalate issues to higher level support teams.
@ -327,4 +329,4 @@ via: http://www.tecmint.com/manage-users-and-groups-in-linux/
[3]:http://www.tecmint.com/compress-files-and-finding-files-in-linux/
[4]:http://www.tecmint.com/chattr-command-examples/
[5]:http://www.tecmint.com/su-vs-sudo-and-how-to-configure-sudo-in-linux/
[6]:http://www.tecmint.com/vi-editor-usage/
[6]:http://www.tecmint.com/vi-editor-usage/

View File

@ -1,3 +1,4 @@
translating by fw8899
How to Setup SSH Login Without Password CentOS / RHEL
================================================================================
![](http://www.ehowstuff.com/wp-content/uploads/2015/12/notebook-1071774_1280.jpg)

View File

@ -0,0 +1,195 @@
使用开源工具优化Web响应
================================================================================
Web代理软件转发HTTP请求时并不会改变数据流量。它们经过配置后可以免客户端配置作为透明代理。它们还可以作为网站反向代理的前端缓存服务器在此能支撑一台或多台web服务器为海量用户提供服务。
网站代理功能多样有着宽泛的用途从页面缓存、DNS和其他查询到加速web服务器响应、降低带宽消耗。代理软件广泛用于大型高访问量的网站比如纽约时报、卫报 以及社交媒体网站如Twitter、Facebook和Wikipedia。
页面缓存已经成为优化单位时间内所能吞吐的数据量的至关重要的机制。好的Web缓存还能降低延迟尽可能快地响应页面让终端用户不至于因等待内容的时间过久而失去耐心。它们还能将频繁访问的内容缓存起来以节省带宽。如果你需要降低服务器负载并改善网站内容响应速度那缓存软件能带来的好处就绝对值得探索一番。
为深入探查Linux下可用的相关软件的质量我列出了下边5个优秀的开源web代理工具。它们中有些功能完备强大也有几个只需很低的资源就能运行。
### Squid ###
Squid是一个高性能、开源的代理缓存和Web缓存服务器支持FTP、Internet Gopher、HTTPS和SSL等多种协议。它通过一个非阻塞I/O事件驱动的单一进程处理所有IPV4或IPV6上的请求。
Squid由一个主服务程序squid和DNS查询程序dnsserver另外还有可选的请求重写、执行认证程序组件及一些管理和客户端工具构成。
Squid提供了丰富的访问控制、认证和日志环境 用于开发web代理和内容服务网站应用。
其特性包括:
- Web代理
- 通过缓存来降低访问时间和带宽使用
- 将元数据和特别热的对象缓存到内存中
- 缓存DNS查询
- 支持非阻塞的DNS查询
- 实现了失败请求的未果缓存
- Squid缓存可架设为层次结构或网状结构以节省额外的带宽
- 通过可扩展的访问控制来执行网站使用条款
- 隐匿请求如禁用或修改客户端HTTP请求头特定属性
- 反向代理
- 媒体范围限制
- 支持SSL
- 支持IPv6
- 错误页面的本地化 - Squid可以根据访问者的语言选项对每个请求展示本地化的错误页面
- 连接Pinning用于NTLM Auth Passthrough - 一种通过Web代理允许Web服务器使用Microsoft NTLM安全认证替代HTTP标准认证的方案
- 支持服务质量 (QoS, Quality of Service) 流
- 选择一个TOS/Diffserv值来标记本地命中
- 选择一个TOS/Diffserv值来标记邻居命中
- 选择性地仅标记同级或上级请求
- 允许任意发往客户端的HTTP响应保持由远程服务器处响应的TOS值
- 对收到的远程服务器的TOS值在复制之前对指定位进行掩码操作再发送到客户端
- SSL Bump (用于HTTPS过滤和适配) - Squid-in-the-middle在CONNECT方式的SSL隧道中用配置化的客户端和服务器端证书对流量进行解密和加密
- 支持适配模块
- ICAP旁路和重试增强 - 通过完全的旁路和动态链式路由扩展ICAP来处理多多个适应性服务。
- 支持ICY流式协议 - 俗称SHOUTcast多媒体流
- 动态SSL证书生产
- 支持ICAP协议(Internet Content Adaptation Protocol)
- 完整的请求日志记录
- 匿名连接
- 网站: [www.squid-cache.org][1]
- 开发: 美国国家应用网络研究实验室和网络志愿者
- 授权: GNU GPL v2
- 版本号: 4.0.1
### Privoxy ###
Privoxy(Privacy Enhancing Proxy)是一个非缓存类Web代理软件它自带的高级过滤功能用来增强隐私保护修改页面内容和HTTP头部信息访问控制以及去除广告和其它招人反感的互联网垃圾。Privoxy的配置非常灵活能充分定制已满足各种各样的需求和偏好。它支持单机和多用户网络两种模式。
Privoxy使用Actions规则来处理浏览器和远程站点间的数据流。
其特性包括:
- 高度配置化
- 广告拦截
- Cookie管理
- 支持"Connection: keep-alive"。可以无视客户端配置而保持持久连接
- 支持IPv6
- 标签化,允许按照客户端和服务器的请求头进行处理
- 作为拦截代理器运行
- 巧妙的手段和过滤机制用来处理服务器和客户端的HTTP头部
- 可以与其他代理软件链式使用
- 整合了基于浏览器的配置和控制工具,能在线跟踪规则和过滤效果,可远程开关
- 页面过滤(文本替换、根据尺寸大小删除广告栏, 隐藏的"web-bugs"元素和HTML容错等
- 模块化的配置使得标准配合和用户配置可以存放于不同文件中,这样安装更新就不会覆盖用户的个性化设置
- 配置文件支持Perl兼容的正则表达式以及更为精妙和灵活的配置语法
- GIF去动画
- 旁路处理大量click-tracking脚本避免脚本重定向
- 大多数代理生成的页面(例如 "访问受限" 页面可由用户自定义HTML模板
- 自动监测配置文件的修改并重新读取
- 最大特点是可以基于每个站点或每个位置来进行控制
- 网站: [www.privoxy.org][2]
- 开发: Fabian Keil开发领导者, David Schmidt, 和众多其他贡献者
- 授权: GNU GPL v2
- 版本号: 3.4.2
### Varnish Cache ###
Varnish Cache是一个为性能和灵活性而生的web加速器。它新颖的架构设计能带来显著的性能提升。根据你的架构通常情况下它能加速响应速度300-1000倍。Varnish将页面存储到内存这样web服务器就无需重复地创建相同的页面只需要在页面发生变化后重新生成。页面内容直接从内存中访问当然比其他方式更快。
此外Varnish能大大提升响应web页面的速度用任何应用服务器都能使网站访问速度大幅度地提升。
按按经验Varnish Cache比较经济的配置是1-16GB内存+SSD固态硬盘。
其特性包括:
- 新颖的设计
- VCL - 非常灵活的配置语言。VCL配置转换成C然后编译、加载、运行灵活且高效
- 能使用round-robin轮询和随机分发两种方式来负载均衡两种方式下后端服务器都可以设置权重
- 基于DNS、随机、散列和客户端IP的分发器
- 多台后端主机间的负载均衡
- 支持Edge Side Includes包括拼装压缩后的ESI片段
- 多线程并发
- URL重写
- 单Varnish缓存多个虚拟主机
- 日志数据存储在共享内存中
- 基本的后端服务器健康检查
- 优雅地处理后端服务器“挂掉”
- 命令行界面的管理控制台
- 使用内联C来扩展Varnish
- 可以与Apache用在相同的系统上
- 单系统可运行多个Varnish
- 支持HAProxy代理协议。该协议在每个收到的TCP请求例如SSL终止过程中附加小段头信息以记录客户端的真实地址
- 冷热VCL状态
- 用名为VMODs的Varnish模块来提供插件扩展
- 通过VMODs定义后端主机
- Gzip压缩及解压
- HTTP流通过和获取
- 神圣模式和优雅模式。用Varnish作为负载均衡器神圣模式下可以将不稳定的后端服务器在一段时间内打入黑名单阻止它们继续提供流量服务。优雅模式允许Varnish在获取不到后端服务器状态良好的响应时提供已过期版本的页面或其它内容。
- 实验性支持持久化存储无需LRU缓存淘汰
- 网站: [www.varnish-cache.org][3]
- 开发: Varnish Software
- 授权: FreeBSD
- 版本号: 4.1.0
### Polipo ###
Polipo是一个开源的HTTP缓存代理只需要非常低的资源开销。
它监听来自浏览器的web页面请求转发到web服务器然后将服务器的响应转发到浏览器。在此过程中它能优化和整形网络流量。从本质来讲Polipo与WWWOFFLE很相似但其实现技术更接近于Squid。
Polipo最开始的目标是作为一个兼容HTTP/1.1的代理理论它能在任何兼容HTTP/1.1或更早的HTTP/1.0的站点上运行。
其特性包括:
- HTTP 1.1、IPv4 & IPv6、流量过滤和隐私保护增强
- 如确认远程服务器支持则无论收到的请求是管道处理过的还是在多个连接上同时收到的都使用HTTP/1.1管道
- 下载被中断时缓存起始部分,当需要续传时用区间请求来完成下载
- 将HTTP/1.0的客户端请求升级为HTTP/1.1,然后按照客户端支持的级别进行升级或降级后回复
- 全面支持IPv6 (作用域(链路本地)地址除外)
- 作为IPv4和IPv6网络的网桥
- 内容过滤
- 能使用Poor Man多路复用技术降低延迟
- 支持SOCKS 4和SOCKS 5协议
- HTTPS代理
- 扮演透明代理的角色
- 可以与Privoxy或tor一起运行
- 网站: [www.pps.univ-paris-diderot.fr/~jch/software/polipo/][4]
- 开发: Juliusz Chroboczek, Christopher Davis
- 授权: MIT License
- 版本号: 1.1.1
### Tinyproxy ###
Tinyproxy是一个轻量级的开源web代理守护进程其设计目标是快而小。它适用于需要完整HTTP代理特性但系统资源又不足以运行大型代理的场景比如嵌入式部署。
Tinyproxy对小规模网络非常有用这样的场合下大型代理会使系统资源紧张或有安全风险。Tinyproxy的一个关键特性是其缓冲连接的理念。实质上Tinyproxy服务器的响应进行了高速缓冲然后按照客户端能够处理的最高速度进行响应。该特性极大的降低了网络延滞带来的问题。
特性:
- 易于修改
- 隐匿模式 - 定义哪些HTTP头允许通过哪些又会被拦截
- 支持HTTPS - Tinyproxy允许通过CONNECT方法转发HTTPS连接任何情况下都不会修改数据流量
- 远程监控 - 远程访问代理统计数据,让你能清楚了解代理服务当前的忙碌状态
- 平均负载监控 - 通过配置,当服务器的负载接近一定值后拒绝新连接
- 访问控制 - 通过配置仅允许指定子网或IP地址的访问
- 安全 - 运行无需额外权限,减小了系统受到威胁的概率
- 基于URL的过滤 - 允许基于域和URL的黑白名单
- 透明代理 - 配位为透明代理,这样客户端就无需任何配置
- 代理链 - 来流量出口处采用上游代理服务器,而不是直接转发到目标服务器,创建我们所说的代理链
- 隐私特性 - 限制允许从浏览器收到的来自HTTP服务器的数据例如cookies同时限制允许通过的从浏览器到HTTP服务器的数据例如版本信息
- 低开销 - 使用glibc内存开销只有2MBCPU负载按并发连接数线性增长取决于网络连接速度。 Tinyproxy可以运行在老旧的机器上而无需担心性能问题。
- 网站: [banu.com/tinyproxy][5]
- 开发: Robert James Kaes和其他贡献者
- 授权: GNU GPL v2
- 版本号: 1.8.3
--------------------------------------------------------------------------------
via: http://www.linuxlinks.com/article/20151101020309690/WebDelivery.html
译者:[fw8899](https://github.com/fw8899)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[1]:http://www.squid-cache.org/
[2]:http://www.privoxy.org/
[3]:https://www.varnish-cache.org/
[4]:http://www.pps.univ-paris-diderot.fr/%7Ejch/software/polipo/
[5]:https://banu.com/tinyproxy/

View File

@ -3,7 +3,6 @@ IPv6因特网中的隐私保护和网络管理器
IPv6的使用量正在不断增加让我们始料未及的是伴随这个协议不断增加的使用量大量隐私问题涌现出来。互联网社区在积极发表相关解决方案当前状况是怎样的呢网络管理器又是如何跟上的呢让我们来瞧瞧吧
![](https://blogs.gnome.org/lkundrak/files/2015/12/cameras1.jpg)
## 通过IPv6方式连接的主机的特性

View File

@ -0,0 +1,87 @@
使用Nmon监控Linux的系统性能
================================================================================
Nmon得名于Nigel's的监控器是IBM的员工Nigel Griffiths为AIX和Linux系统开发的一款计算机性能系统监控工具。Nmon可以把操作系统的统计数据展示在屏幕上或者存储到一份数据文件里来帮助理解计算机资源的使用情况、调整选项和系统瓶颈。这个系统基准测试工具只需要使用一条命令就能得到大量重要的性能数据。使用Nmon可以很轻松的监控系统的CPU、内存、网络、硬盘、文件系统、NFS、高耗进程、资源和微分区功率的信息。
### Nmon 安装 ###
Nmon默认是存在于Ubuntu的仓库中的。你可以通过下面的命令安装Nmon
sudo apt-get install nmon
怎么使用Nmon来监控Linux的性能
安装完成后,通过在终端输入`nmon` 命令来启动Nmon
nmon
你会看到下面的输出:
![nmon-output](https://www.maketecheasier.com/assets/uploads/2015/12/nmon-output.png)
从上面的截图可以看到nmon命令行工具完全是交互式运行的你可以使用快捷键来轻松查看对应的统计数据。
你可以使用下面的nmon快捷键来显示不同的系统统计数据
- `q` : 停止或编辑Nmon
- `h` : 查看帮助
- `c` : 查看CPU统计数据
- `m` : 查看内存统计数据
- `d` : 查看硬盘统计数据
- `k` : 查看内核统计数据
- `n` : 查看网络统计数据
- `N` : 查看NFS统计数据
- `j` : 查看文件系统统计数据
- `t` : 查看高耗进程
- `V` : 查看虚拟内存统计数据
- `v` : 详细模式
### 核查CPU处理器 ###
如果你想收集关于CPU性能相关的统计数据你应该按下键盘上的`c`键,之后你将会看到下面的输出:
![nmon_cpu_output](https://www.maketecheasier.com/assets/uploads/2015/12/nmon_cpu_output.png)
### 核查高耗进程统计数据 ###
如果想收集系统正在运行的高耗进程的统计数据,按键盘上的`t`键,之后你将会看到下面的输出:
![nmon_process_output](https://www.maketecheasier.com/assets/uploads/2015/12/nmon_process_output.jpg)
### 核查网络统计数据 ###
如果想收集Linux系统网络统计数据按下`n`键,你将会看到下面输出:
![n_network_output](https://www.maketecheasier.com/assets/uploads/2015/12/nmon_network_output.png)
### 硬盘 I/O 图表 ###
使用`d` 键获取硬盘相关的信息,你会看到下面输出:
![nmon_disk_output](https://www.maketecheasier.com/assets/uploads/2015/12/nmon_disk_output.png)
### 核查内核信息 ###
Nmon一个非常重要的快捷键是`k`键,用来显示系统内核相关的概要信息。按下`k`键之后,会看到下面输出:
![nmon_kernel_output](https://www.maketecheasier.com/assets/uploads/2015/12/nmon_kernel_output.png)
### 获取系统信息 ###
对每个系统管理员来说一个非常有用的快捷键是`r`键可以用来显示计算机系统结构、操作系统版本号和CPU等不同资源的信息。按下`r`键之后会看到下面输出:
![nmon_system_output](https://www.maketecheasier.com/assets/uploads/2015/12/nmon_system_output.png)
### 总结 ###
还有许多其他的工具实现的功能和Nmon一样不过Nmon对一个Linux新手来说还是很友好的。如果你有什么问题尽管评论。
--------------------------------------------------------------------------------
via: https://www.maketecheasier.com/monitor-linux-system-performance/
作者:[Hitesh Jethva][a]
译者:[sonofelice](https://github.com/sonofelice)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.maketecheasier.com/author/hiteshjethva/

View File

@ -0,0 +1,390 @@
GHLandy Translated
LFCS 系列第三讲:如何在 Linux 中归档/压缩文件及目录、设置文件属性和搜索文件
================================================================================
最近Linux 基金会发起了 一个全新的 LFCSLinux Foundation Certified SysadminLinux 基金会认证系统管理员)认证,旨在让遍布全世界的人都有机会参加该认证的考试,并且通过考试的人将会得到关于他们有能力在 Linux 上执行基本的中间系统管理任务的认证证书。这项认证包括了对已运行的系统和服务的支持、一流水平的问题解决和分析以及决定何时将问题反映给工程师团队的能力。
![Linux Foundation Certified Sysadmin Part 3](http://www.tecmint.com/wp-content/uploads/2014/10/lfcs-Part-3.png)
LFCS 系列第三讲
请看以下视频,这里边讲给出 Linux 基金会认证程序的一些想法。
youtube 视频
<iframe width="720" height="405" frameborder="0" allowfullscreen="allowfullscreen" src="//www.youtube.com/embed/Y29qZ71Kicg"></iframe>
本讲是《十套教程》系列中的第三讲,在这一讲中,我们会涵盖如何在文件系统中归档/压缩文件及目录、设置文件属性和搜索文件等内容,这些都是 LFCS 认证中必须掌握的知识。
### 归档和压缩的相关工具 ###
文件归档工具将一堆文件整合到一个单独的归档文件之后,我们可以将归档文件备份到不同类型的媒介或者通过网络传输和发送 Email 来备份。在 Linux 中使用频率最高的归档实用工具是 tar。当归档工具和压缩工具一起使用的时候可以减少同一文件和信息在硬盘中的存储空间。
#### tar 使用工具 ####
tar 将一组文件打包到一个单独的归档文件(通常叫做 tar 文件或者 tarball。tar 这个名称最初代表磁带存档程序tape archiver但现在我们可以用它来归档任意类型的可读写媒介上边的数据而不是只能归档磁带数据。tar 通常与 gzip、bzip2 或者 xz 等压缩工具一起使用,生成一个压缩的 tarball。
**基本语法:**
# tar [选项] [路径名 ...]
其中 ... 代表指定那些文件进行归档操作的表达式
#### tar 的常用命令 ####
注:表格
<table cellspacing="0" border="0">
<colgroup width="150">
</colgroup>
<colgroup width="109">
</colgroup>
<colgroup width="351">
</colgroup>
<tbody>
<tr>
<td bgcolor="#999999" height="18" align="CENTER" style="border: 1px solid #000001;"><b>长选项</b></td>
<td bgcolor="#999999" align="CENTER" style="border: 1px solid #000001;"><b>简写</b></td>
<td bgcolor="#999999" align="CENTER" style="border: 1px solid #000001;"><b>描述</b></td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000001;">&nbsp;&ndash;create</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;c</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;创建 tar 归档文件</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000001;">&nbsp;&ndash;concatenate</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;A</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;将一存档与已有的存档合并</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000001;">&nbsp;&ndash;append</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;r</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;把要存档的文件追加到归档文件的末尾</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000001;">&nbsp;&ndash;update</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;u</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;更新新文件到归档文件中去</td>
</tr>
<tr class="alt">
<td height="20" align="LEFT" style="border: 1px solid #000001;">&nbsp;&ndash;diff 或 &ndash;compare</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;d</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;比较存档与当前文件的不同之处</td>
</tr>
<tr>
<td height="18" align="LEFT" style="border: 1px solid #000001;">&nbsp;&ndash;file archive</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;f</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;使用档案文件或设备</td>
</tr>
<tr class="alt">
<td height="20" align="LEFT" style="border: 1px solid #000001;">&nbsp;&ndash;list</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;t</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;列出 tarball 中的内容</td>
</tr>
<tr>
<td height="20" align="LEFT" style="border: 1px solid #000001;">&nbsp;&ndash;extract 或 &ndash;get</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;x</td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;从归档文件中释放文件</td>
</tr>
</tbody>
</table>
#### 常用的操作修饰符 ####
注:表格
<table cellspacing="0" border="0">
<colgroup width="162">
</colgroup>
<colgroup width="109">
</colgroup>
<colgroup width="743">
</colgroup>
<tbody>
<tr class="alt">
<td bgcolor="#999999" height="18" align="CENTER" style="border: 1px solid #000001;"><b><span style="font-family: Droid Sans;">长选项</span></b></td>
<td bgcolor="#999999" align="CENTER" style="border: 1px solid #000001;"><b><span style="font-family: Droid Sans;">缩写</span></b></td>
<td bgcolor="#999999" align="CENTER" style="border: 1px solid #000001;"><b><span style="font-family: Droid Sans;">描述</span></b></td>
</tr>
<tr>
<td height="20" align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;&ndash;directory dir</span></td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;C</span></td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;执行归档操作前,先转到指定目录</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;&ndash;same-permissions</span></td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;p</span></td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Droid Sans;">&nbsp;保持原始的文件权限</span></td>
</tr>
<tr>
<td height="38" align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;&ndash;verbose</span></td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;v</span></td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;列出所有的读取或提取文件。但这个标识符与 &ndash;list 一起使用的时候,还会显示出文件大小、属主和时间戳的信息</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;&ndash;verify</span></td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;W</span></td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Droid Sans;">&nbsp;写入存档后进行校验</span></td>
</tr>
<tr>
<td height="20" align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;&ndash;exclude file</span></td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;&mdash;</span></td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;不把指定文件包含在内</td>
</tr>
<tr class="alt">
<td height="18" align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;&ndash;exclude=pattern</span></td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;X</span></td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Droid Sans;">&nbsp;以PATTERN模式排除文件</span></td>
</tr>
<tr>
<td height="20" align="LEFT" style="border: 1px solid #000001;">&nbsp;&ndash;gzip 或 &ndash;gunzip</td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;z</span></td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;通过gzip压缩归档</td>
</tr>
<tr class="alt">
<td height="20" align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;&ndash;bzip2</span></td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;j</span></td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;通过bzip2压缩归档</td>
</tr>
<tr>
<td height="20" align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;&ndash;xz</span></td>
<td align="LEFT" style="border: 1px solid #000001;"><span style="font-family: Consolas;">&nbsp;J</span></td>
<td align="LEFT" style="border: 1px solid #000001;">&nbsp;通过xz压缩归档</td>
</tr>
</tbody>
</table>
Gzip 是最古老的压缩工具压缩率最小bzip2 的压缩率稍微高一点。另外xz是最新的压缩工具压缩率最好。xz 具有最佳压缩率的代价是:完成压缩操作花费最多时间,压缩过程中占有较多系统资源。
通常,通过这些工具压缩的 tar 文件相应的具有 .gz、.bz2 或 .xz的扩展名。在下列的例子中我们使用 file1、file2、file3、file4 和 file5 进行演示。
**通过 gzip、bzip2 和 xz 压缩归档**
归档当前工作目录的所有文件,并以 gzip、bzip2 和 xz 压缩刚刚的归档文件(请注意,用正则表达式来指定那些文件应该归档——这是为了防止归档工具包前一步生成的文件打包进来)。
# tar czf myfiles.tar.gz file[0-9]
# tar cjf myfiles.tar.bz2 file[0-9]
# tar cJf myfile.tar.xz file[0-9]
![Compress Multiple Files Using tar](http://www.tecmint.com/wp-content/uploads/2014/10/Compress-Multiple-Files.png)
压缩多个文件
**列举 tarball 中的内容和更新/追加文件到归档文件中**
列举 tarball 中的内容,并显示相同信息为一个详细目录清单。注意,不能直接向压缩的归档文件更新/追加文件(若你需要向压缩的 tarball 中更新/追加文件,需要先解压 tar 文件后再进行操作,然后重新压缩)。
# tar tvf [tarball]
![Check Files in tar Archive](http://www.tecmint.com/wp-content/uploads/2014/10/List-Archive-Content.png)
列举归档文件中的内容
运行一下任意一条命令:
# gzip -d myfiles.tar.gz [#1]
# bzip2 -d myfiles.tar.bz2 [#2]
# xz -d myfiles.tar.xz [#3]
然后:
# tar --delete --file myfiles.tar file4 (删除tarball中的file4)
# tar --update --file myfiles.tar file4 (更新tarball中的file4)
# gzip myfiles.tar [ 如果你运行 #1 命令 ]
# bzip2 myfiles.tar [ 如果你运行 #2 命令 ]
# xz myfiles.tar [ 如果你运行 #3 命令 ]
最后
# tar tvf [tarball] #again
将 file4 修改后的日期和时间与之前显示的对应信息进行比较
**排除文件类型**
假设你现在需要备份用户的家目录。一个有经验的系统管理员会选择忽略所有视频和音频文件再备份(也可能是公司规定)。
可能你最先想到的方法是在备份是时候,忽略扩展名为 .mp3 和 .mp4或者其他格式的文件。但如果你有些自作聪明的用户将扩展名改为 .txt 或者 .bkp那你的方法就不灵了。为了发现并排除音频或者视频文件你需要先检查文件类型。以下 shell 脚本可以代你完成类型检查:
#!/bin/bash
# 把需要进行备份的目录传递给 $1 参数.
DIR=$1
#排除文件类型中包含了 mpeg 字符串的文件,然后创建 tarball 并进行压缩。
# -若文件类型中包含 mpeg 字符串, $?(最后执行的命令的退出状态)返回 0然后文件名被定向到排除选项。否则返回 1。
# -若 $? 等于 0该文件从需要备份文件的列表排除。
tar X <(for i in $DIR/*; do file $i | grep -i mpeg; if [ $? -eq 0 ]; then echo $i; fi;done) -cjf backupfile.tar.bz2 $DIR/*
![Exclude Files in tar Archive](http://www.tecmint.com/wp-content/uploads/2014/10/Exclude-Files-in-Tar.png)
排除文件进行备份
**使用 tar 保持文件的原有权限进行恢复**
通过以下命令,你可以保留文件的权限将备份文件恢复到原始用户的家目录(本例是 user_restore
# tar xjf backupfile.tar.bz2 --directory user_restore --same-permissions
![Restore Files from tar Archive](http://www.tecmint.com/wp-content/uploads/2014/10/Restore-tar-Backup-Files.png)
从归档文件中恢复
**扩展阅读:**
- [18 tar Command Examples in Linux][1]
- [Dtrx An Intelligent Archive Tool for Linux][2]
### 通过 find 命令搜索文件 ###
find 命令用于递归搜索目录树中包含指定字符的文件和目录,然后在屏幕显示出于指定字符相匹配的文件和目录,或者在匹配项进行其他操作。
通常,我们通过文件名、文件的属主、属组、类型权限、日期及大小来搜索。
#### 基本语法:####
# find [需搜索的目录] [表达式]
**通过文件大小递归搜索文件**
以下命令会搜索当前目录(.)及其下两层子目录(-maxdepth 3包含当前目录及往下两层的子目录大于 2 MB-size +2M的所有文件-f
# find . -maxdepth 3 -type f -size +2M
![Find Files by Size in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Find-Files-Based-on-Size.png)
通过文件大小搜索文件
**搜索符合一定规则的文件并将其删除**
有时候777 权限的文件通常为外部攻击者打开便利之门。不管是以何种方式,让所有人都可以对文件进行任意操作都是不安全的。对此,我们采取一个相对激进的方法——删除这些文件(‘{ }’用来“聚集”搜索的结果)。
# find /home/user -perm 777 -exec rm '{}' +
![Find all 777 Permission Files](http://www.tecmint.com/wp-content/uploads/2014/10/Find-Files-with-777-Permission.png)
搜索 777 权限的文件
**按访问时间和修改时间搜索文件**
搜索 /etc 目录下访问时间(-atime或修改时间-mtime大于或小于 6 个月或者刚好 6 个月的配置文件。
按照下面例子对命令进行修改:
# find /etc -iname "*.conf" -mtime -180 -print
![Find Files by Modification Time](http://www.tecmint.com/wp-content/uploads/2014/10/Find-Modified-Files.png)
按修改时间搜索文件
- 扩展阅读: [35 Practical Examples of Linux find Command][3]
### 文件权限及基本属性 ###
ls -l 命令输出的前 10 位字符是文件的属性,其中第一个字符用来表明文件的类型。
- : 普通文件
- -d : 目录
- -l : 符号链接
- -c : 字符设备 (它将数据作为字节流处理如terminal)
- -b : 块设备 (在块设备中处理数据,如存储设备)
接下来表示文件属性的 9 位字符叫做文件的读写模式代表文件属主、同组用户和其他用户通常指的是“外部世界”对应的读r、写w和执行x权限。
文件的写权限允许对应的用户对文件进行打开和读写,对于同时设置了执行权限的目录,对应用户可以列举出该目录的内容。另外,文件的执行权限允许将文件当做是一个可执行程序来运行,而目录的执行权限则是允许用户进入和退出该目录。
文件的权限通过 chown 命令来更改,其基本语法如下:
# chmod [new_mode] file
new_mode 可以是 3 位八进制数值或者对应权限的表达式。
八进制数值可以从二进制数值进行等值转换,通过下列方法来计算文件属主、同组用户和其他用户权限对应的二进制数值:
一个确定权限的二进制数值表现为 2 的幂r=2^2w=2^1x=2^0当权限省缺时二进制数值为 0。如下
![Linux File Permissions](http://www.tecmint.com/wp-content/uploads/2014/10/File-Permissions.png)
文件权限
使用八进制数值设置上图的文件权限,请输入:
# chmod 744 myfile
通过 u、g 和 o 分别代表用户、同组用户和其他用户,然后你也可以使用权限表达式来单独对用户设置文件的权限模式。也可以通过 a 代表所有用户,然后设置文件权限。通过 + 号或者 - 号相应的赋予或移除文件权限。
**为所有用户撤销一个 shell 脚本的执行权限**
正如之前解释的那样,我们可以通过 - 号为需要移除权限的属主、同组用户、其他用户或者所有用户去掉指定的文件权限。下面命令中的短横线(-)可以理解为:移除(-所有用户a的 backup.sh 文件执行权限x
# chmod a-x backup.sh
下面演示为文件属主、同组用户赋予读、写和执行权限,并赋予其他用户读权限。
当我们使用 3 位八进制数值为文件设置权限的时候,第一位数字代表属主权限,第二位数字代表同组用户权限,第三位数字代表其他用户的权限:
- 属主:(r=2^2 + w=2^1 + x=2^0 = 7)
- 同组用户:(r=2^2 + w=2^1 + x=2^0 = 7)
- 其他用户:(r=2^2 + w=0 + x=0 = 4),
# chmod 774 myfile
随着练习时间的推移,你会知道何种情况下使用哪种方式来更改文件的权限模式的效果最好。
使用 ls -l 详细列举目录详细同样会显示出文件的属主和属组(这个很基本,而且影响到系统文件的访问控制)。
![Linux File Listing](http://www.tecmint.com/wp-content/uploads/2014/10/Linux-File-Listing.png)
列举 Linux 文件
通过 chown 命令可以对文件的归属权进行更改,可以同时或者分开更改属主和属组。其基本语法为:
# chown user:group file
至少要指定用户或者用户组
**举几个例子:**
将文件的属主更改为指定用户:
# chown gacanepa sent
同时将文件的属主和属组更改为指定的用户和组:
# chown gacanepa:gacanepa TestFile
只将文件的属组更改为指定组。注意组名前的冒号(:)。
# chown :gacanepa email_body.txt
### 结论 ###
作为一个系统管理员,你需要懂得如何创建和恢复备份、如何在系统中搜索文件并更改它们的属性。通过一些技巧,你可以更好地管理系统并避免以后出问题。
我希望,本文给出的技巧可以帮助你达成管理系统的目标。你可以随时在评论中发表自己的技巧及社区给你带来的益处。
先行感谢!
参考链接
- [About the LFCS][4]
- [Why get a Linux Foundation Certification?][5]
- [Register for the LFCS exam][6]
--------------------------------------------------------------------------------
via: http://www.tecmint.com/compress-files-and-finding-files-in-linux/
作者:[Gabriel Cánepa][a]
译者:[GHLandy](https://github.com/GHLandy)
校对:[校对者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/18-tar-command-examples-in-linux/
[2]:http://www.tecmint.com/dtrx-an-intelligent-archive-extraction-tar-zip-cpio-rpm-deb-rar-tool-for-linux/
[3]:http://www.tecmint.com/35-practical-examples-of-linux-find-command/
[4]:https://training.linuxfoundation.org/certification/LFCS
[5]:https://training.linuxfoundation.org/certification/why-certify-with-us
[6]:https://identity.linuxfoundation.org/user?destination=pid/1

View File

@ -0,0 +1,195 @@
GHLandy Translated
LFCS 系列第四讲:分区存储设备、格式化文件系统和配置交换分区
================================================================================
去年八月份Linux 基金会发起了 LFCSLinux Foundation Certified SysadminLinux 基金会认证系统管理员)认证,给所有系统管理员一个展现自己的机会。通过基础考试后,他们可以胜任在 Linux 上的整体运维工作:包括系统支持、一流水平的诊断和监控以及在必要之时向其他支持团队提交帮助请求等。
![Linux Foundation Certified Sysadmin Part 4](http://www.tecmint.com/wp-content/uploads/2014/10/lfcs-Part-4.png)
LFCS 系列第四讲
需要注意的是Linux 基金会认证是非常严格的,通过与否完全要看个人能力。通过在线链接,你可以随时随地参加 Linux 基金会认证考试。所以,你再也不用到考试中心了,只需要不断提高自己的专业技能和经验就可去参加考试了。
请看一下视频,这里将讲解 Linux 基金会认证程序。
youtube 视频
<iframe width="720" height="405" frameborder="0" allowfullscreen="allowfullscreen" src="//www.youtube.com/embed/Y29qZ71Kicg"></iframe>
本讲是《十套教程》系列中的第四讲。在本讲中,我们将涵盖分区存储设备、格式化文件系统和配置交换分区等内容,这些都是 LFCS 认证中的必备知识。
### 分区存储设备 ###
分区是一种将单独的硬盘分成一个或多个区的手段。一个分区只是硬盘的一部分,我们可以认为这部分是独立的磁盘,里边包含一个单一类型的文件系统。分区表则是将硬盘上这些分区与分区标识符联系起来的索引。
在 Linux 中IBM PC 兼容系统里边用于管理传统 MBR最新到2009年分区的工具是 fdisk。对于 GPT2010年至今分区我们使用 gdisk。这两个工具都可以通过程序名后面加上设备名称如 /dev/sdb进行调用。
#### 使用 fdisk 管理 MBR 分区 ####
我们先来介绍 fdisk
# fdisk /dev/sdb
然后出现提示说进行下一步操作。若不确定如何操作,按下 “m” 键显示帮助。
![fdisk Help Menu](http://www.tecmint.com/wp-content/uploads/2014/10/fdisk-help.png)
fdisk 帮助菜单
上图中,使用频率最高的选项已高亮显示。你可以随时按下 “p” 显示分区表。
![Check Partition Table in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Show-Partition-Table.png)
显示分区表
Id 列显示由 fdisk 分配给每个分区的分区类型(分区 id。一个分区类型代表一种文件系统的标识符简单来说包括该分区上数据的访问方法。
请注意,每个分区类型的全面都全面讲解将超出了本教程的范围——本系列教材主要专注于 LFCS 测试,因能力为主。
**下面列出一些 fdisk 常用选项:**
按下 “l”小写 L选项来显示所有可以由 fdisk 管理的分区类型。
按下 “d” 可以删除现有的分区。若硬盘上有多个分区fdisk 将询问你要删除那个分区。
键入对应的数字,并按下 “w” 保存更改(将更改写入分区表)。
在下图的命令中,我们将删除 /dev/sdb2然后显示p分区表来验证更改。
![fdisk Command Options](http://www.tecmint.com/wp-content/uploads/2014/10/fdisk-options.png)
fdisk 命令选项
按下 “n” 后接着按下 “p” 会创建新一个主分区。最后,你可以使用所有的默认值(这将占用所有的可用空间),或者像下面一样自定义分区大小。
![Create New Partition in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Create-New-Partition.png)
创建新分区
若 fdisk 分配的分区 Id 并不是我们想用的,可以按下 “t” 来更改。
![Change Partition Name in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Change-Partition-Name.png)
更改分区类型
全部设置好分区后,按下 “w” 将更改保存到硬盘分区表上。
![Save Partition Changes](http://www.tecmint.com/wp-content/uploads/2014/10/Save-Partition-Changes.png)
保存分区更改
#### 使用 gdisk 管理 GPT 分区 ####
下面的例子中,我们使用 /dev/sdb。
# gdisk /dev/sdb
必须注意的是gdisk 可以用于创建 MBR 和 GPT 两种分区表。
![Create GPT Partitions in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Create-GPT-Partitions.png)
创建 GPT 分区
使用 GPT 分区方案,我们可以在同一个硬盘上创建最多 128 个分区,单个分区最大以 PB 为单位,而 MBR 分区方案最大的只能 2TB。
注意fdisk 与 gdisk 中大多数命令都是一样的。因此,我们不会详细介绍这些命令选项,而是给出一张使用过程中的截图。
![gdisk Command Options](http://www.tecmint.com/wp-content/uploads/2014/10/gdisk-options.png)
gdisk 命令选项
### 格式化文件系统 ###
一旦创建完需要的分区,我们就必须为分区创建文件系统。查询你所用系统支持的文件系统,请运行:
# ls /sbin/mk*
![Check Filesystems Type in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Check-Filesystems.png)
检查文件系统类型
选择文件系统取决于你的需求。你应该考虑到每个文件系统的优缺点以及其特点。选择文件系统需要看的两个重要属性:
- 日志支持,允许从系统崩溃事件中快速恢复数据。
- 安全增强式 LinuxSELinux支持按照项目 wiki 所说,“安全增强式 Linux 允许用户和管理员更好的把握访问控制权限”。
在接下来的例子中,我们通过 mkfs 在 /dev/sdb1上创建 ext4 文件系统(支持日志和 SELinux标卷为 Tecmint。mkfs 基本语法如下:
# mkfs -t [filesystem] -L [label] device
或者
# mkfs.[filesystem] -L [label] device
![Create ext4 Filesystems in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Create-ext4-Filesystems.png)
创建 ext4 文件系统
### 创建并启用交换分区 ###
要让 Linux 系统访问虚拟内存则必须有一个交换分区当内存RAM用完的时候将硬盘中指定分区即 Swap 分区当做内存来使用。因此当有足够的系统内存RAM来满足系统的所有的需求时我们并不需要划分交换分区。尽管如此是否使用交换分区取决于管理员。
下面列出选择交换分区大小的经验法则:
物理内存不高于 2GB 时,取两倍物理内存大小即可;物理内存在 2GB 以上时,取一倍物理内存大小即可;并且所取大小应该大于 32MB。
所以,如果:
M为物理内存大小S 为交换分区大小,单位 GB那么
若 M < 2
S = M *2
否则
S = M + 2
记住,这只是基本的经验。对于作为系统管理员的你,才是决定是否使用交换分区及其大小的关键。
要配置交换分区,首先要划分一个常规分区,大小像我们之前演示的那样来选取。然后添加以下条目到 /etc/fstab 文件中其中的X要更改为对应的 b 或 c
/dev/sdX1 swap swap sw 0 0
最后,格式化并启用交换分区:
# mkswap /dev/sdX1
# swapon -v /dev/sdX1
显示交换分区的快照:
# cat /proc/swaps
关闭交换分区:
# swapoff /dev/sdX1
下面的例子,我们会使用 fdisk 将 /dev/sdc1512MB系统和内存为 256MB来设置交换分区下面是我们之前详细提过的步骤。注意这种情况下我们使用的是指定大小分区。
![Create-Swap-Partition in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Create-Swap-Partition.png)
创建交换分区
![Add Swap Partition in Linux](http://www.tecmint.com/wp-content/uploads/2014/10/Enable-Swap-Partition.png)
启用交换分区
### 结论 ###
在你的系统管理员之路上,创建分区(包括交换分区)和格式化文件系统是非常重要的一部。我希望本文中所给出的技巧指导你到达你的管理员目标。随时在本讲评论区中发表你的技巧和想法,一起为社区做贡献。
参考链接
- [About the LFCS][1]
- [Why get a Linux Foundation Certification?][2]
- [Register for the LFCS exam][3]
--------------------------------------------------------------------------------
via: http://www.tecmint.com/create-partitions-and-filesystems-in-linux/
作者:[Gabriel Cánepa][a]
译者:[GHLandy](https://github.com/GHLandy)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://www.tecmint.com/author/gacanepa/
[1]:https://training.linuxfoundation.org/certification/LFCS
[2]:https://training.linuxfoundation.org/certification/why-certify-with-us
[3]:https://identity.linuxfoundation.org/user?destination=pid/1