Select Page

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

Author: Bill Anderson | | 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.

How to Solve the Oracle Error ORA-12154: TNS:could not resolve the connect identifier specified

The “ORA-12154: TNS Oracle error message is very common for database administrators. Learn how to diagnose & resolve this common issue here today.

Vijay Muthu | February 4, 2021

Data Types: The Importance of Choosing the Correct Data Type

Most DBAs have struggled with the pros and cons of choosing one data type over another. This blog post discusses different situations.

Craig Mullins | October 11, 2017

How to Recover a Table from an Oracle 12c RMAN Backup

Our database experts explain how to recover and restore a table from an Oracle 12c RMAN Backup with this step-by-step blog. Read more.

Megan Elphingstone | February 2, 2017

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