20、head和od

一、head与od

1、head -n 18 filename.cpp | tail -n 1

head [OPTION]... [FILE]... //output the first part of files

-n, --lines=[-]N

print the first N lines instead of the first 10; with the leading '-', print all but the last N lines of each file

head -n 3 filename 等价于head -n3 header.h

head --lines=5 header.h

-c //显示前n字节

-v //显示文件名

-q //不显示文件名

2、od

od(octal dump)

od - dump files in octal and other formats

od [OPTION]...[FILE]...

语法:od [-abcdfhilovx][-A <字码基数>][-j <字符数目>][-N <字符数目>][-s <字符串字符数>][-t <输出格式>][-w <每列字符数>][--help][--version][文件...]

补充说明:od指令会读取所给予的文件的内容,并将其内容以八进制字码呈现出来。【1

od常用的还是传统的命令格式

-a file //选出指字的字符显示,忽略高位

-c file //以ASCII characters or backslash escapes显示字符

-x file //以16进制显示字符

-f file //以浮点数显示字符

-d file //十进制

参考

1http://www.0djx.com/article/20100510/7204.html

原文地址:https://www.cnblogs.com/mydomain/p/2165505.html