linux get name of file without extension code example Example: remove file extension bash $ filename=foo.txt $ echo "${filename%.*}" foo