basename command in Linux

basename command in Kali Linux

basename command

Description
Basename is a simple command which returns the file name string without any path info and it is mostly used in shell scripts.
It can also remove the file extension, and return only the file name without an extension.
The syntax of basename command is as follows,
basename String [ Suffix ]
basename OPTION string – input string Suffix – string needs to be removed from the input
 Options
-a, --multiple
support multiple arguments and treat each as a NAME.
-s, --suffix=SUFFIX
remove a trailing suffix SUFFIX, such as a file extension.
-z, --zero
separate output with NUL rather than a newline.
--help
display help information and exit.
--version
output version information and exit.
Examples 
 basename /usr/bin/sort
 Outputs the string "sort". 

basename include/stdio.h .h
 Outputs the string "stdio".
basename -s .h include/stdio.h
 Outputs the string "stdio".
basename -a any/str1 any/str2
Outputs the string "str1" followed by the string "str2".

Labels:

Post a Comment

[blogger]

Author Name

{picture#YOUR_PROFILE_PICTURE_URL} YOUR_PROFILE_DESCRIPTION {facebook#https://www.facebook.com/wTsXDev} {twitter#https://twitter.com/wTsDev} {google#https://plus.google.com/u/0/+AnonSalame} {pinterest#https://www.pinterest.com/Thexwts/} {youtube#https://www.youtube.com/channel/UCg2fUa8Yp-aWDCJYQTVHmBg}

Contact Form

Name

Email *

Message *

Powered by Blogger.