How to remove directory name with special characters and directories with env variable name on UNIX How to remove directory name with special characters and directories with env variable name on UNIX unix unix

How to remove directory name with special characters and directories with env variable name on UNIX


For the junk names, it would be easiest to construct a wildcard that would catch only them. Select a readable portion of the name (e.g. the _6 substring) and wrap it in asterisks. First try it out:

ls *_6*

If it lists only the junk name, proceed to delete it:

rm *_6*

If it lists other names as well, try to make the wildcard more specific, using other readable characters in the name:

ls *w*_6*tP*N*x*

Proceed until you've found a wildcard that would match only unwanted files.


Determine inode numbers of necessary files/folders:

# ls -ila 14549980 drwxr-xr-x  3 root root       4096 Mar  5 20:45 ">?<

And pipeline it to rm:

find . -inum 14549980  -exec rm -ir {} \;


if you create a directory like --rw-r-r--. to delete this file do the followingrm -rf ./--rw-r-r--