Table of Contents

unix Keywords

Local Host

Definition

A “local host” is the local computer that a user is operating. A “local host” is also the standard name given to the loopback IP address of the network interface of a computer. This “local host” address is the address a computer can use to refer to itself when doing anything network or internet related.

Remote Host

Definition

A “remote host” is the term used to decsribe a remote system that users can connect to. Examples of a “remote host” would include webserver, file server or any system that allows remote client to connect to it.

Home Directory

Definition

The “home directory” is the directory for a particular user on a multi-user operating system. This directory contains all of the users settings and any files the particular user created.

Current Working Directory

Definition

The “current working directory” is the directory the user is currently residing in. A user can change there “current working directory” by issuing the “cd” or change directory command at the Linux command prompt.

Demonstration

Below is a sample that shows the “current working directory” and how to change the “current working directory”:

lab46:~$                   // This line shows that the current working directory is the home directory which is denotated by the "~" symbol.
lab46:~$ cd src            // This line shows the "cd" command being used and the directory name the user wants to switch to that is inside the home directory.
lab46:~/src$               // This line shows the result of the "cd" command that was issued. Note how the prompt has changed to show the new current working directory and its location to the home directory.

Types of Files

Definition

The Unix / Linux operating systems have 3 types of files which are, directory, regular, special.

The “directory” file type is a type of file that contains a list of other files and directories within it. these files are denotated with a “d” when a long directory listing is done.

The “regular” file type is the most common file type. These are the kinds of files that contain user data such as programs, documents, audio/video files, etc. these files are denotated by a hyphen when a long directoty listing is done.

The “special” file type encomapsses all other files that are not classified under the “directory” or “regular” types. These files include symbolic links which is denotated by an “l” when doing a long directory listing, a character deivce denotated by a “c”, a block device denotated by a “b”, etc.

Demonstration

Below is an example of the different file types found, note the information in the long directory listing.

system:/dev$ ls -l
crw------- 1 root root  10, 231 Jan 17 15:39 snapshot  //This is a character device which is a special file type, note the "c" designation for the character device file type.
drwxr-xr-x 2 root root       60 Jan 17 15:39 snd       //This is a "directory" file type, note the "d" designation for the file type.
lrwxrwxrwx 1 root root       24 Jan 17 15:39 sndstat -> /proc/asound/oss/sndstat  //This a also a special file type called a symbolic link, note the "l" designation for the file type.
-rw-r--r-- 1 user user      485 Feb 16 21:45 test.c    //This is a "regular" file type, note the "-" designation for the file type.
system:/dev$

The Unix Shell

Definition

The Unix Shell is the command line inteperter for Unix and Unix-like operating systems. This shell provides the user with a command line driven interface for the operating system. From this interface a user can execute programs, perform file manipulation and more. The Shell is also a scripting programming language for these operating system. Common operations performed with shell script include file manipulation, the execution of programs, and printing text.

Demonstration

Below is an example of the Unix Shell interface.

lab46:~$ cp test.c ~/script/test.c // Here file manipulation is occuring, the file test.c is being copied into the folder named "script" and is being named "test.c".
lab46:-$

Shell Scripting

Definition

Shell scripting is a programming language for the shell environment. Unline some programming languages this is a high level programming language. Shell scripts are most useful for program automation or when several programs need to be ran over and over. Instead of a user having to enter the commands over and over a script file can be created with the commands that are needed and then only the single script file needs to be executed, and in turn, the script will be read by the command interperter and the commands will be executed.

Demonstration

Below is an example of a Unix shell script. The script below will execute the mount command and mount a cd that is inserted in a cdrom drive at the mount point “/mnt/cdrom”. Then the script will then execute the cp command and copy the contents of the cdrom to a folder named “files” in the root directory. The the “tar” command is executed and the files located in the file/ directory are copied into an archive named “cdrom.tar”. Lastly the gzip command executes and conpressed the cdrom.tar archive.

/*
 * Sample Shell Script Code
 */
#!/bin/bash
mount /dev/cdrom /mnt/cdrom
cp /mnt/cdrom/file1*.* /files/
tar -cf cdrom.tar /files/*.*
gzip cdrom.tar

File Manipulation

Definition

File manipulation is the process of accessing a file or files for the purpose of performing some action upon them. These actions include but are not limited to reading the contents of a file, writing data to a file, deleting a file, changing the permissions on a file, etc.

Demonstration

Below is an example of file manipulation.

lab46:~$ cp file1 file2.txt                   //Here file manipulation occurs in the form of a file copy. The contents of file1 are being copied into a file named "file2.txt".
lab46:~$ rm file1                             //Here file manipulation occurs in the form of the deletion of the file named file1.
lab46:~$ echo "Hello World!" > file3.txt      //Here file manipulation occurs in the form of file creation and a file write procedure. The output of the echo command is piped into a file named "file3.txt". If this file didn't exist before, the file is created and then the output is written to the file.
lab46:~$ cat file3.txt                        //Here file manipulation occurs in the form of a file read. The file "file3.txt" is being read out and the contents are printed on the standard output device.
Hello World!
lab46:~/src$ 

unix Objective

unix Objective

The objective of this course is to gain a working knowledge of the Unix / Linux operating systems. This includes file manipulation, package management, shell scripting, desktop environments, etc.

Definition

This objective entails a systematic learning experience of the different parts of the Unix / Linux operating system from very basics such as file manipulation, to more advnace techniques such as shell scripting, which is the creation of scripts to automate certiant processes within the Unix / Linux operating system.

Method

By completing the labs and case studies associated with the course and by reading the text for the course and applying that knowledge to the course work I shall gain a mountain of knowledge of the Unix / Linux operating systems.

Measurement

Successfull completion of this course would entail gaining a working knowledge of the information gathered from the course and being able to demonstrate the knowleged that was obtained from the text and prior coursework.

Analysis

Reflect upon your results of the measurement to ascertain your achievement of the particular course objective.