control character file names

Bill Campbell freebsd at celestial.com
Sun Dec 14 19:21:37 PST 2008


On Sun, Dec 14, 2008, Noah wrote:
> Hi there,
>
> there is a blank directory that I cant seem to view.  I believe the  
> directory is a '^M'.  can somebody please explain how I can see  
> filenames and directories containing control characters.  Also how do I  
> rename the directory with 'mv'?

There are various ways to handle this.

# this will show the file with special characters escaped
ls | cat -v 

# this will put the output of ls into a file that can then be
# edited with vim so one could insert ``mv '' before the funny
# file name, and `` newname'' after it.
ls > tmpfile

As others have mentioned, using a graphical file manager can make
it easy as well.

Bill
-- 
INTERNET:   bill at celestial.com  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
Voice:          (206) 236-1676  Mercer Island, WA 98040-0820
Fax:            (206) 232-9186

The end move in politics is always to pick up a gun.  -- Buckminster Fuller


More information about the freebsd-questions mailing list