Friday, September 21, 2012

Access Or Rename Folders Named With Control Characters

Sometimes when cleaning up systems that have been compromised you end up with folders that have been created with control characters making it seemingly impossible to enter or rename them.

The easiest method here is to rename them by referencing the INODE number of the system.

First we get the inode number:
root@server [/]# ls -il
 96372062 drwxr-xr-x  2 root root  4096 Jan 01  2000 \t\t\t\t/
Now that we know the inode number, 96372062, we can rename it using find and move:
root@server [/]# find . -type d -inum 96372062 -exec mv -i {} delete-me \;
This essentially looks for all directories in the current directory (recursively) with the inode specified and then asks (-i is interactive mode) to move that directory to a new name of "delete-me".

This is extremely handy, however, always exercise caution.

No comments:

Post a Comment