LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-15-2004, 08:36 PM   #1
short101
Member
 
Registered: May 2004
Location: Aust.
Distribution: Debian
Posts: 424

Rep: Reputation: 30
Restore a file that somehow was backed up


Hi all. Recently I have changed a couple of my config files and then next time I look in that directory, there is a backup file and a completely new config file. I was mucking around with my cdrom in /etc/fstab and then next time I booted the machine I have a new fstab and a backup file. The new file file seems to be a basic one as it doesnt have my vfat partition on it, or any of the commands that I had put in for my cdrom. Can anyone tell my how or why this happens and how can I restore my old fstab file. I have looked in my bible and tried a couple of commands but cant seem to get it right. I havent started delving into the depths of backups yet so if anyone can tell me how to restore this one file, that would be great.
 
Old 07-15-2004, 10:19 PM   #2
short101
Member
 
Registered: May 2004
Location: Aust.
Distribution: Debian
Posts: 424

Original Poster
Rep: Reputation: 30
O.k. Done a little more looking and I dont even know what kind of file it is. If I look at the properties for it, it just says that it is a backup file with the title of fstab~. I'm under the impression that most backup files are tar files? Is this right? Still googling but cant seem to find out how this happened.
 
Old 07-15-2004, 11:04 PM   #3
kevinalm
Member
 
Registered: Oct 2003
Location: Iowa
Distribution: LFS 5.0, building 6.3, win98se, multiboot
Posts: 288

Rep: Reputation: 30
When you edit a file with certain editors, especially gui ones, they automatically save the _original_ file as filename~ . fstab~ is the file as it was before you alterred it and fstab is the new version of fstab including any changes you made.
 
Old 07-15-2004, 11:20 PM   #4
short101
Member
 
Registered: May 2004
Location: Aust.
Distribution: Debian
Posts: 424

Original Poster
Rep: Reputation: 30
Thanks but I cant even open that file, to see whats in it, and the new file doesnt have the changes in it that I saved. When I try :restore to restore the old file I get: bash command not found, but I know I have dump installed cause I tried to install it and it said I have the latest version. Is there another command that I have to use. Ive looked at the man page for restore and "restore" is a command but I cant seem to get it to work. Any ideas. As I said, I havent got into backups yet so I'm a bit over my head at the moment.
 
Old 07-15-2004, 11:42 PM   #5
kevinalm
Member
 
Registered: Oct 2003
Location: Iowa
Distribution: LFS 5.0, building 6.3, win98se, multiboot
Posts: 288

Rep: Reputation: 30
Were you "root" every time you tried to edit fstab? Most everything in /etc belongs to root since it contains most of the system wide config files. You can have some odd things happen in /etc when you try to read/edit files as a normal user.

The mv and cp commands are all that are needed to restore a file "backedup" by an editor as all you need to do is change the filename.
 
Old 07-16-2004, 06:47 AM   #6
short101
Member
 
Registered: May 2004
Location: Aust.
Distribution: Debian
Posts: 424

Original Poster
Rep: Reputation: 30
When I edited fstab, I was logged in as a user but had to open it as root to edit it. How do you restore these files with mv or cp? Do I just have to rename it? I cant even open it as I dont know what program created it. When I try to open it, I get the screen that says "open with" and I dont know what to open it with.
 
Old 07-16-2004, 12:18 PM   #7
kevinalm
Member
 
Registered: Oct 2003
Location: Iowa
Distribution: LFS 5.0, building 6.3, win98se, multiboot
Posts: 288

Rep: Reputation: 30
The file should be just a text file, use kedit, kate, kwrite, gedit, and the like to edit it from the gui. Cli editors include vi, nano and pico among others. Just to veiw the file from the cli:

less filename

Scroll with up and down arrow. Hit q to quit.

When an editor "backs up" a file it just renames the file so you just rename it back to restore.
 
Old 07-17-2004, 04:09 AM   #8
short101
Member
 
Registered: May 2004
Location: Aust.
Distribution: Debian
Posts: 424

Original Poster
Rep: Reputation: 30
Thanks kevinalm, I feel like a bit of an idiot. I was thinking there must be some kind of program that has to be run to restore the file Anyway I renamed the old file and I can see my windows partition again. Thanks again.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Restore all default file permissions pauliehaha Linux - General 4 05-25-2011 11:56 PM
restore file or dir from dump file brumela Linux - Newbie 3 09-08-2004 04:31 AM
Restore File ? mikeshn Linux - General 3 07-15-2004 01:57 PM
restore file ust Linux - General 1 03-29-2004 03:24 AM
How to restore a deleted file satimis Linux - Newbie 1 09-12-2003 04:18 AM


All times are GMT -5. The time now is 11:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration