basename Linux Commands
What is Linux basename Command?
Explanation
basename COMMAND:basename command is used to remove any prefix ending in file name. It returns only the file name without the file extension.
SYNTAX :
basename NAME [SUFFIX]
NAME - file name
SUFFIX - prefix to remove
OPTIONS:
--help |
Display help. |
--version |
Output version information and exit. |
EXAMPLE:
-
basename test.php .php
Output:
test
The basename command, removes the prefix '.php' from the file name and returns only 'test'.