{"id":2774,"date":"2019-03-20T11:02:05","date_gmt":"2019-03-20T11:02:05","guid":{"rendered":"http:\/\/ri.itservices.manchester.ac.uk\/csf3\/?page_id=2774"},"modified":"2025-10-27T12:37:35","modified_gmt":"2025-10-27T12:37:35","slug":"linux-mac","status":"publish","type":"page","link":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/filesystems\/file-transfer\/linux-mac\/","title":{"rendered":"Linux\/Mac command-line tools"},"content":{"rendered":"<h2>Command-line Tools<\/h2>\n<p>Linux and Mac users can use the command-line to transfer files. While GUI programs do exist, we find the command-line more reliable, if a little more difficult to begin with.<\/p>\n<p>Open a <em>Terminal<\/em> app on your Linux or Mac desktop to give yourself a command-line. The following commands can then be used. Please note, type them carefully (or cut-n-paste). The commands are sensitive to where the spaces occur and additional characters.<\/p>\n<p>In all of the commands below, replace <code><em>username<\/em><\/code> with your own IT username.<\/p>\n<h2>rsync<\/h2>\n<p>The <code>rsync<\/code> command is used to transfer files securely and efficiently between your PC\/laptop and CSF. No installation is usually needed on Linux or Mac systems (it is there by default). It is also available in Mobaxterm (Windows) when you start a <strong>local<\/strong> terminal (instead of the usual remote connection to the CSF).<\/p>\n<p>Rsync has some nice features for resuming interrupted transfers (no need to transfer everything again) and can be used to keep folders on your PC and the CSF in-sync \u2013 i.e., it can detect which files are new or have changed and only copy those.<\/p>\n<p>Below examples assume that you have opened a terminal at your <strong>local machine<\/strong> and that you have changed to the local directory where you want to transfer files to\/from (in MobaXterm specifically you may have to navigate to <code>\/drives\/c\/Users\/<em>your-user-name<\/em><\/code> to find your user&#8217;s local files). The commands are run <em>on your PC\/laptop<\/em>, NOT the CSF. Please type them carefully (notice the : between the CSF address and the file or folder names after it).<\/p>\n<ul>\n<li>Upload a file <em>from<\/em> your local machine <em>to<\/em> your CSF <em>home<\/em> directory (the <code>~<\/code> at the end is short-hand for <em>your CSF home folder<\/em>)\n<pre>rsync -avz myinput.dat <em>username<\/em>@csf3.itservices.manchester.ac.uk<strong>:~<\/strong><\/pre>\n<\/li>\n<li>Upload a file <em>from<\/em> your local machine <em>to<\/em> your CSF <em>scratch<\/em> directory\n<pre>rsync -avz myinput.dat <em>username<\/em>@csf3.itservices.manchester.ac.uk:~\/scratch\/<\/pre>\n<\/li>\n<li>Download a file <em>from<\/em> your CSF home directory to your local machine (don&#8217;t forget the <strong><code>.<\/code><\/strong> at the end to mean the <em>current folder<\/em> on your PC)\n<pre>rsync -avz <em>username<\/em>@csf3.itservices.manchester.ac.uk:~\/myresult.dat  <strong>.<\/strong><\/pre>\n<\/li>\n<li>Download a file <em>from<\/em> your CSF <em>scratch<\/em> directory to your local machine (don&#8217;t forget the <strong><code>.<\/code><\/strong> at the end to mean the <em>current folder<\/em> on your PC)\n<pre>rsync -avz <em>username<\/em>@csf3.itservices.manchester.ac.uk:~\/scratch\/myresult.dat  <strong>.<\/strong><\/pre>\n<\/li>\n<li>Download an entire directory <em>from<\/em> your CSF <em>scratch<\/em> area to your local machine (don&#8217;t forget the <strong><code>.<\/code><\/strong> at the end to mean the <em>current folder<\/em> on your PC)\n<pre>rsync -avz <em>username<\/em>@csf3.itservices.manchester.ac.uk:~\/scratch\/results_dir  <strong>.<\/strong><\/pre>\n<p>    <strong>!!Caution!!:<\/strong> Do NOT put a <code>\/<\/code> at the end of directory names as it changes the behaviour of rsync and may not do quite what you expect.\n    <\/li>\n<\/ul>\n<p>The <code>-avz<\/code> flag on the <code>rsync<\/code> command will run it in <em>archive<\/em> mode (it will transfer all files in a folder if a folder name is given instead of a filename and it will preserve the timestamps on files), it will be <em>verbose<\/em> (displaying filenames as it transfers them) and it will <em>compress<\/em> traffic to try to reduce the transfer time (files will be compressed before transfer and decompressed when received). Please check the <code>rsync<\/code> documentation using <code>man rsync<\/code> on your system.<\/p>\n<h3>CSF scratch cleanup and timestamps<\/h3>\n<p>If transferring files to your CSF scratch area, you may prefer to apply today&#8217;s timestamp to the file, rather than using the original timestamp on the source file. This is so that your file will have the full 3-months in the CSF scratch area before the <a href=\"\/csf3\/filesystems\/scratch-cleanup\/\">automatic scratch cleanup policy<\/a> deletes the file! In this case use:<\/p>\n<pre>\r\nrsync -rlvz myinput.dat <em>username<\/em>@csf3.itservices.manchester.ac.uk:~\/scratch\/\r\n<\/pre>\n<p>The <code>-rl<\/code> flag replaces the <code>-a<\/code> flag.<\/p>\n<h2>scp or sftp<\/h2>\n<p>The commands <code>scp<\/code> or <code>sftp<\/code> will both transfer files in a similar manner to <code>rsync<\/code>, although rsync offers more options.<\/p>\n<ul>\n<li>Upload a file <em>from<\/em> your local machine <em>to<\/em> your CSF home directory (don&#8217;t forget the <strong><code>:<\/code><\/strong> at the end)\n<pre>scp myinput.dat <em>username<\/em>@csf3.itservices.manchester.ac.uk:\r\n<\/pre>\n<\/li>\n<li>Upload a file <em>from<\/em> your local machine <em>to<\/em> your CSF scratch area\n<pre>scp myinput.dat <em>username<\/em>@csf3.itservices.manchester.ac.uk:~\/scratch\/<\/pre>\n<\/li>\n<li>Download a file <em>from<\/em> your CSF home directory <em>to<\/em> your local machine (don&#8217;t forget the <strong><code>.<\/code><\/strong> at the end to mean the <em>current folder<\/em> on your PC)\n<pre>scp <em>username<\/em>@csf3.itservices.manchester.ac.uk:results.out  <strong>.<\/strong><\/pre>\n<\/li>\n<li>Download a file <em>from<\/em> your CSF scratch area <em>to<\/em> your local machine\n<pre>scp <em>username<\/em>@csf3.itservices.manchester.ac.uk:~\/scratch\/myresults.dat  <strong>.<\/strong><\/pre>\n<\/li>\n<\/ul>\n<p>Remember that all of the above commands are run in a terminal on your laptop\/desktop that IS NOT logged-in to the CSF i.e. the commands are run on your local machine not on the CSF.<\/p>\n<div class=\"note\">\nIn newer version of macOS you will need to use additional option &#8216;<strong>-O<\/strong>&#8216; in your scp command to make it work.<br \/>\nE.g. <strong>scp -O myinput.dat u&#115;&#x65;&#x72;n&#97;&#x6d;&#x65;&#64;&#99;&#x73;&#x66;3&#46;&#x69;&#x74;s&#101;&#x72;&#x76;i&#99;&#101;&#x73;&#x2e;m&#97;&#x6e;&#x63;h&#101;&#x73;&#x74;e&#114;&#x2e;&#x61;c&#46;&#x75;&#x6b;:<\/strong>\n<\/div>\n<h2>More information<\/h2>\n<p>Please see the <code>man<\/code> for the command for more help (e.g., <code>man rsync<\/code>). Alternatively have a look at the online docs:<\/p>\n<ul>\n<li><a href=\"https:\/\/linux.die.net\/man\/1\/rsync\">rsync<\/a><\/li>\n<li><a href=\"https:\/\/linux.die.net\/man\/1\/scp\">scp<\/a><\/li>\n<li><a href=\"https:\/\/linux.die.net\/man\/1\/sftp\">sftp<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Command-line Tools Linux and Mac users can use the command-line to transfer files. While GUI programs do exist, we find the command-line more reliable, if a little more difficult to begin with. Open a Terminal app on your Linux or Mac desktop to give yourself a command-line. The following commands can then be used. Please note, type them carefully (or cut-n-paste). The commands are sensitive to where the spaces occur and additional characters. In all.. <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/filesystems\/file-transfer\/linux-mac\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":2767,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-2774","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/2774","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/comments?post=2774"}],"version-history":[{"count":19,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/2774\/revisions"}],"predecessor-version":[{"id":11270,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/2774\/revisions\/11270"}],"up":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/2767"}],"wp:attachment":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/media?parent=2774"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}