Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-25-2013
Registered User
 
Join Date: Dec 2012
Location: INDIA
Posts: 39
Thanks: 32
Thanked 0 Times in 0 Posts
Vi Created empty file

Hi,

While creating a file by vi by mistake I created a file with empty name.

Please tell me how to delete it
Sponsored Links
    #2  
Old 01-25-2013
Mead Rotor
 
Join Date: Aug 2005
Location: Saskatchewan
Posts: 16,407
Thanks: 492
Thanked 2,538 Times in 2,421 Posts

Code:
rm filename

Sponsored Links
    #3  
Old 01-25-2013
elixir_sinari's Avatar
Gotham Knight
 
Join Date: Mar 2012
Location: India
Posts: 1,372
Thanks: 87
Thanked 478 Times in 458 Posts
What says

Code:
ls -b

or

Code:
ls|od -bc

in the file's directory?
The Following User Says Thank You to elixir_sinari For This Useful Post:
nag_sathi (01-25-2013)
    #4  
Old 01-25-2013
Registered User
 
Join Date: Dec 2012
Location: INDIA
Posts: 39
Thanks: 32
Thanked 0 Times in 0 Posts
Thanks elixir

I tried it , but showing below message


Code:


Code:
rm -i \177
rm: 177 non-existent

Sponsored Links
    #5  
Old 01-25-2013
elixir_sinari's Avatar
Gotham Knight
 
Join Date: Mar 2012
Location: India
Posts: 1,372
Thanks: 87
Thanked 478 Times in 458 Posts
Try:

Code:
rm -i $'\177'

Sponsored Links
    #6  
Old 01-25-2013
Registered User
 
Join Date: Dec 2012
Location: INDIA
Posts: 39
Thanks: 32
Thanked 0 Times in 0 Posts
still same error


Code:


Code:
user@PROD2>>rm -i $'\177'
rm: $\177 non-existent

Sponsored Links
    #7  
Old 01-25-2013
Registered User
 
Join Date: Aug 2006
Posts: 314
Thanks: 1
Thanked 47 Times in 45 Posts
Try to identify the file via inode number and delete it that way:

Code:
$ touch ' '
$ ls -i
4907244    4907245 file1.txt  4907246 file2.txt
$ find . -inum 4907244 -exec rm {} \;
$ ls -i
4907245 file1.txt  4907246 file2.txt
$

I created a file with a space as name. ls -i gave me the inode number (the number without a filename behind it) and I used find to delete it.
The Following 3 Users Say Thank You to cero For This Useful Post:
elixir_sinari (01-25-2013), nag_sathi (01-25-2013), Yoda (01-25-2013)
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to delete core file (file created due to apps crashed) s3270226 Homework & Coursework Questions 6 04-07-2011 12:13 PM
perl script to check if empty files are created and delete them and run a shell script hussa1n Shell Programming and Scripting 2 06-26-2010 09:34 PM
While trying to do ssh without password, rsa key file is created as empty. nibiru78 AIX 2 05-19-2010 06:12 PM
Getting same exit status for empty and non empty file mavesum UNIX for Dummies Questions & Answers 4 12-03-2008 08:59 AM
How to empty a file(already created) laknar Shell Programming and Scripting 4 07-04-2007 01:00 PM



All times are GMT -4. The time now is 04:16 AM.