LinuxQuestions.org
Review your favorite Linux distribution.
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 02-16-2007, 10:43 PM   #1
Murkhadh
LQ Newbie
 
Registered: Feb 2007
Posts: 22

Rep: Reputation: 15
Question about files with ~ at the end


This probably sounds like a newb question but why is it that sometimes when I edit a file (vim) that after i hit :q or :wq to close it. there is a file of the same name in the directory now with a ~ at the end of it

for example, I closed "file1.conf" by typing :wq in vim

then I ls-l in the directory and I have

file1.conf
file1.conf~
 
Old 02-16-2007, 10:48 PM   #2
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
I guess it's a backup - do a test and have a look at the two files
 
Old 02-16-2007, 10:53 PM   #3
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,898

Rep: Reputation: 353Reputation: 353Reputation: 353Reputation: 353
The most common reason (that I have seen) for the tilde (~) at the end of a file is that there was an improper shutdown which left a temp file behind.

Some applications will leave a copy of the original file with a file extension, such as; .bak, .orig, etc.

Since you don't name the distro you are using, and the :wq is a proper shutdown for vim, I suspect that is the backup file (a copy of the original) before you edited the file. If anything goes wrong after your edit, you can easily restore to a working condition by copying the <filename>~ to <filename>.

You should do some research into vim and how to turn off the backup feature if you don't want it.
 
Old 02-16-2007, 10:57 PM   #4
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
From

http://vimdoc.sourceforge.net/cgi-bi...q2html3.pl#7.1

Quote:
7.1. When I edit and save files, Vim creates a file with the same name as
the original file and a "~" character at the end. How do I stop Vim
from creating this file? (or) How do I disable the Vim backup file
feature?

You have set the 'backup' option, so Vim creates a backup file when saving
the original file. You can stop Vim from creating the backup file, by
clearing the option:

:set nobackup

Note that, by default this option is turned off. You have explicitly
enabled the 'backup' option in one of the initialization files. You may
also have to turn off the 'writebackup' option:

:set nowritebackup

For more information, read

:help 07.4
:help backup-table
:help 'backup'
:help 'writebackup'
:help 'backupskip'
:help 'backupdir'
:help 'backupext'
:help 'backupcopy'
:help backup
 
Old 02-17-2007, 12:09 AM   #5
Murkhadh
LQ Newbie
 
Registered: Feb 2007
Posts: 22

Original Poster
Rep: Reputation: 15
Thank u for the replies. The distro is Slackware. I am going to check those vim settings.
 
Old 02-17-2007, 12:12 AM   #6
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
I guess from within vim, just type set nobackup
 
  


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
Whats the command to untar files that end in .tar.bz2? BaZiL Linux - Newbie 3 06-20-2007 11:51 AM
Anyone know where FC5 kernel build files end up. sass10151 Fedora 8 09-01-2006 01:10 AM
Simple script to copy files, getting \r's at end of cmd ElricM Linux - Newbie 2 07-23-2005 12:21 PM
batch append string to the end of a determined line in text files osio Programming 6 06-30-2005 10:28 AM
what exactly are files that end in .so rolandkirk55 Linux - Newbie 4 09-07-2004 05:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:50 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