Remove all files with particular name but different extensions at once
Unix does not have file-name-extensions, nor does Microsoft's Windows (not after Windows ME. However file-explorer still has the concept). What you need to do is find all files starting with ... (in your case starting with cheatsheetold.
.
You can do this with cheatsheetold.*
. It will then pass the file list to rm
. You can use it with any command. It is not an rm
thing.
Practice with echo cheatsheetold.*
It was not stated in which shell (bash, fish, zsh, csh) you desire to use some sort of wildcard when removing files.
As bash
is a prominent shell I state that it would be possible to simply use this command:
rm -- cheatsheetold.*
note that the wildcard *
is used after the --
as to avoid any unindented mishaps by bash shell extensions
the command line env | grep 'SHELL'
might show you the shell you use. I have also tested the command line in the more POSIX reduced dash
shell.
I simply do not use any other shells (like csh and tsh or fish) so I cannot tell how globbing works there.
another way to get an idea which shell is running might be this
ps -p $$
where the $$
should be the PID of the current process (the shell) and ps the tool to list processes limited to the PID of the current shell.
https://help.ubuntu.com/community/ShellGlobbing