Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

251
Views
Delete dir with hyphen in name

I'm on CentOS 7.2 and I've somehow managed to create a folder called "-p". I can't seem to remove it now. I've tried the following:

rmdir -p rmdir "-p" rmdir \-p rmdir "\p"

It's probably simple, but I'm struggling.

I guess worst case I'll move anything out of the parent folder and go for a rm -rf

Many thanks

EDIT: just figured out the command that did it (and has done it again)

mkdir –p /etc/redis /var/redis

...I don't even

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

You could do:

rm ./-p

And depending on the rm used:

rm -- -p
over 4 years ago · Santiago Trujillo Report

0

You can pass foldernames starting with hypens to mkdir and rmdir after a "double hypen". Here's an example:

$ ls -1
$ mkdir -- -p
$ ls -1
-p
$ rmdir -- -p
$ ls -1
$
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!