How can I refer to a file named esc[G ? I need to delete it or move it.
TIA
How can I refer to a file named esc[G ? I need to delete it or move it.
TIA
cd to the folder it's in, get its inode number with ls -li, then
find . -inum inodenumber -exec echo rm '{}' ';'
Remove the 'echo' once you've tested it and are sure it does what you want.
Would
mv -i *G
or
rm -i *G
help? Apply utmost care when answering the confirmation question!
There are ways to directly enter escape characters into shell commands, but the method varies depending on what shell you're using, command history editing mode, etc.; but the following should work on any system using an ASCII based codeset:
mv $(printf '\033[G') whatever
or:
rm $(printf '\033[G')
as long as you're using a shell that understands POSIX standard command substitutions.
Corona, I'll have to remember that "inode" technique. After making sure there was only one file in the directory ending in G, the mv command changed the same to something standard like Rudic and Don suggested.
I had to take a hex dump of the ls -l to see its true name.
In this case, another way that work under Linux bash and I think work fine under sh,ksh,...
In fact, depend terminal configuration (often touch CTRL-V), we can check:
$ stty -a
speed 38400 baud; rows 42; columns 158; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?; swtch = M-^?; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc ixany imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke
Here, in red, lnext show ^V (CTRL-V), so, you can write the name of file by typing:
'CTRL-V' and 'ESCAPE' and '[' and 'G' keys.
Regards.