Basename is a standard UNIX computer program. When basename is given a path name, it will delete any prefix up to the last slash ('/') character and return the result. Simply we can say that basename strips directory information, suffixes and prefixes from file names.
The syntax for the basename command is
The options are
- -a: support multiple arguments and treat each as a NAME.
- -s: remove a trailing suffix SUFFIX, such as a file extension.
- -z: separate output with NUL rather than a newline.
- -help: display help information and exit.
- -version: output version information and exit.
- basename /home/yyy/commnd
It will remove prefix. /home/yyy/ can be removed. Prints only 'command'
- basename commandline line
- basename /home/yyy/commandline line
