Download a file using wget command to a particular folder using -P

Sometime we want to download a file directly to a particular folder/directory/location. For example we want to download Apache Tomcat file located at below mentioned path to /home/ directory

Tomcat File Path:

https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53.tar.gz

We can use wget command with -P option

wget https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53.tar.gz -P /home/

After executing the above mentioned command, in the below screenshot, we can see that file is download successfully and saved at /home/ path.

wget result