1

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

ilkkachu
  • 138,973
Luan Pham
  • 164
  • 1
  • 9

1 Answers1

3

-- 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.

jesse_b
  • 37,005