0

I have an alias set up

alias nano="nano -B"

so everytime I change a <configFile>, a backup <configFile>~ is generated.

Now I have a lot of those backups I don't need anymore so I tried

rm *~

but this doesn't work

rm: cannot remove '*~': No such file or directory

How can I remove all files ending with ~?

EDIT: here the ouput of ls -alF (in this case I'm root and in the /root folder)

drwx------  6 root root  4096 Nov  9 12:58 ./
drwxr-xr-x 23 root root  4096 Oct 31 06:55 ../
-rw-------  1 root root 51486 Nov  9 11:13 .bash_history
-rw-r--r--  1 root root  4218 Nov  9 12:56 .bashrc
drwx------  2 root root  4096 Jul 19 15:47 .cache/
drwx------  2 root root  4096 Jun 27 15:36 .gnupg/
drwxr-xr-x  2 root root  4096 Jul  3 10:54 .nano/
-rw-r--r--  1 root root   798 Jun 27 11:45 .profile
-rw-------  1 root root  1024 Jun 27 14:25 .rnd
-rw-r--r--  1 root root    66 Sep  4 14:15 .selected_editor
drwx------  2 root root  4096 Sep  5 13:00 .ssh/
-rw-r--r--  1 root root    65 Nov  9 09:30 Trying
-rw-------  1 root root   628 Jul 19 15:37 .viminfo
-rw-r--r--  1 root root   143 Nov  9 12:58 .virtualMachines
-rw-r--r--  1 root root   143 Nov  9 12:58 .virtualMachines~
-rw-rw-r--  1 root root   358 Nov  9 12:57 .virtualServices
-rw-rw-r--  1 root root   358 Nov  9 09:48 .virtualServices~

in this case I want to remove .virtualMachines~ and .virtualServices~

derHugo
  • 3,356
  • 5
  • 31
  • 51
  • 1
    for me it works. Are you sure that you're in the folder where these files exist? please add output of ls -l. I have the same error when no file like that exists. – pLumo Nov 09 '17 at 11:55
  • Oh, for me too – you seem to be in the wrong directory. – dessert Nov 09 '17 at 11:57
  • No I'm definatly not see the edit. Is it a problem they start with a .? – derHugo Nov 09 '17 at 12:01
  • 1
    Files and directories starting . are usually "hidden", the default globbing excludes those. See dupe on matching them correctly. (I'd personally use shopt -s dotglob) – muru Nov 09 '17 at 12:04
  • @muru can you anyway explain please how this works in general? Tha answer of your link doesn't realy explain how to setup a custom extglob. Or does it mean after you did shopt -s extglob you can use it as pattern in the command line? (woulda be ugly to have to remind this pattern everytime) – derHugo Nov 09 '17 at 12:12
  • @derHugo the latter, and that's why I prefer dotglob. – muru Nov 09 '17 at 12:23

0 Answers0