LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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-22-2018, 06:07 PM   #1
NewbProgrammer
Member
 
Registered: Jun 2017
Location: Check my IP address.
Distribution: Gentoo, Puppy, Mint Rosa, Arch, SliTaz, Crunchbang, LinuxBBQ, OpenSUSE, NanoLinux, LFS CentOS.
Posts: 54

Rep: Reputation: 13
How to remove redundant file?


I'm using Emacs as my editor.

$ ls
article.tex


This is what my directory looks like. However, when I edit with Emacs (Save and close the file) this happens:

$ ls
article.tex
article.tex~

These two files are exactly the same. How do I make Emacs not make a redundant file?
 
Old 02-22-2018, 06:16 PM   #2
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,732

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Sorry, I don't know the answer to your question*, but I will point out that the file ending with ~ is a before changes backup of the file being edited.
To see that, make a change to the file before you save and close, and you'll see that the ~ file is not the same as the later file.
Use
Code:
ls -ltr
to see that it's both newer and a different size than the file being edited.

*I'm sure there's some way to tell emacs to not make backups. Try searching for "control emacs backups"...or man emacs for more information.
 
Old 02-22-2018, 06:50 PM   #3
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Code:
article.tex
article.tex~
that bold one is a temp file with your changes until the file is saved. Its required, you'll find a lot of text editors use this method.
 
Old 02-22-2018, 07:22 PM   #4
NewbProgrammer
Member
 
Registered: Jun 2017
Location: Check my IP address.
Distribution: Gentoo, Puppy, Mint Rosa, Arch, SliTaz, Crunchbang, LinuxBBQ, OpenSUSE, NanoLinux, LFS CentOS.
Posts: 54

Original Poster
Rep: Reputation: 13
BW-userx,

I did explicitly tell Emacs to save by doing "C-x C-s" and then I quit afterwards.

The problem still persists.
 
Old 02-22-2018, 08:40 PM   #5
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,780

Rep: Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213
Emacs by default saves the old version of the file with a "~" suffix. You can turn that feature off. The option is called "make-backup-files", and in the options groups it's in Files->Backup. Or, you can avoid digging through the "Customize Emacs" menus and just edit your ~/.emacs file and insert a line
Code:
(setq make-backup-files nil)
 
Old 02-22-2018, 09:06 PM   #6
NewbProgrammer
Member
 
Registered: Jun 2017
Location: Check my IP address.
Distribution: Gentoo, Puppy, Mint Rosa, Arch, SliTaz, Crunchbang, LinuxBBQ, OpenSUSE, NanoLinux, LFS CentOS.
Posts: 54

Original Poster
Rep: Reputation: 13
That helped!

Many thanks!
 
  


Reply



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
LXer: How To Empty a File, Delete N Lines From a File, Remove Matching String From a File, And Remove Empty/Blank Lines From a File In Linux LXer Syndicated Linux News 0 11-22-2017 12:30 PM
Qt "cannot call constructor for""a function-style cast remove the redundant ::QBrush" Peterius Linux - Software 4 11-24-2010 04:57 PM
How to build a redundant, high-availability File Server system manya Linux - Server 3 03-24-2010 05:07 AM
Redundant entries in a file. sumitdevbharadwaj Linux - General 1 09-11-2009 04:44 AM
Replicate file shares for redundant servers? toben Linux - Software 1 12-06-2007 07:48 AM

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

All times are GMT -5. The time now is 04:17 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
Open Source Consulting | Domain Registration