this post was submitted on 18 Jun 2026
5 points (61.9% liked)
linux4noobs
4225 readers
26 users here now
linux4noobs
Noob Friendly, Expert Enabling
Whether you're a seasoned pro or the noobiest of noobs, you've found the right place for Linux support and information. With a dedication to supporting free and open source software, this community aims to ensure Linux fits your needs and works for you. From troubleshooting to tutorials, practical tips, news and more, all aspects of Linux are warmly welcomed. Join a community of like-minded enthusiasts and professionals driving Linux's ongoing evolution.
Seeking Support?
- Mention your Linux distro and relevant system details.
- Describe what you've tried so far.
- Share your solution even if you found it yourself.
- Do not delete your post. This allows other people to see possible solutions if they have a similar problem.
- Properly format any scripts, code, logs, or error messages.
- Be mindful to omit any sensitive information such as usernames, passwords, IP addresses, etc.
Community Rules
- Keep discussions respectful and amiable. This community is a space where individuals may freely inquire, exchange thoughts, express viewpoints, and extend help without encountering belittlement. We were all a noob at one point. Differing opinions and ideas is a normal part of discourse, but it must remain civil. Offenders will be warned and/or removed.
- Posts must be Linux oriented
- Spam or affiliate links will not be tolerated.
founded 2 years ago
MODERATORS
'folder'$'\003'
That's the name of the folder.
What does
lsshow?you can escape special charcters with
\something like\'folder\'\$\'\\003\'might workbe careful with
rm -rfas you might delete your entire disk if done badly. use some other command to test if it targets the correct directory likels \'folder\'\$\'\\003\'Oh that is unpleasantly fiddly to insert all the backslashes to escape the bits. Testing here, (fiddly to even make a dir called that, lol), for fun, instead of just pressing tab, ... is it just the $ and the \ you need to escape? and the ' are fine? Results here are inconclusive, not sure I managed to make a file with the same name, it showing here with extra outer '.
Probably easier to just interactively.... but yeah, in case needing to have it written for a script... probably easiest still to just press tab, to see how it arranges the escape syntax, and paste that into your script. ;)
The fi in fish is friendly interactive, after all.
Yep as others have noted put a \ in front of each special character. The \ tells the system to treat the following character as a alphanumeric character in the string and not as a operator or a command. Since ', $ and \ are all special characters you will need a \ just before each when typing this name. Also as mentioned do this with a benign command like ls first to make sure your only acting on that specific directory or you might have a bad day.
Edit: How the heck did you get some of those folder names? Looks like a script with incorrect variable/macro substitution made these.
I believe u should Type
Basically a \ interprets the following character as a character. With the ' I’m not sure, so maybe
could do the trick too
Edit: correct code
After doing the step, the cursor simply came in the centre.
there is a space between your first
\and the'that doesn't belong there. (The backslash escapes the space, but not the apostrophe, that's why it's coloured red and not cyan)Press Ctrl+C and try again with the corrected command.
Are the ~~hyphens~~ apostrophes and the backslash part of the folder name too?
If so, try
\'folder\'\$\'\\003\'escaping the ~~hyphens~~ apostrophes', the dollar sign$and the backslash\.Do you see the folder with the strange name here ?
Oh hey, seeing that has just given me another idea (not sure if anyone else mentioned this yet elsewhere further down in the conversation... but...)
Tried just using a unique portion of the name that's easy to type, along with asterisks for the rest? e.g.
rmdir *old*00*(or rm -r if it's not an empty dir you want rid of).As the other commenters and I have mentioned, you should try escaping any of the special characters
',$, and\by a backslash, i.e.\',\$and\\rm -rf command ?
rm -rf \'folder\'\$\'\\003\'There are no hyphens.
sorry, I mean apostrophes.
Nothing happened.