linux命令column,Linux column命令详解(每日一令之二十一)

功能介绍:

格式化输出

使用放法:NAME

column - columnate lists

SYNOPSIS

column [-tx] [-c columns] [-s sep] [file ...]

DESCRIPTION

The column utility formats its input into multiple columns. Rows are filled before columns. Input is taken from file operands, or, by default, from the standard

input. Empty lines are ignored.

The options are as follows:

-c Output is formatted for a display columns wide.

-s Specify a set of characters to be used to delimit columns for the -t option.

-t Determine the number of columns the input contains and create a table. Columns are delimited with whitespace, by default, or with the characters supplied

using the -s option. Useful for pretty-printing displays.

-x Fill columns before filling rows.

Column exits 0 on success, >0 if an error occurred.

实例[root@uyhd000225 ~]# mount

/dev/hda1 on / type ext3 (rw)

proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

devpts on /dev/pts type devpts (rw,gid=5,mode=620)

tmpfs on /dev/shm type tmpfs (rw)

/dev/xvdb1 on /data type ext3 (rw)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

[root@uyhd000225 ~]# mount |column -t

/dev/hda1 on / type ext3 (rw)

proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

devpts on /dev/pts type devpts (rw,gid=5,mode=620)

tmpfs on /dev/shm type tmpfs (rw)

/dev/xvdb1 on /data type ext3 (rw)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

解释-s选项:

我以为-s选项是输出分隔符,比如上面,我是用如下命令:[root@uyhd000225 ms]# mount |column -s '@' -t

/dev/hda1 on / type ext3 (rw)

proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

devpts on /dev/pts type devpts (rw,gid=5,mode=620)

tmpfs on /dev/shm type tmpfs (rw)

/dev/xvdb1 on /data type ext3 (rw)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

[root@uyhd000225 ms]#

我以为他会输出以@为分隔符,但是没有安装我的期望输出

man column没有详细说明使用方法,info column也没有:

google发现他是输出分隔符,使用方法如下[root@uyhd000225 testDir]# cat testcolumn

Jackie | 18 | male

Helen | 20 | female

Daniel Liu | 23 | male

[root@uyhd000225 testDir]# cat testcolumn | column -s '|' -t

Jackie 18 male

Helen 20 female

Daniel Liu 23 male

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
文件为压缩包,内包含doc、pdf版本任君选择。 本资源部分源自网络,如有纰漏还望告知。 整理不易,如果觉得不错,请点赞留言,谢谢!!! 本资源专为入门学习Linux的新手们量身定制。 内含Linux常用必会60+个命令实例以及详解。 Linux提供了大量的命令,利用它可以有效地完成大量的工作, 如磁盘操作、文件存取、目录操作、进程管理、文件权限设定等。 所以,在Linux系统上工作离不开使用系统提供的命令。 要想真正理解Linux系统,就必须从Linux命令学起, 通过基础的命令学习可以进一步理解Linux系统。 一、系统: # uname -a # 查看内核/操作系统/CPU信息 # head -n 1 /etc/issue # 查看操作系统版本 # cat /proc/cpuinfo # 查看CPU信息 # hostname # 查看计算机名 # lspci -tv # 列出所有PCI设备 # lsusb -tv # 列出所有USB设备 # lsmod # 列出加载的内核模块 # env # 查看环境变量 二、资源: # free -m # 查看内存使用量和交换区使用量 # df -h # 查看各分区使用情况 # du -sh # 查看指定目录的大小 # grep MemTotal /proc/meminfo # 查看内存总量 # grep MemFree /proc/meminfo # 查看空闲内存量 # uptime # 查看系统运行时间、用户数、负载 # cat /proc/loadavg # 查看系统负载 三、磁盘与分区: # mount | column -t # 查看挂接的分区状态 # fdisk -l # 查看所有分区 # swapon -s # 查看所有交换分区 # hdparm -i /dev/hda # 查看磁盘参数(仅适用于IDE设备) # dmesg | grep IDE # 查看启动时IDE设备检测状况 …………………………………………………………………………

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值