deleting a weird file on unix by inode - plembo/onemoretech GitHub Wiki
title: deleting weird file on aix link: https://onemoretech.wordpress.com/2009/03/16/deleting-weird-file-on-aix/ author: lembobro description: post_id: 358 created: 2009/03/16 17:12:51 created_gmt: 2009/03/16 17:12:51 comment_status: open post_name: deleting-weird-file-on-aix status: publish post_type: post
deleting weird file on aix
One of the DBA’s came to me with this problem.
There was a file named -S
in one of the directories of an AIX box. Needed to nuke it. All the usual stuff failed: escaping (-S), double (”-S”) and single (’-S’) quotes, along with variations on those themes. Had to use the inode option.
First, find the inode. ls -li
. First column will be the inode number.
Example:
`
root@example:~# ls -li
1627444 -rw-r--r-- 1 oracle dba 10814 2008-12-21 11:35 test.txt
1627445 -rw-r--r-- 1 oracle dba 10814 2008-12-21 11:35 root.sh
**1627446 -rw-r–r– 1 oracle dba 10814 2008-12-21 11:35 -S**
`
Then nuke, find . -inum [inode number] -exec rm {} \;
Again, thusly:
root@example:~# find . -inum 1627446 -exec rm {} \;
Slightly different syntax on Linux:
find . -inum [inode number] -exec rm -i {} \;
Like this:
[root@example ~]# find . -inum 793211 -exec rm -i {} \;
Just don’t tell the Unix guys you heard it here. They’re pretty jealous of their turf.
Copyright 2004-2019 Phil Lembo