Shell and DoC Systems, Lab 2
Remote Working, gitlab, and LabTS
Chapter 2: Remote Working
Copy file to /tmp
Let’s create the file ~/modules/shell/USERNAME.txt (replacing USERNAME with your own username, naturally).
Make sure that this file has the permissions -rw-r--r-- (i.e. only you can write to it, but everyone can read it).
Now we want to copy this file to the /tmp directory on your machine.
But what is /tmp? It is the “temporary directory”, where programs and users can store files which are only needed temporarily.
Never store valuable or sensitive data in /tmp! It could be deleted without warning.
So how do we copy files? We use the cp command from the first session (remember you can use man cp to see details about the cp command):
username@MACHINE:~$ cp path/to/original.txt path/to/destination.txt
Here we have copied one file, located at path/to/original.txt, to a new location, path/to/destination.txt.
cp can only be used to copy files within the machine you’re currently working on. We’ll see how to copy files between machines soon!
Exercise 2
- Create the file
~/modules/shell/USERNAME.txt(using your own username). Edit the file to add a message for your neighbour. - Copy the file to the
/tmpdirectory on your computer. - Use
lsto check that the file has been successfully copied.