2018/08/24-linux

od:dump files in octal and other formats(以八进制或其他格式转储文件;dump:倾倒,倾销)

-t(--format=TYPE):select output format or formats

TYPE is made up of one or more of these specifications:

a:named character,ignoring high-order bit    默认字符串

c:ASCII character or backslash escape(backslash:反斜杠) ASCII码

d[SIZE]:signed decimal,SIZE bytes per integer 有符号整型,每个整数占SIZE bytes

f[SIZE]:floating point,SIZE bytes per integer 浮点数,每个数占SIZE bytes

o[SIZE]:octal,SIZE bytes per integer 八进制,每个数占SIZE bytes

u[SIZE]:unsigned decimal,SIZE bytes per integer 无符号整型,每个整数占用SIZE bytes

x[SIZE]:hexadecimal,SIZE bytes per integer 十六进制,每个整数占用SIZE bytes

SIZE is a number.For TYPE in doux,SIZE may also be C for sizeof(char),S for sizeof(short),I for sizeof(int),L for sizeof(long).

if TYPE is f ,SIZE may also be F for sizeof(float),D for sizeof(double) or L for sizeof(long double)

od -t c /usr/bin/passwd

以ASCII码显示/usr/bin/passwd的内容

cat /etc/issue

od -t oc /etc/issue

od -t oCc /etc/issue

观察'e',ASCII码对应的十进制是101,八进制145(1*8*8+4*8+5*1=101)

od -t oc issue

用八进制和ASCII码来显示issue

一行16个字节,od默认按int读取,int是按四个字节分割,所以上面分成了四段,

下面是按char读取,char是按一个字节分割,所以,上面和下面没有对齐。

od -t oCc issue

oC,按照char来截取,即按照一个字节来分割,这样上面和下面就能对齐了。

Linux文件有若干属性,包括:读(r)、写(w)、运行(x)权限、所有者(o)、所属组(g)、是文件(-)、是目录(d)还是连接文件(l)等等。

其中要改变 读写运行权限使用chmod,要改变所有者所属组使用chown chgrp。

chattr :change file attributes on a linux file system

使用root用户操作:

cp ~/.bahsrc /home/myuser/bashrc

ls -l /home/myuser/bashrc

-rw-r----- 1 root  root 1177 Aug 24 11:56 /home/myuser/bashrc

su myuser

cd /home/myuser

ls -l bashrc

-rw-r----- 1 root root 1177 Aug 24 11:56 /home/myuser/bashrc

cat bashrc

cat :bashrc :Permission denied

su - root

chown myuser:mygroup /home/myuser/bashrc

su myuser

ls -l /home/myuser/bashrc

-rw-r----- 1 myuser mygroup 1177 Aug 24 11:56 /home/myuser/bashrc

cat /home/myuser/bashrc

可读取


 


 

猜你喜欢

转载自blog.csdn.net/qzw752890913/article/details/82012317
今日推荐