Sunday, September 24, 2023
 Popular · Latest · Hot · Upcoming
rated 0 times [  8] [ 0]  / answers: 1 / hits: 34911  / 1 Year ago, mon, april 25, 2022, 7:42:01

I am trying to understand linux and working through some tutorials. One states that I can copy files to the current directory by using a cp -a command with a relative pathname such as

cp -a ../somedir/.   

It fails each time I run it. Is the syntax incorrect?

I tried the man page, but it didn't seem to find anything that answers my question.

More From » files


cp -a ../somedir/. is wrong. The general syntax is

cp source target

You only specified one argument. To copy something to current directory, you can run

cp ../somedir .

Note the space before the dot. . is shorthand for current directory. .. is shorthand for parent directory.

[#5757] Wednesday, April 27, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.

Total Points: 456
Total Questions: 130
Total Answers: 98

Location: El Salvador
Member since Sun, Sep 12, 2021
2 Years ago