Operating System - HP-UX
1748142 Members
3730 Online
108758 Solutions
New Discussion юеВ

How to Unlink a file in Hp-UX UNIX

 
SOLVED
Go to solution
Becke
Super Advisor

How to Unlink a file in Hp-UX UNIX

I need to restore a filesystem in a particular directory, but before I actually restore that database filesystem, i need to delete the contents of that directory,

The problem is that there are several links in this directory which points to some other filesystems, how do i unlink these links before deleting the contents, so I can restore the filesystem.

Please advise how to unlink it, so when I blow the contents it won't actually blow other files...

what command is good to unlink the files without deleting their links files
5 REPLIES 5
Steven E. Protter
Exalted Contributor
Solution

Re: How to Unlink a file in Hp-UX UNIX

These soft links are just files.

They can be deleted with the rm command.

If you need to re-establish after the work, then do an ll command on them so its easier to put them back together.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
harry d brown jr
Honored Contributor

Re: How to Unlink a file in Hp-UX UNIX

are they hard links or symbolic?

live free or die
harry d brown jr
Live Free or Die
Geoff Wild
Honored Contributor

Re: How to Unlink a file in Hp-UX UNIX

rm

Example

cd ~gwild
ln -s /tmp mytmp
ls -l mytmp
lrwxr-xr-x 1 root sys 4 Apr 21 07:29 mytmp -> /tmp

rm mytmp
ls -ld /tmp
drwxrwxrwt 21 bin bin 8192 Apr 21 07:30 /tmp


Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Suraj Singh_1
Trusted Contributor

Re: How to Unlink a file in Hp-UX UNIX

I am sure u are talking of symbolic links as u mentioned that currently u have linked filesystems.

These could be two ways to achieve what you wish to do:
1. You can simply remove the link files (using rm), just have the names of these files backed up so that if you plan to create them again, you don't have any problems. [ ls -l|grep ^l ]

2. unmount the filesystems which are linked to the files you are mentioning. This would definitely ensure that you do not alter any data.

Rgds
What we cannot speak about we must pass over in silence.
Becke
Super Advisor

Re: How to Unlink a file in Hp-UX UNIX

Thanks Guys,

I have used unlink command to delete the links without acutally deleting the target files, which were linked.

Cheers