1, a Linux distribution system directory naming names and applications.
Naming rules:
1, follow FHS (Filesystem Hierarchy Standard) standard
2, strictly case-sensitive
3, the file is a directory, in the same path, two files with the same name can not be
4, support the use of any character other than /
5, the longest character not more than 255 characters
Catalog description:
2, the metadata description file which, respectively, what is the meaning, what to see? How to modify the timestamp information file?
Metadata information: refers to the property, file size, creation time, access time, is the information belongs to the main group and so on.
You can view a stat command
File: File Name
Size: Size (Unit: byte)
Blocks: The number of data blocks occupied by the file
IO Block: (: byte units) file block size data blocks occupied by
regular file: regular file (file type)
device: device number (hex / decimal)
inode: inode
Links: hard links (1 representing no other hard-wired)
Access: a first Access, permissions (octal / rwx format)
Uid: main View (ID number / name)
Gid: belongs to the group (ID number / name)
access: The second access, last access time
modify: recent data modification time
Change: recent metadata modified
Birth: creation time
可以用touch 进行修改时间戳
格式:touch [OPTION]...FILE...
-a 仅改变 atime 和 ctime
-m 仅改变 mtime 和 ctime
-t [[CC]YY]MMDDhhmm[.ss] 指定atime和mtime的时间戳
其中,atime是第二个Access的时间戳,mtime是指Modify时间戳,ctime是指Change时间戳。
3、总结软连接和硬连接区别,并用实例操作说明。
软链接
ln -s 原文件 目标文件
特征:
1、相当于windows的快捷方式
2、符号链接,所以链接文件大小都很小
3、当运行软连接的时候,会根据链接指向找到真正的文件,然后执行
4、所有链接文件的权限都是777,而真正的权限是由指向的那个文件决定的
5、原文件丢失后,软链接无法访问,会报找不到的错误
6、ls -al ,软连接后面箭头执行的时源文件
硬链接
ln 源文件 目标文件
特征:1、原文件和链接文件的属性完全一样
2、链接文件和源文件的关系类似于:复制+同步更新
3、当原文件丢失,硬链接文件还可以访问
4、不能跨分区,不能针对目录使用
5、原理:原文件和硬链接文件的节点相同的,1个文件名只能对应1个节点号。但是1个节点号能对应多个文件名。所以,他们的属性完全相同,并且修改了其中一个的内容另外一个也会跟着修改。
对shenyuxin文件创建 syx硬链接,和syx1软连接,当删除源文件shenyuxin后,syx还能打开,syx1无法打开。
硬链接的文件和源文件属性一样,元数据一样。
4、Linux上的文件管理类命令都有哪些,其常用的使用方法及其相关示例演示。
ls:列出指定目录下的内容格式;
mkdir:创建目录
rmdir:删除目录
cd:切换目录
cp:复制
格式:单源复制:cp [OPTION]... [-T] SOURCE DEST(如果DEST不存在则创建,存在则覆盖)
多源复制:cp [OPTION]... SOURCE... DIRECTORY(DEST必须为directory)
-i:交互式复制,即覆盖前提醒用户确认
-f:强制覆盖目标文件
-r,-R:递归复制目录
示例:cp -if /data/[1-3].txt /data/test --test必须为目录,把三个文件一起复制到test中
cp -r /data /practice --把data目录及目录下的内容一起复制到practice中
rm:删除
rm [OPTION]... FILE...
-i:交互式复制,即覆盖前提醒用户确认
-f:强制覆盖目标文件
-r,-R:递归处理,将制定目录下的所有文件包括目录一并删除
示例:rm -rf /practice --递归删除/practice目录
5、复制/etc/profile至/tmp/目录,用查找替换命令删除/tmp/profile文件中的 行首的空白字符
cp /etc/profile /tmp/
vim profile
6, a tab indentation in vim four characters
arranged in vim: set tabstop = 4