Deleting Symbolic and/or Hard links


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Deleting Symbolic and/or Hard links
# 1  
Old 03-30-2010
Deleting Symbolic and/or Hard links

From what I understand a symbolic link is alot like a shortcut where it points to another file. if the original file is deleted the symbolic link is rendered useless but a symbolic link can be deleted without any problem.

A hard link is like a copy of the file itself but pointing to the same data on the HDD. if the original file is deleted the hardlink will still work and behave just like the original file. If the hardlink is deleted the original remains and works as normal.

is this correct? if so, why do people say hardlinks are dangerous?
The reason I ask is because I need to delete some incremental backup files from a samba share and I'm a little scared of causing data loss by deleting things I shouldn't.
# 2  
Old 03-30-2010
# 3  
Old 03-30-2010
hardlinks vs symbolic links

Hardlink is nothing but another entry in the filesystem which point to the same data on the data blocks of the harddisk.
symbolic link is a entry in the filesystem which points to another entry on the filesystem not to the data block

It means that in hardlinks we have two references to same data, if one got deleted other will survive but in symbolic links it refers to the filename not to the data.
# 4  
Old 03-30-2010
thanks ktrimu and amitranjansahu
this is what I thought. it should mean that the hardlink and original file are exactly the same just named differently or in another directory, which means I can delete either one and I will suffer no data loss until all pointers to the file are deleted, but then why are hard links considered dangerous? I remember reading that they should be avoided but I see no reason why. do you know what I should watch out for?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Symbolic links

Soft link,Hard link brief explanation (1 Reply)
Discussion started by: RAJU KAVATI
1 Replies

2. AIX

List all the soft links and hard links

Hi I'm logged in as root in an aix box Which command will list all the soft links and hard links present in the server ? (2 Replies)
Discussion started by: newtoaixos
2 Replies

3. Solaris

Hard Links and Soft or Sym links

When loooking at files in a directory using ls, how can I tell if I have a hard link or soft link? (11 Replies)
Discussion started by: Harleyrci
11 Replies

4. Windows & DOS: Issues & Discussions

gVim on windows 7 64 constantly overwrites symbolic and even hard links

I use sugarsync to sync my vimrc across computers. I keep the _vimrc file in a syncing folder and in my home folder, I have a symbolic link ~\_vimrc pointing to ~\Synced Docs\_vimrc. On my mac I have a .vimrc symbolic link pointing at the _vimrc file. On the pc side, every time I open the _vimrc... (3 Replies)
Discussion started by: dp88
3 Replies

5. UNIX for Dummies Questions & Answers

Permissioning for symbolic links

I've just started using UNIX in a Linux vmplayer. I'm trying to run the command: ln -s `pwd`/$1 `python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"`/$1 in a script from an online tutorial, but I keep getting an error message: ln: creating symbolic link... (1 Reply)
Discussion started by: ChipT
1 Replies

6. UNIX for Dummies Questions & Answers

Symbolic Links

Hi all, I have scoured the entire forum for this but to no avail unfortunately. Basically, I would like to remove my symbolic link from my folder name i.e. foldername -> /a/b/c/d/f where f is indeed a folder. I have tried rmdir but this does not work and in actual fact deletes the... (4 Replies)
Discussion started by: cyberfrog
4 Replies

7. AIX

Symbolic Links

I am linking a directory as follows: ln -sf /home/xxx/userid/real_files/* /home/xxx/userid/linked_files This gives me symbolic links for all the files in the real_files directory in the linked_files directory. My question is, if I go and remove a file in the real_files directory and then go... (1 Reply)
Discussion started by: rcarnesiii
1 Replies

8. Programming

Ignoring symbolic/hard links while scanning through a directory

Hi, I am writing a unix system utility that is supposed to scan through a directory, collecting information about the files and subdirectories. That part is going well. The tricky part is that some files in the directory are hard links or symbolic links. I am supposed to IGNORE these links.... (4 Replies)
Discussion started by: Yifan_Guo
4 Replies

9. UNIX for Dummies Questions & Answers

deleting files by type (symbolic links)

How do I delete just the symbolic links in a directory? I have files that I wish to keep that have similar names, length and date/time. Can I use file size? Thanks kyle (4 Replies)
Discussion started by: kryan_toolboy
4 Replies

10. UNIX for Dummies Questions & Answers

links: (soft, hard? symbolic??) inode

Hi, what is link? and soft link? how about hard one and symbolic link. and inode. i get confuse about this links. could anyone help me with full explainsion? thks Gusla (5 Replies)
Discussion started by: gusla
5 Replies
Login or Register to Ask a Question