SCP & SSH by Mac Terminal CLI or Command Line Interface
Video Instructions
Back-Up Your Files, Folder, and Data!!
MAKE BACKUPS OR COPIES OF YOUR IMPORTANT FILES!!! Google the cp command in Linux.Or use OneDrive. See Office 365 -- OneDrive. Or Github or Gitlab or some other solution.
FILES CAN BE BE REPLACED OR COPIED OVER WITHOUT ANY WARNING!Quick Tips
- SCP or Secure Copy Protocol lets you securely copy files or folders between two machines/computers/servers/hosts.
- scp is the CLI command, or Command Line Interface command.
- scp needs you to specify the source you are copying from & destination to copy to.
So...
scp source_file_or_folder destination_file_or_folder - Specify source (where you copy from) 1st & destination (where you copy to) 2nd.
- Always refer to the machine you are *not on* with userid@host:/file/folder/path
- Always refer to the machine you are *on* with just /file/folder/path
- Check file paths. Mistyped file paths are a very common error.
Using SSH
DO NOT use the ssh command at all in the same Terminal window.
If you ssh into Tux, you won't be able to scp to/from your local computer (normally).
Commands below:
ssh MacUserId@tux.cs.drexel.edu
or...
ssh mjg88@tux.cs.drexel.edu
- Connect to remote Tux host.
- A password prompt will then be displayed. Please type in your password it will remain invisible the whole time. Once you type it in, simply hit Enter or Return key on your keyboard.
Using SCP
Below are example of how to use SCP.
For ALL of these examples:
- "MacUserID" is your Mac login userid.
- "yourTuxUserid" is your Tux userid.
- Do not use mjg88 as either your Tux or Mac login userid.
- mjg88 is an example for either userid.
- pwd command prints outs (shows you) your current folder (working directory) and the full file or folder path of it
- ls command lists the files or folders in the current folder (working directory)
- cd /path/to/folder changes directory, or navigates to, a different directory or folder
- cd sub_folder_name changes directory, or navigates to, a sub-directory or sub-folder of the current folder or directory you are in.
- cd ../ changes to the parent directory or goes up one folder level
- cd changes directory to your home directory or folder
Example 1
scp yourTuxUserid@tux.cs.drexel.edu:temp.txt /Users/MacUserId/Desktop/
or...
scp mjg88@tux.cs.drexel.edu:temp.txt /Users/mjg88/Desktop/
- Copying temp.txt from your remote Tux home folder to your local Mac computer's desktop folder.
Example 2
scp yourTuxUserid@tux.cs.drexel.edu:temp.txt
or...
scp mjg88@tux.cs.drexel.edu:temp.txt
- Copying a file named temp.txt from your remote Tux home folder to your local Mac computer.
- You already navigated in the Terminal CLI on your Mac to the folder (directory) that you want to copy the file to.
- You are not renaming the file.
- So you do not need to specify the destination file or file path.
Example 3
scp temp.txt yourTuxUserid@tux.cs.drexel.edu:temp.txt
or...
scp temp.txt mjg88@tux.cs.drexel.edu:temp.txt
- Copying a file named temp.txt from your local Mac to your remote Tux home directory.
- You already navigated in the Terminal CLI on your Mac to the folder (directory) that you want to copy the file from.
Example 4
scp /Users/MacUserId/Desktop/temp.txt yourTuxUserid@tux.cs.drexel.edu:temp.txt
or...
scp /Users/mjg88/Desktop/temp.txt mjg88@tux.cs.drexel.edu:temp.txt
- Copying a file named temp.txt from your local Mac's Desktop folder to your remote Tux home directory.
Example 5
scp yourTuxUserid@tux.cs.drexel.edu:test.txt /Users/MacUserId/Desktop/
or...
scp mjg88@tux.cs.drexel.edu:test.txt /Users/mjg88/Desktop/
- Copy the file test.txt from the remote Tux host to your local Mac's Desktop folder
Example 6
scp /Users/MacUserId/Desktop/test.txt yourTuxUserid@tux.cs.drexel.edu:
or...
scp /Users/mjg88/Desktop/test.txt mjg88@tux.cs.drexel.edu:
- Copy the file "test.txt" from your local Mac's Desktop folder to the remote Tux host
Example 7
scp -r test_folder/ yourTuxUserid@tux.cs.drexel.edu:test_folder
or...
scp -r test_folder/ mjg88@tux.cs.drexel.edu:test_folder
- Copy the folder "test_folder" from your local Mac to the user's remote Tux host home directory
Example 8
scp -r test_folder/ yourTuxUserid@tux.cs.drexel.edu:test-folder-newnameor...
scp -r test_folder/ mjg88@tux.cs.drexel.edu:test-folder-newname
- Copy the folder "test_folder" from your local Mac to the user's remote Tux host home directory, and rename it as "test-folder-newname"
Example 9
scp -r "test folder"/ yourTuxUserid@tux.cs.drexel.edu:"test folder"
or...
scp -r "test folder"/ mjg88@tux.cs.drexel.edu:"test folder"
- Copy the folder "test folder" (space in the name) from your local Mac to the user's remote Tux host home directory
Example 10
scp -r "test folder"/ yourTuxUserid@tux.cs.drexel.edu:"test folder newname"
or...
scp -r "test folder"/ mjg88@tux.cs.drexel.edu:"test folder newname"
- Copy the folder "test folder" (space in the name) from your local Mac to the user's remote Tux host home directory, and rename it as "test folder newname"