bash: remove files interactively

2019-02-23 00:00:00 IN1 , 2023-04-10 14:16:30 IN1


Q: How to remove files interactively so that one is prompted for each file before the final deletion.

A: use the rm command with the -i option.

remove interactively all files which match Pattern "*_160x120"

rm -i *_160x120

example

admin1@erazer:/tmp$ rm -i *_160x120
rm: Normale Datei 'bild029.f15a3c6ded0213f91604e90830a3f902.jpg_160x120' entfernen? j
rm: Normale Datei 'bild036.3df230bc879330b8084f11b45cca3aa8.jpg_160x120' entfernen? 
rm: Normale Datei 'bild050.f010d8404771ed46b98c0a13c016720d.jpg_160x120' entfernen? j
rm: Normale Datei 'bild056.0990e9fd624e25a16eaaad0a4c878ce8.jpg_160x120' entfernen? j
rm: Normale Datei 'bild077.97903b2f7337f1c0dabc946801df67a5.jpg_160x120' entfernen? j
This website uses Cookies to provide you with the best possible service. Please see our Privacy Policy for more information. Click the check box below to accept cookies. Then confirm with a click on "Save".