Peer Tutor P1 W3
Peer Tutor P1 W3
Aim
Execute simple shell commands to practice relative and absolute paths.
Practice commands: rm , mkdir, rmdir, touch, cat , cp , mv, pwd, whoami
Get help using: man
Guidelines
- Use your ubuntu server environment to complete these tasks.
- Use "Tab competition" as much as possible
- Copy your commands or screenshots into this document.
- "Your user's home directory" is /home/yourusername
"The home directory" is /home.
Tasks
1. Your environment:
a. What is your present working directory when you log in? /home/jolonas
How can you find out? pwd
c. Are you root? Do you have privileged access? Are you an administrator? Ik
ben root, heb privileged acces en ben administrator
How can you see that? root: whoami, privileged acces en administrator:
groups
If you used an absolute path, move back to "tmp" folder and use a relative
path. Command? cd tmp
If you used a relative path, move back to "tmp" folder and use an absolute
path. Command?
Copy the file to the /tmp folder using absolute paths. Command? cp ~/hello.txt
/tmp/
Which command can you use to check if the file was copied? (without using
the cd command)? ls /tmp/hello.txt
Copy the file to the /tmp folder using relative paths. Command? cp hello.txt
/tmp/
Which command can you use to check if the file was copied? (without using
the cd command)? ls /tmp/hello.txt
c. Create an empty file named "byebye.txt" in your home directory using the
"touch" command.
Move the file to the folder /tmp.
3. How can you see the contents of the text file "syslog"
The file is located in the folder /var/log
Command? cat /var/log/syslog
cp -u
b. Which option do you use with mkdir so that "parent directories" are created
when needed.
In other words, which option do you need to create subfolders and their
parent folders at once.
mkdir -p
c. Which options do you use with ls to see file sizes in an easy to read way. By
default file sizes are listed in quantity of bytes, but for us it is easier to
understand file sizes with units, eg. 1.2M rather than 1171868 bytes
ls -h