Table of Contents

UNIX/Linux Fundamentals Journal

Week 1

January 24, 2014

The first order of business in Week 1 was to get my work area set up.

Lab 0x1 Basic Utilities and their Manual Pages

  1. ls - shows a list of files
  2. ls -l shows a long listing format
  3. Grep utility is 119Kb, Timestamp on cat utility is April 28 2010
  4. type “cd” to go to home directory, both the MOTD and the Lab1.text file are the same size
  5. mv lab1a.text src/lab1.file unix doesnt need a rename utility because mv takes care of both
  6. by creating a link, whatever you do in the /lab1 directory is also done in the /src directory
  7. typing “man 1 du” brings up section 1 of the du manual pages, using the “-h” argument will show size in human readable format. i assume -h is default because it looks the same with and without that argument
  8. using the -v argument will enable verbose (which exlpains what is being donw) and with the mv command a “–backup =control” will make a backup of each file being moved, and “-b” is the same but with no extra argument.

Lab 0x2

    1. cd / will switch to the root directory
    2. Permission is denied for the lost+found and root directories
    1. To get from root to my home directory i typed:
      cd home

      , then

      cd mb006142

      (my user name)

# Do the following: ## Change to the /tmp directory and run the pwd utility. ## What is your current working directory? - /tmp

4. For the following table, determine if the pathname is absolute or relative:

a.	src relative
b.	../../../../../usr/etc/../man/man2 - relative 
c.	/var/public/unix - absolute
d.	/usr/sbin - absolute

5. Record your current working directory and do the following:

a.	Change to the “.” directory. Check your present working directory.
b.	Did it change? Explain. no it did not because the "." is the current directory, so all i did was cd into the current directory 
c.	Change to the root (/) directory. Now change to the .. directory.
d.	Has your directory changed? Explain,  again it didnt change because the ".." specifies parent directory and the root directory has no parent directory.

6. Using the -l (dash ell) option to ls, look at files within the following directories and determine if they are predominantly regular, directory, or special files.

a.	/var/log - mostly compressed files
b.	/dev - special files
c.	/ - mostly directories
d.	/etc/init.d - mostly executable files and shell scripts

7. Change to the /usr/bin directory and take a look at the permissions on the vim utility.

a.	What user owns this file? - owner is shown as root 
b.	What can the owner do with the file? - 
c.	What can the group do with the file?  -    all users have read write and execute permissions
d.	What can anyone else on the system do with the file? -

8. View the permissions of the following files and determine their octal permissions:

a.	/var/log/daemon.log - 6 4 0
b.	/etc/resolv.conf -   6 4 4
c.	/usr/bin/split	- 7 5 5
d.	Your home directory - 7 1 1

9. Using symbolic notation:

a.	How would you assign write permission to the world? chmod o=w
b.	How would you remove the execute bit from the owning group? chmod u-x

10. Using the mkdir(1) utility, create a directory named lab2/ in your home directory. Then, using chmod(1), set the directory with octal permissions to the following criteria:

a.	give the directory full read/write/search for the owning user
b.	no permissions for group
c.	and search-only permission for other
d.	What was the exact incantation used? (combine parts a-c into one command-line) chmod 701 lab2

12. Explore the following:

a.	Investigate the various “bin” directories on the system.
b.	Prove that they are all independent entities (give a couple examples of proof).
/usr/local/plan9/lp/bin
/usr/lib/klibc/bin
/usr/lib/gprolog-iso/bin
/usr/lib/debug/usr/bin          THEY ALL HAVE DIFFERENT PARENT DIRECTORIES
/usr/lib/common-lisp/bin
/usr/bin

Lab 0x3

  1. Using the wc(1) utility on /etc/passwd:
    1. -How do you get wc(1) to display just the line count? - wc -l
    2. -How many lines are in the file? - 27
  2. Using the head(1) utility on /etc/passwd:
    1. -Display the first 16 lines of the file.
    2. -How did you do this? head -16 passwd
  3. Using the tail(1) utility on /etc/passwd:
    1. -Display the last 8 lines of the file.
    2. -How did you do this? tail -8 passwd
  4. Do the following:
    1. -Change to the /tmp directory.
    2. -Someone in the group create a file with a unique name, as agreed on by both people.
    3. -Fill the file with some initial data.
    4. -One group member should “tail -f” this file.
    5. -The other member should append text to the file by doing: echo “stuff” » /tmp/groupfile a couple times.
    6. -Be sure to switch roles so both group members see what is going on.

Lab 0x4