$linuxcli.in _    [commands]    [tips & tricks]    [manpage]    [ESXi CLi]    [what is my ip?]    [pingme!]    [BIOS lock code]    [Code repo]


{

Delete all files except the tarball files

}

  rm command is use to remove files and with
  option -r which remove recursively; in other
  words contents of the directory, and with
  option -f it will never prompt for
  confirmation to delete a file.
  |
  | 
  |____.   .________________Anything in between dollar and parenthesis $() 
  |    |  |              |  character will execute and output will be on
  |    |  |              |  same place.
# rm -rf  $(ls [^*.tar.*])  
            |  |        |
            |  |        |
            |  |________|
            |           | 
  ls command to         |
  list content          |
  of the directory.     |
                        |
                In between square brackets [] character
                a conditional match is done. In this the
                carat ^ character is use to invert the
                given input in conditional match. Asterik
                * chracter is a wildcard chracter in
                conditional match which means any or zero
                to match.

Last updated on 18 February 2025 6:31 am IST