merge
This commit is contained in:
nullpic 2013-10-28 15:35:03 +08:00
commit fd47e42930
15 changed files with 727 additions and 676 deletions

View File

@ -1,3 +1,5 @@
translating-----------------coolpigs
How to Install Ubuntu Touch 13.10 on Your Phone
================================================================================
**Ubuntu Touch 13.10 is a new operating system from Canonical aimed at phones, but it's not as easy installing it on your phone as it is on the desktop.**

View File

@ -1,292 +0,0 @@
coolpigs is translating this article
Installing a Desktop Algorithmic Trading Research Environment using Ubuntu Linux and Python
================================================================================
In this article I want to discuss how to set up a robust, efficient and interactive development environment for algorithmic trading strategy research making use of Ubuntu Desktop Linux and the Python programming language. We will utilise this environment for nearly all subsequent algorithmic trading articles.
To create the research environment we will install the following software tools, all of which are open-source and free to download:
- [Oracle VirtualBox][1] - For virtualisation of the operating system
- [Ubuntu Desktop Linux][2] - As our virtual operating system
- [Python][3] - The core programming environment
- [NumPy][4]/[SciPy][5] - For fast, efficient array/matrix calculation
- [IPython][6] - For visual interactive development with Python
- [matplotlib][7] - For graphical visualisation of data
- [pandas][8] - For data "wrangling" and time series analysis
- [scikit-learn][9] - For machine learning and artificial intelligence algorithms
These tools (coupled with a suitable [securities master database][10]) will allow us to create a rapid interactive strategy research environment. Pandas is designed for "data wrangling" and can import and cleanse time series data very efficiently. NumPy/SciPy running underneath keeps the system extremely well optimised. IPython/matplotlib (and the qtconsole described below) allow interactive visualisation of results and rapid iteration. scikit-learn allows us to apply machine learning techniques to our strategies to further enhance performance.
Note that I've written the tutorial so that Windows or Mac OSX users who are unwilling or unable to install Ubuntu Linux directly can still follow along by using VirtualBox. VirtualBox allows us to create a "Virtual Machine" inside the host system that can emulate a guest operating system without affecting the host in any way. This allows experimentation with Ubuntu and the Python tools before committing to a full installation. For those who already have Ubuntu Desktop installed, you can skip to the section on "Installing the Python Research Environment Packages on Ubuntu".
## Installing VirtualBox and Ubuntu Linux ##
This section of the tutorial regarding VirtualBox installation has been written for a Mac OSX system, but will easily translate to a Windows host environment. Once VirtualBox has been installed the procedure will be the same for any underlying host operating system.
Before we begin installing the software we need to go ahead and download both Ubuntu and VirtualBox.
**Downloading the Ubuntu Desktop disk image**
Open up your favourite web browser and navigate to the [Ubuntu Desktop][11] homepage then select Ubuntu 13.04:
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0004.png)
*Download Ubuntu 13.04 (64-bit if appropriate)*
You will be asked to contribute a donation although this is optional. Once you have reached the download page make sure to select Ubuntu 13.04. You'll need to choose whether you want the 32-bit or 64-bit version. It is likely you'll have a 64-bit system, but if you're in doubt, then choose 32-bit. On a Mac OSX system the Ubuntu Desktop ISO disk image will be stored in your Downloads directory. We will make use of it later once we have installed VirtualBox.
**Downloading and Installing VirtualBox**
Now that we've downloaded Ubuntu we need to go and obtain the latest version of Oracle's VirtualBox software. Click [here][12] to visit the website and select the version for your particular host (for the purposes of this tutorial we need Mac OSX):
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0002.png)
*Oracle VirtualBox download page*
Once the file has been downloaded we need to run it and click on the package icon (this will vary somewhat in Windows but will be a similar process):
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0007.png)
*Double-click the package icon to install VirtualBox*
Once the package has opened, we follow the installation instructions, keeping the defaults as they are (unless you feel the need to change them!). Now that VirtualBox has been installed we can open it from the Applications folder (which can be found with Finder). It puts VirtualBox on the icon dock while running, so you may wish to keep it there permanently if you want to examine Ubuntu Linux more closely in the future before committing to a full install:
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0008.png)
*VirtualBox with no disk images yet*
We are now going to create a new 'virtual box' (i.e. virtualised operating system) by clicking on the New icon, which looks like a cog. I've called mine "Ubuntu Desktop 13.04 Algorithmic Trading" (so you may wish to use something similarly descriptive!):
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0009.png)
*Naming our new virtual environment*
Choose the amount of RAM you wish to allocate to the virtual system. I've kept it at 512Mb since this is only a "test" system. A 'real' backtesting engine would likely use a native installation (and thus allocate significantly more memory) for efficiency reasons:
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0010.png)
*Choose the amount of RAM for the virtual disk*
Create a virtual hard drive and use the recommended 8Gb, with a VirtualBox Disk Image, dynamically allocated, with the same name as the VirtualBox Image above:
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0011.png)
*Choosing the type of hard disk used by the image*
You will now see a complete system with listed details:
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0012.png)
*The virtual image has been created*
We now need to tell VirtualBox to include a virtual 'CD drive' for the new disk image so that we can pretend to boot our new Ubuntu disk image from this CD drive. Head to the Settings section, click on the "Storage" tab and add a Disk. You will need to navigate to the Ubuntu Disk image ISO file stored in your Downloads directly (or wherever you downloaded Ubuntu to). Select it and then save the settings:
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0014.png)
*Choosing the Ubuntu Desktop ISO on first boot*
Now we are ready to boot up our Ubuntu image and get it installed. Click on "Start" and then on "OK" when you see the message about Host Capture of the Mouse/Keyboard. Note that on my Mac OSX, the host capture key is the Left Cmd key (i.e. Left Apple key). You will now be presented with the Ubuntu Desktop installation screen. Click on "Install Ubuntu":
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0015.png)
*Click on Install Ubuntu to get started*
Make sure to tick both boxes to install the proprietary MP3 and Wi-Fi drivers:
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0016.png)
*Install the proprietary drivers for MP3 and Wi-Fi*
You will now see a screen asking how you would like to store the data created for the operating system. Don't panic about the "Erase Disk and Install Ubuntu" option. It does NOT mean that it will erase your normal hard disk! It actually refers to the virtual disk it is using to run Ubuntu in, which is safe to erase (there isn't anything on there anyway, as we've just created it). Carry on with the install and you will be presented with a screen asking for your location and subsequently, your keyboard layout:
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0017.png)
*Select your geographical location*
Enter in your user credentials, making sure to remember your password as you'll need it later on for installing packages:
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0018.png)
*Enter your username and password (this password is the administrator password)*
Ubuntu will now install the files. It should be relatively quick as it is just copying from the hard disk to the hard disk! Eventually it will complete and the VirtualBox will restart. If it doesn't restart on its own, you can go to the menu and force a Shutdown. You will be brought back to the Ubuntu Login Screen:
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0019.png)
*The Ubuntu Desktop login screen*
Login with your username and password from above and you will see your shiny new Ubuntu desktop:
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0020.png)
*The Unity interface to the Ubuntu Desktop after logging in*
The last thing to do is click on the Firefox icon to test that the internet/networking functionality is correct by visiting a website (I picked QuantStart.com, funnily enough!):
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0021.png)
The Ubuntu Desktop login screen
Now that the Ubuntu Desktop is installed we can begin installing the algorithmic trading research environment packages.
## Installing the Python Research Environment Packages on Ubuntu ##
Click on the search button at the top-left of the screen and type "Terminal" into the box to bring up the command-line interface. Double-click the terminal icon to launch the Terminal:
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0022.png)
*The Ubuntu Desktop login screen*
All subsequent commands will need to be typed into this terminal.
The first thing to do on any brand new Ubuntu Linux system is to update and upgrade the packages. The former tells Ubuntu about new packages that are available, while the latter actually performs the process of replacing older packages with newer versions. Run the following commands (you will be prompted for your passwords):
sudo apt-get -y update
sudo apt-get -y upgrade
*Note that the -y prefix tells Ubuntu that you want to accept 'yes' to all yes/no questions. "sudo" is a Ubuntu/Debian Linux command that allows other commands to be executed with administrator privileges. Since we are installing our packages sitewide, we need 'root access' to the machine and thus must make use of 'sudo'.*
You may get an error message here:
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
To remedy it just run "sudo apt-get -y update" again or take a look at this site for additional commands to run in case the first does not work ([http://penreturns.rc.my/2012/02/could-not-get-lock-varlibaptlistslock.html][13]).
Once both of those updating commands have been successfully executed we now need to install Python, NumPy/SciPy, matplotlib, pandas, scikit-learn and IPython. We will start by installing the Python development packages and compilers needed to compile all of the software:
sudo apt-get install python-pip python-dev python2.7-dev build-essential liblapack-dev libblas-dev
Once the necessary packages are installed we can go ahead and install NumPy via pip, the Python package manager. Pip will download a zip file of the package and then compile it from the source code for us. Bear in mind that it will take some time to compile, probably 10-20 minutes!
sudo pip install numpy
Once NumPy has been installed we need to check that it works before proceeding. If you look in the terminal you'll see your username followed by your computer name. In my case it is `mhallsmoore@algobox`, which is followed by the prompt. At the prompt type `python` and then try importing NumPy. We will test that it works by calculating the mean average of a list:
mhallsmoore@algobox:~$ python
Python 2.7.4 (default, Sep 26 2013, 03:20:26)
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> from numpy import mean
>>> mean([1,2,3])
2.0
>>> exit()
Now that NumPy has been successfully installed we want to install the Python Scientific library known as SciPy. However it has a few package dependencies of its own including the ATLAS library and the GNU Fortran compiler:
sudo apt-get install libatlas-base-dev gfortran
We are ready to install SciPy now, with pip. This will take quite a long time (approx 20 minutes, depending upon your computer) so it might be worth going and grabbing a coffee:
sudo pip install scipy
Phew! SciPy has now been installed. Let's test it out by calculating the standard deviation of a list of integers:
mhallsmoore@algobox:~$ python
Python 2.7.4 (default, Sep 26 2013, 03:20:26)
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy
>>> from scipy import std
>>> std([1,2,3])
0.81649658092772603
>>> exit()
Next we need to install the dependency packages for matplotlib, the Python graphing library. Since matplotlib is a Python package, we cannot use pip to install the underlying libraries for working with PNGs, JPEGs and freetype fonts, so we need Ubuntu to install them for us:
sudo apt-get install libpng-dev libjpeg8-dev libfreetype6-dev
Now we can install matplotlib:
sudo pip install matplotlib
We're now going to install the data analysis and machine learning libraries pandas and scikit-learn. We don't need any additional dependencies at this stage as they're covered by NumPy and SciPy:
sudo pip install -U scikit-learn
sudo pip install pandas
We should test scikit-learn:
mhallsmoore@algobox:~$ python
Python 2.7.4 (default, Sep 26 2013, 03:20:26)
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from sklearn load datasets
>>> iris = datasets.load_iris()
>>> iris
..
..
'petal width (cm)']}
>>>
In addition, we should also test pandas:
>>> from pandas import DataFrame
>>> pd = DataFrame()
>>> pd
Empty DataFrame
Columns: []
Index: []
>>> exit()
Finally, we want to instal IPython. This is an interactive Python interpreter that provides a significantly more streamlined workflow compared to using the standard Python console. In later tutorials I will outline the full usefulness of IPython for algorithmic trading development:
sudo pip install ipython
While IPython is sufficiently useful on its own, it can be made even more powerful by including the qtconsole, which provides the ability to inline matplotlib visualisations. However, it takes a little bit more work to get this up and running.
First, we need to install the the [Qt library][14]. For this you may need to update your packages again (I did!):
sudo apt-get update
Now we can install Qt:
sudo apt-get install libqt4-core libqt4-gui libqt4-dev
The qtconsole has a few additional packages, namely the ZMQ and Pygments libraries:
sudo apt-get install libzmq-dev
sudo pip install pyzmq
sudo pip install pygments
Finally we are ready to launch IPython with the qtconsole:
ipython qtconsole --pylab=inline
Then we can make a (rather simple!) plot by typing the following commands (I've included the IPython numbered input/outut which you do not need to type):
In [1]: x=np.array([1,2,3])
In [2]: plot(x)
Out[2]: [<matplotlib.lines.Line2D at 0x392a1d0>]
This produces the following inline chart:
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0023.png)
*IPython with qtconsole displaying an inline chart*
That's it for the installation procedure. We now have an extremely robust, efficient and interactive algorithmic trading research environment at our fingertips. In subsequent articles I will be detailing how IPython, matplotlib, pandas and scikit-learn can be combined to successfully research and backtest quantitative trading strategies in a straightforward manner.
--------------------------------------------------------------------------------
via: http://quantstart.com/articles/Installing-a-Desktop-Algorithmic-Trading-Research-Environment-using-Ubuntu-Linux-and-Python
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
[1]:https://www.virtualbox.org/
[2]:http://www.ubuntu.com/desktop
[3]:http://python.org/
[4]:http://www.numpy.org/
[5]:http://www.scipy.org/
[6]:http://ipython.org/
[7]:http://matplotlib.org/
[8]:http://pandas.pydata.org/
[9]:http://scikit-learn.org/
[10]:http://quantstart.com/articles/Securities-Master-Database-with-MySQL-and-Python
[11]:http://www.ubuntu.com/desktop
[12]:https://www.virtualbox.org/
[13]:http://penreturns.rc.my/2012/02/could-not-get-lock-varlibaptlistslock.html
[14]:http://qt-project.org/downloads

View File

@ -1,136 +0,0 @@
Translating---------------geekpi
02 The Linux Kernel: The Source Code
================================================================================
After the kernel source code is downloaded and uncompressed, users will see many folders and files. It may be a challenge trying to find a particular file. Thankfully, the source code is sorted in a specific way. This enables developers to find any given file or part of the kernel.
The root of the kernel source code contains the folders listed below.
arch
block
crypto
Documentation
drivers
firmware
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
There are also some files that are located in the root of the source code. They are listed in the table below.
**COPYING** - Information about licensing and rights. The Linux kernel is licensed under the GPLv2 license. This license grants anyone the right to use, modify, distribute, and share the source code and compiled code for free. However, no one can sell the source code.
**CREDITS** - List of contributors
**Kbuild** - This is a script that sets up some settings for making the kernel. For example, this script sets up a ARCH variable where ARCH is the processor type that a developer wants the kernel to support.
**Kconfig** - This script is used when developer configure the kernel which will be discussed in a later article.
**MAINTAINERS** - This is a list of the current maintainers, their email addresses, website, and the specific file or part of the kernel that they specialize in developing and fixing. This is useful for when a developer finds a bug in the kernel and they wish to report the bug to the maintainer that can handle the issue.
**Makefile** - This script is the main file that is used to compile the kernel. This file passes parameters to the compiler as well as the list of files to compile and any other necessary information.
**README** - This text file provides information to developers that want to know how to compile the kernel.
**REPORTING-BUGS** - This text document provides information on reporting bugs.
The coding for the kernel will be in files with the extension ".c", or ".h". The “.c” extension indicates that the kernel is written in C, one of many programming languages. The “.h” files are Header files, and they are also written in C. The header files contain code that many of the “.c” files use. This saves programmers' time because they can use the contained code instead of writing new code. Otherwise, a group of code that performs the same action would be in many or all of the “.c” files. That would also consume and waste hard drive space.
All of the files in the above listed folders are well organized. The folder names help developers to at least have a good guess on the contents of the folders. A directory tree and descriptions are provided below.
**arch** - This folder contains a Kconfig which sets up some settings for compiling the source code that belongs in this folder. Each supported processor architecture is in the corresponding folder. So, the source code for Alpha processors belong in the alpha folder. Keep in mind that as time goes on, some new processors will be supported, or some may be dropped. For Linux Kernel v3.9.4, these are the folders under arch:
alpha
arc
arm
arm64
avr32
blackfin
c6x
cris
frv
h8300
hexagon
ia64
m32r
m68k
metag
microblaze
mips
mn10300
openrisc
parisc
powerpc
s390
score
sh
sparc
tile
um
unicore32
x86
xtensa
**block** This folder holds code for block-device drivers. Block devices are devices that accept and send data in blocks. Data blocks are chunks of data instead of a continual stream.
**crypto** - This folder contains the source code for many encryption algorithms. For example, “sha1_generic.c” is the file that contains the code for the sha1 encryption algorithm.
**Documentation** - This folder contains plain-text documents that provide information on the kernel and many of the files. If a developer needs information, they may be able to find the needed information in here.
**drivers** - This directory contains the code for the drivers. A driver is software that controls a piece of hardware. For example, for a computer to understand the keyboard and make it usable, a keyboard driver is needed. Many folders exist in this folder. Each folder is named after each piece or type of hardware. For example, the bluetooth folder holds the code for bluetooth drivers. Other obvious drivers are scsi, usb, and firewire. Some drivers may be more difficult to find. For instance, joystick drivers are not in a joystick folder. Instead, they are under ./drivers/input/joystick. Keyboard and mouse drivers are also located in the input folder. The Macintosh folder contains code for hardware made by Apple. The xen folder contains code for the Xen hypervisor. A hypervisor is software or hardware that allows users to run multiple operating systems on a single computer. This means that the xen code would allow users to have two or more Linux system running on one computer at the same time. Users could also run Windows, Solaris, FreeBSD, or some other operating system on the Linux system. There are many other folders under drivers, but they are too numerous to mention in this article, but they will in a later article.
**firmware** - The firmware folder contains code that allows the computer to read and understand signals from devices. For illustration, a webcam manages its own hardware, but the computer must understand the signals that the webcam is sending the computer. The Linux system will then use the vicam firmware to understand the webcam. Otherwise, without firmware, the Linux system does not know how to process the information that the webcam is sending. Also, the firmware helps the Linux system to send messages to the device. The Linux system could then tell the webcam to refocus or turnoff.
**fs** - This is the FileSystem folder. All of the code needed to understand and use filesystems is here. Inside this folder, each filesystem's code is in its own folder. For instance, the ext4 filesystem's code is in the ext4 folder. Within the fs folder, developers will see some files not in folders. These files handle filesystems overall. For example, mount.h would contain code for mounting filesystems. A filesystem is a structured way to store and manage files and directories on a storage device. Each filesystem has its own advantages and disadvantages. These are due to the programming of the filesystem. For illustration, the NTFS filesystem supports transparent compression (when enabled, files are automatically compressed without the user noticing). Most filesystems lack this feature, but they could only possess this ability if it is programmed into the files in the fs folder.
**include** - The include folder contains miscellaneous header files that the kernel uses. The name for the folder comes from the C command "include" that is used to import a header into C code upon compilation.
**init** - The init folder has code that deals with the startup of the kernel (INITiation). The main.c file is the core of the kernel. This is the main source code file the connects all of the other files.
**ipc** - IPC stands for Inter-Process Communication. This folder has the code that handles the communication layer between the kernel and processes. The kernel controls the hardware and programs can only ask the kernel to perform a task. Assume a user has a program that opens the DVD tray. The program does not open the tray directly. Instead, the program informs the kernel that the tray should be opened. Then, the kernel opens the tray by sending a signal to the hardware. This code also manages the kill signals. For illustration, when a system administrator opens a process manager to close a program that has locked-up, the signal to close the program is called a kill signal. The kernel receives the signal and then the kernel (depending on which type of kill signal) will ask the program to stop or the kernel will simply take the process out of the memory and CPU. Pipes used in the command-line are also used by the IPC. The pipes tell the kernel to place the output data on a physical page on in memory. The program or command receiving the data is given a pointer to the page on memory.
**kernel** - The code in this folder controls the kernel itself. For instance, if a debugger needed to trace an issue, the kernel would use code that originated from source files in this folder to inform the debugger of all of the actions that the kernel performs. There is also code here for keeping track of time. In the kernel folder is a directory titled "power". Some code in this folder provide the abilities for the computer to restart, power-off, and suspend.
**lib** - the library folder has the code for the kernel's library which is a set of files that that the kernel will need to reference.
**mm** - The Memory Management folder contains the code for managing the memory. Memory is not randomly placed on the RAM. Instead, the kernel places the data on the RAM carefully. The kernel does not overwrite any memory that is being used or that holds important data.
**net** - The network folder contains the code for network protocols. This includes code for IPv6 and Appletalk as well as protocols for Ethernet, wifi, bluetooth, etc. Also, the code for handling network bridges and DNS name resolution is in the net directory.
**samples** - This folder contains programming examples and modules that are being started. Assume a new module with a helpful feature is wanted, but no programmer has announced that they would work on the project. Well, these modules go here. This gives new kernel programmers a chance to help by going through this folder and picking a module they would like to help develop.
**scripts** - This folder has the scripts needed for compiling the kernel. It is best to not change anything in this folder. Otherwise, you may not be able to configure or make a kernel.
**security** - This folder has the code for the security of the kernel. It is important to protect the kernel from computer viruses and hackers. Otherwise, the Linux system can be damaged. Kernel security will be discussed in a later article.
**sound** - This directory has sound driver code for sound/audio cards.
**tools** - This directory contains tools that interact with the kernel.
**usr** - Remember the vmlinuz file and similar files mentioned in the previous article? The code in this folder creates those files after the kernel is compiled.
**virt** - This folder contains code for virtualization which allows users to run multiple operating systems at once. This is different from Xen (mentioned previously). With virtualization, the guest operating system is acting like any other application within the Linux operating system (host system). With a hypervisor like Xen, the two operating systems are managing the hardware together and the same time. In virtualization, the guest OS runs on top of the Linux kernel while in a hypervisor, there is no guest OS and all of the operating systems do not depend on each other.
Tip: Never move a file in the kernel source unless you know what you are doing. Otherwise, the compilation with fail due to a "missing" file.
The Linux kernel folder structure has remained relatively constant. The kernel developers have made some modifications, but overall, this setup is the same throughout all kernel versions. The driver folder's layout also remains about the same.
--------------------------------------------------------------------------------
via: http://www.linux.org/threads/the-linux-kernel-the-source-code.4204/
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -1,3 +1,5 @@
translating-------------------geekpi
03 The Linux Kernel: Drivers
================================================================================
Drivers are small programs that enable the kernel to communicate and handle hardware or protocols (rules and standards). Without a driver, the kernel does not know how to communicate with the hardware or handle protocols (the kernel actually hands the commands to the BIOS and the BIOS passes them on the the hardware). The Linux Kernel source code contains many drivers (in the form of source code) in the drivers folder. Each folder within the drivers folder will be explained. When configuring and compiling the kernel, it helps to understand the drivers. Otherwise, a user may add drivers to the kernel that they do not need or leave out important drivers. The driver source code usually includes a commented line that states the purpose of the driver. For example, the source code for the tc driver has a single commented line that says the driver is for TURBOchannel buses. Because of the documentation, users should be able to look at the first few commented lines of future drivers to learn their purpose.
@ -232,4 +234,4 @@ via: http://www.linux.org/threads/the-linux-kernel-drivers.4205/
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -1,42 +0,0 @@
翻译中 by小眼儿
Torvalds: SteamOS will "really help" Linux on desktop
================================================================================
Linus Torvalds has welcomed the arrival of Valves Linux-based platform, SteamOS, and said it could boost Linux on desktops.
The Linux creator praised Valve's "vision" and suggested its momentum would force other manufacturers to take Linux seriously - especially if game developers start to ditch Windows.
"I love the Steam announcements I think that's an opportunity to really help the desktop," he said, speaking at LinuxCon in Edinburgh.
Valve announced SteamOS last month as a way to bring PC gaming to the living room. Users will be able to install the system on PCs they build themselves, and Valve will make the system available to manufacturers to use on their own hardware.
> I love the Steam announcements I think that's an opportunity to really help the desktop
Should SteamOS gain traction among gamers and developers, that could force more hardware manufacturers to extend driver support beyond Windows.
That's a sore point for Torvalds, who [slammed Nvidia last][1] year for failing to support open-source driver development for its graphics chips. Now that SteamOS is on the way, Nvidia has opened up to the Linux community, something Torvalds predicts is a sign of things to come.
"Im not just saying itll help us get traction with the graphics guys," he said. "Itll also force different distributors to realise if this is how Steam is going, they need to do the same thing because they cant afford to be different in this respect. They want people to play games on their platform too."
"Its the best model for standardisation," he added. "I think good standards are people doing things, saying 'this is how we do it' and being successful enough to drive the market."
### Pretty login screens ###
Another reason Linux hasn't done well on desktop, according to Torvalds, is because developers focus on useless UX features.
"Linux is doing wonderfully well in so many different areas, but I still am somewhat disappointed about the fact that Linux desktop is this morass of in-fighting and people who do bad things," he said.
"I do hope the desktop people will try to work together, and work more on the technology than trying to make the login screen look really nice," he added.
Torvalds wouldn't mention specific companies, but has [previously championed Googles Chromebook Pixel][2], which runs on the Linux-based Chrome OS - describing other PCs as "crap" by comparison.
--------------------------------------------------------------------------------
via: http://www.pcpro.co.uk/news/384934/torvalds-steamos-will-really-help-linux-on-desktop
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://www.wired.com/wiredenterprise/2012/06/torvalds-nvidia-linux/
[2]:https://plus.google.com/+LinusTorvalds/posts/dk1aiW4JjHd

