Merge pull request #2 from LCTT/master

更新2014年12月29日
This commit is contained in:
H-mudcup 2014-12-29 08:07:38 +08:00
commit 3923955df0
11 changed files with 430 additions and 425 deletions

View File

@ -1,146 +0,0 @@
(translating by runningwater)
How To Create A Bootable Ubuntu USB Drive For Mac In OS X
================================================================================
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/11/Create_bootable_Ubuntu_USB_Mac_OS_X.jpg)
I bought a Macbook Air yesterday after Dell lost my laptop from their service centre last month. And among the first few things I did was to dual boot Mac OS X with Ubuntu Linux. Ill cover up Linux installation on Macbook in later articles as first we need to learn **how to create a bootable Ubuntu USB drive for Mac in OS X**.
While it is fairly easy to create a bootable USB in Ubuntu or in Windows, it is not the same story in Mac OS X. This is why the official Ubuntu guide suggest to use a disk rather than USB for live Ubuntu in Mac. Considering my Macbook Air neither has a CD drive nor do I possess a DVD, I preferred to create a live USB in Mac OS X.
### Create a Bootable Ubuntu USB Drive in Mac OS X ###
As I said earlier, creating a bootable USB in Mac OS X is a tricky procedure, be it for Ubuntu or any other bootable OS. But dont worry, following all the steps carefully will have you going. Lets see what you need to for a bootable USB:
#### Step 1: Format the USB drive ####
Apple is known for defining its own standards and no surprises that Mac OS X has its own file system type known as Mac OS Extended or [HFS Plus][1]. So the first thing you would need to do is to format your USB drive in Mac OS Extended format.
To format the USB drive, plug in the USB key. Go to **Disk Utility** program from Launchpad (A rocket symboled icon in the bottom plank).
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/11/Disk_Utility_Mac.jpg)
- In Disk Utility, from the left hand pane, select the USB drive to format.
- Click the **Partition** tab in the right side pane.
- From the drop-down menu, select **1 Partition**.
- Name this drive anything you desire.
- Next, change the **Format to Mac OS Extended (Journaled)**
The screenshot below should help you.
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/11/Format_Usb_Mac_4.jpg)
There is one last thing to do before we go with formatting the USB. Click the Options button in the right side pane and make sure that the partition scheme is **GUID Partition Table**.
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/11/Format_Usb_Mac_2.jpg)
When all is set to go, just hit the **Apply** button. It will give you a warning message about formatting the USB drive. Of course hit the Partition button to format the USB drive.
#### Step 2: Download Ubuntu ####
Of course, you need to download ISO image of Ubuntu desktop. Jump to [Ubuntu website to download your favorite Ubuntu desktop OS][2]. Since you are using a Macbook Air, I suggest you to download the 64 Bit version of whichever version you want. Ubuntu 14.04 is the latest LTS version, and this is what I would recommend to you.
#### Step 3: Convert ISO to IMG ####
The file you downloaded is in ISO format but we need it to be in IMG format. This can be easily done using [hdiutil][3] command tool. Open a terminal, either from Launchpad or from the Spotlight, and then use the following command to convert the ISO to IMG format:
hdiutil convert -format UDRW -o ~/Path-to-IMG-file ~/Path-to-ISO-file
Normally the downloaded file should be in ~/Downloads directory. So for me, the command is like this:
hdiutil convert -format UDRW -o ~/Downloads/ubuntu-14.10-desktop-amd64 ~/Downloads/ubuntu-14.10-desktop-amd64.iso
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/11/ISO_to_IMG_Convert_Mac_OS_X.jpeg)
You might notice that I did not put a IMG extension to the newly converted file. It is fine as the extension is symbolic and it is the file type that matters not the file name extension. Also, the converted file may have an additional .dmg extension added to it by Mac OS X. Dont worry, its normal.
#### Step 4: Get the device number for USB drive ####
The next thing is to get the device number for the USB drive. Run the following command in terminal:
diskutil list
It will list all the disks currently available in the system. You should be able to identify the USB disk by its size. To avoid confusion, I would suggest that you should have just one USB drive plugged in. In my case, the device number is 2 (for a USB of size 8 GB): /dev/disk2
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/11/Create_bootable_USB_Mac_OSX.jpeg)
When you got the disk number, run the following command:
diskutil unmountDisk /dev/diskN
Where N is the device number for the USB you got previously. So, in my case, the above command becomes:
diskutil unmountDisk /dev/disk2
The result should be: **Unmount of all volumes on disk2 was successful**.
#### Step 5: Creating the bootable USB drive of Ubuntu in Mac OS X ####
And finally we come to the final step of creating the bootable USB drive. We shall be using [dd command][4] which is a very powerful and must be used with caution. Therefore, do remember the correct device number of your USB drive or else you might end up corrupting Mac OS X. Use the following command in terminal:
sudo dd if=/Path-to-IMG-DMG-file of=/dev/rdiskN bs=1m
Here, we are using dd (copy and convert) to copy and convert input file (if) IMG to diskN. I hope you remember where you put the converted IMG file, in step 3. For me the command was like this:
sudo dd if=~/Downloads/ubuntu-14.10-desktop-amd64.dmg of=/dev/rdisk2 bs=1m
As we are running the above command with super user privileges (sudo), it will require you to enter the password. Similar to Linux, you wont see any asterisks or something to indicate that you have entered some keyboard input, but thats the way Unix terminal behaves.
Even after you enter the password, **you wont see any immediate output and thats norma**l. It will take a few minutes for the process to complete.
#### Step 6: Complete the bootable USB drive process ####
Once the dd command finishes its process, you may see a dialogue box saying: **The disk you inserted was not readable by this computer**.
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/11/Bootable_USB_3.png)
Dont panic. Everything is just fine. Just **dont click either of Initialize, Ignore or Eject just now**. Go back to the terminal. Youll see some information about the last completed process. For me it was:
> 1109+1 records in
> 1109+1 records out
> 1162936320 bytes transferred in 77.611025 secs (14984164 bytes/sec)
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/11/Create_bootable_USB_Mac_OSX_1.jpeg)
Now, in the terminal use the following command to eject our USB disk:
diskutil eject /dev/diskN
N is of course the device number we have used previously which is 2 in my case:
diskutil eject /dev/disk2
Once ejected, click on **Ignore** in the dialogue box that appeared previously. Now your bootable USB disk is ready. Remove it from the system.
#### Step 7: Checking your newly created bootable USB disk ####
Once you have completed the mammoth task of creating a live USB of USB in Mac OS X, it is time to test your efforts.
- Plugin the bootable USB and reboot the system.
- At start up when the Apple tune starts up, press and hold option (or alt) key.
- This should present you with the available disks to boot in to. I presume you know what to do next.
For me it showed tow EFI boot:
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/11/Ubuntu_boot_USB_Mac_OSX_1.jpeg)
I selected the first one and it took me straight to Grub screen:
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/11/Ubuntu_boot_USB_Mac_OSX.jpeg)
I hope this guide helped you to create a bootable USB disk of Ubuntu for Mac in OS X. Well see how to dual boot Ubuntu with OS X in next article. Stay tuned.
--------------------------------------------------------------------------------
via: http://itsfoss.com/create-bootable-ubuntu-usb-drive-mac-os/
作者:[Abhishek][a]
译者:[runningwater](https://github.com/runningwater)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://itsfoss.com/author/Abhishek/
[1]:http://en.wikipedia.org/wiki/HFS_Plus
[2]:http://www.ubuntu.com/download/desktop
[3]:https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/hdiutil.1.html
[4]:http://en.wikipedia.org/wiki/Dd_%28Unix%29

View File

@ -1,75 +0,0 @@
Linux FAQs with Answers--How to check SSH protocol version on Linux
================================================================================
> **Question**: I am aware that there exist SSH protocol version 1 and 2 (SSH1 and SSH2). What is the difference between SSH1 and SSH2, and how can I check which SSH protocol version is supported on a Linux server?
Secure Shell (SSH) is a network protocol that enables remote login or remote command execution between two hosts over a cryptographically secure communication channel. SSH was designed to replace insecure clear-text protocols such as telnet, rsh or rlogin. SSH provides a number of desirable features such as authentication, encryption, data integrity, authorization, and forwarding/tunneling.
### SSH1 vs. SSH2 ###
The SSH protocol specification has a number of minor version differences, but there are two major versions of the protocol: **SSH1** (SSH version 1.XX) and **SSH2** (SSH version 2.00).
In fact, SSH1 and SSH2 are two entirely different protocols with no compatibility in between. SSH2 is a significantly improved version of SSH1 in many respects. First of all, while SSH1 is a monolithic design where several different functions (e.g., authentication, transport, connection) are packed into a single protocol, SSH2 is a layered architecture designed with extensibility and flexibility in mind. In terms of security, SSH2 comes with a number of stronger security features than SSH1, such as MAC-based integrity check, flexible session re-keying, fully-negotiable cryptographic algorithms, public-key certificates, etc.
SSH2 is standardized by IETF, and as such its implementation is widely deployed and accepted in the industry. Due to SSH2's popularity and cryptographic superiority over SSH1, many products are dropping support for SSH1. As of this writing, OpenSSH still [supports][1] both SSH1 and SSH2, while on all modern Linux distributions, OpenSSH server comes with SSH1 disabled by default.
### Check Supported SSH Protocol Version ###
#### Method One ####
If you want to check what SSH protocol version(s) are supported by a local OpenSSH server, you can refer to **/etc/ssh/sshd_config** file. Open /etc/ssh/sshd_config with a text editor, and look for "Protocol" field.
If it shows the following, it means that OpenSSH server supports SSH2 only.
Protocol 2
If it displays the following instead, OpenSSH server supports both SSH1 and SSH2.
Protocol 1,2
#### Method Two ####
If you cannot access /etc/ssh/sshd_config because OpenSSH server is running on a remote server, you can test its SSH protocol support by using SSH client program called ssh. More specifically, we force ssh to use a specific SSH protocol, and see how the remote SSH server responds.
The following command will force ssh command to use SSH1:
$ ssh -1 user@remote_server
The following command will force ssh command to use SSH2:
$ ssh -2 user@remote_server
If the remote SSH server supports SSH2 only, the first command with "-1" option will fails with an error message like this:
Protocol major versions differ: 1 vs. 2
If the SSH server supports both SSH1 and SSH2, both commands should work successfully.
### Method Three ###
Another method to check supported SSH protocol version of a remote SSH server is to run an SSH scanning tool called [scanssh][2]. This command-line tool is useful when you want to check SSH protocol versions for a bulk of IP addresses or the entire local network to upgrade SSH1-capable SSH servers.
Here is the basic syntax of scanssh for SSH version scanning.
$ sudo scanssh -s ssh -n [ports] [IP addresses or CIDR prefix]
The "-n" option can specify the SSH port number(s) to scan. You can specify multiple port numbers separated by comma. Without this option, scanssh will scan port 22 by default.
Use the following command to discover SSH servers on 192.168.1.0/24 local nework, and detect their SSH protocol versions:
$ sudo scan -s ssh 192.168.1.0/24
![](https://farm8.staticflickr.com/7550/15460750074_95f83217a2_b.jpg)
If scanssh reports "SSH-1.XX-XXXX" for a particular IP address, it implies that the minimum SSH protocol version supported by the corresponding SSH server is SSH1. If the remote server supports SSH2 only, scanssh will show "SSH-2.0-XXXX".
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/check-ssh-protocol-version-linux.html
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://www.openssh.com/specs.html
[2]:http://www.monkey.org/~provos/scanssh/

View File

@ -1,3 +1,4 @@
(translating by runningwater)
Linux FAQs with Answers--How to install 7zip on Linux
================================================================================
> **Question**: I need to extract files from an ISO image, and for that I want to use 7zip program. How can I install 7zip on [insert your Linux distro]?
@ -66,7 +67,7 @@ To test the integrity of an archive:
via:http://ask.xmodulo.com/install-7zip-linux.html
译者:[译者ID](https://github.com/译者ID)
译者:[runningwater](https://github.com/runningwater)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -1,74 +0,0 @@
Linux FAQs with Answers--How to install kernel headers on Linux
================================================================================
> **Question**: I need to install kernel headers to install a device driver for my kernel. What is a proper way to install matching kernel headers on [insert your Linux distro]?
When you compile a device driver a custom kernel module, you need to have kernel header files installed on your Linux system. Kernel headers are needed also when you build a userspace application which links directly against the kernel. When you install kernel headers in such cases, you must make sure to kernel headers are exactly matched with the kernel version of your system (e.g., 3.13.0-24-generic).
If your kernel is the default version that comes with the distribution, or you upgraded it using the default package manager (e.g., apt-get, aptitude or yum) from base repositories, you can install matching kernel headers using the package manager as well. On the other hand, if you downloaded the [kernel source][1] and compiled it manually, you can install matching kernel headers by using [make command][2].
Here we assume that your kernel comes from base repositories of your Linux distribution, and see how we can install matching kernel headers.
### Install Kernel Headers on Debian, Ubuntu or Linux Mint ###
Assuming that you did not manually compile the kernel, you can install matching kernel headers using apt-get command.
First, check if matching kernel headers are already available on your system using dpkg-query command.
$ dpkg-query -s linux-headers-$(uname -r)
----------
dpkg-query: package 'linux-headers-3.11.0-26-generic' is not installed and no information is available
Go ahead and install matching kernel headers as follows.
$ sudo apt-get install linux-headers-$(uname -r)
![](https://farm9.staticflickr.com/8681/16000652415_a7c399992e_z.jpg)
Verify that matching kernel headers are successfully installed.
$ dpkg-query -s linux-headers-$(uname -r)
----------
Package: linux-headers-3.11.0-26-generic
Status: install ok installed
The default location of kernel headers on Debian, Ubuntu or Linux Mint is **/usr/src**.
### Install Kernel Headers on Fedora, CentOS or RHEL ###
If you did not manually upgrade the kernel, you can install matching kernel headers using yum command.
First, check if matching kernel headers are already installed on your system. If the following command does not produce any output, it means kernel headers are not available.
$ rpm -qa | grep kernel-headers-$(uname -r)
Go ahead and install kernel headers with yum command. This command will automatically find a package of matching kernel headers, and install it.
$ sudo yum install kernel-headers
![](https://farm9.staticflickr.com/8594/15378403114_c51ff6f4ae_z.jpg)
Verify the status of the installed package.
$ rpm -qa | grep kernel-headers-$(uname -r)
----------
kernel-headers-3.10.0-123.9.3.el7.x86_64
The default location of kernel headers on Fedora, CentOS or RHEL is **/usr/include/linux**.
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/install-kernel-headers-linux.html
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:https://www.kernel.org/pub/linux/kernel/
[2]:https://www.kernel.org/doc/Documentation/kbuild/headers_install.txt

View File

@ -1,47 +0,0 @@
Linux FAQs with Answers--How to install non-free packages on Debian
================================================================================
> **Question**: I need to install some proprietary device driver on Debian, which is part of a non-free package. However, I cannot find and install the package in my Debian box. How can I install non-free packages on Debian?
The Debian project is distributed as a collection of packages, [48,000][1] of them, as of Debian Wheezy. These packages are categorized into three areas: main, contrib and non-free, mainly based on licensing requirements, e.g., [Debian Free Software Guidelines][2] (DFSG).
The main area contains free software that complies with DFSG. The contrib area contains free software that complies with DFSG, but relies on non-free software for compilation or execution. Finally, the non-free area contains non-free packages that are not compliant with DFSG but redistributable. The main repository is considered a part of Debian, but neither contrib or non-free repository is. The latter two are maintained and provided only as a convenience to users.
If you want to install a non-free package maintained by Debian, you need to enable contrib and non-free repositories. To do so, open /etc/apt/sources.list with a text editor, and append "contrib non-free" to each source.
The following is an example of /etc/apt/sources.list for Debian Wheezy.
deb http://ftp.us.debian.org/debian/ wheezy main contrib non-free
deb-src http://ftp.us.debian.org/debian/ wheezy main contrib non-free
deb http://security.debian.org/ wheezy/updates main contrib non-free
deb-src http://security.debian.org/ wheezy/updates main contrib non-free
# wheezy-updates, previously known as 'volatile'
deb http://ftp.us.debian.org/debian/ wheezy-updates main contrib non-free
deb-src http://ftp.us.debian.org/debian/ wheezy-updates main contrib non-free
![](https://farm8.staticflickr.com/7562/16063758036_0ef8fce075_b.jpg)
After modifying sources of packages, run the following command to download package index files for contrib and non-free repositories.
$ sudo apt-get update
If you are using aptitude, run the following instead.
$ sudo aptitude update
Now you are ready to search and install any non-free package on Debian.
![](https://farm9.staticflickr.com/8593/16089610915_b638fce55d_c.jpg)
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/install-nonfree-packages-debian.html
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:https://packages.debian.org/stable/allpackages?format=txt.gz
[2]:https://www.debian.org/social_contract.html#guidelines

View File

@ -1,82 +0,0 @@
Linux FAQs with Answers--How to rename multiple files on Linux
================================================================================
> **Question**: I know I can rename a file using mv command. But what if I want to change the name of many files? It will be tedius to invoke mv command for every such file. Is there a more convenient way to rename multiple files at once?
In Linux, when you want to change a file name, mv command gets the job done. However, mv cannot rename multiple files using wildcard. There are ways to deal with multiple files by using a combination of sed, awk or find in conjunction with [xargs][1]. However, these CLIs are rather cumbersome and not user-friendly, and can be error-prone if you are not careful. You don't want to undo incorrect name change for 1,000 files.
When it comes to renaming multiple files, the rename utility is probably the easiest, the safest, and the most powerful command-line tool. The rename command is actually a Perl script, and comes pre-installed on all modern Linux distributions.
Here is the basic syntax of rename command.
rename [-v -n -f] <pcre> <files>
<pcre> is a Perl-compatible regular expression (PCRE) which represents file(s) to rename and how. This regular expression is in the form of 's/old-name/new-name/'.
The '-v' option shows the details of file name changes (e.g., XXX renamed as YYY).
The '-n' option tells rename to show how the files would be renamed without actually changing the names. This option is useful when you want to simulate filename change without touching files.
The '-f' option force overwriting existing files.
In the following, let's see several rename command examples.
### Change File Extensions ###
Suppose you have many image files with .jpeg extension. You want to change their file names to *.jpg. The following command converts *.jpeg files to *.jpg.
$ rename 's/\.jpeg$/\.jpg/' *.jpeg
### Convert Uppercase to Lowercase and Vice-Versa ###
In case you want to change text case in filenames, you can use the following commands.
To rename all files to lower-case:
# rename 'y/A-Z/a-z/' *
To rename all files to upper-case:
# rename 'y/a-z/A-Z/' *
![](https://farm9.staticflickr.com/8655/16054304245_bcf9d23b59_b.jpg)
### Change File Name Patterns ###
Now let's consider more complex regular expressions which involve subpatterns. In PCRE, a subpattern captured within round brackets can be referenced by a number preceded by a dollar sign (e.g., $1, $2).
For example, the following command will rename 'img_NNNN.jpeg' to 'dan_NNNN.jpg'.
# rename -v 's/img_(\d{4})\.jpeg$/dan_$1\.jpg/' *.jpeg
----------
img_5417.jpeg renamed as dan_5417.jpg
img_5418.jpeg renamed as dan_5418.jpg
img_5419.jpeg renamed as dan_5419.jpg
img_5420.jpeg renamed as dan_5420.jpg
img_5421.jpeg renamed as dan_5421.jpg
The next command will rename 'img_000NNNN.jpeg' to 'dan_NNNN.jpg'.
# rename -v 's/img_\d{3}(\d{4})\.jpeg$/dan_$1\.jpg/' *jpeg
----------
img_0005417.jpeg renamed as dan_5417.jpg
img_0005418.jpeg renamed as dan_5418.jpg
img_0005419.jpeg renamed as dan_5419.jpg
img_0005420.jpeg renamed as dan_5420.jpg
img_0005421.jpeg renamed as dan_5421.jpg
In both cases above, the subpattern '\d{4}' captures four consecutive digits. The captured four digits are then referred to as $1, and used as part of new filenames.
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/rename-multiple-files-linux.html
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://xmodulo.com/xargs-command-linux.html

View File

@ -0,0 +1,147 @@
在 Mac OS X 系统中创建可启动的 Ubuntu USB 驱动盘
================================================================================
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/11/Create_bootable_Ubuntu_USB_Mac_OS_X.jpg)
上个月,在戴尔的服务中心丢失我的笔记本后,我买了一台 Macbook Air 笔记本。买回来后我首先做的一些事就是给机器装上双系统,使 Ubuntu Linux 和 Mac OS X 都可用。随后的文章我会介绍如何在 Macbook 上安装 Linux ,刚开始我们需要学习 **如何在 Mac 的 OS X 系统中创建可启动的 Ubuntu USB 驱动盘**
在 Ubuntu 系统或 Windows 系统中创建可启动的 USB 是非常容易的,但在 Mac OS X 系统中就没这么简单了。这就是为什么 Ubuntu 的官方指南上,在 Mac 中安装 live Ubuntu 推荐使用磁盘安装而不是 USB 的原因。考虑到我的 Macbook Air 既没有 CD 驱动也没有 DVD 驱动,所以我更愿意在 Mac OS X 下创建一个 live USB.
### 在 Mac OS X 下创建可启动 USB 驱动盘###
如前所述,在 Mac OS X 上创建对于像 Ubuntu 或任何其它可引导的操作系统这样的可启动 USB 盘是个极其麻烦的过程。但请别担心,按照下面的步骤一步一步操作就行。让我们就开始创建一个可启动的 USB 盘的操作吧:
#### 步骤 1: 格式化 USB 驱动盘 ####
苹果是以它自定义的标准而闻名的,所以 Mac OS X 系统有自己的文件系统类型就好不奇怪了,它的文件系统叫做 Mac OS 扩展或 [HFS 插件][1]。因此,您需要做的第一件事就是用 Mac OS 扩展文件系统来格式化您的 USB 驱动盘。
要格式化 USB 盘,插入 USB 钥匙链。从 Launchpad在底部面板上的一个火箭形状的图标上前往**磁盘工具**应用程序。
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/11/Disk_Utility_Mac.jpg)
- 在磁盘工具中,从左手边的面板上选择 USB 驱动盘来格式化。
- 点击右边面板的**分区**标签。
- 从下拉菜单中,选择 **1 分区**
- 给这驱动盘起个您想要的名字。
- 接下来,切换来**格式化成 Mac OS 扩展 (日志型)**
下面的截屏将会对您有所帮助。
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/11/Format_Usb_Mac_4.jpg)
在我们开始真正格式化 USB 盘之前这是唯一一件要做的操作。点击在右边面板的选项按纽,要确保分区的模式是 **GUID 分区表**形式的。
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/11/Format_Usb_Mac_2.jpg)
当所有的都已经设置完了后,仅仅只需点击**应用**按纽。它会弹出一个要格式化 USB 驱动盘的警告消息,当然是要点击分区按纽来格式化 USB 驱动盘拉。
#### 步骤 2: 下载 Ubuntu ####
当然,您需要下载 Ubuntu 桌面版本的 ISO 镜像文件。链接到[ Ubuntu 官网去下载您喜欢的 Ubuntu 桌面版本系统][2]。因为您使用的是 Macbook Air我建议您下载 64 位版本中的一款。Ubuntu 14.04 是最新的 LTS 版本,我建议您们使用它。
#### 步骤 3: 把 ISO 格式转成 IMG 格式 ####
您下载的文件是 ISO 格式的,但我们需要它是 IMG 格式的,使用 [hdiutil][3] 命令工具就可以很容易的转换。打开终端,也可以从 Launchpad 或 Spotlight 中打开,然后使用如下的命令就可以把 ISO 格式的转换成 IMG 格式的了:
hdiutil convert -format UDRW -o ~/Path-to-IMG-file ~/Path-to-ISO-file
通常下载的文件会在 ~/Downloads 目录下。所以在我的系统来,输入的命令是:
hdiutil convert -format UDRW -o ~/Downloads/ubuntu-14.10-desktop-amd64 ~/Downloads/ubuntu-14.10-desktop-amd64.iso
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/11/ISO_to_IMG_Convert_Mac_OS_X.jpeg)
您可能已经注意到我并没有新转换出的文件加上 IMG 后缀。这是没问题的,因为后缀只是个标志,它代表的是文件类型并不是文件的扩展名。转换出来的文件可能会被 Mac OS X 系统自动加上个 .dmg 后缀。别担心,这是正常的。
#### 步骤 4: 获得 USB 驱动盘的设备号 ####
接下来的事情就是获得 USB 驱动盘的设备号。在终端中运行如下命令:
diskutil list
它会列出系统中当前可用的所有‘磁盘’信息。从它的大小上您应该能识别出此 USB 驱动盘。为了避免混淆,我建议您只插入一个 USB 盘。我的示例中,设置号是 2 (一个大小为 8G 的 USB: /dev/disk2
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/11/Create_bootable_USB_Mac_OSX.jpeg)
当得到设备号后,运行如下命令:
diskutil unmountDisk /dev/diskN
这儿的 N 就是前面您得到的 USB 的设备号。所以,我的示例中,上面的命令就变成:
diskutil unmountDisk /dev/disk2
执行结果应该是:**成功的卸载 disk2 上的所有卷**。
#### 步骤 5: 在 Mac OS X 中创建可启动的 USB 驱动盘####
终于我们只有创建可启动的 USB 盘这最后一步了。我们会使用 [dd 命令][4],它非常的强大,必须得小心使用。因此,一定要记得您 USB 驱动盘的正确设备号,要不然会使 Mac OS X 系统崩溃。在终端中使用如下命令:
sudo dd if=/Path-to-IMG-DMG-file of=/dev/rdiskN bs=1m
这儿我们使用 dd (拷贝和转换) 来把 IMG 输入文件 (if) 拷贝和转换到 磁盘 N 中。我希望您还记得在步骤 3 中已经生成的 IMG 文件的存放位置。对我的机器来说,命令如下所示:
sudo dd if=~/Downloads/ubuntu-14.10-desktop-amd64.dmg of=/dev/rdisk2 bs=1m
我们用超级用户权限sudo来运行上面的命令还需要您输入密码。跟 Linux 中类似,您从键盘中输入密码时,将看不到任何星号或显示的提示,不用担心,这是 Unix 终端的习惯。
甚至在您输入完密码后,**您都不会看到立即的输出,这是正常的**。需要一小会儿时间才会处理完成。
#### 步骤 6: 完成可启动 USB 驱动盘的整个处理过程 ####
一旦 DD 命令处理完成,会弹出一个对话框:**您插入的磁盘在这机器上不可读**。
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/11/Bootable_USB_3.png)
别惊慌,一切正常。只是**现在不要点击初始化、忽略或弹出按纽**。回到终端,您会看到最新处理完成的一些信息。我的机器中显示如下:
> 1109+1 records in
>
> 1109+1 records out
>
> 1162936320 bytes transferred in 77.611025 secs (14984164 bytes/sec)
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/11/Create_bootable_USB_Mac_OSX_1.jpeg)
现在,在终端中使用如下命令来弹出我们的 USB 驱动盘:
diskutil eject /dev/diskN
N 当然指的是我们前面使用过的设备号,在我的示例中是 2
diskutil eject /dev/disk2
一旦弹出,点击前面出现那对话框上的**忽略**按纽。现在您的可启动 USB 磁盘已经创建好了,把它从系统中移除。
#### 步骤 7: 检查您新创建的可启动 USB 盘 ####
一旦您在 Mac OS X 中完成了创建一个 live USB 这么重大的任务,是时候测试您的幸成果了。
- 插入可启动 USB 盘,重启系统。
- 在苹果启动的时候,一直按着 option (或 alt键。
- 这会引导您进入启动时需要访问的可使用磁盘界面。我假设您知道接下来的操作步骤。
对我机器来说它显示了两个 EFI 启动盘:
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/11/Ubuntu_boot_USB_Mac_OSX_1.jpeg)
我选择第一个,然后它就会直接进入 Grub 界面:
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/11/Ubuntu_boot_USB_Mac_OSX.jpeg)
我希望这篇教程对您想要在 Mac OS X 下创建可启动的 Ubuntu 系统 USB 驱动盘。在接下来的一篇文章中您会学到怎么样安装 OS X 和 Ubuntu 双系统。请继续关注。
--------------------------------------------------------------------------------
via: http://itsfoss.com/create-bootable-ubuntu-usb-drive-mac-os/
作者:[Abhishek][a]
译者:[runningwater](https://github.com/runningwater)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://itsfoss.com/author/Abhishek/
[1]:http://en.wikipedia.org/wiki/HFS_Plus
[2]:http://www.ubuntu.com/download/desktop
[3]:https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/hdiutil.1.html
[4]:http://en.wikipedia.org/wiki/Dd_%28Unix%29

View File

@ -0,0 +1,77 @@
Linux有问必答-- 如何在Linux上检查SSH的版本
================================================================================
> **Question**我想到SSH存在1和2两个版本SSH1和SSH2。这两者之间有什么不同还有我该怎么在Linux上检查SSH协议的版本
Secure Shell (SSH) is a network protocol that enables remote login or remote command execution between two hosts over a cryptographically secure communication channel. SSH was designed to replace insecure clear-text protocols such as telnet, rsh or rlogin. SSH provides a number of desirable features such as authentication, encryption, data integrity, authorization, and forwarding/tunneling.
安全ShellSSH通过加密的安全通信通道来远程登录或者远程执行命令。SSH被设计来替代不安全的明文协议如telnet、rsh和rlogin。SSH提供了大量需要的特性如认证、加密、数据完整性、授权和转发/通道。
### SSH1 vs. SSH2 ###
SSH协议规范存在一些小版本的差异但是有两个主要的大版本**SSH1** (版本号 1.XX) 和 **SSH2** (版本号 2.00)。
事实上SSH1和SSH2是两个完全不同互不兼容的协议。SSH2明显地提升了SSH1中的很多方面。首先SSH是宏设计几个不同的功能认证、传输、连接被打包进一个单一的协议SSH2带来了比SSH1更强大的安全特性如基于MAC的完整性检查灵活的会话密钥更新、充分协商的加密算法、公钥证书等等。
SSH2 is standardized by IETF, and as such its implementation is widely deployed and accepted in the industry. Due to SSH2's popularity and cryptographic superiority over SSH1, many products are dropping support for SSH1. As of this writing, OpenSSH still [supports][1] both SSH1 and SSH2, while on all modern Linux distributions, OpenSSH server comes with SSH1 disabled by default.
SSH2由IETF标准化且它的实现在业界被广泛部署和接受。由于SSH2对于SSH1的流行和加密优势许多产品对SSH1放弃了支持。在写这篇文章的时候OpenSSH仍旧[支持][1]SSH1和SSH2,然而在所有的现代Linux发行版中OpenSSH服务器默认禁用了SSH1。
### 检查支持的SSH协议版本 ###
#### 方法一 ####
如果你想检查本地OpenSSH服务器支持的SSH协议版本你可以参考**/etc/ssh/sshd_config**这个文件。用文本编辑器打开/etc/ssh/sshd_config并且查看"Protocol"字段。
如果如下显示就代表服务器只支持SSH2。
Protocol 2
如果如下显示就代表服务器同时支持SSH1和SSH2。
Protocol 1,2
#### 方法二 ####
如果因为OpenSSH服务其运行在远端服务器上而你不能访问/etc/ssh/sshd_config。你可以使用叫ssh的SSH客户端来检查支持的协议。具体说来就是强制ssh使用特定的SSH协议接着我么查看SSH服务器的响应。
下面的命令强制ssh使用SSH1
$ ssh -1 user@remote_server
下面的命令强制ssh使用SSH2
$ ssh -2 user@remote_server
如果远程SSH服务器只支持SSH2,那么第一个带“-1”的选项就会出现像下面的错误信息
Protocol major versions differ: 1 vs. 2
如果SSH服务器同时支持SSH1和SSH2,那么两个命令都有效。
### 方法三 ###
另一个检查版本的方法是运行SSH扫描工具叫做[scanssh][2]。这个命令行工具在你想要检查一组IP地址或者整个本地网络来升级SSH1兼容的SSH服务器时很有用。
下面是基本的SSH版本扫描语法。
$ sudo scanssh -s ssh -n [ports] [IP addresses or CIDR prefix]
"-n"选项可以指定扫描的SSH端口。你可以用都好分隔来扫描多个端口不带这个选项scanssh会默认扫描22端口。
使用下面的命令来发现192.168.1.0/24本地网络中的SSH服务器并检查SSH协议v版本
$ sudo scan -s ssh 192.168.1.0/24
![](https://farm8.staticflickr.com/7550/15460750074_95f83217a2_b.jpg)
如果scanssh为特定IP地址报告“SSH-1.XX-XXXX”这暗示着相关的SSH服务器支持的最低版本是SSH1.如果远程服务器只支持SSH2,scanssh会显示“SSH-2.0-XXXX”。
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/check-ssh-protocol-version-linux.html
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://www.openssh.com/specs.html
[2]:http://www.monkey.org/~provos/scanssh/

View File

@ -0,0 +1,74 @@
Linux有问必答-- 如何在Linux上安装内核头文件
================================================================================
> **提问**:我在安装一个设备驱动前先要安装内核头文件。怎样安装合适的内核头文件?
当你在编译一个设备驱动模块时你需要在系统中安装内核头文件。内核头文件同样在你编译与内核直接链接的用户空间程序时需要。当你在这些情况下安装内核头文件时你必须确保内核头文件精确地与你当前内核版本匹配比如3.13.0-24-generic
如果你的内核发行版自带的内核版本或者使用默认的包管理器的基础仓库升级的比如apt-ger、aptitude或者yum你也可以使用包管理器来安装内核头文件。另一方面如果下载的是[kernel源码][1]并且手动编译的,你可以使用[make命令][2]来安装匹配的内核头文件。
现在我们假设你的内核是发行版自带的,让我们看下该如何安装匹配的头文件。
### 在 Debian、Ubuntu 或者 Linux Mint 上安装内核头文件 ###
假设你没有手动编译内核你可以使用apt-get命令来安装匹配的内核头文件。
首先使用dpkg-query命令检查是否有可用的内核头文件。
$ dpkg-query -s linux-headers-$(uname -r)
----------
dpkg-query: package 'linux-headers-3.11.0-26-generic' is not installed and no information is available
接着使用下面的命令安装匹配的内核头文件。
$ sudo apt-get install linux-headers-$(uname -r)
![](https://farm9.staticflickr.com/8681/16000652415_a7c399992e_z.jpg)
验证头文件是否成功安装。
$ dpkg-query -s linux-headers-$(uname -r)
----------
Package: linux-headers-3.11.0-26-generic
Status: install ok installed
Debian、Ubuntu、Linux Mint默认头文件在**/usr/src**下。
### 在 Fedora、CentOS 或者 RHEL 上安装内核头文件 ###
假设你没有手动编译内核你可以使用yum命令来安装匹配的内核头文件。
首先用下面的命令检查系统是否已经按炸ung了头文件。如果下面的命令没有任何输出这就意味着还没有头文件。
$ rpm -qa | grep kernel-headers-$(uname -r)
接着用yum命令安装头文件。这个命令会自动找出合适的头文件并安装。
$ sudo yum install kernel-headers
![](https://farm9.staticflickr.com/8594/15378403114_c51ff6f4ae_z.jpg)
验证包安装的状态。
$ rpm -qa | grep kernel-headers-$(uname -r)
----------
kernel-headers-3.10.0-123.9.3.el7.x86_64
Fedora、CentOS 或者 RHEL上默认内核头文件的位置是**/usr/include/linux**。
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/install-kernel-headers-linux.html
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:https://www.kernel.org/pub/linux/kernel/
[2]:https://www.kernel.org/doc/Documentation/kbuild/headers_install.txt

View File

@ -0,0 +1,47 @@
Linux有问必答-- 如何在Debian下安装闭源软件包
================================================================================
> **提问**: 我需要在Debian下安装特定的闭源设备驱动。然而, 我无法再Debian中找到并安装包.如何在Debian下安装闭源软件包?
Debian是一个拥有[48,000][1]软件包的发行版. 这些软件包被分为三类: main, contrib 和 non-free, 主要是根据许可证要求, 例如, [Debian开源软件指南][2] (DFSG).
main软件仓库包括符合DFSG的开源软件。contrib也包括符合DFSG的开源软件但是依赖闭源软件来编译或者执行。non-free包括不符合DFSG的可再分发的闭源软件。main仓库被认为是Debian项目的一部分但是contrib和non-free不是。后两者只是为了用户的方便而维护和提供。
如果你想一直能够在Debian上安装闭源软件包你需要添加contrib和non-free软件仓库。这样做,用文本编辑器打开 /etc/apt/sources.list 添加"contrib non-free""到每个源。
下面是适用于 Debian Wheezy的 /etc/apt/sources.list 例子。
deb http://ftp.us.debian.org/debian/ wheezy main contrib non-free
deb-src http://ftp.us.debian.org/debian/ wheezy main contrib non-free
deb http://security.debian.org/ wheezy/updates main contrib non-free
deb-src http://security.debian.org/ wheezy/updates main contrib non-free
# wheezy-updates, 之前叫做 'volatile'
deb http://ftp.us.debian.org/debian/ wheezy-updates main contrib non-free
deb-src http://ftp.us.debian.org/debian/ wheezy-updates main contrib non-free
![](https://farm8.staticflickr.com/7562/16063758036_0ef8fce075_b.jpg)
修改完源后, 运行下面命令去下载contrib和non-free软件仓库的文件索引.
$ sudo apt-get update
如果你用 aptitude, 运行下面命令.
$ sudo aptitude update
现在你在Debian上搜索和安装任何闭源软件包。
![](https://farm9.staticflickr.com/8593/16089610915_b638fce55d_c.jpg)
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/install-nonfree-packages-debian.html
译者:[mtunique](https://github.com/mtunique)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:https://packages.debian.org/stable/allpackages?format=txt.gz
[2]:https://www.debian.org/social_contract.html#guidelines

View File

@ -0,0 +1,83 @@
Linux有问必答-- 如何在Linux重命名多个文件
================================================================================
> **提问**我知道我可以用mv命令重命名文件。但是当我想重命名很多文件怎么办如果为每个文件都这么做将会是很乏味的。有没有办法一次性重命名多个文件
在Linux中当你想要改变一个文件名使用mv命令就好了。然而mv不能使用通配符重命名多个文件。可以用sed、awk或者与[xargs][1]结合使用来处理多个文件的情况。然而这些命令行即繁琐u又不友好并且如果不小心的话还很容易出错。你不会想要撤销1000个文件的错误名的。
When it comes to renaming multiple files, the rename utility is probably the easiest, the safest, and the most powerful command-line tool. The rename command is actually a Perl script, and comes pre-installed on all modern Linux distributions.
当你想要重命名多个文件的时候重命名的工具或许是最简单、最安全和最强大的命令行工具。重命名命令实际上是一个Perl脚本它预安装在所有的现在Linux发行班上
下面是重命名命令的基本语法。
rename [-v -n -f] <pcre> <files>
<pcre> 是Perl兼容正则表达式它表示的是要重命名的文件和该怎么做。正则表达式的形式是s/old-name/new-name/’。
-v选项会显示文件名改变的细节比如XXX重命名成YYY
-n选项告诉rename会在不实际改变名称的情况下显示文件将会重命名的情况。这个选项在你想要在不改变文件名的情况下模拟改变文件名的情况下很有用。
-f选项强制覆盖存在的文件。
下面就让我们看下rename命令的几个实际例子。
### 改变文件扩展名 ###
假设你有许多.jpeg的图片文件。你想要把它们的名字改成*.jpg。下面的命令就会将*.jpeg 文件改成 *.jpg。
$ rename 's/\.jpeg$/\.jpg/' *.jpeg
### 大写改成小写,反之亦然 ###
有时你想要改变文件名的大小写,你可以使用下面的命令。
把所有的文件改成小写:
# rename 'y/A-Z/a-z/' *
把所有的文件改成大写:
# rename 'y/a-z/A-Z/' *
![](https://farm9.staticflickr.com/8655/16054304245_bcf9d23b59_b.jpg)
### 更改文件名模式 ###
现在让我们考虑包含子模式的更复杂的正则表达式。在PCRE中子模式包含在圆括号中$符后接上数字(比如$1$2
比如下面的命令会将img_NNNN.jpeg变成dan_NNNN.jpg
# rename -v 's/img_(\d{4})\.jpeg$/dan_$1\.jpg/' *.jpeg
----------
img_5417.jpeg renamed as dan_5417.jpg
img_5418.jpeg renamed as dan_5418.jpg
img_5419.jpeg renamed as dan_5419.jpg
img_5420.jpeg renamed as dan_5420.jpg
img_5421.jpeg renamed as dan_5421.jpg
比如下面的命令会将img_000NNNN.jpeg变成dan_NNNN.jpg
# rename -v 's/img_\d{3}(\d{4})\.jpeg$/dan_$1\.jpg/' *jpeg
----------
img_0005417.jpeg renamed as dan_5417.jpg
img_0005418.jpeg renamed as dan_5418.jpg
img_0005419.jpeg renamed as dan_5419.jpg
img_0005420.jpeg renamed as dan_5420.jpg
img_0005421.jpeg renamed as dan_5421.jpg
上面的例子中,子模式‘\d{4}会捕捉4个连续的数字捕捉的四个数字就是$1, 将会用于新的文件名。
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/rename-multiple-files-linux.html
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://xmodulo.com/xargs-command-linux.html