- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to remove the file with strange name?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 05:03 AM
06-01-2006 05:03 AM
$ ll
total 480
-rwxrwxrwx 1 oracle oinstall 10095 Apr 5 17:58 CPL_MASTER.SH
-rwxrwxrwx 1 oracle oinstall 6717 Mar 24 2005 CPL_MASTER.SHBCK
-rwxrwxrwx 1 oracle oinstall 7662 Apr 21 2005 CPL_MASTER.SHBCK02
-rwxrwxrwx 1 oracle oinstall 7727 Jul 7 2005 CPL_MASTER.SHBCK03
-rwxrwxrwx 1 oracle oinstall 4861 Feb 9 2005 CPL_MASTER_BATCH.SH
-rwxrwxrwx 1 oracle oinstall 10035 Jul 15 2005 CPL_MASTER_TEST.SH
-rwxrwxrwx 1 oracle oinstall 425 Feb 9 2005 SH
-rwxrwxrwx 1 oracle oinstall 215 Feb 9 2005 cpl_ftp.sh
-rwxrwxrwx 1 oracle oinstall 87 Jul 21 2005 cpl_list.sh
-rwxrwxrwx 1 oracle oinstall 83 Jul 21 2005 cpl_list1.sh
-rwxrwx--- 1 oracle oinstall 5365 Apr 19 14:11 database_schema.txt
-rwxrwxrwx 1 oracle oinstall 3920 Nov 18 2005 database_schema.txt_crypt
-rwxrwxrwx 1 oracle oinstall 67 Feb 9 2005 ftp_test.txt
-rwxrwxrwx 1 oracle oinstall 10 Feb 9 2005 linevar.txt
-rwxrwxrwx 1 oracle oinstalsdfadfjal;ksdjfkl;ajds;lfkjas;df.log
-rwxrwxrwx 1 oracle oinstall 3178 Dec 8 08:30 njphrrs.log
-rwxrwxrwx 1 oracle oinstall 1319 Jul 7 2005 obj_bu_batch.sql
-rwxrwxrwx 1 oracle oinstall 127 Feb 9 2005 read_line_by_line.sh
-rwxrwxrwx 1 oracle oinstall 330 Feb 9 2005 read_line_by_line2.sh
-rwxrwxrwx 1 oracle oinstall 333 Feb 11 2005 read_line_by_line3.sh
-rwxrwxrwx 1 oracle oinstall 516 Feb 11 2005 read_line_by_line4.sh
-rwxrwxrwx 1 oracle oinstall 80 Feb 9 2005 runsql.sh
-rwxrwxrwx 1 oracle oinstall 86 Mar 30 2005 select.sql
-rwxrwxrwx 1 oracle oinstall 1186 Feb 10 2005 test1.sh
-rwxrwxrwx 1 oracle oinstall 82 Feb 9 2005 test_dest.sh
-rwxrwxrwx 1 oracle oinstall 333 Feb 9 2005 test_server_dest.sh
-rwxrwxrwx 1 oracle oinstall 619 Jul 7 2005 trig_bu_batch.sql
-rwxrwxrwx 1 oracle oinstall 1090 Jul 7 2005 view_bu_batch.sql
See the file in the middle of "ll":
-rwxrwxrwx 1 oracle oinstalsdfadfjal;ksdjfkl;ajds;lfkjas;df.log
Why the filename overwrote the group owner, size, and time of the file?
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 05:06 AM
06-01-2006 05:06 AM
Re: How to remove the file with strange name?
rm *ksdjfkl*df.log
...jcd...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 05:07 AM
06-01-2006 05:07 AM
Re: How to remove the file with strange name?
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1012235
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 05:11 AM
06-01-2006 05:11 AM
SolutionOne easy, guaranteed way is to list your file(s) by inode and then remove the file by that inode number:
# ls -il /path #...note the inode number in the first column
# find /path -xdev -type f -inum
I suggest that you substitute 'ls -l' for 'rm' before you actually remove the file to verify that you really want to remove what you found.
Another form, which will prompt you to respond before the remove happens, is:
# find /path -xdev -type f -inum
In any case, the most important points are (1) use '-xdev' so no mountpoints are crossed; (2) substitute the
*Remember* and inode number is only unique within a filesystem. That is, the *same* inode numbers can (often do) exist in different mounted filesystems!
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 05:27 AM
06-01-2006 05:27 AM
Re: How to remove the file with strange name?
Then create an ll the identifies just this file. Now since the file has ; characters, these mean something special to the shell so you can escape them with \ or replace them in the ll command with * something like this:
ll *ksdjfkl*
If that shows you just the bad file, replace the ll with rm:
rm *ksdjfkl*
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 05:31 AM
06-01-2006 05:31 AM
Re: How to remove the file with strange name?
# cd
# rm -i -- ./*
cheers!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 05:59 PM
06-01-2006 05:59 PM
Re: How to remove the file with strange name?
The only problem I could see is, it has some special characters (;) in the file name.
See the output of the following command
bash-2.02# rm oinstalsdfadfjal;ksdjfkl;ajds;lfkjas;df.log
rm: oinstalsdfadfjal non-existent
bash: ksdjfkl: command not found
bash: ajds: command not found
bash: lfkjas: command not found
bash: df.log: command not found
";" is used for seperating different commands on the same line.
So rm will try to remove a file with name till first ; i.e. oinstalsdfadfjal
Then it will try to execute next command till next ; and so on.
If you want to remove this file, then special meaning of ; should be removed. So, use \ before ;. This will override the special meaning of the ; operator.
See following output.
bash-2.02# cat > oinstalsdfadfjal\;ksdjfkl\;ajds\;lfkjas\;df.log
This is a test file.
bash-2.02# ls -l | grep oi
-rw-r--r-- 1 root sys 21 Jun 2 11:10 oinstalsdfadfjal;ksdjfkl;ajds;lfkjas;df.log
bash-2.02# cat oinstalsdfadfjal\;ksdjfkl\;ajds\;lfkjas\;df.log
This is a test file.
bash-2.02# rm oinstalsdfadfjal\;ksdjfkl\;ajds\;lfkjas\;df.log
bash-2.02# ls -l | grep oi
I think this will solve your problem.
Thanks and regards,
Prasad.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 06:07 PM
06-01-2006 06:07 PM
Re: How to remove the file with strange name?
You can try in this way also.
Parse the output so that it will give the exact file name and then pass that file name to rm command.
1. Using xargs.
bash-2.02# ls -l | grep -i oin
-rw-r--r-- 1 root sys 20 Jun 2 11:25 oinstalsdfadfjal;ksdjfkl;ajds;lfkjas;df.log
bash-2.02# ls -l | grep -i oin | awk '{print $9}'
oinstalsdfadfjal;ksdjfkl;ajds;lfkjas;df.log
bash-2.02# ls -l | grep -i oin | awk '{print $9}' | xargs -n1 rm
bash-2.02# ls -l | grep -i oin
2. Way
bash-2.02# ls -l | grep -i oi
-rw-r--r-- 1 root sys 5 Jun 2 11:27 oinstalsdfadfjal;ksdjfkl;ajds;lfkjas;df.log
bash-2.02# ls | grep -i oi
oinstalsdfadfjal;ksdjfkl;ajds;lfkjas;df.log
bash-2.02# rm `ls | grep -i oi`
bash-2.02# ls | grep -i oi
bash-2.02#
Thanks and reagrds,
Prasad.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 06:49 PM
06-01-2006 06:49 PM
Re: How to remove the file with strange name?
You can find the inode number of the file.
Then do a find and remove it.
1. # ls -li filename
2. # find / -inum i_number -exec rm {} \;
cheers,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 09:19 PM
06-01-2006 09:19 PM
Re: How to remove the file with strange name?
$ ls -li *fadfjal*
note "inode number" is first colum
List:
$ find $PWD -inum i_number -exec ll{} \;
and delete:
$ find $PWD -inum i_number -exec rm{} \;
rgs,
ran