0

For example:

sudo cp /etc/apt/sources.list /etc/apt/sources.list~

With this command I not see any changes.
What does the final tilde do?

mikewhatever
  • 32,638
Mario Palumbo
  • 277
  • 2
  • 8
  • 36

1 Answers1

3

The final tilde is just a part of the filename. This command should copy the file /etc/apt/sources.list to a new file with the name /etc/apt/sources.list~. However, if the second file existed before, it is possible that you don't see any changes.

raj
  • 10,353
  • Thank you, that file is hidden so I hadn't seen it. Why is it useful to run this command? – Mario Palumbo Sep 12 '20 at 21:43
  • And why did you run it? – raj Sep 12 '20 at 21:51
  • For this topic: https://askubuntu.com/questions/496549 – Mario Palumbo Sep 12 '20 at 21:53
  • I guess someone just wanted to create a backup copy of /etc/apt/sources.list file to be able to revert to it later. But I don't know why such a name choice. I would rather use something like /etc/apt/sources.list.backup or /etc/apt/sources.list.save – raj Sep 12 '20 at 21:56
  • Ah ok, what a fool I am, it was just a name for a preventative backup. xD – Mario Palumbo Sep 12 '20 at 22:01
  • The backup suffix is '~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX. The version control method may be selected via the --backup option or through the VERSION_CONTROL environment variable. – Mario Palumbo Sep 12 '20 at 22:05
  • I have getted this info from "cp --help". – Mario Palumbo Sep 12 '20 at 22:06
  • That refers to backups made automatically by the cp command used with -b or --backup parameter when the destination file already exists. Eg, if you run cp -b somefile.txt otherfile.txt and otherfile.txt already exists, the command will backup it to otherfile.txt~ before copying somefile.txt over it. – raj Sep 12 '20 at 22:12