LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-03-2015, 02:47 AM   #1
Upendra Pratap Singh
Member
 
Registered: May 2011
Location: India
Distribution: Ubuntu 14.04
Posts: 110
Blog Entries: 4

Rep: Reputation: 0
Question what are ~ files


When I am opening a file from Ubuntu GUI, then a similar file gets created in the same directory with a ~(tilde) at the end of the file name.

What are these files?

I am asking this because I was told that these are not the files that are supposed to be there. I was also instructed to open files through terminal only.

What's the catch?
 
Old 09-03-2015, 02:52 AM   #2
Randicus Draco Albus
Senior Member
 
Registered: May 2011
Location: Hiding somewhere on planet Earth.
Distribution: No distribution. OpenBSD operating system
Posts: 1,711
Blog Entries: 8

Rep: Reputation: 635Reputation: 635Reputation: 635Reputation: 635Reputation: 635Reputation: 635
A ~ at the end of a file indicates a backup file. At least with BSD.
 
Old 09-03-2015, 03:10 AM   #3
ericson007
Member
 
Registered: Sep 2004
Location: Japan
Distribution: CentOS 7.1
Posts: 735

Rep: Reputation: 154Reputation: 154
Itis the same in linux. Not all editors do that though, but many will create such a bacup file unless you tell the editor not to.
 
Old 09-03-2015, 06:48 AM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by Upendra Pratap Singh View Post
When I am opening a file from Ubuntu GUI
sounds like vi(m)?
Just opening files with a GUI doesn't create these ~ appended files, an editor does (sounds like vi(m) to me)
http://vim.wikia.com/wiki/Remove_swa...king_directory
 
Old 09-03-2015, 07:55 AM   #5
ericson007
Member
 
Registered: Sep 2004
Location: Japan
Distribution: CentOS 7.1
Posts: 735

Rep: Reputation: 154Reputation: 154
Vi does it for sure, but so does gedit depending how it is setup by the distro
 
1 members found this post helpful.
Old 09-03-2015, 10:00 AM   #6
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
It's the editor creating automatic backups of your file as you edit it. Nothing to worry about, if you don't like them I'm sure your editor has a way to disable that functionality.
 
Old 09-04-2015, 07:53 AM   #7
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,881
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Emacs creates files like these as backups. But wait, it can get worse because if there's a problem, emacs creates # files. Ahhhh!!

All in all, I think several programs use the ~ symbol to designate a backup file as a protective measure for interim copies.

These files are not intended for direct use by anyone. Unfortunately they also do not get cleaned up when editors leave, especially emacs for one.
Quote:
I am asking this because I was told that these are not the files that are supposed to be there. I was also instructed to open files through terminal only.
(1) You're curious because they are there and you just weren't informed?
(2) Or you're concerned or curious because you were told that the files in particular should absolutely not be there?

The first rendition (1) would be normal and I feel you should not worry too much about them, however you can likely also delete them if you don't have any editors open. I would recommend that you just leave them there.

The second rendition (2) would not be true, no one instructing you should be telling you that you'd never encounter these files.

Last edited by rtmistler; 09-04-2015 at 07:55 AM.
 
1 members found this post helpful.
Old 09-04-2015, 08:25 AM   #8
goumba
Senior Member
 
Registered: Dec 2009
Location: New Jersey, USA
Distribution: Fedora, OpenSUSE, FreeBSD, OpenBSD, macOS (hack). Past: Debian, Arch, RedHat (pre-RHEL).
Posts: 1,335
Blog Entries: 7

Rep: Reputation: 402Reputation: 402Reputation: 402Reputation: 402Reputation: 402
Quote:
Originally Posted by rtmistler View Post
Emacs creates files like these as backups. But wait, it can get worse because if there's a problem, emacs creates # files. Ahhhh!!

All in all, I think several programs use the ~ symbol to designate a backup file as a protective measure for interim copies.
Yup, there are several programs that use the tilde (~) to indicate backups.

Emacs does not create a # file if there is a problem. It is always created. The "#" prefix and sufix with emacs is for the autosave feature. When the original file is saved, that file *should* be deleted. If not, the next time the user opens that file emacs assumes it crashed last time around, and the user is prompted asking if they want to load the "recovered" data.

Last edited by goumba; 09-04-2015 at 08:28 AM.
 
Old 09-05-2015, 11:59 AM   #9
Upendra Pratap Singh
Member
 
Registered: May 2011
Location: India
Distribution: Ubuntu 14.04
Posts: 110

Original Poster
Blog Entries: 4

