当我们键入 时ls -l
,我们会获得有关当前目录中所有对象的元数据。
所述元数据具有10个破折号和1个ST破折号表示如果对象是一个目录或文件或链接
d
表示对象是文件夹之类的目录
-
表示该对象是一个文件等:.cpp、.png、.jpeg
l
表示对象是一个链接
当一个对象是一个链接时,究竟是什么意思,你如何创建一个作为链接的对象?
slm*_*slm 14
在l
你引用意味着文件是一个链接(符号)到另一个文件(或目录)。
lrwxrwxrwx. 1 root root 22 Feb 24 17:36 jcmd -> /etc/alternatives/jcmd
lrwxrwxrwx. 1 root root 23 Feb 24 17:36 javap -> /etc/alternatives/javap
lrwxrwxrwx. 1 root root 23 Feb 24 17:36 javah -> /etc/alternatives/javah
Run Code Online (Sandbox Code Playgroud)
这些是使用命令创建的,ln -s source link
. 源是我们想要链接到的文件/目录,“链接”是我们想要给链接的名称。
建立链接
$ ln -s ~/winfile.txt a_link.txt
Run Code Online (Sandbox Code Playgroud)
确认
$ ls -l | grep winfile
lrwxrwxrwx. 1 saml saml 22 Mar 5 11:15 a_link.txt -> /home/saml/winfile.txt
-rw-rw-r--. 1 saml saml 41 Mar 5 07:44 winfile.txt
Run Code Online (Sandbox Code Playgroud)
如果您查阅info ls
信息页面,您将找到ls
.
摘抄
The file type is one of the following characters:
'-' regular file
'b' block special file
'c' character special file
'C' high performance ("contiguous data") file
'd' directory
'D' door (Solaris 2.5 and up)
'l' symbolic link
'M' off-line ("migrated") file (Cray DMF)
'n' network special file (HP-UX)
'p' FIFO (named pipe)
'P' port (Solaris 10 and up)
's' socket
'?' some other file type
Run Code Online (Sandbox Code Playgroud)
10.1.2 列出了哪些信息 - 关于 ls 的 coreutils 文档
归档时间: |
|
查看次数: |
4274 次 |
最近记录: |