cd and rm a directory with '^M'

DAve dave.list at
Thu Sep 4 05:28:32 UTC 2008

Edwin Groothuis wrote:
>> I had rsync create a directory with a '^M' in it.
> Use command-line completion:
> [~/xx] edwin at k7>touch foo^Mbar		# that's ^V^M
> [~/xx] edwin at k7>ls -l
> total 0
> -rw-r--r--  1 edwin  edwin  0 Sep  4 13:46 foo?bar
> [~/xx] edwin at k7>rm foo <TAB>		# autocompletes to foo^Mbar
If you find yourself on a machine without a full featured shell you can 
delete by the inode number. Chuck Swiger saved my bacon with that trick 
several years ago.

[sysadmin /usr/home/sysadmin]$ touch abc^M
[sysadmin /usr/home/sysadmin]$ ls -i
2449500 abc?   2449511
[sysadmin /usr/home/sysadmin]$ find . -type f -inum 2449500 | xargs rm
[sysadmin /usr/home/sysadmin]$ ls -i

I've needed but a few times since then, but when I did...


Don't tell me I'm driving the cart!

More information about the freebsd-questions mailing list