1 Ian Sutton
- CSE
384 - Sept
9 2014
3 (1) The root directory is uppermost directory mounted on a filesystem
,
4 usually written as
"/". It is the first directory to be mounted
5 during boot
, and the only directory to be mounted
in the
case of
6 emergency maintenance
if booted
in single
-user mode. It contains
7 all the mountpoints
for the other filesystems
if the OS splits
8 system directories into seperate partitions.
10 (2) The home directory contains perhaps
1 directory per user
, named
11 after the user it is
for. It contains that user
's personal files.
12 A user almost certainly has write privileges to his/her home
13 directory. It is usually abbreviated as ~, and the `cd` command
14 with no arguments will cd to the executing user's home directory
,
17 (3) See screenshots
, script replicated here
:
22 echo "Printing contents of home directory"
24 echo "cd'ing to \"Desktop\" (although I'm using a tiled WM that doesn't support the XDG Desktop directory)"
25 cd /home
/kremlin
/Desktop
27 echo "Printing working directory"
29 echo "Creating \"Backups\" directory"
31 echo "Writing name/SUID into /tmp/hw2"
32 # I thought you meant something about the SUID permissions bit at first :)
33 echo -ne "Ian Sutton\n417517518" > /tmp
/hw2
34 echo "Copying it to \"Backups\" folder"
36 echo "Removing original"
38 echo "Listing contents of \"Backups\" folder"
40 echo "Deleting \"Backups\" folder"
43 (4) See screenshots
, script replicated here
:
47 echo "cd'ing to root directory"
50 echo "searching for file 'cpp' only one dir deep and displaying its file type.."
51 find .
-maxdepth 1 -type f
-name cpp
-exec file {} \
;
52 echo "printing the first 160 bytes of it in hex.."
53 find .
-maxdepth 1 -type f
-name cpp
-exec xd
{} \
; | head -c 160