From 5ecac8abaa90a0d0837b4feb9814e776418b7175 Mon Sep 17 00:00:00 2001 From: GOLinux Date: Wed, 18 Jun 2014 16:06:58 +0800 Subject: [PATCH] Translated:20140617 How to use Linux lsblk Command to List Block Device Information.md --- ...ommand to List Block Device Information.md | 108 ------------------ ...ommand to List Block Device Information.md | 107 +++++++++++++++++ 2 files changed, 107 insertions(+), 108 deletions(-) delete mode 100644 sources/tech/20140617 How to use Linux lsblk Command to List Block Device Information.md create mode 100644 translated/tech/20140617 How to use Linux lsblk Command to List Block Device Information.md diff --git a/sources/tech/20140617 How to use Linux lsblk Command to List Block Device Information.md b/sources/tech/20140617 How to use Linux lsblk Command to List Block Device Information.md deleted file mode 100644 index 47becf6d59..0000000000 --- a/sources/tech/20140617 How to use Linux lsblk Command to List Block Device Information.md +++ /dev/null @@ -1,108 +0,0 @@ -Translating by GOLinux ... -How to use Linux lsblk Command to List Block Device Information -================================================================================ -The command **lsblk** (list block devices) is used to list information about all available block devices, however, **it does not list information about RAM disks**. Examples of block devices are hard disk, flash drives, CD-ROM e.t.c - -### How To Install lsblk ### - -The command lsblk comes in the package util-linux-ng, now renamed util-linux. The package comes with several other utilities such as dmesg. To install lsblk download util-linux [here][1]. - -### How To Install lsblk In Fedora ### - -Fedora users can install the package as follows: - - $ sudo yum install util-linux-ng - -The command has several options: - -### The Default Option ### - -The command lsblk by default will list all block devices in a tree-like format. Open your terminal and type the command as follows: - - $ lsblk - -The output is as follows: - -![lsblk default](http://linoxide.com/wp-content/uploads/2014/03/lsblk-default.jpg) - -There are seven columns namely: - -**NAME** : This is the device name. - -**MAJ:MIN** : This column shows the major and minor device number. - -**RM** : This column shows whether the device is removable or not. Note in this example the device sdb and sr0 have their RM values equals to 1 indicating they are removable. - -**SIZE** : This is column give information on the size of the device. For example 298.1G indicate the device is 298.1GB and 1K indicate the device size is 1KB. - -**RO** : This indicates whether a device is read-only. In this case all devices have a RO=0, indicating they are not read only. - -**TYPE** :This column shows information whether the block device is a disk or a partition(part) within a disk. In this example sda and sdb are disks while sr0 is a read only memory (rom). - -**MOUNTPOINT** : This column indicates mount point on which the device is mounted. - -### List All Devices ### - -The default option does not list all empty devices. To view these also use the command as follows: - - $ lsblk -a - -This option will list all devices including empty ones. - -![lsblk bytes sda](http://linoxide.com/wp-content/uploads/2014/03/lsblk-bytes-sda.png) - -### List Device Permissions and Owner ### - -The command lsblk can also be used to list the ownership of a particular device as well as the group the mode. This can be achieved as follows: - - $ lsblk -m - -![lsblk permissions](http://linoxide.com/wp-content/uploads/2014/03/lsblk-permissions.png) - -### List Specific Devices ### - -It is possible also to get information about a specific device only. This can be achieved by specifying the device name after the option supplied to lsblk. For example you would be interested to know your hard drive size in bytes. You can accomplish this by running the command as follows: - - $ lsblk -b /dev/sda - -or if you prefer: - - $ lsblk --bytes /dev/sda - -### List Devices Without Header in List Form ### - -You can also combine several options to get a specific output. For example you might want to list the devices in a list format instead of the default tree format. You may also be interested in removing the header with the name of the different columns. The two different options can be combined to achieve the desired output as follows: - - $ lsblk -nl - -or still you can use the option which will give the same output. - - $ lsblk --noheadings --list - -![lsblk no header and list](http://linoxide.com/wp-content/uploads/2014/03/lsblk-no-header-and-list.png) - -### List SCSI Devices ### - -To get a list of SCSI devices only you can use the option -S. This option is capital S and it should not be confused with the option -s which prints dependencies in inverse order. - - $ lsblk -S - -lsblk SCSI devices On the contrary the inverse option will give output as follows: Type the command: - - $ lsblk -s - -or - - $ lsblk --inverse - -lsblk inverse You can use lsblk to get more information about your block devices, try it out today! - --------------------------------------------------------------------------------- - -via: http://linoxide.com/linux-command/linux-lsblk-command/ - -译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[1]:ftp://ftp.kernel.org/pub/linux/utils/util-linux/ diff --git a/translated/tech/20140617 How to use Linux lsblk Command to List Block Device Information.md b/translated/tech/20140617 How to use Linux lsblk Command to List Block Device Information.md new file mode 100644 index 0000000000..ace45377b4 --- /dev/null +++ b/translated/tech/20140617 How to use Linux lsblk Command to List Block Device Information.md @@ -0,0 +1,107 @@ +使用Linux的lsblk命令列出块设备信息 +================================================================================ +**lsblk**(列出块设备)命令勇于列出所有可用块设备的信息,但是,它**不列出RAM盘的信息**。块设备有硬盘,闪存盘,CD-ROM等等。 + +### 如何安装lsblk ### + +lsblk命令包含在util-linux-ng包中,现在该包改名为util-linux。这个包带了几个其它工具,如dmesg。要安装lsblk,请在[此处][1]下载util-linux包。 + +### Fedora中安装lsblk ### + +Fedora用户可以通过以下方法来安装该包: + + $ sudo yum install util-linux-ng + +该命令有几个选项: + +### 默认选项 ### + +lsblk命令默认情况下将以树状列出所有块设备。打开终端,并输入以下命令: + + $ lsblk + +输出如下: + +![lsblk default](http://linoxide.com/wp-content/uploads/2014/03/lsblk-default.jpg) + +7个栏目名称如下: + +**NAME** : 这是块设备名。 + +**MAJ:MIN** : 本栏显示主要和次要设备号。 + +**RM** : 本栏显示设备是否可移动设备。注意,在本例中设备sdb和sr0的RM值等于1,这说明他们是可移动设备。 + +**SIZE** : 本栏列出设备的容量大小信息。例如298.1G表明该设备大小为298.1GB,而1K表明该设备大小为1KB。 + +**RO** : 该项表明设备是否为只读。在本案例中,所有设备的RO值为0,表明他们不是只读的。 + +**TYPE** :本栏显示块设备是否是磁盘或磁盘上的一个分区。在本例中,sda和sdb是磁盘,而sr0是只读存储(rom)。 + +**MOUNTPOINT** : 本栏指出设备挂载的挂载点。 + +### 列出所有设备 ### + +默认选项不会列出所有空设备。要查看这些空设备,请使用以下命令: + + $ lsblk -a + +该选项将列出所有设备,包括控设备在内。 + +![lsblk bytes sda](http://linoxide.com/wp-content/uploads/2014/03/lsblk-bytes-sda.png) + +### 列出设备权限和属主 ### + +lsblk命令也可以用于列出一个特定设备的拥有关系,同时也可以列出组和模式。可以通过以下命令来获取这些信息: + + $ lsblk -m + +![lsblk permissions](http://linoxide.com/wp-content/uploads/2014/03/lsblk-permissions.png) + +### 列出指定设备 ### + +该命令也可以只获取指定设备的信息。这可以通过在提供给lsblk命令的选项后指定设备名来实现。例如,你可能对了解以字节显示你的磁盘驱动器大小比较感兴趣,那么你可以通过运行以下命令来实现: + + $ lsblk -b /dev/sda + +或者,如果你偏好: + + $ lsblk --bytes /dev/sda + +### 以列表形式列出不带头的设备 ### + +你也可以组合几个选项来获取指定的输出。例如,你也许想要以列表格式列出设备,而不是默认的树状格式。你可能也对移除不同栏目名称的头感兴趣。可以将两个不同的选项组合,以获得期望的输出,命令如下: + + $ lsblk -nl + +或者,你可以使用下面的选项,它们也能给出相同的输出。 + + $ lsblk --noheadings --list + +![lsblk no header and list](http://linoxide.com/wp-content/uploads/2014/03/lsblk-no-header-and-list.png) + +### 列出SCSI设备 ### + +要获取SCSI设备的列表,你只能使用-S选项。该选项是大写字母S,不能和-s选项混淆,该选项是用来以颠倒的顺序打印依赖的。 + + $ lsblk -S + +lsblk列出SCSI设备,相反,逆序选项将给出如下输出。输入命令: + + $ lsblk -s + +或者 + + $ lsblk --inverse + +lsblk逆序。你可以使用lsblk来获取关于你的块设备的更多信息,自己把它试着显示出来吧! + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-command/linux-lsblk-command/ + +译者:[GOLinux](https://github.com/GOLinux) 校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:ftp://ftp.kernel.org/pub/linux/utils/util-linux/