cluster-file_transfer
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
cluster-file_transfer [2024/05/07 13:03] – gabriele | cluster-file_transfer [2024/05/09 12:48] (current) – gabriele | ||
---|---|---|---|
Line 9: | Line 9: | ||
- | ===== Transferring data ===== | + | ===== 1. Transferring data ===== |
You need to upload your data into the folder that was created by the IT for you within the ''/ | You need to upload your data into the folder that was created by the IT for you within the ''/ | ||
Line 17: | Line 17: | ||
To know more about ''/ | To know more about ''/ | ||
- | Please NOTE: theoretically, | + | Please NOTE: theoretically, |
- | Transferring code | + | ===== 2. Transferring code ===== |
+ | You can upload your scripts into a folder within your home directory on the cluster. The IT will have probably created a folder in the home directory with the first letter of your name preceding your surname (e.g., '' | ||
- | You can upload your scripts into a folder within your home directory on the cluster. The IT will have probably created a folder in the home directory with the first letter of your name preceding your surname (e.g., | + | /home/gbellucci |
- | /home/gbellucci | + | Your folder name in the home directory has the same name as the username you use to access the cluster. This name was provided to you by the IT when you asked for access. Be aware that there might be deviations on how your folder name in the home directory has been created (especially if you were granted access to the cluster before 2024). If you have access to the cluster, just log in using '' |
- | Your folder name in the home directory has the same name as the username you use to access | + | The most secure way to transfer code is using File Transfer Clients like '' |
- | The most secure way to transfer code is using File Transfer Clients like sftp and scp via the command line. Please see below for how to use these clients and a demonstration video. | ||
- | + | ===== 3. File Transfer Clients | |
- | File Transfer Clients | + | Primary access to psychp01 is via ssh based tools (on the command line). To upload or download data and code, File Transfer Clients such as '' |
- | + | ||
- | Primary access to psychp01 is via ssh based tools (on the command line). To upload or download data and code, File Transfer Clients such as scp and sftp can be used. | + | |
To transfer data to and from psychp01 use the following address: | To transfer data to and from psychp01 use the following address: | ||
- | psychp01.rhul.ac.uk | + | |
- | + | ||
- | + | ||
- | sftp | + | |
- | sftp, which stands for Secure File Transfer Protocol, is an encrypted protocol built into SSH that can implement commands for transferring files between two remote systems over a secure connection. There are many resources on the web on how to use sftp (e.g., here). Here, example applications to transfer data onto psychp01 will be shown. | ||
- | First, you need to establish a secure connection with the server. This is very similar to how you would connect with the server using ssh (see here). | + | ==== SFTP ==== |
+ | '' | ||
+ | First, you need to establish a secure connection with the server. This is very similar to how you would connect with the server using '' | ||
- | sftp username@psychp01.rhul.ac.uk | + | |
Like for the ssh connection, “username” is the username provided to you by the IT when you asked for access to the cluster. Hit enter and you will be required to enter your password. Once you are connected, at the beginning of your command line, you will see that an connection has been established: | Like for the ssh connection, “username” is the username provided to you by the IT when you asked for access to the cluster. Hit enter and you will be required to enter your password. Once you are connected, at the beginning of your command line, you will see that an connection has been established: | ||
- | sftp> | + | |
- | Now, you can ftp commands to (among others) upload, download, remove, and move files. Type help to check all commands available. | + | Now, you can use '' |
- | sftp> help | + | |
- | The sftp connection puts you on the cluster. Here, you can use all common commands you would use on your local machine to get the current directory, change the current directory and so on. If you would like to use the same commands on your local computer, you can do that by adding an “l” in front of the command you want to use. This “l” stands for “local” and tells sftp to use the command on the local machine as opposed to the remote one. | + | The '' |
+ | For instance, when you establish an '' | ||
- | For instance, when you establish an sftp connection, you will find yourself in your home directory. Hence, if your home directory path is / | + | |
+ | Remote working | ||
- | sftp> pwd | + | On the contrary, if you type '' |
- | Remote working directory: / | + | |
- | On the contrary, if you type lpwd, you will see the second line of the code below appearing: | + | sftp> |
+ | Local working directory: /Users/Gab | ||
- | sftp> lpwd | + | where '' |
- | Local working directory: | + | |
- | where /Users/Gab is my (local) current | + | To download data from the cluster onto your local directory, you need to use the '' |
- | To download data from the cluster onto your local directory, you need to use the get command, like this: | + | sftp> |
- | sftp> | + | For example, if you have to get a file called '' |
- | For example, if you have to get a file called results_matrix.mat from the folder results in your home directory | + | sftp> |
- | sftp> get / | + | Alternatively, |
- | Alternatively, | + | sftp> |
+ | sftp> | ||
+ | sftp> | ||
- | sftp> cd / | + | __NOTE__: If you have folder names that contain spaces, '' |
- | sftp> lcd /Users/Gab/project_results | + | If you have to download a folder, you will need to use the '' |
- | sftp> get results_matrix.mat | + | |
- | NOTE: If you have folder names that contain spaces, sftp would fail. For instance, something like that: sftp> lcd / | + | |
- | + | ||
- | If you have to download a folder, you will need to use the -r argument like that: | + | |
- | + | ||
- | sftp> get -r remote_dirpath local_dirpath | + | |
On the contrary, if you have to upload data from your local machine to the cluster, you will need to use the put command: | On the contrary, if you have to upload data from your local machine to the cluster, you will need to use the put command: | ||
- | sftp> put local_filename_path remote_dirpath | + | |
- | In this video, you will see how to transfer a Python code and a bash file to psychp01 using put. | + | In the video on page 20 of the pdf file on the [[cluster-guide|main page]], you will see how to transfer a Python code and a bash file to psychp01 using '' |
+ | ==== SCP ==== | ||
+ | '' | ||
+ | When transferring data, '' | ||
+ | scp source destination | ||
- | + | The first argument is the address of the source file to transfer, the second the address where it has to be transferred to. A good way to memorize it is to think that '' | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | scp | + | |
- | + | ||
- | scp (secure copy) is a command-line utility that allows you to securely copy files and directories between two locations. scp use requires a password, and both the files and password are encrypted so as to securely transfer data from one location to the other. scp uses the ssh protocol for both authentication and encryption. See here for my information. | + | |
- | + | ||
- | When transferring data, scp takes on two main arguments: | + | |
- | + | ||
- | scp source destination | + | |
- | + | ||
- | The first argument is the address of the source file to transfer, the second the address where it has to be transferred to. A good way to memorize it is to think that scp needs to know what to send where to. | + | |
For example, to transfer files from the remote cluster (source) to your local machine (destination), | For example, to transfer files from the remote cluster (source) to your local machine (destination), | ||
- | scp username@address_name: | + | |
+ | |||
+ | To transfer files from your local machine (source) to the remote cluster (destination), | ||
- | Suppose my username | + | scp pathname_local_src |
- | To transfer files from your local machine to the remote cluster, use: | + | |
- | scp < | + | Suppose my username |
- | Suppose the filename of the file (e.g., a MATLAB file .m) I need to transfer is best_analysis.m, | + | scp /Users/Gab/ |
- | scp /Users/ | + | Remember, your data will not be in your folder in the home directory but in your '' |
- | Remember, your data will not be in your folder in the home directory but in your MRIWork# folder in /MRIWork. Hence, to upload a data file (say, data.mat), you’d need to type: | + | scp /Users/Gab/ |
- | scp / | + | If you have to upload or download multiple files or a file that contains multiple file (e.g., a folder), now you’ll have a directory path (and not a file path), and you can use the '' |
- | If you have to upload or download multiple files or a file that contains multiple file (e.g., a folder), now you’ll have a directory path (and not a file path), and you can use the -r argument to reiterate the sending over all files like that: | + | scp -r dirpath_local_src username@psychp01.rhul.ac.uk:dirpath_remote_dest |
- | scp -r dirpath_local_src username@psychp01.rhul.ac.uk:dirpath_remote_dest | + | For example, if your directory path is to the folder called '' |
- | For example, if your directory path is to the folder called | + | scp -r /Users/Gab/analyses_folder |
- | scp -r /Users/Gab/ | + | If you have a whole data folder to transfer, you will upload it into your '' |
- | If you have a whole data folder to transfer, you will upload it into your / | + | |
- | + | ||
- | scp -r / | + | |
You would swap the two arguments if the folder is on the cluster, and you would need to get it onto your local computer: | You would swap the two arguments if the folder is on the cluster, and you would need to get it onto your local computer: | ||
- | scp -r username@psychp01.rhul.ac.uk: | + | |
- | For example, if your directory path is to the folder on the cluster called results_folder that you need to download into your analyses_folder on your local computer, you can type the following: | + | For example, if your directory path is to the folder on the cluster called |
- | scp -r gbellucci@psychp01.rhul.ac.uk:/ | + | |
- | rsync | ||
- | rsync, which stands for remote sync, is a remote and local file synchronization tool. It uses an algorithm to minimize the amount of data copied by only moving the portions of files that have changed. Please see here for more information. | + | ==== RSYNC ==== |
+ | '' | ||
- | sshfs | ||
- | sshfs allows you to mount the file system on your local machine. See here for more details. Basic usage for Linux users: | + | ==== SSHFS ==== |
+ | '' | ||
- | sshfs username@psychp01.rhul.ac.uk: | + | |
- | FileZilla | + | ==== FileZilla |
+ | '' | ||
- | FileZilla is a free and open-source File Transfer Protocol (FTP) client that supports ftp, ftps and sftp protocols. It allows the implementation of the above command-line programs through a graphical interface. Please have a look at this step-by-step guide on how to use FileZilla. | ||
+ | ==== ExpanDrive ==== | ||
+ | An alternative to File Transfer Clients like the one mentioned above is [[https:// | ||
- | ExpanDrive | + | The downside is that it is a non-free commercial tool. |
- | An alternative to File Transfer Clients like the one mentioned above is ExpanDrive. ExpanDrive is a network filesystem client for MacOS, Microsoft Windows | + | [[{: |
+ | [[{: | ||
- | The downside is that it is a non-free commercial tool. | ||
+ | ~~DISCUSSION|Discussion~~ |
cluster-file_transfer.1715087034.txt.gz · Last modified: 2024/05/07 13:03 by gabriele