问题
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