1

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?

4
  • 3
    . is the current directory you are in (and .. the parent directory of that)
    – thrig
    Commented Apr 18, 2017 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
    Commented Apr 18, 2017 at 17:48
  • 1
    cp requires two arguments, and the space delimits the source and the destination arguments.
    – thrig
    Commented Apr 18, 2017 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
    Commented Apr 18, 2017 at 18:03

1 Answer 1

3

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .