Home > Archive > Linux/Unix > June 2002 > Deleting a file





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Deleting a file
The VMS Kid

2002-06-20, 5:41 am

You do an "ls -l" on an HP-UX box and see a file that looks like this:

-rwx r-xr-x 1 vmskid users 24633 Jun 17 06:45 perm.c

Then you su to the superuser account and type "rm perm.c". You get the following message back:

"rm: perm.c non-existent"

What is the problem?
dpx

2002-06-20, 6:01 am

what kind of file is it ?
The VMS Kid

2002-06-20, 6:21 am

$ file perm.c
perm.c: c program text
Myr

2002-06-20, 7:05 am

hey there VMS..

when you su... does it by any chance put you in a different directory? such as root's home? Just a thought...

-Mike
Supertech

2002-06-20, 7:17 am

try a chmod 777 perm.c

or

try changing the file name, deleting the .c

or

cat perm.c - to see whats in it

be careful, this is a compiled C program so If you didn't compile it in the first place, you might be deleting a system file.
The VMS Kid

2002-06-20, 7:37 am

OK. I am in the directory of the file which I am wishing to delete. I am su, so the permissions don't matter, but I have read write and execute permission in the directory and read and write permission to the file. It is not a system file since I am the one who wrote it. It is not compiled C object code, but C source code. The compiled program is "perm". What is wrong.

I actually know the answer, as it was asked to me at a job interview that I had. Just want to know if I am the only one who didn't know about this.
Supertech

2002-06-20, 7:57 am

"I actually know the answer, as it was asked to me at a job interview that I had. Just want to know if I am the only one who didn't know about this."

ain't you smart... I certainly won't waste any more of my time trying to answer your trick questions. thank you.
The VMS Kid

2002-06-20, 8:16 am

Sorry, didn't mean to piss anyone off, but the question kind of caught me off-guard. The problem was that the file contains some ASCII non-printing characters. :S You need to use a special ls option to see them.
dpx

2002-06-20, 8:19 am

so it is a quiz .....
my answer :the immutable flag is set on that file with the chattr +i command ?
The VMS Kid

2002-06-20, 11:50 am

To get control characters into the string, type CTRL-V followed
by the control character. Try this:

$ touch `echo 'tricky[CTRL-V][CTRL-L]'`

Then do a listing. You will see tricky listed, but you need special options (usually -b or -v) to see the *real* filename.
ccieToBe

2002-06-20, 4:18 pm

I was guessing that something was up with the file name so I would have said trying using some wild cards (*) in the file name for the rm command. My secondary guess was that the fs is courupt I guess I was close
The VMS Kid

2002-06-21, 5:16 am

Well, I remember reading that you could include "non-printing" characters in a Unix file, but I forgot about it. So it kind of baffled me when this guy asked me this question. The other possibility is that the file was on a different filesystem I think, although he was speaking of HP-UX specifically so am not sure if this would generalize to other Unixes. But I think its neat now that I know it.
Sponsored Links





Free Braindumps | MCSE braindumps software forum

Copyright 2003 - 2008 examnotes.net