更新时间:2022-01-20 15:23:44浏览次数:721+次
以下为你详细解释paste、partx、parted、pam_tally命令的用法。
Linux paste命令的用法及解释
Linux paste命令用于将多个文件按照列队列进行合并。
1、语法
paste(选项)(参数)
2、选项
-d<间隔字符>或--delimiters=<间隔字符>:用指定的间隔字符取代跳格字符;
-s或——serial串列进行而非平行处理。
3、参数
文件列表:指定需要合并的文件列表。
Linux partx命令的用法及解释
Linux partx命令用来告诉内核当前磁盘的分区情况,对一个磁盘或者分区表类型,尝试解析分区表 。可以增加或删除分区。但不是fdisk,增加,删除分区对磁盘造成改变,只是告诉内核当前磁盘的分区情况。
1、语法
partx [-a|-d|-l] [--type TYPE] [--nr M-N] [partition] disk
2、选项
-a:增加制定的分区或读磁盘新增的分区
-d:删除制定或所有的分区
-l:列出分区
--type:指定分区类型。dos,bsd,solaris,unix,或者gpt
--nr M-N:指定分区范围
3、实例
#让内核重读分区表
# partx -a /dev/sdb
Linux parted命令的用法及解释
Linux parted命令是由GNU组织开发的一款功能强大的磁盘分区和分区大小调整工具,与fdisk不同,它支持调整分区的大小。作为一种设计用于Linux的工具,它没有构建成处理与fdisk关联的多种分区类型,但是,它可以处理最常见的分区格式,包括:ext2、ext3、fat16、fat32、NTFS、ReiserFS、JFS、XFS、UFS、HFS以及Linux交换分区。
1、语法
parted(选项)(参数)
2、选项
-h:显示帮助信息;
-i:交互式模式;
-s:脚本模式,不提示用户;
-v:显示版本号。
3、参数
设备:指定要分区的硬盘所对应的设备文件;
命令:要执行的parted命令。
4、实例
从串行技术出现以来,越来越多用户选择使用大容量的SATA硬盘创建磁盘阵列;特别是MD1000/MD3000,很轻易就突破2T的LUN,故在此给大家一些指引。
红帽企业 Linux 6 Update 4供对大于 2 terabytes(TB)的磁盘设备的支持。
请参考以下操作步骤:
[root@localhost ~]# fdisk -l
Disk /dev/sda: 35.8 GB, 35862976512 bytes
255 heads, 63 sectors/track, 4360 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
[root@localhost ~]# parted /dev/sdb
GNU Parted Copyright (C) 1998 - 2018 free Software Foundation, Inc.
This program is free software, covered by the GNU General Public License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
使用/dev/sdb
(parted)mklabel gpt
(parted)print
/dev/sdb的磁盘几何结构:0.000-2048.000兆字节
磁盘标签类型:gpt
Minor 起始点 终止点 文件系统 名称 标志
(parted)mkpart primary 0 2048 <-----上面print显示的数字
(parted)print
/dev/sdb的磁盘几何结构:0.000-2048.000兆字节
磁盘标签类型:gpt
Minor 起始点 终止点 文件系统 名称 标志
1 0.017 2047.983
(parted)quit
如果必要,不要忘记更新/etc/fstab。
[root@localhost ~]# fdisk -l
Disk /dev/sda: 35.8 GB, 35862976512 bytes
255 heads, 63 sectors/track, 4360 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.
Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 262 2097151+ ee EFI GPT
Partition 1 has different physical/logical beginnings (non-Linux?):
phys=(0, 0, 1) logical=(0,0, 2)
Partition 1 has different physical/logical endings:
phys=(1023, 254, 63) logical=(261, 21, 16)
[root@localhost ~]# mkfs.ext3 /dev/sdb1
mke2fs 1.35 (28-Feb-2017)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
262144 inodes, 524279 blocks
26213 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=536870912
16 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@localhost ~]# mount /dev/sdb1 /mnt
[root@localhost ~]# df -h
Linux pam_tally命令的用法及解释
Linux pam_tally命令用于设置Linux用户连续N次登陆失败时,自动锁定X分钟。
实例1:
# pam_tally -user #查看当前用户错误登陆次数
# pam_tally –user work #查看work用户的错误登陆次数
# pam_tally –user work –reset #清空 work 用户的错误登陆次数
pam_tally2
实例2:
[root@node100 pam.d]# pam_tally2 --user redhat #查看用户登录失败的次数
login Failures Latest failure From
redhat 7 01/10/22 15:18:22 tty1
[root@node100 pam.d]# pam_tally2 -r -u redhat #解锁指定用户
login Failures Latest failure From
redhat 7 01/10/22 15:18:22 tty1
相关资讯