Understanding ls output [closed]

我是研究僧i 提交于 2020-01-14 07:04:28

问题


When I run ls -lrt command on a Unix folder , I get the following output

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

I am not sure what is BEA in these folders. They do not seem to be files nor folders. Why is there a arrow besides them pointing to somewhere else?


回答1:


The file in question is a symbolic link. The symbolic link is another name that "points to" the real file.

When you do ls -l it also shows you which file is pointed to by the link. You can actually see:

lrwxrwxrwx
^
|________ `l` here means a link



回答2:


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.



回答3:


These are called symbolic links in linux (shortcuts in windows)

When you work on them, for eg vim BEA , you will be editing the actual file in ../../../Some/Folder/SOLARIS/BEA



来源:https://stackoverflow.com/questions/22086175/understanding-ls-output

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!