Main Content

Oops - I typed ci not vi, and have lost my file ...

Archive - Originally posted on "The Horse's Mouth" - 2011-02-21 23:04:08 - Graham Ellis

Sitting writing late at night, I occasionally misspoll something; no great problem - I can go back and correct it, or if I fail to do so occasionally my kind reader will work out whaT I mean and forgive. But occasionally, when I'm typing in commands at the command line, one character can cause a big problem. Let's say I typed "ci" rather that "vi":

munchkin:fppy grahamellis$ ci demo
demo,v <-- demo
enter description, terminated with single '.' or end of file:
NOTE: This is NOT the log message!
>> Err ...
>> .
initial revision: 1.1
done
munchkin:fppy grahamellis$


And that's an easy mistake to make - with "c" and "v" next to each other on the keyboard. And - oh dear - the "demo" file has gone!

munchkin:fppy grahamellis$ ls demo
ls: demo: No such file or directory
munchkin:fppy grahamellis$


Blind panic? Perhaps so, the first time ... but fear not. You have called up RCS - the "Revision Control System" and Checked In the file called demo. You'll have a file called demo,v in your current directory, and you can use the co command to get a copy out; you'll then probably need to use chmod to get set the permissions on the file and make it writable again.

Note - my example is Mac OS X; some versions of ci don't even prompt for a description and you just appear to loose your file. It's also possible that you system / RCS has been configured to save the ,v files elsewhere, so you may need to use find to find them.