Rep: Reputation: 0
Quote:
Originally Posted by suicidaleggroll View Post
It's the editor creating automatic backups of your file as you edit it. Nothing to worry about, if you don't like them I'm sure your editor has a way to disable that functionality.
How can I tell the editor to stop making these backup files? Is there any command that needs to be run from the terminal?

Right now I am using Ubuntu Mate 15 version.
 
Old 09-05-2015, 12:02 PM   #10
Upendra Pratap Singh
Member
 
Registered: May 2011
Location: India
Distribution: Ubuntu 14.04
Posts: 110

Original Poster
Blog Entries: 4

Rep: Reputation: 0
Quote:
Originally Posted by rtmistler View Post
Emacs creates files like these as backups. But wait, it can get worse because if there's a problem, emacs creates # files. Ahhhh!!

All in all, I think several programs use the ~ symbol to designate a backup file as a protective measure for interim copies.

These files are not intended for direct use by anyone. Unfortunately they also do not get cleaned up when editors leave, especially emacs for one.(1) You're curious because they are there and you just weren't informed?
(2) Or you're concerned or curious because you were told that the files in particular should absolutely not be there?

The first rendition (1) would be normal and I feel you should not worry too much about them, however you can likely also delete them if you don't have any editors open. I would recommend that you just leave them there.

The second rendition (2) would not be true, no one instructing you should be telling you that you'd never encounter these files.
Mine was the second case. Looks like the guy who forbade me to remove ~ files said this because he did not want those files or at least that clutter when ls command is run.

Thanks for your kind attention to my post
 
Old 09-05-2015, 12:03 PM   #11
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Quote:
Originally Posted by Upendra Pratap Singh View Post
How can I tell the editor to stop making these backup files? Is there any command that needs to be run from the terminal?

Right now I am using Ubuntu Mate 15 version.
Check the settings and preferences in your editor.
 
1 members found this post helpful.
Old 09-05-2015, 12:27 PM   #12
Upendra Pratap Singh
Member
 
Registered: May 2011
Location: India
Distribution: Ubuntu 14.04
Posts: 110

Original Poster
Blog Entries: 4

Rep: Reputation: 0
Quote:
Originally Posted by suicidaleggroll View Post
Check the settings and preferences in your editor.
I was able to get this done in my gui editors. What about vi?
 
Old 09-05-2015, 12:30 PM   #13
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,623

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
the very FIRST time you edit a system file and royally mess it up and the Operating System will no longer BOOT
is the VERY LAST time you will stop NOT having back up files and turn that ~ back on

using "mv" to move that BACK UP config file to the original file is a LOT easier than trying to REMEMBER!!! what you did to a system file using "vi" or "nano"

there is a REASON for BACKUP FILES

Last edited by John VV; 09-05-2015 at 12:31 PM.
 
1 members found this post helpful.
Old 09-05-2015, 12:31 PM   #14
Upendra Pratap Singh
Member
 
Registered: May 2011
Location: India
Distribution: Ubuntu 14.04
Posts: 110

Original Poster
Blog Entries: 4

Rep: Reputation: 0
Quote:
Originally Posted by John VV View Post
the very FIRST time you edit a system file and royally mess it up and the Operating System will no longer BOOT
is the VERY LAST time you will stop NOT having back up files and turn that ~ back on

using "mv" to move that BACK UP config file to the original file is a LOT easier than trying to REMEMBER!!! what you did to a system file using "vi" or "nano"

there is a REASON for BACKUP FILES
i got that thanks....
 
Old 09-05-2015, 06:16 PM   #15
Randicus Draco Albus
Senior Member
 
Registered: May 2011
Location: Hiding somewhere on planet Earth.
Distribution: No distribution. OpenBSD operating system
Posts: 1,711
Blog Entries: 8

Rep: Reputation: 635Reputation: 635Reputation: 635Reputation: 635Reputation: 635Reputation: 635
Quote:
How can I tell the editor to stop making these backup files? Is there any command that needs to be run from the terminal?
To learn how to use and configure applications, the first place to look is the man pages.
Code:
$ man vi
 
1 members found this post helpful.
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Restored files symbolically link to backup files, & can't boot using linked files mazinoz Linux Mint 1 01-31-2015 05:10 AM
need to rsync only selected files (--files-from) also need to delete files on dest. ? BrianK Linux - General 5 10-22-2009 09:52 PM
ntfs hard drive mounted. but doesnt show all files , tar files ataomega Linux - Software 1 08-28-2009 12:47 PM
in copy files or ls files the command want to invert select some files how to?? hocheetiong Linux - Newbie 3 06-27-2008 06:32 AM
How to filter files in files and files which are in a sub-directory with "grep"? Piero Linux - Newbie 9 08-29-2003 02:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:41 AM.

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
Open Source Consulting | Domain Registration