• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

KaliTut

Kali Linux tutorial and Linux Tips

  • Home
  • Raspberry Pi
  • Privacy Policy
  • About us
  • Affiliate disclaimer

basename command in Linux

by

basename command in Kali Linux

basename command in Linux

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”.

Post Views: 376

Filed Under: Linux Commands

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Follow us

  • Facebook
  • Twitter
  • YouTube

Categories

  • algorithm
  • Android Ai coding
  • Android pentesting tools
  • Arduino
  • Artificial Intelligence
  • Books
  • ChatGPT Prompt
  • Darknet
  • database
  • General
  • Github Tools
  • Hacking
  • Kali Linux
  • Linux
  • Linux Commands
  • Network Administrator
  • Penetration Testing
  • Penetration Testing Tools
  • PowerShell
  • Raspberry Pi
  • resources
  • Review
  • Termux
  • Tutorials
  • Ubuntu
  • Uncategorized
  • Video Tutorials
  • vmware
  • WiFi Adapter
  • WiFi Pentesting
  • Wireless Router
  • Wireshark

Recent Posts

  • Shannon – The AI Pentesting Tool That Finds Real Exploits
  • Transforming Photos with ChatGPT Prompt : A Cinematic Double Exposure in a Post-Apocalyptic World
  • Stryker Android App: Your Mobile Pentesting Powerhouse
  • Alfa awus036ach review
  • Alfa AWUS1900 for Wireless Penetration Testing

Footer

Kalitut

Kalitut.com goal is to share the knowledge for free, help you find the best tools on the web and provides tutorials

Find us on social media

  • Facebook
  • Pinterest
  • Reddit
  • Twitter
  • YouTube

Copyright © 2026

  • Home
  • About us
  • Privacy Policy
  • Affiliate disclaimer