Extract File Name in Shell
Level 126 keystrokes
basename extracts the filename from a path.
Shell code
# Removes the directory part and prints only the last component: file.txt# dirname does the opposite and would print /path/to1basename /path/to/file.txtOutput
file.txt
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this Shell code and how often they appear.
/× 3.× 1