What is the difference between cp fileA fileB and cp -- fileA fileB in Linux?


-- specifies the end of options. In your specific example this shouldn't make a difference but if you were using filename globbing such as: cp * fileB to find a file and you had a file in your directory named -R for example your command could potentially be:

cp -R dirA fileB

Which obviously wouldn't be the desired outcome. This is especially important when using commands like rm.

|improve this answer|||||
  • Thank you, your answer is very clear for me. – Luan Pham Nov 15 '19 at 9:26

Not the answer you're looking for? Browse other questions tagged or ask your own question.