了解ls输出

时间:2014-02-28 04:26:57

标签: unix

当我在Unix文件夹上运行ls -lrt命令时,我得到以下输出

MyServer> ls -lrt
total 10
drwxr-x---   3 UnixUser  other        512 Jul 22  2011 FolderA
lrwxrwxrwx   1 UnixUser  other         46 Aug 23  2011 BEA -> ../../../Some/Folder/SOLARIS/BEA

我不确定这些文件夹中的BEA是什么。它们似乎不是文件或文件夹。为什么除了他们之外还有一个箭头指向其他地方?

3 个答案:

答案 0 :(得分:4)

BEA and Perlx.x in these folders are symbolic links. The symbolic link is another name that "points to" the real file.

The option '-l' tells the command to use a long list format. It gives back several columns wich correspond to:

1. Permissions
2. Number of hardlinks
3. File owner
4. File group
5. File size
6. Modification time
7. Filename

The first letter in the permissions(**lrwxrwxrwx**) column show the file's type. **`l` here means a link**, A 'd' means a directory and a '-' means a normal file (there are other characters, but those are the basic ones). The next nine characters are divided into 3 groups, each one a permission. Each letter in a group correspond to the read, write and execute permission, and each group correspond to the owner of the file, the group of the file and then for everyone else.

[ File type ][ Owner permissions ][ Group permissions ][ Everyone permissions ]
The characters can be one of four options:

r = read permission
w = write permission
x = execute permission
- = no permission
Finally, the "+" at the end means some extended permissions.

答案 1 :(得分:1)

这些在linux中称为symbolic links(Windows中的快捷方式)

当您处理它们时,例如vim BEA,您将在../../../Some/Folder/SOLARIS/BEA

中编辑实际文件

答案 2 :(得分:0)

相关文件是符号链接。符号链接是另一个“指向”真实文件的名称。

执行ls -l时,它还会显示链接指向的文件。你实际上可以看到:

lrwxrwxrwx
^
|________ `l` here means a link