2019-03-17

#doy010

##课堂笔记

###2019年3月13日

老男孩思想:如何提升自学能力?

[if !supportLists]1. [endif]养成主动看书的习惯。

[if !supportLists]2. [endif]养成预习的习惯。

[if !supportLists]3. [endif]课堂上积极思考,对老师提问的问题主动回答;对于不会的要主动发问。

[if !supportLists]4. [endif]对老师留的课后拓展的作业要能够完成。

[if !supportLists]5. [endif]对学习的内容要深度总结(思维导图总结,画图总结)等。

[if !supportLists]6. [endif]课后遇到不会的不要轻易问别人,要学会自己解决问题。

[if !supportLists]7. [endif]提升阅读外语能力。


重定向符号的核心知识

超重点

>或1>标准输出重定向,箭头方向就是数据流向,把左边的数据流向到右边,会清空右边之前的数据。

[root@oldgirl ~]# cp test.txt{,.ori}

[root@oldgirl ~]# cp test.txt test.txt.ori

>>或1>> 追加输出重定向,内容追加到文件尾部

[root@oldgirl ~]# echo "I am studying linux." >>/data/oldboy.txt

[root@oldgirl ~]# cat /data/oldboy.txt

I am studying linux.

I am studying linux.

I am studying linux.

<或0< 标准输入重定向,箭头方向就是数据流向

Standard  input,   writing    to   standard  output.

标准输入写到标准输出

[root@oldboyedu ~]# tr "am" "01" </data/oldboy.txt

I 01 studying linux.

I 01 studying linux.

I 01 studying linux.

I 01 studying linux..

<<追加输入重定向,箭头方向就是数据流向


2>标准错误输出重定向,箭头方向就是数据流向,把左边的【报错】输出到右边(覆盖)。

2>>标准错误追加输出重定向,箭头方向就是数据流向,把左边的【报错】输出到右边(追加)。

固定定义:

数字1标准输出(standard output)

数字0标准输入(standard  input)

数字2错误输出 (error output)

此外还有一个特殊重定向用法:将标准错误重定向到标准输出,即标准错误和标准输出一样从定向到文件中,这个功能有3种实现命令方法。

方法1:echo "I am oldboy" >oldboy.txt  2>oldboy.txt

方法2:echo "I am oldboy" &>oldboy.txt

方法3:echo "I am oldboy" 1>oldboy.txt 2>&1


cat>test.txt <<EOF

test

liyao

oldboy

EOF


文件属性:文件的大小 时间 类型 权限 属主

索引节点:文件的唯一标识

身份证:人的唯一标识

进程号:进程的唯一标识



[root@oldboyedu ~]# ls -lhi

total 24K

33631870 -rw-r--r--. 1 root root   4 Mar 13 11:29 a.txt

33631871 -rw-r--r--. 1 root root  30 Mar 13 11:28 b.txt

16777289 drwxr-xr-x. 2 root root  64 Mar  7 11:57 data1

33631866 -rw-r--r--. 1 root root 712 Mar 11 15:58 grep.txt

33631863 -rw-r--r--. 1 root root  12 Mar 13 11:23 oldboy.txt

16964029 drwxr-xr-x. 2 root root   6 Mar  7 10:56 test

33631865 -rw-r--r--. 1 root root  24 Mar 13 11:46 test.txt

33631864 -rw-r--r--. 1 root root  54 Mar 13 10:26 test.txt.ori

 1          2        3   4    5    6  7   8   9    10

共10列

第一列:inode索引节点编号(相当于人的身份证、家庭住址,全国唯一);

系统读取文件时首先通过文件名找到inode号码,然后才能读取到文件内容。

第二列:文件类型及权限。这一列共11个字符,

其中第一个字符为文件类型,

随后的9个字符为文件的对应权限,

最后一个字符点号“.”是和selinux有关的一个标识;


第三列:硬连接数

第四列:属主:文件的拥有者,用户

第五列:属组:文件属于的组,用户组

第六列:大小

第七列:月份

第八列:日

第九列:时间

第十列:文件名


老男孩思想:学习的时候重视过程,工作的时候重视结果。


第二列第一个字符:文件类型

一切皆文件。Windows用扩展名区分文件,Linux里有自己的文件类型,Linux的里扩展名

兼容windows方便区分文件。

1.-普通文件(regular file)

图片视频文档都是文件

创建:touch vim echo cat

拷贝、移动:cp、mv

删除:rm

三种类型:

a.纯文本文件:字符数字等内容

b.数据文件:存放命令收集的信息。

c.二进制文件:可执行的命令。

[root@oldboyedu ~]# file d.txt

d.txt: ASCII text

[root@oldboyedu ~]# file /var/log/lastlog

/var/log/lastlog: data

[root@oldboyedu ~]# file /bin/cat

/bin/cat: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=8ac8b57ae50762a4a0480486839107e87b3c284d, stripped


2.d目录(directory)

生成: mkdir -p

复制:cp -a/-r

删除: rm -fr

区分:

a.开头为d

b.颜色为蓝色

c.ls -p,目录结尾加斜线,斜线结尾

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容