Select Page

Art of BI: Migrating files using SCP on Linux or Unix

Author: Bill Anderson | 2 min read | April 28, 2016

Here’s a short blog post as a quick reference for some of the ways to move files using the terminal window for Linux/Unix using the SCP cmd. For this example we will be moving files and directories from a Dev environment onto a TST environment.

As an example, let’s walk through how to copy the file nohup.log from the ./start_stop directory in DEV to a directory into TST:

[code language="bash"]
scp /mp01/ancillary/start_stop/no_hup.log <user_name>@<server_name>:/mp01/ancillary/start_stop/
[/code]

– Be sure to add a forward slash for the target folder because if not it may interpret it as the name of a file that you are writing to.

– You will be asked to enter the password of the TST (Going to) userName from the system. This will not run if the password is incorrect.

To copy all files with the same file type .py from the start_stop directory from DEV to a directory in TST:

[code language="bash"]
scp <user_name>@<server_name>:"/mp01/ancillary/start_stop/*.py" /mp01/ancillary/start_stop/
[/code]

– You will be asked to enter the password of the DEV (Source) userName from the system. This will not run if the password is incorrect.

To copy the entire directory start_stop from Dev to a directory in TST:

[code language="bash"]
scp -r <user_name>@<server_name>:/mp01/ancillary/start_stop /mp01/ancillary/
[/code]

– You will be asked to enter the password of the DEV (Source) userName from the system. This will not run if the password is incorrect.

– The key here is to use the “-r” switch for copying an entire folder directory

In the end, one should always use the “man” command, for example “scp man”, from the terminal prompt to get all the information about the programs on which they have questions.

Subscribe to Our Blog

Never miss a post! Stay up to date with the latest database, application and analytics tips and news. Delivered in a handy bi-weekly update straight to your inbox. You can unsubscribe at any time.

Work with Us

Let’s have a conversation about what you need to succeed and how we can help get you there.

CONTACT US

Work for Us

Where do you want to take your career? Explore exciting opportunities to join our team.

EXPLORE JOBS