Vi Created empty file | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


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 !!

Vi Created empty file

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-25-2013
nag_sathi nag_sathi is offline
Registered User
 
Join Date: Dec 2012
Last Activity: 21 July 2014, 1:26 AM EDT
Location: INDIA
Posts: 60
Thanks: 43
Thanked 1 Time in 1 Post
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
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 18 August 2014, 2:39 PM EDT
Location: Saskatchewan
Posts: 19,212
Thanks: 772
Thanked 3,220 Times in 3,018 Posts

Code:
rm filename

Sponsored Links
    #3  
Old 01-25-2013
elixir_sinari's Avatar
elixir_sinari elixir_sinari is offline Forum Advisor  
Gotham Knight
 
Join Date: Mar 2012
Last Activity: 16 July 2014, 3:22 PM EDT
Location: India
Posts: 1,412
Thanks: 100
Thanked 495 Times in 472 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
nag_sathi nag_sathi is offline
Registered User
 
Join Date: Dec 2012
Last Activity: 21 July 2014, 1:26 AM EDT
Location: INDIA
Posts: 60
Thanks: 43
Thanked 1 Time in 1 Post
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
elixir_sinari elixir_sinari is offline Forum Advisor  
Gotham Knight
 
Join Date: Mar 2012
Last Activity: 16 July 2014, 3:22 PM EDT
Location: India
Posts: 1,412
Thanks: 100
Thanked 495 Times in 472 Posts
Try:

Code:
rm -i $'\177'

Sponsored Links
    #6  
Old 01-25-2013
nag_sathi nag_sathi is offline
Registered User
 
Join Date: Dec 2012
Last Activity: 21 July 2014, 1:26 AM EDT
Location: INDIA
Posts: 60
Thanks: 43
Thanked 1 Time in 1 Post
still same error


Code:


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

Sponsored Links
    #7  
Old 01-25-2013
cero cero is online now
Registered User
 
Join Date: Aug 2006
Last Activity: 20 August 2014, 8:19 AM EDT
Posts: 362
Thanks: 3
Thanked 64 Times in 59 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 4 Users Say Thank You to cero For This Useful Post:
elixir_sinari (01-25-2013), nag_sathi (01-25-2013), RavinderSingh13 (11-22-2013), Yoda (01-25-2013)
Sponsored Links
Closed Thread

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 08:39 AM.