User Tools

Site Tools


opus:spring2012:rhensen:unixpart1

unix Keywords

Home Directory

Definition

The home directory is the main directory for each user on the system. When a user first logs on to a Unix system, their working directory will be their home directory. Each user has their own home directory in which they are the owner of all of the files. The home directory is specified by the ~ symbol.

Demonstration

To change to the home directory at any time, a user only has to enter the cd command.

lab46:/var/public/data/fall2010$ cd
lab46:~$ 

Current Working Directory

Definition

This is the directory that you are currently in and is the directory that will be shown in the command prompt. Any commands that reference files using a relative path name will use the current working directory as the starting point.

Demonstration

You can display the absolute path name of the current working directory by using the pwd (print working directory) command.

lab46:~$ pwd
/home/rhensen

Types of Files

Definition

In order for Unix to properly make use of certain files, it must know the type of file. Most files are regular files, such as text files, and are treated by Unix as simply a container or data. The next most common types of file are directories, which are used to contain other files. Aside from these two main types there are also different varieties of special files.

Demonstration

The type column of a listing of files is the leftmost character on each line. The top file is a regular file since it has a - in this field. The middle file is a directory since the type field displays a d. The last one is a type of special file called a link, which can be seen from the l.

-rw-r--r-- 1 rhensen lab46  30 Feb 10 23:12 lab03.txt
drwxr-xr-x 2 rhensen lab46   6 Jan 25 22:33 bin
lrwxrwxrwx 1 rhensen lab46  17 Jan 19 11:57 Maildir -> /var/mail/rhensen

Wildcards

Definition

A wildcard character is a symbol that is used to substitute for characters in a string. The question mark (?) symbol is used to represent one and only one character. The star (*) is used to represent zero or more characters. Square brackets ([]) can be used to match particular characters or a range of characters.

Demonstration

Alternatively (or additionally), if you want to demonstrate something on the command-line, you can do so as follows:

lab46:~$ ls file*
file1 file2 file3 file32 filea
lab46:~$ ls file?
file1 file2 file3 filea
lab46:~$ ls file[3]*
file3 file32

Tab Completion

Definition

In Unix, the Tab key can be used to complete the names of commands and path names that you have begun typing. Tab completions only work when the user has typed enough that there is only one command or path name that can be filled in by hitting Tab.

Demonstration

Here hitting Tab after each letter typed does nothing for t and te, but it eventually completes the line with an important command when tet is entered.

lab46:~$ t
lab46:~$ te
lab46:~$ tet
lab46:~$ tetris-bsd

$PATH

Definition

$PATH is an environment variable that is used to reference all of the directories within a user's search path. Whenever a command is entered, Unix will look through the directories specified in the $PATH variable in order to find that command. If this variable were not used, all commands would have to be entered with an absolute path name.

Demonstration

The value of $PATH can be displayed with the command “echo $PATH”.

lab46:~$ echo $PATH
/home/rhensen/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games

Local Host

Definition

The term local host refers to the computer that a user is currently at.

Demonstration

For example, I am currently accessing Lab 46 from my home computer using Putty. In this case my computer is the local host.

Remote Host

Definition

The term remote host refers to a machine that a user is able to access from across a network without being physically present at that machine.

Demonstration

For example, I am currently accessing Lab 46 from my home computer using Putty. In this case, Lab 46 is the remote host.

login as: login as:
login as:@lab46.corning-cc.edu's password:

unix Objective

unix Objective

My reason for taking this course is to gain familiarity with the Unix environment and develop a working knowledge how to essentially get Unix to do what I want it to.

Definition

For me, I feel that I have a good working knowledge of something when I am able to use my knowledge to solve a problem that I have not seen before. I believe that one of the most important skills to develop when working with computers is to be able to apply what you know to different situations.

Method

As I use Unix throughout the semester, either through assignments or during my own personal use, I will reflect on the ease with which I am accomplishing my desired actions.

Measurement

I will feel that I have become familiar with Unix when I am comfortable with a variety of commands, have an understanding of how the Unix shell operates, and most importantly when I am able to effectively use the manuals to better understand commands that I am not familiar with.

Analysis

This far into the course, I feel satisfied with my progress so far. I do not know a great deal of commands, but I know enough to navigate through the directories and perform some basic actions with files, such as copying. I am very comfortable with how to use path names, which is a major component of understanding any OS especially when using a CLI. I also have a good understanding of how to use certain features of the shell, such as wildcards and piping. One area that I am still having some difficulty with is using unfamiliar commands correctly. I know how to access the manual pages, but I am still finding that reading through these is difficult and it is sometimes hard for me to find useful information from these. I would like to become more comfortable with learning new commands and effectively using the documentation.

opus/spring2012/rhensen/unixpart1.txt · Last modified: 2012/03/01 14:56 by rhensen