Strip a matching suffix from a string.
Section: String Operations
Trim suffix pattern
bash
bash
file='archive.tar.gz'
echo "${file%.gz}"Explanation
Useful for extensions and temporary suffixes.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing String Operations