How to remove files with wildcard?

296 Views Asked by At

rm with wildcard is not working.

if there are files that named with ef1 & ef2 then, i tried to erase ef1 & ef2.

$ rm ef* This could not erase ef1 & ef2.

But like as bellow, single file rm is working. $ rm ef1 $ rm ef2

Trying to create files to delete with *(asterisk,wildcard)

asdf@asdf:~/Documents/rust/hello$ touch ef1 ef2

asdf@asdf:~/Documents/rust/hello$ ls

ef1 ef2 hello main.rs test.c test_c

asdf@asdf:~/Documents/rust/hello$ rm ef*

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

Why i can not delete ef1 and ef2????

asdf@asdf:~/Documents/rust/hello$ rm -r ef*

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

asdf@asdf:~/Documents/rust/hello$ rm -f ef*

asdf@asdf:~/Documents/rust/hello$ rm -rf ef*

asdf@asdf:~/Documents/rust/hello$ sudo rm ef*

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

asdf@asdf:~/Documents/rust/hello$ ls

ef1 ef2 hello main.rs test.c test_c

Why i can not delete ef1 and ef2????

alias rm

bash: alias: rm: not found

type rm

rm is hashed (/usr/bin/rm)

which rm

/usr/bin/rm

\rm ef*

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

echo $-

himBHs

1

There are 1 best solutions below

0
yWorld On

Two days of wasted time...

I have finally found the answer by my self. Unfortunately, the problem was me my self.

I focused on rm with wildcard works with "sudo -i". So i checked .bashrc and found the solution with single line. Once i commented out source ~~~ then problem fixed.

There was bellow line at above source ~~~~. I dont know why i did that.

#!/bin/sh #GLOBIGNORE="*"