How do I delete all files that start with 'labtest,' but keep the file 'labtest' itself undeleted?I was tryingrm labtest*[!labtest]But that didn't work out too well.Question 5Enter a command to delete all files that have filenames starting with 'labtest', except 'labtest' itself, from the current directory (Delete all files startingwith 'labtest' followed by one or more characters).You entered: rm *labtest?![labtest]Please try again.
Deleting all files except a specific one?
shell;files;wildcards
This will delete all files in the current directory starting with labtest except for the file labtest itself. It will not consider files unless they begin with labtestecho labtest?*    # List files that begin with labtestrm labtest?*      # Delete themThe question-mark is a single character wildcard: it must match something. The asterisk is a globbing wildcard and will match zero or more characters. The combination ensures that we cannot match just labtest by itself.