Open wujunchuan opened 7 years ago
Linux的组成
Linux内核
Linux一切都是文件
如果忘记了命令名,使用 man -k可以搜索man pages里面的关键词
man -k
例如要查看与终端相关的命令行,可以输入 man -k terminal 一个通常会在多个内容区有对应的说明手册,使用 man section# topic来查看 例如输入man 1 intro阅读这个命令的手册第1部分,使用man 2 intro阅读第三部分..
例如要查看与终端相关的命令行,可以输入 man -k terminal
man -k terminal
一个通常会在多个内容区有对应的说明手册,使用 man section# topic来查看
man section# topic
例如输入man 1 intro阅读这个命令的手册第1部分,使用man 2 intro阅读第三部分..
man 1 intro
man 2 intro
Linux的文件系统采用单目录结构,这个目录给称为虚拟目录
虚拟目录会让文件和目录出现在同一挂载点的目录下,但是物理上可能是相互隔离的
图中的/home位置连接的是Disk2,用户目录都位于Disk2
.单点符标识当前目录,..双点符标识当前目录父目录
.
..
ls -R 遍历目录
ls -R
过滤输出列表:ls可以使用过滤器来过滤结果
ls
?
*
!
cp -i在复制的时候Shell会询问是否需要覆盖已存在的文件
cp -i
链接文件:Linux文件系统的优势,如需要在系统上维护同一个文件的两份或多份副本,除保存多份单独的物理文件副本以外,还可以通过保存一份物理文件副本+多个虚拟副本.连接是指向文件真实位置的占位符.
关于Linux下创建链接的更加详细的资料: linux下创建和删除软、硬链接(入门) 理解 Linux 的硬链接与软链接(IBM,较原理性)
关于Linux下创建链接的更加详细的资料:
linux下创建和删除软、硬链接(入门)
理解 Linux 的硬链接与软链接(IBM,较原理性)
符号链接(soft link)
硬链接(hard link)
区别:
硬链接不能跨文件系统 软链接可以 软链接在指定的位置上生成一个文件的镜像,不会占用磁盘空间(但是要有自己的inode,在磁盘上要有一小片空间来存放路径名) 硬链接会在选定的位置上生成一个和源文件大小相同的文件
硬链接不能跨文件系统
软链接可以
软链接在指定的位置上生成一个文件的镜像,不会占用磁盘空间(但是要有自己的inode,在磁盘上要有一小片空间来存放路径名)
硬链接会在选定的位置上生成一个和源文件大小相同的文件
共同点:无论是软链接还是硬链接,文件都始终保持同步变化
复制链接文件一定要小心,比如使用cp复制链接文件,得到的其实是源文件的副本
cp
不要创建软连接文件的软连接,这样形成的连接链容易断裂
使用mv影响的只是文件名,不会影响时间戳与inode编号
mv
想要同时创建多个目录和子目录,使用-p参数
-p
使用cat,more,less可以方便的查看文件的内容
cat
more
less
tail
head
Linux命令行与shell脚本编程大全(第3版)学习笔记
Chapter 1
Linux的组成
Linux内核
Chapter 3
Linux一切都是文件
如果忘记了命令名,使用
man -k
可以搜索man pages里面的关键词Linux的文件系统采用单目录结构,这个目录给称为虚拟目录
虚拟目录会让文件和目录出现在同一挂载点的目录下,但是物理上可能是相互隔离的
.
单点符标识当前目录,..
双点符标识当前目录父目录ls -R
遍历目录过滤输出列表:
ls
可以使用过滤器来过滤结果?
代表一个字符*
代表0个或者多个字符!
将不需要的内容排除在外cp -i
在复制的时候Shell会询问是否需要覆盖已存在的文件链接文件:Linux文件系统的优势,如需要在系统上维护同一个文件的两份或多份副本,除保存多份单独的物理文件副本以外,还可以通过保存一份物理文件副本+多个虚拟副本.连接是指向文件真实位置的占位符.
符号链接(soft link)
硬链接(hard link)
区别:
共同点:无论是软链接还是硬链接,文件都始终保持同步变化
复制链接文件一定要小心,比如使用
cp
复制链接文件,得到的其实是源文件的副本不要创建软连接文件的软连接,这样形成的连接链容易断裂
使用
mv
影响的只是文件名,不会影响时间戳与inode编号mv
不仅可以用来重命名,还可以用来移动文件想要同时创建多个目录和子目录,使用
-p
参数使用
cat
,more
,less
可以方便的查看文件的内容tail
,head
可以查看文件中一小部分内容