In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
01. Command Overview
Basename-strips directories and suffixes from file names
The basename command is used to print the basic name of a directory or file. The basename and dirname commands are commonly used for command substitution in shell scripts to specify output file names that differ from the specified input file names.
02. Command format
Basename name [suffix] basename option
03. Common option
Displays the NAME after removing the directory components. If SUFFIX is specified, remove the trailing SUFFIX.--help to display help information, and then end-- version displays version information, and then ends
04. Reference exampl
4.1 displays the file name, excluding the directory
[deng@localhost ~] $basename / home/deng/scott_data.sql scott_ data.sql [Deng @ localhost ~] $
4.2 displays the file name, does not contain directories, and does not display suffixes
[deng@localhost ~] $basename / home/deng/scott_data.sql .sqlscott _ data [Deng @ localhost ~] $
4.3 displays the file name, does not contain directories, and does not show suffixes
-s specifies the suffix to be removed
[deng@localhost ~] $basename-s. SQL / home/deng/scott_data.sql scott_ data [Deng @ localhost ~] $
4.4 output multiple parameters sequentially
[deng@localhost test] $basename-a. / 20190712.log. / 20190713.log 20190712.log20190713.log [deng@localhost test] $ls
4.5 display the name of the last directory
If the last one is a directory, the name of the last directory is displayed
[deng@localhost test] $basename / home/deng/share/share [deng@localhost test] $
So far, this is the end of this article on the use of Linux basename commands. For more information about Linux basename commands, please search for previous articles or related articles below. I hope you will support me in the future!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.