# basename command, cut out the extension



## robert wild (May 31, 2017)

Hi all,

When I do this command, I get the following output - 

```
[root@robw-linux scripts]# basename /mnt/local/data/tars/test.tar 
test.tar
```
This is what I want but I don't want the extension i.e. .tar, is there a way to do this please?

Many thanks

rob


----------



## SirDice (May 31, 2017)

`basename -s .tar /mnt/local/data/tars/test.tar`


----------

