Centos文件内容查阅 cat 、tac、more、less 、head、tail、 od

本文详细介绍了在Centos系统中查阅文件内容的常用命令,包括cat用于合并并显示文件内容,tac从最后一行开始展示文件,more和less提供分页查看方式,head展示文件的前几行,tail展示文件的后几行,以及od命令用于查看二进制文件内容。这些工具对于日常的文件操作和系统管理至关重要。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

cat

由第一行到最后一行连续显示在屏幕上
NAME
cat - concatenate files and print on the standard output

SYNOPSIS
cat [OPTION]… [FILE]…

DESCRIPTION
Concatenate FILE(s), or standard input, to standard output.

   -A, --show-all
          equivalent to -vET

   -b, --number-nonblank
          number nonempty output lines, overrides -n
         打印行号,不算空白行

   -e     equivalent to -vE

   -E, --show-ends
          display $ at end of each line

   -n, --number
          number all output lines
          打印行号,包括空白行

   -s, --squeeze-blank
          suppress repeated empty output lines

   -t     equivalent to -vT

   -T, --show-tabs
          display TAB characters as ^I
          将“Tab”按键以` ^I`显示出来

   -u     (ignored)

   -v, --show-nonprinting
          use ^ and M- notation, except for LFD and TAB
          列出一些看不出来的字符

与cat相反,

  tac

从最后一行开始显示

more

一页一页的显示文件内容

less

与more类似 。但比more 更好的是可以往前翻页

head

只显示前几行

tail

只显示后几行

od

查看二进制文件

od /var/log/wtmp

具体
NAME
od - dump files in octal and other formats

SYNOPSIS
od [OPTION]… [FILE]…
od [-abcdfilosx]… [FILE] [[+]OFFSET[.][b]]
od --traditional [OPTION]… [FILE] [[+]OFFSET[.][b] [+][LABEL][.][b]]

DESCRIPTION
Write an unambiguous representation, octal bytes by default, of FILE to standard output. With more than one FILE argument,
concatenate them in the listed order to form the input. With no FILE, or when FILE is -, read standard input.

   If first and second call formats both apply, the second format is assumed if the last operand begins with + or (if there are  2
   operands)  a  digit.   An  OFFSET operand means -j OFFSET.  LABEL is the pseudo-address at first byte printed, incremented when
   dump is progressing.  For OFFSET and LABEL, a 0x or 0X prefix indicates hexadecimal; suffixes may be . for octal and b for mul‐
   tiply by 512.

   Mandatory arguments to long options are mandatory for short options too.

   -A, --address-radix=RADIX
          output format for file offsets; RADIX is one of [doxn], for Decimal, Octal, Hex or None

   -j, --skip-bytes=BYTES
          skip BYTES input bytes first

   -N, --read-bytes=BYTES
          limit dump to BYTES input bytes

   -S BYTES, --strings[=BYTES]
          output strings of at least BYTES graphic chars; 3 is implied when BYTES is not specified

   -t, --format=TYPE
          select output format or formats

   -v, --output-duplicates
          do not use * to mark line suppression

   -w[BYTES], --width[=BYTES]
          output BYTES bytes per output line; 32 is implied when BYTES is not specified

   --traditional
          accept arguments in third form above

   --help display this help and exit

   --version
          output version information and exit

Traditional format specifications may be intermixed; they accumulate:
-a same as -t a, select named characters, ignoring high-order bit

   -b     same as -t o1, select octal bytes

   -c     same as -t c,  select printable characters or backslash escapes

   -d     same as -t u2, select unsigned decimal 2-byte units

   -f     same as -t fF, select floats

   -i     same as -t dI, select decimal ints

   -l     same as -t dL, select decimal longs

   -o     same as -t o2, select octal 2-byte units

   -s     same as -t d2, select decimal 2-byte units
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值