Bash error No such file or directory Handling

Handling Bash Error '$'\t' No such file or directory

A memo on handling errors like '$'\t': No such file or directory in Linux Bash command line. This can happen due to newline code issues when reading files line by line and using `mv` or similar operations.

Shou Arisaka
1 min read
Oct 10, 2025

A memo on handling errors like ’$‘\t’: No such file or directory in Linux Bash command line.

This can happen due to newline code issues when reading files line by line and using mv or similar operations.

e.g.

mv: cannot move '01 Track01.flac' to '01 - Track01'$'\t': No such file or directory
mv: cannot move '02 Track02.flac' to '02 - Track02'$'\t': No such file or directory
mv: cannot move '03 Track03.flac' to '03 - Track03'$'\t': No such file or directory

Even changing newline codes with nkf doesn’t help. Hmm…

nkf -Lu --overwrite names.txt

This is getting tedious, so let’s just replace \t.

sed -i $'s/\t//' names.txt

# To output to a new file
sed -i.bak $'s/\t//' names.txt

Done.

I don’t really understand \r and \t.

Share this article

Shou Arisaka Oct 10, 2025

🔗 Copy Links