LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   what are ~ files (https://www.linuxquestions.org/questions/linux-general-1/what-are-%7E-files-4175552492/)

Upendra Pratap Singh 09-03-2015 02:47 AM

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?

Randicus Draco Albus 09-03-2015 02:52 AM

A ~ at the end of a file indicates a backup file. At least with BSD.

ericson007 09-03-2015 03:10 AM

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.

Habitual 09-03-2015 06:48 AM

Quote:

Originally Posted by Upendra Pratap Singh (Post 5415135)
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

ericson007 09-03-2015 07:55 AM

Vi does it for sure, but so does gedit depending how it is setup by the distro

suicidaleggroll 09-03-2015 10:00 AM

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.

rtmistler 09-04-2015 07:53 AM

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.

goumba 09-04-2015 08:25 AM

Quote:

Originally Posted by rtmistler (Post 5415734)
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.

Upendra Pratap Singh 09-05-2015 11:59 AM

Quote:

Originally Posted by suicidaleggroll (Post 5415288)
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.

Upendra Pratap Singh 09-05-2015 12:02 PM

Quote:

Originally Posted by rtmistler (Post 5415734)
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

suicidaleggroll 09-05-2015 12:03 PM

Quote:

Originally Posted by Upendra Pratap Singh (Post 5416295)
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.

Upendra Pratap Singh 09-05-2015 12:27 PM

Quote:

Originally Posted by suicidaleggroll (Post 5416299)
Check the settings and preferences in your editor.

I was able to get this done in my gui editors. What about vi?

John VV 09-05-2015 12:30 PM

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

Upendra Pratap Singh 09-05-2015 12:31 PM

Quote:

Originally Posted by John VV (Post 5416315)
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....

Randicus Draco Albus 09-05-2015 06:16 PM

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


All times are GMT -5. The time now is 01:31 AM.