Results 1 to 3 of 3

Thread: Help me with getting back my disappeared file !

  1. #1
    Join Date
    Dec 2007
    Location
    Oslo
    Beans
    14
    Distro
    Kubuntu 8.04 Hardy Heron

    Angry Help me with getting back my disappeared file !

    Hi,

    I really need an urgent help.

    I was programing C in my Ubuntu and suddenly when I ran :

    cc -o Oblig1-2.c Oblig1-2

    suddenly a lot of weired errors came on screen() and my c file disappeared !!!!! Can anyone help me with this ? It was my school project ... Is there any backup system that I can use to restore the file ?

    Thank you

    Shahab,

    P.S. :
    shahab@LinLap:~/c_workspace/Oblig1/src$ cc -o Oblig1-2.c Oblig1-2
    Oblig1-2: In function `_start':
    (.text+0x0): multiple definition of `_start'
    /usr/lib/gcc/i486-linux-gnu/4.2.3/../../../../lib/crt1.o.text+0x0): first defined here
    Oblig1-2.rodata+0x0): multiple definition of `_fp_hw'
    /usr/lib/gcc/i486-linux-gnu/4.2.3/../../../../lib/crt1.o.rodata+0x0): first defined here
    Oblig1-2: In function `_fini':
    /build/buildd/glibc-2.7/build-tree/i386-libc/csu/crti.S:41: multiple definition of `_fini'
    /usr/lib/gcc/i486-linux-gnu/4.2.3/../../../../lib/crti.o:/build/buildd/glibc-2.7/build-tree/i386-libc/csu/crti.S:41: first defined here
    Oblig1-2.rodata+0x4): multiple definition of `_IO_stdin_used'
    /usr/lib/gcc/i486-linux-gnu/4.2.3/../../../../lib/crt1.o.rodata.cst4+0x0): first defined here
    Oblig1-2: In function `__data_start':
    , ...

  2. #2
    Join Date
    Mar 2006
    Location
    brooklyn, ny
    Beans
    290
    Distro
    Xubuntu 11.10 Oneiric Ocelot

    Re: Help me with getting back my disappeared file !

    If you haven't figured out what seems to have happened, is that you told the compiler 'cc' to write to the output file (-o Oblig1-2.c) after compiling Oblig1-2 (which was an executable so you got error messages).

    The correct command would be
    Code:
    cc -o Oblig1-2 Oblig1-2.c
    or just
    Code:
    cc Oblig1-2.c
    (and then you would have a compiled program called Oblig1-2.out that you can then rename).

    So basically you started to save over the file with nonsense, which cc then used to delete it.

    It is possible to recover the file off the hard disk, however it is not a simple task.

    If you are lucky the file is still open somewhere:
    http://www.cyberciti.biz/tips/linux-recover-deleted-files-with-lsof-command.html

    Otherwise, read up here:
    http://www.xs4all.nl/~carlo17/howto/undelete_ext3.html

    Actually this seems a better method than the above:
    http://tips-debian.blogspot.com/2008...-ext2ext3.html
    Last edited by jamesrl; October 1st, 2008 at 11:34 PM. Reason: added new method

  3. #3
    Join Date
    Feb 2007
    Location
    /dev/random
    Beans
    671
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Help me with getting back my disappeared file !

    Hi,

    shahab.fm's problem is not a deleted file, it's been overwritten: cc (gcc) did precisely what it was told to do.

    Depending upon the editor used and how much work was done after the last save in that editor this file might be available to him:

    Oblig1-2.c~

    I suggest looking for that file. Assuming Ubuntu (GNOME & Nautilus) via the GUI by opening the folder where Oblig1-2.c was and using Ctrl+H to show the hidden files. Or via the command line with:
    Code:
    ls *c~
    Main system: Dell 1420n - C2D T5250, 4GB RAM, 120GB SATA. Ubuntu 8.04.3.
    Assorted VMs (via VBox). Favorites: Fedora, FreeBSD, Solaris.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •