From: kremlin Date: Mon, 15 Sep 2014 20:52:17 +0000 (-0400) Subject: homework 2 X-Git-Url: https://uglyman.kremlin.cc/gitweb/gitweb.cgi?a=commitdiff_plain;h=5f59f2f79dd1cd6811e7c59e85150f443e14650f;p=assignments.git homework 2 --- 5f59f2f79dd1cd6811e7c59e85150f443e14650f diff --git a/assgn2/assgn2-1.sh b/assgn2/assgn2-1.sh new file mode 100755 index 0000000..e11f9a7 --- /dev/null +++ b/assgn2/assgn2-1.sh @@ -0,0 +1,21 @@ +cd /home/kremlin +echo "Printing contents of home directory" +ls -lah /home/kremlin +echo "cd'ing to \"Desktop\" (although I'm using a tiled WM that doesn't support the XDG Desktop directory)" +cd /home/kremlin/Desktop +cd +echo "Printing working directory" +pwd +echo "Creating \"Backups\" directory" +mkdir ~/Backups +echo "Writing name/SUID into /tmp/hw2" +# I thought you meant something about the SUID permissions bit at first :) +echo -ne "Ian Sutton\n417517518" > /tmp/hw2 +echo "Copying it to \"Backups\" folder" +cp /tmp/hw2 ~/hw2 +echo "Removing original" +rm /tmp/hw2 +echo "Listing contents of \"Backups\" folder" +ls ~/Backups +echo "Deleting \"Backups\" folder" +rm -rf ~/Backups diff --git a/assgn2/assgn2-2.sh b/assgn2/assgn2-2.sh new file mode 100755 index 0000000..da211b7 --- /dev/null +++ b/assgn2/assgn2-2.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +echo "cd'ing to root directory" +cd / +ls -lah | grep bin +echo "searching for file 'cpp' only one dir deep and displaying its file type.." +find . -maxdepth 1 -type f -name cpp -exec file {} \; +echo "printing the first 160 bytes of it in hex.." +find . -maxdepth 1 -type f -name cpp -exec xd {} \; | head -c 160 diff --git a/assgn2/assgn2.sh b/assgn2/assgn2.sh new file mode 100755 index 0000000..d5d2b1a --- /dev/null +++ b/assgn2/assgn2.sh @@ -0,0 +1,53 @@ +Ian Sutton - CSE 384 - Sept 9 2014 + +(1) The root directory is uppermost directory mounted on a filesystem, + usually written as "/". It is the first directory to be mounted + during boot, and the only directory to be mounted in the case of + emergency maintenance if booted in single-user mode. It contains + all the mountpoints for the other filesystems if the OS splits + system directories into seperate partitions. + +(2) The home directory contains perhaps 1 directory per user, named + after the user it is for. It contains that user's personal files. + A user almost certainly has write privileges to his/her home + directory. It is usually abbreviated as ~, and the `cd` command + with no arguments will cd to the executing user's home directory, + if it exists. + +(3) See screenshots, script replicated here: + +#!/bin/sh + +cd /home/kremlin +echo "Printing contents of home directory" +ls -lah /home/kremlin +echo "cd'ing to \"Desktop\" (although I'm using a tiled WM that doesn't support the XDG Desktop directory)" +cd /home/kremlin/Desktop +cd +echo "Printing working directory" +pwd +echo "Creating \"Backups\" directory" +mkdir ~/Backups +echo "Writing name/SUID into /tmp/hw2" +# I thought you meant something about the SUID permissions bit at first :) +echo -ne "Ian Sutton\n417517518" > /tmp/hw2 +echo "Copying it to \"Backups\" folder" +cp /tmp/hw2 ~/hw2 +echo "Removing original" +rm /tmp/hw2 +echo "Listing contents of \"Backups\" folder" +ls ~/Backups +echo "Deleting \"Backups\" folder" +rm -rf ~/Backups + +(4) See screenshots, script replicated here: + +#!/bin/sh + +echo "cd'ing to root directory" +cd / +ls -lah | grep bin +echo "searching for file 'cpp' only one dir deep and displaying its file type.." +find . -maxdepth 1 -type f -name cpp -exec file {} \; +echo "printing the first 160 bytes of it in hex.." +find . -maxdepth 1 -type f -name cpp -exec xd {} \; | head -c 160 diff --git a/assgn2/script1.png b/assgn2/script1.png new file mode 100644 index 0000000..39bb4c1 Binary files /dev/null and b/assgn2/script1.png differ diff --git a/assgn2/script2.png b/assgn2/script2.png new file mode 100644 index 0000000..54e127e Binary files /dev/null and b/assgn2/script2.png differ