View File

@ -1,21 +0,0 @@
Ubuntu 14.04 LTS Named Trusty Tahr
================================================================================
![](http://www.omgubuntu.co.uk/wp-content/uploads/2013/10/Stuffed_Arabian_Tahr-750x5243.jpg)
**The tantalising trials of taxonomy are complete: the mascot for Ubuntu 14.04 LTS has been chosen get used to typing out the name Trusty Tahr.**
“*Whats a…tahr?*”, you ask? Google tells me its a goat-like mammal found in mountainous areas in Oman, India and the Himalayas.
The sure-footed animal reflects the goals for Ubuntu 14.04 LTS, which [Shuttleworth says][1], will see conservative choices made on the desktop as it focuses on delivering “*…performance, refinement, maintainability [and] technical debt.*”
Ubuntu 14.04 LTS for servers and desktops is pencilled in for release in April 2014.
--------------------------------------------------------------------------------
via: http://www.omgubuntu.co.uk/2013/10/ubuntu-14-04-lts-named-trusty-tahr
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://www.markshuttleworth.com/archives/1295

View File

@ -1,3 +1,4 @@
翻译中 Luox
di Disk Information Utility, Better Than df
================================================================================
If you are a Linux command line user, you would have definitely used the df command to check disk usage for file systems. Though df is a popular command but still it does not provide some advanced features like actual disk space that is available to a user, various useful display formats etc. There is another command line utility available that not only provides these advanced features but also all the features that df provides. In this article, we will discuss the disk information utility — **di**.
@ -261,4 +262,4 @@ via: http://mylinuxbook.com/di-a-disk-information-utility/
[1]:http://www.expertslogin.com/linux-command/linux-df-command/
[2]:http://www.manpagez.com/man/1/di/
[3]:http://www.gentoo.com/di/
[4]:http://freecode.com/projects/diskinfo
[4]:http://freecode.com/projects/diskinfo

View File

@ -1,134 +0,0 @@
(翻译中......)
gcp Advanced Command Line File Copier Inspired By cp
================================================================================
A few weeks back, we discussed [advanced copy][1] (modified cp command that shows progress bar). A reader dropped in a comment pointing out another utility that also provides basic cp command functionality but along with some advanced features. So, in this article, lets discuss the very same command line utility — **gcp**.
### gcp Advanced Command Line File Copier ###
gcp — as the manual suggests — is an advanced command line file copier that is inspired by the standard [cp command][2] but provides various advanced features like progress bar indicator, source lists, continuous copying even if there is a problematic file etc.
Here is a complete list of options :
![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-main.png)
### Testing Environment ###
- OS Ubuntu 13.04
- Shell Bash 4.2.45
- Application gcp 0.1.3
### A Brief Tutorial ###
Here are some of the examples of gcp command :
**1. Transfer Progress Indicator**
The gcp command provides transfer progress indicator so that the user is aware of the current status of the copying process.
Here is an example :
![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-1.png)
So you can see that the gcp command provides details like complete file size, percentage of copy complete, transfer rate and time left for the copy operation to complete.
**2. Copy Directories Recursively Through -r Option**
To copy complete directories recursively, use -r option.
Here is an example :
![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-2.png)
So you can see that the gcp command shows the transfer indicator taking in account the complete size of the folder.
**3. Elaborate Error Descriptions**
In case of any error, the gcp command displays descriptive error messages pinning down the individual culprit file.
Here is an example :
![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-3.png)
So you can see that the gcp command provided a detailed error message related to the file **August Rush.avi** that was already present inside the destination folder. But an error did not disrupt the copy of other file(s).
**4. Get Detailed Output Through -v Option**
The verbose option -v can be used to keep track of all the details that the gcp command is up to.
Here is an example :
![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-4.png)
So you can see that extended details were provided in output when -v option was used.
**5. Create And Use Sources List**
One of the shining features of the gcp command is that it lets you create a list of source files that you can use later.
For example, I saved the list of source file in the following copy operation using the option **sources-save**.
![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-5-1.png)
The list name in this case is **SOURCES_SAVE**. You can confirm the saved list through **sources-list** option.
![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-5-3.png)
So you can see that a list named **SOURCES_SAVE** is saved.
Now, I deleted the files that I copied in the first step :
![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-5-2.png)
and repeated the first step again but without mentioning the source file names. The option **sources-load** was use to load the source file names from the list **SOURCES_SAVE**.
![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-5-4.png)
So you can see that the gcp command picked up the source file names from the list **SOURCES_SAVE** and the copy process started normally.
Here are other options related to source file lists :
![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-5-5.png)
The gcp command provides various other useful options. For complete list of options, read the [man page of gcp][3].
### Download/Installation/Configuration ###
Here are some of the important links related to the gcp command :
- [Home Page][4]
- [Download Link][5]
- [Another useful gcp Tutorial][6]
You can alternatively download and install the gcp command through command line package managers like yum, apt-get etc. Ubuntu users can also use Ubuntu software centre to download and install this utility.
### Pros ###
- Status bar and source lists are the USP of this utility.
- Skips the problematic file(s) but the copy operation is not hampered.
- Usage is similar to that of the standard cp command.
### Cons ###
- While copying folders, it could be better if copy status of each file is displayed.
- Doesnt come pre-installed in most of the Linux distributions.
### Conclusion ###
If you are fed up of waiting blindly while copying large files through standard cp command the gcp is a good alternative. System administrators will love the source list feature. Its a must have utility.
**Have you ever used gcp or any other advanced cp-like command line utility? Share your experience with us.**
--------------------------------------------------------------------------------
via: http://mylinuxbook.com/gcp-advanced-command-line-file-copier-inspired-by-cp/
译者:[runningwater](https://github.com/runningwater) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://mylinuxbook.com/advanced-copy-cp-command/
[2]:http://www.cyberciti.biz/faq/cp-copy-command-in-unix-examples/
[3]:http://manpages.ubuntu.com/manpages/precise/en/man1/gcp.1.html
[4]:http://wiki.goffi.org/wiki/Gcp/en
[5]:http://wiki.goffi.org/wiki/Gcp/en
[6]:http://www.hecticgeek.com/2012/03/gcp-command-line-file-copy-ubuntu-linux/

View File

@ -0,0 +1,136 @@
02 Linux 内核: 源代码
================================================================================
在下载并解压内核源代码后,用户可以看到许多文件夹和文件。尝试去找一个特定的文件或许是一个挑战。谢天谢地,源代码以一个特定的方式排序。这使开发者能够轻松找到任何文件或者内核的一部分
内核源代码的根目录下包含了以下文件夹
arch
block
crypto
Documentation
drivers
firmware
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
这里另外还有一些文件在源代码的根目录下。它们在下表中列出。
**COPYING** -许可和授权信息。Linux内核在GPLv2许可证下授权。该许可证授予任何人有权免费去使用、修改、分发和共享源代码和编译代码。然而,没有人可以出售源代码。
**CREDITS** - 贡献者列表
**Kbuild** - 这是一个设置一些内核设定的脚本。打个比方这个脚本设定一个ARCH变量ARCH是处理器的类型这是一个开发者想要内核支持的类型。
**Kconfig** - 这个脚本会在开发人员配置内核的时候用到,这会在以后的文章中讨论。
**MAINTAINERS** - 这是一个目前维护者列表,他们的电子邮件地址,主页,和特定的文件或者他们正在从事的开发和修复的内核的一部分。这对当一个开发者在内核中发现一个问题并希望能够报告这个问题给能够处理这个问题的维护者时是很有用的。
**Makefile** - This script is the main file that is used to compile the kernel. This file passes parameters to the compiler as well as the list of files to compile and any other necessary information.
这个脚本是编译内核主文件。这个文件将编译参数和编译所需的文件和必要的信息传给编译器
**README** - 这个文档提供给开发者想要知道的如何编译内核的信息。
**REPORTING-BUGS** - 这个文档提供如何报告问题的信息。
为内核的代码是以“.c”或“.h”为扩展名的文件。 “.c”的扩展名表明内核是用众多的编程语言之一C写的 “h”的文件是头文件而他们也是用C写成。头文件包含了许多“.c”文件需要使用的代码。因为他们可以使用已经存在的代码而不是编写新的代码,这节省了程序员的时间。否则一组执行相同的动作的代码将存在许多或全部都是“c”文件。这也会消耗和浪费硬盘空间。
所有上面列出的文件夹中的文件都有良好的组织。文件夹名称至少可以帮助开发人员很好地猜测文件夹中的内容。下面提供了一个目录树和描述。
**arch** - This folder contains a Kconfig which sets up some settings for compiling the source code that belongs in this folder. Each supported processor architecture is in the corresponding folder. So, the source code for Alpha processors belong in the alpha folder. Keep in mind that as time goes on, some new processors will be supported, or some may be dropped. For Linux Kernel v3.9.4, these are the folders under arch:
此文件夹包含了编译代码所需的一系列设定的Kconfig文件。每个支持的处理器架构都在它相应的文件夹中。所以Alpha处理器的源代码在alpha文件夹中。请记住随着时间的推移一些新的处理器将被支持,有些会被放弃。对于Linux v3.9.4arch下有以下文件夹
alpha
arc
arm
arm64
avr32
blackfin
c6x
cris
frv
h8300
hexagon
ia64
m32r
m68k
metag
microblaze
mips
mn10300
openrisc
parisc
powerpc
s390
score
sh
sparc
tile
um
unicore32
x86
xtensa
**block** 此文件夹包含块设备驱动程序的代码。块设备是以块接收和发送的数据的设备。数据块都是大块的数据而不是持续的数据流。
**crypto** - 这个文件夹包含许多加密算法的源代码。例如“sha1_generic.c”这个文件包含了SHA1加密算法的代码。
**Documentation** - 此文件夹包含了内核信息和其他许多文件信息的纯文本文档。如果开发者需要一些信息,他们可以在这里找到所需要的信息。
**drivers** - 该目录包含了驱动代码。驱动是一块控制硬件的软件。例如,要让计算机知道键盘并使其可用,键盘驱动器是必要的。这个文件夹中存在许多文件夹。每个文件夹都以硬件的种类或者型号命名。例如,'bluetooth'包含了蓝牙驱动程序的代码。还有其他明显驱动器像SCSIUSB和火线。有些驱动程序可能会比较难找到。例如操纵杆驱动不在'joystick'文件夹中。相反,它们在./drivers/input/joystick。同样键盘和鼠标驱动也在这个文件夹中。 'Macintosh'包含了苹果的硬件代码。 'Xen'包含了Xen hypervisor代码。hypervisor是一种允许用户在一台计算机上运行多个操作系统的软件或硬件。这意味着在Xen允许用户在一台计算机上同时运行的两个或两个以上的Linux系统。用户还可以运行WindowsSolarisFreeBSD或其他操作系统在Linux系统上。driver文件夹下还有许多其他的文件夹但他们在这篇文章中无法一一列举他们将在以后的文章中提到。
**firmware** - fireware中包含了让计算机读取和理解从设备发来的信号的代码。举例来说一个摄像头管理它自己的硬件但计算机必须了解摄像头给计算机发送的信号。Linux系统会使用vicam固件了解摄像头。否则没有了固件,Linux系统将不知道如何处理摄像头发来的信息。另外固件同样有助于将Linux系统发送消息给该设备。这样Linux系统可以告诉摄像头重新调整或关闭摄像头。
**fs** - 这是文件系统的文件夹。理解和使用的文件系统所需要的所有的代码就在这里。在这个文件夹里每种文件系统都有自己的文件夹。例如ext4文件系统的代码在ext4文件夹内。 在fs文件夹内开发者会看到一些不在文件夹中的文件。这些文件用来处理文件系统整体。例如mount.h中会包含挂载文件系统的代码。文件系统是以结构化的方式来存储和管理的存储设备上的文件和目录。每个文件系统都有自己的优点和缺点。这是由文件系统的编写决定的。举例来说NTFS文件系统支持的透明压缩当启用时会在用户没注意的情况下自动压缩文件。大多数文件系统缺乏此功能但如果在fs文件夹里编入相应的文件它们也有这种能力。
**include** - include包含了内核所需的各种头文件.这个名字来自于C语言用"incluide"来在编译时导入头文件.
**init** - init文件夹包含了内核启动处理代码(INITiation).main.c是内核的核心文件.这是用来链接其他文件的主要源代码文件.
**ipc** - IPC代表进程间通讯。此文件夹中的代码是作为内核与进程之间的通信层。内核控制着硬件因此程序只能请求内核来执行任务。假设用户有一个打开DVD托盘的程序。程序不直接打开托盘。相反该程序通知内核托盘应该被打开。然后内核给硬件发送一个信号去打开托盘。这些代码同样管理kill信号。举例来说当系统管理员打开进程管理器去关闭一个已经锁死的程序这个关闭程序的信号被称为kill信号。内核接收到信号然后会要求程序停止取决于kill的类型或内核直接把进程从内存和CPU中移除。命令行中的管道同样用于进程间通信 。管道会告诉内核在某个内存页上写入输出数据。程序或者命令得到的数据是来自内存页上的某个给定指针.
**kernel** - 这个文件夹中的代码控制内核本身。例如,如果一个调试器需要跟踪问题,内核将使用这个文件夹中代码来将内核指令通知调试器。这里还有踪时间的代码。内核文件夹下有个"power"文件夹 。这个文件夹中的代码可以使计算机重新启动,关机,挂起。
**lib** - 这个文件夹包含了内核需要引用的一系列内核库文件代码
**mm** - mm文件夹中包含了内存管理代码。内存并不是随机放置在RAM上 。相反内核小心地将数据放在RAM上。内核不会覆盖任何正在使用或保存重要数据的内存区域。
**net** - net文件夹中包含了网络协议代码。这包括IPv6,AppleTalk以太网 WiFi蓝牙等的代码此外处理网桥和DNS解析的代码也在net目录。
**samples** -此文件夹包含了程序示例和正在编写中的模块代码。假设一个新的模块引入了一个希望的功能,但没有程序员声明可以正常运行在内核上。那么,这些模块就会移到这里。这给了新内核程序员一个机会通过这个文件夹获得帮助并选择一个他们想要帮助开发的模块。
**scripts** -这个文件夹有内核编译所需的脚本。最好不要改变这个文件夹内的任何东西。否则,您可能无法配置或编译内核。
**security** - 这个文件夹是有关内核安全的代码。它对计算机免于受到病毒和黑客的侵害很重要。否则Linux系统可能会遭到损坏。关于内核的安全性将在以后的文章中讨论。
**sound** - 这个文件夹中包含了声卡驱动。
**tools** - 这个文件夹中包含了和内核交互的文件。
**usr** - 还记得在以前的文章中提到vmlinuz和其他类似的文件么这个文件夹中的代码在内核编译完成后创建这些文件。
**virt** -此文件夹包含了虚拟化代码,它允许用户一次运行多个操作系统。 这与先前提到的Xen是不同的。通过虚拟化客户机操作系统就像任何其他运行在Linux主机的应用程序一样运行。通过hypervisor(注:虚拟机管理程序)如Xen这两个操作系统同时管理硬件。在虚拟化中在客户机操作系统上运行在Linux内核上而在hypervisor中它没有客户系统并且所有的系统不互相依赖。
提示: 决不在内核源代码内动文件,除非你知道你在做什么。否则,编译会由于缺失文件失败。
Linux内核的文件夹结构保持相对稳定。内核开发者已经做了一些修改但总体来说这种设置对整个内核版本相同。驱动程序文件夹的布局也保持基本相同。
--------------------------------------------------------------------------------
via: http://www.linux.org/threads/the-linux-kernel-the-source-code.4204/
译者:[geekpi](https://github.com/geekpi) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -1,97 +1,134 @@
翻译 hello world
Install Apache With SSL in Ubuntu 13.10
Ubuntu 13.10 安装Apache和SSL
================================================================================
In this short tutorial let me show you how to install Apache with SSL support. My testbox details are given below:
### The System info ###
通过这个简短的教程,让我来给你展示如何安装Apache与SSL的支持.以下是我的试验机的详细说明:
### 系统信息 ###
root@ubuntu-unixmen:~# ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:b8:b4:87
inet addr:10.1.1.110 Bcast:10.1.1.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:feb8:b487/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1738 errors:0 dropped:0 overruns:0 frame:0
TX packets:69 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:168845 (168.8 KB) TX bytes:9767 (9.7 KB)
----------
root@ubuntu-unixmen:~# cat /etc/issue
Ubuntu 13.10 \n \l
### 安装apache ###
### Install apache ###
sudo apt-get install apache2 apache2-doc apache2-utils
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
apache2-bin apache2-data libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap ssl-cert
### Test apache page ###
Open up the browser and navigate to http://ip-address/. You should see something like this.
### apache测试页面 ###
打开浏览器,转到http://ip-address/.你应该会看到类似以下的信息.
![](http://180016988.r.cdn77.net/wp-content/uploads/2013/10/apache2-ubuntu.png)
### Create diretory ###
Create a directory called **ssl**.
### 创建目录 ###
创建一个名为**ssl**的目录
sudo mkdir /etc/apache2/ssl
### Create a self-signed certificate ###
### 创建一个自签名凭证 ###
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt
Generating a 2048 bit RSA private key.......................................................................................+++....................................+++writing new private key to '/etc/apache2/ssl/apache.key'-----You are about to be asked to enter information that will be incorporatedinto your certificate request.What you are about to enter is what is called a Distinguished Name or a DN.There are quite a few fields but you can leave some blankFor some fields there will be a default value,If you enter '.', the field will be left blank.-----Country Name (2 letter code) [AU]:
### Activate Apache SSL module ###
Run the following command to enable ssl mode.
### 开启Apache SSL模块 ###
运行以下命令开启ssl模块
$ a2enmod ssl
Considering dependency setenvif for ssl:
Module setenvif already enabled
Considering dependency mime for ssl:
Module mime already enabled
Considering dependency socache_shmcb for ssl:
Enabling module socache_shmcb.
Enabling module ssl
Edit **/etc/apache2/sites-enabled/default-ssl.conf** fie,
编辑 **/etc/apache2/sites-enabled/default-ssl.conf** 文件,
&lt;VirtualHost 10.1.1.110:443&gt;
ServerAdmin webmaster@localhost
ServerName www.unixmen.com:443
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key
### Activate Apache default ssl virtual host: ###
### 启动Apache缺省ssl的虚拟主机: ###
a2ensite default-ssl
Enabling site default-ssl.
To activate the new configuration, you need to run:
service apache2 reload
### Restart Apache: ###
### 重启Apache: ###
sudo service apache2 restart
### Test SSL Connection ###
Open browser and navigate **to https://IP-address**.
###测试SSL连接###
打开浏览器,转到**https://IP-address**.
![](http://180016988.r.cdn77.net/wp-content/uploads/2013/10/apache-cert.png)
完成了.再见!
Youre done. Cheers!
"完成了.再见!"
--------------------------------------------------------------------------------
via: http://www.unixmen.com/install-apache-ssl-ubuntu-13-10/
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
译者:[Luoxcat](https://github.com/Luoxcat) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -0,0 +1,301 @@
在Ubuntu下用Python搭建桌面算法交易研究环境
================================================================================
这篇文章将讨论在ubuntu下,使用Python编程语言,来搭建一个强大,高效和易交互的算法交易策略研究环境.几乎所有的后续的算法交易文章都将利用此环境.
搭建此环境需要安装以下软件,它们都是开源的或免费下载的:
- [Oracle VirtualBox][1] - 虚拟机
- [Ubuntu Desktop Linux][2] - 作为我们的虚拟操作系统
- [Python][3] - 核心编程环境
- [NumPy][4]/[SciPy][5] - 快速、高效的数组和矩阵运算
- [IPython][6] - Python的可视化交互环境
- [matplotlib][7] - 图形化的虚拟数据
- [pandas][8] - 数据“冲突”和时间序列分析
- [scikit-learn][9] - 机器学习和人工智能算法
这些工具(配合合适的 [证券master数据库][10]将使我们能够创建一个快速可交互的策略研究环境。Pandas是专为数据“冲突”设计的它可以高效地导入和清洗时间序列数据。NumPy/SciPy在底层运行使得系统被很好的优化。IPython/matplotlib (和qtconsole详见下文)使结果可视化可交互并快速迭代。scikit-learn可让我们将机器学习技术应用到我们的策略中以进一步提高性能。
请注意我写这篇教程是为了那些无法或不愿意直接安装ubuntu系统的windows或Mac OSX用户通过VirtualBox来搭建此环境。VirtualBox使我们可在host操作系统中创建一个虚拟机可模拟guest操作系统而丝毫不影响host操作系统。由此我们可以在完整安装Ubuntu前练习Ubuntu和Python工具。如果已经安装Ubuntu桌面系统可跳过“在Ubuntu下安装Python研究环境包”这一节。
##安装VirtualBoX和Ubuntu##
Mac OSX操作系统上关于VirtualBox安装的部分已经写过了这里将简单的移到Windows环境中。一旦各种host操作系统下的VirtualBox安装完毕其它过程就都一样了。
开始安装前我们需要先下载Ubuntu和VirtualBox。
**下载Ubuntu桌面磁盘镜像**
打开收藏夹,导航到[Ubuntu 桌面][11]主页然后选择Ubuntu 13.04
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0004.png)
*下载Ubuntu13.0464位如适用*
你会被问及是否愿意捐赠一些money不过这个是可选的。进入下载页面后选择Ubuntu 13.04。你需要选择是否要下载32位或64位版本。很可能你是64位系统但如果你有疑问那么选择32位。在Mac OSX系统上Ubuntu桌面ISO磁盘镜像将保存到下载目录下。安装VirtualBox后我们就要用到它了。
**下载和安装VirtualBox**
现在我们已经下载了Ubuntu 接下来需要去获取最新版本的Oracle的VirtualBox软件。点击[这里][12]访问该网站选择你的特定主机的版本本教程要求Mac OSX版本
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0002.png)
*Oracle VirtualBox下载页面*
一旦文件下载完毕我们点击安装包图标运行Windows上会有些不同但是类似
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0007.png)
*双击安装包图标安装VirtualBox*
打开后按照安装说明操作保持默认除非你觉得有必要修改他们。VirtualBox安装完毕后可从Applications文件夹中打开可通过Finder搜索到。VirtualBox运行过程中它的图标将出现在Dock栏里,如果你以后想经常以虚拟机方式使用Ubuntu,你可以将VirtualBox图标永久保存在Dock栏中:
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0008.png)
*还没有磁盘镜像的VirtualBox*
点击类似齿轮的图标,创建一个新的虚拟盒子(也就是虚拟机),命名为"Ubuntu Desktop 13.04 Algorithmic Trading"(你可以使用别的类似的描述):
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0009.png)
*命名我们的新虚拟环境*
分配虚拟机内存.因为是测试系统,所以我只分配了512Mb.一个实际的回溯引擎因为效率原因需要一个本地安装(这样才能明显分配到更多内存):
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0010.png)
*选择虚拟磁盘的RAM量*
创建虚拟硬盘,大小为推荐的8Gb,动态生成VirtualBox磁盘镜像,名字同上:
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0011.png)
*选择镜像所使用的硬盘类型*
You will now see a complete system with listed details:
完整系统的详细信息如下:
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0012.png)
*已经创建的虚拟镜像*
现在我们需要在VirtualBox中为新的磁盘镜像包含一个虚拟的'CD驱动器',这样就可以假装从这张光盘驱动器引导我们的Ubuntu磁盘镜像。在Settings里点击“Storage”选项卡并添加一个磁盘。选择Downloads目录下的Ubuntu磁盘镜像ISO文件或者其他你下载Ubuntu的目录选择Ubuntu ISO镜像并保存设置。
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0014.png)
*在第一次启动时选择Ubuntu桌面ISO*
一切就绪准备启动Ubuntu镜像并安装。点击“Start”当出现主机捕获鼠标或键盘消息时点击“Ok”。在我的Mac OSX系统中主机捕获键是左边的Cmd键即左Apple键。现在出现在你眼前的就是Ubuntu桌面安装界面点击“Install Ubuntu”
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0015.png)
*点击 "Install Ubuntu "开始安装*
确保勾选两个框安装专有的MP3和Wi-Fi驱动程序
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0016.png)
*安装MP3和Wi-Fi的专用驱动程序*
现在您将看到一个界面询问你想如何保存操作系统创建过程中的的数据。不要惊慌于“Erase Disk and Install Ubuntu”的选项。这并不意味着它会删除你的普通硬盘它实际上指的是运行Ubuntu的虚拟磁盘这是安全擦除反正里面没有什么内容因为是我们刚刚创建的。继续进行安装将出现询问位置的界面随后又将出现选择键盘布局的界面
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0017.png)
*选择您所在的地理位置*
输入您的用户凭据,请务必记住您的密码,以后安装软件包的时候需要它:
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0018.png)
*输入您的用户名和密码(此密码是管理员密码)*
现在, Ubuntu将安装文件。它应该是比较快的因为它是从硬盘复制到硬盘完成后VirtualBox将重启。如果不自行重启你可以去菜单强制关机。接下来将回到Ubuntu的登录界面
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0019.png)
*Ubuntu桌面登录界面*
用您的用户名和密码登录你将看到闪亮的新的Ubuntu桌面
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0020.png)
*Ubuntu桌面登录后的整体界面*
最后需要做的事是点击火狐图标通过访问一个网站我选择QuantStart.com有意思吧来测试互联网/网络功能是正确的:
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0021.png)
*Ubuntu中的火狐浏览器原文此处为"The Ubuntu Desktop login screen"*
现在Ubuntu桌面已经安装完毕接下来我们就可以开始安装的算法交易研究环境软件包。
## Installing the Python Research Environment Packages on Ubuntu ## 在Ubuntu上安装Python研究环境软件包
点击左上角的搜索按钮在输入框里输入“Terminal”弹出命令行界面。双击终端图标启动终端
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0022.png)
**Ubuntu中的终端界面原文此处为"Ubuntu Desktop login screen"*
所有后续的命令都在此终端输入。
任何崭新的Ubuntu Linux系统上做的第一件事就是更新和升级软件包。前者告诉Ubuntu可用的新软件包有哪些后者用新版的软件包替换旧版的。运行下列命令你将被提示输入您的密码
sudo apt-get -y update
sudo apt-get -y upgrade
*-y前缀告诉Ubuntu接受所有回答“是/否”的问题为'是'。 “sudo”是一个Ubuntu/Debian Linux的命令允许以管理员权限执行其他命令。由于我们将在站点范围安装软件包我们需要机器的root权限因此必须使用'sudo'*
你可能会在这里得到一个错误消息:
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
为了解决这个问题,你只需再次运行"sudo apt-get -y update"或者万一第一种方式不起作用,你可以在该站点([http://penreturns.rc.my/2012/02/could-not-get-lock-varlibaptlistslock.html][13])上查看是否有其他的命令。
一旦这些更新命令成功执行接下来我们需要安装PythonNumPy/SciPymatplotlibpandasscikit-learn和IPython。我们将开始安装Python开发包和编译器编译器将在编译所有软件的时候用到
sudo apt-get install python-pip python-dev python2.7-dev build-essential liblapack-dev libblas-dev
一旦安装必要的软件包我们就可以通过pip即Python包管理器安装NumPy的。pip将下载NumPy的zip包然后从源代码编译。请记住编译需要花费一些时间大概10-20分钟
sudo pip install numpy
NumPy安装完了后,我们需要在继续之前检查它是否可用。如果你仔细看终端,你会发现计算机名后面跟了你的用户名。比如我的是`mhallsmoore@algobox`,随后是提示符。在提示符下键入`python`然后试着导入NumPy。我们将计算一个列表的平均值,以测试NumPy是否可用:
mhallsmoore@algobox:~$ python
Python 2.7.4 (default, Sep 26 2013, 03:20:26)
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> from numpy import mean
>>> mean([1,2,3])
2.0
>>> exit()
现在我们已成功安装NumPy接下来要安装Python的科学库,即SciPy。然而它有一些依赖的软件包包括ATLAS库和GNU Fortran编译器
sudo apt-get install libatlas-base-dev gfortran
现在,我们将通过pip安装SciPy.这将需要相当长的时间约20分钟这取决于你的电脑所以也许你可以去喝杯咖啡先
sudo pip install scipy
现在已安装SciPy。让我们通过计算一个整数列表的标准差来测试SciPy是否可以正常使用
mhallsmoore@algobox:~$ python
Python 2.7.4 (default, Sep 26 2013, 03:20:26)
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy
>>> from scipy import std
>>> std([1,2,3])
0.81649658092772603
>>> exit()
接下来我们需要安装matplotlib的依赖包Python的图形库。 由于matplotlib是一个Python包无法使用pip去安装以下PNGJPEG文件和FreeType字体库相关的库所以我们需要Ubuntu为我们安装
sudo apt-get install libpng-dev libjpeg8-dev libfreetype6-dev
现在我们可以安装matplotlib了:
sudo pip install matplotlib
我们将安装数据分析和机器学习库,pandas和scikit-learn.这步不需要安装额外的依赖库, 因为NumPy和SciPy已经将依赖都覆盖了.
sudo pip install -U scikit-learn
sudo pip install pandas
我需要测试scikit-learn:
mhallsmoore@algobox:~$ python
Python 2.7.4 (default, Sep 26 2013, 03:20:26)
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from sklearn load datasets
>>> iris = datasets.load_iris()
>>> iris
..
..
'petal width (cm)']}
>>>
另外,我们需要测试pandas:
>>> from pandas import DataFrame
>>> pd = DataFrame()
>>> pd
Empty DataFrame
Columns: []
Index: []
>>> exit()
最后, 我们需要安装IPython.这是一个交互式的Python解释器它提供了一个更精简的工作流相比标准的Python控制台。在以后的教程中我将讲述IPython在算法交易开发中的充分的用处
sudo pip install ipython
虽然IPython本身已经相当有用但它通过包含qtconsole可以有更强大的能力,qtconsole提供了内联matplotlib可视化的能力。尽管如此它需要多一点点的工作以使它启动和运行。
首先,我们需要安装[Qt库][14]。对于这一点,你可能需要更新你的软件包(我做了!):
sudo apt-get update
现在我们可以安装Qt了:
sudo apt-get install libqt4-core libqt4-gui libqt4-dev
qtconsole有一些附加的包,即ZMQ和Pygments库:
sudo apt-get install libzmq-dev
sudo pip install pyzmq
sudo pip install pygments
最后我们准备启动带有qtconsole的IPython:
ipython qtconsole --pylab=inline
然后我们可以做一个图(非常简单的!), 键入下列命令我已经包含了IPython编号的输入/输出,你不需要再输入):
In [1]: x=np.array([1,2,3])
In [2]: plot(x)
Out[2]: [<matplotlib.lines.Line2D at 0x392a1d0>]
这将产生以下内嵌图表:
![](https://s3.amazonaws.com/quantstart/media/images/qs-python-ubuntu-install-0023.png)
*带有qtconsole的IPython显示一幅内嵌的图表*
这就是它的安装过程。现在我们手头就有一个非常强大的高效和互动的算法交易的科研环境。我会在后续的文章中详细介绍如何结合IPython,matplotlib,pandas和scikit-learn,以一种直观的方式, 成功地研究和回溯测试量化交易策略。
--------------------------------------------------------------------------------
来源于: http://quantstart.com/articles/Installing-a-Desktop-Algorithmic-Trading-Research-Environment-using-Ubuntu-Linux-and-Python
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
译者:[coolpigs](https://github.com/coolpigs) 校对:[校对者ID](https://github.com/校对者ID)
[1]:https://www.virtualbox.org/
[2]:http://www.ubuntu.com/desktop
[3]:http://python.org/
[4]:http://www.numpy.org/
[5]:http://www.scipy.org/
[6]:http://ipython.org/
[7]:http://matplotlib.org/
[8]:http://pandas.pydata.org/
[9]:http://scikit-learn.org/
[10]:http://quantstart.com/articles/Securities-Master-Database-with-MySQL-and-Python
[11]:http://www.ubuntu.com/desktop
[12]:https://www.virtualbox.org/
[13]:http://penreturns.rc.my/2012/02/could-not-get-lock-varlibaptlistslock.html
[14]:http://qt-project.org/downloads

View File

@ -1,5 +1,6 @@
Linus Torvalds吐槽Fedora项目连呼数个Stupid
================================================================================
==========================================
**Linus Torvalds 在Google+上发布了一个非常简单直接的关于Fedora的信息紧接着就引发了一系列谴责和各式吐槽。**
![](http://i1-news.softpedia-static.com/images/news2/Linus-Torvalds-Smashes-the-Fedora-Project-Calls-Them-Stupid-393127-2.jpg)
@ -10,13 +11,13 @@ Linus Torvalds说“为什么你们从来不更新安装镜像呢难道有
问题是这样的,如果你有一台新笔记本,却配了一个老内核,你可能无法完全发挥笔记本的功能,特别是当老内核无法识别无线模块的时候。
也许更新至新内核是个解决办法,但是为了获取新内核,你得访问互联网,但这是不可能的,因为刚不是说了你的老内核无法识别无线硬件模块吗?于是,如此反复,一个悲剧的圈诞生了。当然如果刚好你的名字叫Linus Torvalds这个问题就很好解决了因为你知道如何不通过互联网而是靠自己来编译内核。
也许更新至新内核是个解决办法,但是为了获取新内核,你得访问互联网,但这是不可能的,因为刚不是说了你的老内核无法识别无线硬件模块吗?于是,如此反复,一个悲剧的圈诞生了。当然如果刚好你的名字叫Linus Torvalds这个问题就很好解决了因为你知道如何不通过互联网而是靠自己来编译内核。
消息发布没多久,一些红帽开发者开始试图解释说,他们负担不起雇人测试的开销,因此无法发布有可能无法工作的镜像。
Torvalds说“现在你们说我们没法测试镜像要我说你们这是[敷衍],因为现有的旧镜像本来就有问题,所以号称新的镜像有可能出问题,完全是很愚蠢(stupid)的难道不是吗”说完这些Linus还不停嘴
Torvalds说“现在你们说我们没法测试镜像要我说你们这是[敷衍],因为现有的旧镜像本来就有问题,所以号称新的镜像有可能出问题,完全是很愚蠢(stupid)的难道不是吗”说完这些Linus还不停嘴
他继续说道:“因此,你们所有的说辞都是愚蠢(stupid)的敷衍你们要做的就是更新Fedora19到Fedora19.x告知人们它将持续更新然后停止为本就有问题的镜像寻找愚蠢(stupid)的借口,因为你们压根就没打算测试新镜像是否有问题。”
他继续说道:“因此,你们所有的说辞都是愚蠢(stupid)的敷衍你们要做的就是更新Fedora19到Fedora19.x告知人们它将持续更新然后停止为本就有问题的镜像寻找愚蠢(stupid)的借口,因为你们压根就没打算测试新镜像是否有问题。”
争论双方仍在持续发布新的消息看起来不远的将来我们就能够看到Fedora的镜像更新了。能翻墙的小伙伴们可以到Linus Torvalds的[Google+页面][1]去围观一下凑个热闹。
@ -24,7 +25,7 @@ Torvalds说“现在你们说我们没法测试镜像要我说你们
via: http://news.softpedia.com/news/Linus-Torvalds-Smashes-the-Fedora-Project-Calls-Them-Stupid-393127.shtml
译者:[Mr小眼儿](https://blog.csdn.net/tinyeyeser) 校对:[校对者ID](https://github.com/校对者ID)
译者:[Mr小眼儿](https://blog.csdn.net/tinyeyeser) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -0,0 +1,41 @@
TorvaldsSteamOS将“真正帮助”Linux桌面系统实现逆袭
================================================================================
Linus Torvalds非常欢迎Valve公司的SteamOS系统入驻Linux平台表示它将大力推动Linux桌面系统的发展。
Linux之父大力赞扬Valve的“独到眼光”表示这一合作将迫使其他生产商开始认真重视Linux特别是游戏开发商们将开始摒弃Windows。
他在上周三爱丁堡举行的LinuxCon大会上说道“我爱Steam —— 我认为这是一个能真正帮助Linux桌面系统的大好机会
Valve上个月发布了关于SteamOS的声明表示这将是一种把PC游戏带入起居室的新体验。用户可以在自己任意的PC电脑上安装SteamOS而Valve将在另一端负责SteamOS匹配各个生产商的硬件系统。
> 我爱Steam —— 我认为这是一个能真正帮助Linux桌面系统的大好机会
硬件生产商们也将大力扩展对Windows以外系统的驱动程序支持而SteamOS将以此获得更多游戏玩家和开发商的青睐。
说到这一点就涉及到了Torvalds的痛处。去年Nvidia宣布放弃支持开源系统图形芯片的驱动开发他对此进行了[猛烈抨击][1]。如今SteamOS选择了LinuxNvidia的大门重新对Linux社区敞开Torvalds预言这预示着新的发展机会即将到来。
他说“我并不是说它单单只是帮助我们吸引显卡厂商的注意它还迫使Linux的各个发行版意识到Steam是一个发展趋势他们必须抓住这个趋势因为一旦落下被孤立发行版们是负担不起的他们都想让人们在自己的平台上运行这套系统玩游戏。”
“这就是‘标准化’的最佳例证,”他说,“我认为好的标准能使人们事半功倍、信心满满,足以推动整个市场的发展。”
###漂亮的登录窗口###
Torvalds表示Linux在桌面系统领域一直表现不佳的另一个原因是开发者们总是专注于毫无用处的用户体验特效UX features
“Linux始终在各个领域表现都非常出色但我还是对Linux桌面系统的现状多少有些失望内耗、不干正事、一团糟。”
他还补充道“我真心希望Linux的各个桌面系统能携起手来更多专注于技术而不是总想着如何让登陆窗口看起来更漂亮。”
Torvalds并没有提到某个具体的公司但之前[他曾对Google的Chromebook Pixel大加赞赏][2]认为跟基于Linux的Chrome OS比起来其他PC就是一坨“crap”(译者注这个单词读shi第三声)。
--------------------------------------------------------------------------------
via: http://www.pcpro.co.uk/news/384934/torvalds-steamos-will-really-help-linux-on-desktop
译者:[Mr小眼儿](http://blog.csdn.net/tinyeyeser) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://www.wired.com/wiredenterprise/2012/06/torvalds-nvidia-linux/
[2]:https://plus.google.com/+LinusTorvalds/posts/dk1aiW4JjHd

View File

@ -0,0 +1,21 @@
Ubuntu 14.04 LTS命名为“可靠的塔尔羊Trusty Tahr
================================================================================
![](http://www.omgubuntu.co.uk/wp-content/uploads/2013/10/Stuffed_Arabian_Tahr-750x5243.jpg)
**妙趣横生的名称评选已经结束Ubuntu 14.04 LTS的吉祥物最终敲定 —— “可靠的塔尔羊”(Trusty Tahr)。**
有人可能会问,“*塔尔羊是个什么……羊?*”万能的Google说它是一种类似山羊的哺乳动物分布于阿曼、印度以及喜马拉雅山脉地区。
Ubuntu创始人[Shuttleworth说][1]这样一种“脚踏实地”的动物恰恰反应出Ubuntu 14.04 LTS的目标构筑稳健的桌面环境正如Ubuntu一直以来专注的“*……性能、精益求精、易于维护以及技术至上。*”
Ubuntu 14.04 LTS服务器版和桌面版计划于2014年4月份发布。
--------------------------------------------------------------------------------
via: http://www.omgubuntu.co.uk/2013/10/ubuntu-14-04-lts-named-trusty-tahr
译者:[Mr小眼儿](http://blog.csdn.net/tinyeyeser) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://www.markshuttleworth.com/archives/1295

View File

@ -0,0 +1,134 @@
gcp 源于CP的高级命令行文件拷贝工具
================================================================================
几周前,我们讨论了[高级拷贝][1](修改于cp命令让其可以显示复制进度条)。一位读者在注释中指出其他实用工具不仅也提供了基本的cp命令功能而且还提供cp不具有的高级功能。所以这篇文章里我们将会讨论非常相似的命令行工具**gcp**。
### gcp 高级命令行文件拷贝器 ###
gcp — 根据操作手册介绍 — 是一款高级命令行文件拷贝工具软件,其灵感来自于标准的 [cp命令工具][2] 但它提供了像进度条显示、源文件列表、拷贝过程中出现错误文件不中断继续拷贝等cp所不具有的各项高级功能。
下面是完整的选项列表:
![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-main.png)
### 测试环境###
- 操作系统 Ubuntu 13.04
- Shell工具 Bash 4.2.45
- 应用程序 gcp 0.1.3
### 简短的教程 ###
下面是一些gcp命令的例子
**1. 复制进度显示**
gcp命令提供了进度显示功能以便用户能监控到复制操作的时时状态。
下面是例子:
![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-1.png)
所以你可以看到gcp命令显示了如文件大小、复制完成的百分比、传输速率和复制操作完成的剩余时间等的所有细节。
**2. 使用-r选项递归的拷贝目录**
要递归拷贝完整的目录,可以使用-r选项。
下面是例子:
![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-2.png)
所以你可以看到gcp命令显示了用来统计所有文件夹大小的复制情况的进度条。
**3. 精心设计的错误描述显示**
任何情况的错误gcp命令都会把拷贝失败的文件的信息显示出来。
下面是例子:
![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-3.png)
所以你可以看到gcp命令列出了详细的错误消息即关于**August Rush.avi**文件已经在目标目录中存在,拷贝失败。但这个错误并不会影响其它文件的正常拷贝操作。
**4. 使用-v选项输出详细信息**
详细选项-v参数可以用来跟踪gcp命令执行时的所有详细消息。
下面是例子:
![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-4.png)
所以,你可以看到,使用-v选项可以输出很多细节信息。
**5. 创建和使用源列表**
gcp命令的一个很炫的功能就是可以创建源文件列表以供后期使用。
例如,在下面的拷贝操作中,我使用**-sources-save**选项来保存一个源文件列表。
![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-5-1.png)
这例子的列表名叫做**SOURCES_SAVE**。你可以用**sources-list**选项参数来确认及查看保存的列表。
![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-5-3.png)
那么你可以看到列表名**SOURCES_SAVE**已经保存上了。
现在,删除我们在第一步中拷贝的文件:
![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-5-2.png)
重复第一步的操作,但不要加上源文件路径名,使用**sources-load**选项参数来从**SOURCES_SAVE**列表文件中加载源文件路径名。
![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-5-4.png)
所以你可以看到gcp命令从**SOURCES_SAVE**列表文件中读取源文件路径名,并且正常的执行拷贝操作。
下面是关于源文件列表的其它选项参数:
![](http://mylinuxbook.com/wp-content/uploads/2013/10/gcp-5-5.png)
gcp命令还提供了各式名样的其它有用选项。要查看完整的选项请阅读[gcp帮助主页][3]。
### Download/Installation/Configuration ###
下面是关于gcp命令的一些主要链接站点
- [主页][4]
- [下载链接][5]
- [另一篇很有用的gcp使用教程][6]
你可以通过使用像yum、apt-get等的命令行包管理工具来下载和安装gcp命令。Ubuntu用户也可以使用Ubuntu软件中心来下载和安装这个工具。
### 优点 ###
- 状态条显示和源文件列表是这个工具的核心。
- 出现有问题的文件会直接跳过,不会影响正常文件的复制操作。
- 跟标准的cp命令的用法很相似。
### 不足 ###
- 在复制文件夹的时候,要是能显示每个文件的复制状态,那就更好了。
- 在大多数Linux发行版本中没有预先安装。
### 结论 ###
如果你厌倦了通过标准cp命令拷贝大量文件而无休止的等待的话gcp命令是个不错的选择。系统管理员会喜欢上源文件列表的功能的。它是必备工具。
**你曾经使用过gcp或者类cp的命令行工具吗可以把你的使用心得跟我们分享。**
--------------------------------------------------------------------------------
via: http://mylinuxbook.com/gcp-advanced-command-line-file-copier-inspired-by-cp/
译者:[runningwater](https://github.com/runningwater) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://mylinuxbook.com/advanced-copy-cp-command/
[2]:http://www.cyberciti.biz/faq/cp-copy-command-in-unix-examples/
[3]:http://manpages.ubuntu.com/manpages/precise/en/man1/gcp.1.html
[4]:http://wiki.goffi.org/wiki/Gcp/en
[5]:http://wiki.goffi.org/wiki/Gcp/en
[6]:http://www.hecticgeek.com/2012/03/gcp-command-line-file-copy-ubuntu-linux/