I created a phantom file now i can't delete it?


 
Thread Tools Search this Thread
Operating Systems AIX I created a phantom file now i can't delete it?
# 1  
Old 02-16-2007
I created a phantom file now i can't delete it?

Ok, somehow i've managed to create two .ksh files with the same name. Impossible i know but somehow i did it by mistake...

I was actually copying a file and renaming it as something else but as i was typing the copy name i hit the delete key by mistake and got the ^? characters in the file name and hit return by force of habit... e.g. test^?.ksh
When i did an 'ls -lrt' the file just shows up as "test.ksh"

I created another file with same name thinking it would overwrite it but no it created the file and it now when i now do an 'ls -lrt' i have the two .ksh scripts show up.

But if i do an 'ls-lrt test*.ksh it will only show up the good file that i created.

I'm not all that familiar with unix/aix and have no idea what i've done.

Can anyone give me some pointers on how to get rid of this phantom file i created...

Thanks,
Jaz
# 2  
Old 02-16-2007
Hi, you can try "ls -li" thus finding the Inode number.
# 3  
Old 02-16-2007
Hi,

It's showing the inode number as 591...
# 4  
Old 02-16-2007
Take a look here - http://tldp.org/LDP/abs/html/moreadv.html
and especially Example 15-4.
Hope this helps.
# 5  
Old 02-16-2007
I think your best bet is to copy the file again to another name entirely, then do rm tes*.ksh. I expect that will work.

cp test.ksh saved_test.ksh
rm tes*.ksh

Another option is to check your manpage for the "remove with confirmation" option for rm. In solaris it's -i, not sure if it's the same for aix. Then do rm -i * (of course do the correct switch if yours isn't -i) and respond "n" to all the files except the bad one, say "y" to that.
# 6  
Old 02-16-2007
Quote:
Originally Posted by rhfrommn
I think your best bet is to copy the file again to another name entirely, then do rm tes*.ksh. I expect that will work.

cp test.ksh saved_test.ksh
rm tes*.ksh
I tried that but it didn't find the test.ksh... It shows up when i list the directory but if i try to cp, rm, cat, etc the file it doesn't see it...
# 7  
Old 02-16-2007
Then you may have to go with the rm -i * idea. Just be very careful to say no to all the files except for the exact one you want to delete. I believe that will work since the * by itself should fine every file in the directory. Since your bad file shows up when you do ls it should work.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Delete all files created in specific year

I have more than 200K files created in year 2017 under directory having size of 50GB. I want to all these files in one shot. Is there any faster option available with find command to delete all these file ? (6 Replies)
Discussion started by: sp23029
6 Replies

2. Shell Programming and Scripting

Script needed to delete to the list of files in a directory based on last created & delete them

Hi My directory structure is as below. dir1, dir2, dir3 I have the list of files to be deleted in the below path as below. /staging/retain_for_2years/Cleanup/log $ ls -lrt total 0 drwxr-xr-x 2 nobody nobody 256 Mar 01 16:15 01-MAR-2015_SPDBS2 drwxr-xr-x 2 root ... (2 Replies)
Discussion started by: prasadn
2 Replies

3. UNIX for Dummies Questions & Answers

Phantom Protocol Configuration File

I've been trying to set up the phantom protocol just to try it out. I compiled it fine, but when I ran it I got an error that the configuration file wouldn't load. I found that file didn't exist, so I created it with a blank file, but got this: ./phantom Loading configuration file... (4 Replies)
Discussion started by: Azrael
4 Replies

4. Shell Programming and Scripting

delete ftp accounts created in cpanel

i want to delete the extra ftp accounts that are created in cpanel e.g., when you go to cpanel->ftp accounts, any that are not there by default how can i do this via commandline? i am looping through the users on the server where is this info stored? also - how can the password of an... (0 Replies)
Discussion started by: vanessafan99
0 Replies

5. Homework & Coursework Questions

how to delete core file (file created due to apps crashed)

1. The problem statement, all variables and given/known data: When looking for corefiles, include any file with core in its name. (Some UNIX/Linux systems add the PID of the process that created the core to reduce the chances of overwriting an already existing core file that might be needed. The... (6 Replies)
Discussion started by: s3270226
6 Replies

6. Shell Programming and Scripting

Find directories only and delete them created 3 days before

Hello I have some directories and files created under /export/local/user I would like to delete directories only under /export/local/user, created before 3 days Can someone help me with command to do this task? Thanks (4 Replies)
Discussion started by: needyourhelp10
4 Replies

7. Shell Programming and Scripting

perl script to check if empty files are created and delete them and run a shell script

I have a local linux machine in which the files are dumped by a remote ubuntu server. If the process in remote server has any problem then empty files are created in local machine. Is there any way using perl script to check if the empty files are being created and delete them and then run a shell... (2 Replies)
Discussion started by: hussa1n
2 Replies

8. Shell Programming and Scripting

Delete files created before specific date.

There is a system logging a huge amount of data and we need to delete some of the older logs .I mean the files that are created before one week from today. Here is a listing of files that are sitting there: /usr/WebSphere/AppServer/logs # ls -l -rw-r--r-- 1 root system 3740694 May... (5 Replies)
Discussion started by: moustafashawky
5 Replies

9. AIX

w shows phantom user

Hi When i use "w" command, It list some users with "-" command. That means these use already logout,but still in the system somewhere, no process but list under the "w" and "who" command.How can i get rid of these user. Can anybody help me out.thanks a lot xiko (2 Replies)
Discussion started by: xiko
2 Replies
Login or Register to Ask a Question