basename
Remove leading directory portions from a path. More information: <https://www.gnu.org/software/coreutils/basename>.
Install
- All systems
-
curl cmd.cat/basename.sh
- Debian
-
apt-get install coreutils - Ubuntu
-
apt-get install coreutils -
Alpine
-
apk add coreutils - Arch Linux
-
pacman -S coreutils - Kali Linux
-
apt-get install coreutils - CentOS
-
yum install coreutils - Fedora
-
dnf install coreutils - Windows (WSL2)
-
sudo apt-get updatesudo apt-get install coreutils - OS X
-
brew install coreutils - Raspbian
-
apt-get install coreutils - Docker
-
docker run cmd.cat/basename basenamepowered by Commando
Remove leading directory portions from a path. More information: <https://www.gnu.org/software/coreutils/basename>.
-
Show only the file name from a path:
basename path/to/file -
Show only the rightmost directory name from a path:
basename path/to/directory/ -
Show only the file name from a path, with a suffix removed:
basename path/to/file suffix
© tl;dr; authors and contributors