Command-Line – How to Delete or Remove a File Using rm

command linedeleterm

I am a beginner with Linux / Ubuntu, and I'm trying to remove / delete a file.

The specific is a wallet I created in Electrum to import a paper wallet; I can see the wallet in the file list but can't delete it.

I do understand that one uses the rm command in the Terminal, but I am not sure how to word the actual command. The file I'm trying to delete is home/duncan/.electrum/wallets/import key, but but if I type that into the Terminal it is rejected – i.e.

rm home/duncan/.electrum/wallets/importkey

is rejected.

Best Answer

Mind the space! That tells "rm" there will be a 2nd file after the 1st one.

And since it is 1 file you need to take care of the space. What will work:

rm /home/duncan/.electrum/wallets/"import key"

or

rm /home/duncan/.electrum/wallets/import\ key

by "escaping" the space or

rm /home/duncan/.electrum/wallets/import{tab}

(keep hitting tab til it shows the file name).

/home/duncan can be abbreviated by ~ (ie. rm ~/.electrum/wallets/"import key")


The file name was Import_keys. So the shorthand version for Duncan:

rm ~/.electrum/wallets/Import_keys

No need for "'s. The capital I probably was the culprit.

Related Question