6

Editing text file using Emacs will make Emacs make a companion file for its own purpose.

For example, after first editing a file called test.c, Emacs will leave a file called test.c~ in the same directory. This can be a little annoying when visualizing all files cluttered with the ~ files in a console

Any way to get rid of seeing these ~ files in a console, like the Gnome Terminal?

Update

Thanks to @don_crisst's comment below:

use ls -B to hide the ~ files when displaying file names. The command line switches, -B or --ignore-backups, do not list implied entries ending with ~.

5
  • 6
    Is that when using ls ? You can use ls -B. -B or --ignore-backups = do not list implied entries ending with ~ Apr 25, 2013 at 11:50
  • 2
    There should be a law that emacs users have to clean up after themselves or configure it to not do this, honestly.
    – goldilocks
    Apr 25, 2013 at 14:27
  • You can configure emacs to put these files in a different location (backup-dir, autosave-dir, or something like that). Apr 25, 2013 at 14:51
  • 1
    Possibly useful: How do I control how Emacs makes backup files? (has instructions both for configuring where the backup files are stored, and disabling file save backups entirely)
    – user
    Jun 25, 2013 at 7:36
  • Please note, that configuring emacs to save backup files in a different directory can pose security risks.
    – tjb
    May 24, 2018 at 6:16

1 Answer 1

4

Use ls -B to hide the ~ files when displaying file names. The command line switches, -B or --ignore-backups, do not list implied entries ending with ~.

3
  • 3
    If you are using Bash, see also the FIGNORE environment variable, which allows you to exclude files from tab completion by pattern matching. There is also GLOBIGNORE for excluding files from glob (wildcard) expansion.
    – tripleee
    Jun 25, 2013 at 4:58
  • Eye-opening comment. Thanks. @tripleee Jun 25, 2013 at 8:45
  • 1
    does not work on vanilla osx, where -B has a different meaning (non-printable characters).
    – ivo Welch
    Aug 17, 2016 at 17:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .