A Basic Question About Links


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers A Basic Question About Links
# 1  
Old 09-15-2010
A Basic Question About Links

How can you tell if a file is linked to another file??????

Moderator's Comments:
Mod Comment Do not title posts "Urgent", etc. Per forum rules.
# 2  
Old 09-15-2010
what says ls -la <filename>?

if its linked it'll be in the order of:

<filename> --> ../../opt/bin/<filename>

ie. you'll see the pointer (-->) to another file.
# 3  
Old 09-15-2010
Code:
For soft links:
Directory listing permissions from "ls -la" starts character "l"
e.g.
lrwxr-xr-x

if [ -h filename ]
then
        echo "file is a soft link"
fi

You cannot tell simply whether a file has soft links pointing to that file

Code:
For hard links:
The link count field in directory listing from "ls -la" has a value greater than one.
Two or more files in the same mounted filesystem have the same inode number.
You can use "find" to find all the hard links to a file.


Last edited by methyl; 09-15-2010 at 12:03 PM.. Reason: too wide
# 4  
Old 09-16-2010
This command will show you all the link files:

HTML Code:
ls -l | grep "^l"
cheers
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Soft links question

Hello. I have some main directories. For example : /main_dir1 /main_dir2In main_dir2, I have a sub dir named sub_dir2-1 with 2 files in it ( file_2-1, file_2-2 ) /main_dir2sub_dir2-1file_2-1 file_2-2From "/main_dir1/A/B/C" I make a soft link ln -s /main_dir2/sub_dir2-1 ... (6 Replies)
Discussion started by: jcdole
6 Replies

2. Shell Programming and Scripting

Book and Links about Shells; and zsh question

HI, I would like to ask You about some good books or links where I can find information about shells, theoretical information. I will be grateful if You can help me And I have question about zsh loop trivial script: #!/bin/zsh for i in {1..100000} do echo $i; doneexec time is 10... (9 Replies)
Discussion started by: Physix
9 Replies

3. Shell Programming and Scripting

basic nc question

i'm doing this in one terminal: nc -lu 7402 and it appears to start listening properly, then in another i do this: echo "hello" | nc -u localhost 7402 and nothing happens on the listening terminal - what am i doing wrong? thanks. (7 Replies)
Discussion started by: peterworth
7 Replies

4. Shell Programming and Scripting

basic question

hi, I have a basic question,, i am in a directory called /intas/OCU_3.9.1/sbin ocuut1@france>mv itsa_tcs itsa_tcs_old mv: itsa_tcs_old: rename: Permission denied i am logging as the owner of the file. when i am doing this i am getting the above error of permission denied. I know... (3 Replies)
Discussion started by: namishtiwari
3 Replies

5. UNIX for Dummies Questions & Answers

Question posting links

Hi, I do not want to violate any rules, so thought to ask before posting any links. Just to contribute to the forum: through surfing I found a link to download "Unix in a Nutshell" (*.chm) FREE. I was wondering if I can post that link here. Thanks Hemang (5 Replies)
Discussion started by: hemangjani
5 Replies

6. UNIX for Dummies Questions & Answers

Really basic question....

Hello all. Let me start off by saying I know a little more then it seems by me asking this question... here goes I have an old 486 box and I want to start messing around with unix. I've been taking classes for 3 or 4 years in c programming in unix, so I am used to the commands and such, but I... (1 Reply)
Discussion started by: robherms
1 Replies

7. UNIX for Dummies Questions & Answers

A question for links in Unix

Is there a command that I can list, at once, all the links(path) of a give file ( including hard link and soft link)? If not, can it be down by writing a script? Thanks a lot. (I know that pwd would only list one path.) (2 Replies)
Discussion started by: nj302
2 Replies

8. UNIX for Dummies Questions & Answers

Very Basic Question

How to know if my AIX 5.2 is running at 64bits? THANKS (5 Replies)
Discussion started by: GermanSkull
5 Replies

9. UNIX for Dummies Questions & Answers

basic question

I have some basic doubts. Can someone clarify in this forum? 1)if then eval ' tset -s -Q -m ':?hp' ' else eval ' tset -s -Q ' what does it exactly mean in .profile? 2) what are 'nobody' and 'noaccess' usernames in /etc/passwd file. ... (3 Replies)
Discussion started by: asutoshch
3 Replies
Login or Register to Ask a Question