0

I have one copy cp command related question: In my home directory, there is a folder which is known as WebDev, Inside WebDev folder, there is a target folder which contains WebDev.rar.

Now, I am deploying the new war file after building using maven. My tomcat is in different directory. So basically, when I am inside the tomcat directory, I am typing the following command:

sudo cp ~/WebDev/target/WebDev.war .

Basically what above command is doing is (since I am already inside the tomcat directory), I am copying the WebDev.rarinside the tomcat. Is it a correct way to do that? I didn't understand why there is a dot . with a space after WebDev.rar.

Or alternatively, if I want to copy the file by navigating to various directory using FileZilla, is that a good option?

  • 3
    . is the current directory you are in (and .. the parent directory of that) – thrig Apr 18 '17 at 17:30
  • @thrig Thanks. And the dot . should always be after one space, right? In my case WebDev.war and one space and then .. – Tan Apr 18 '17 at 17:48
  • 1
    cp requires two arguments, and the space delimits the source and the destination arguments. – thrig Apr 18 '17 at 17:52
  • Okay, so in my case ~/WebDev/target/WebDev.war is the source and . is the destination separated by space which makes sense. Thanks – Tan Apr 18 '17 at 18:03
2

The following commands are equivalent:

cp ~/WebDev/target/WebDev.war .
cp ~/WebDev/target/WebDev.war ./
cp ~/WebDev/target/WebDev.war ./WebDev.war
cp ~/WebDev/target/WebDev.war WebDev.war

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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