UNIX Basics


UNIX is a powerful command line operating system. There are GUI versions available, but they're really just add-ons for the command line inhibited. It was developed at Bell Labs in 1969 and is now being developed by many other corporations. Its main use is as a multi-user server environment, which is ironic since it's name is a play on the name "Multics." UNIX was a "simpler" OS. Since UNIX has been around for so long, people have created countless shortcuts and workarounds to mask any weakness that UNIX had.  
(Source: Technical Glossary)

UNIX commands consist of three parts, the command, option switch and argument.
These may be used in one of the following methods:

Useful unix commands:

Command

Function

ls List files subdirectories in current directory
cd Change a directory
cd .. Change back or up ONE directory
chmod Change permissions (see Web Page Faq's for permissions)
chgrp Change group ownership of file or directory
chown Change owner of file or directory
cp Copy file or direcotry
mkdir Make a directory
mv Move a file or directory
rm Remove (delete) a file or directory
VERY IMPORTANT-There is NO "undo" function in UNIX
rmdir Remove directory

Options for the ls command:

Option Switch Function
-a List all entries, including those that begin with a dot (.), which are normally not listed.
-A List all entries, including those that begin with a dot (.), with the exception of the working directory (.) and the parent directory (..).
-b Force printing of non-printable characters to be in the octal \ddd notation.
-c Use time of last modification of the i-node (file created, mode changed, and so forth) for sorting (-t) or printing (-l or -n). 
-C Multi-column output with entries sorted down the columns. This is the default output format.
-d If an argument is a directory, list only its name (not its contents); often used with -l to get the status of a directory.
-f  Force each argument to be interpreted as a directory and list the name found in each slot. This option turns off -l, -t, -s, and -r, and turns on -a; the order is the order in which entries appear in the directory.
-F Mark directories with a trailing slash (/), doors with a trailing greater-than sign (>), executable files with a trailing asterisk (*), FIFOs with a trailing vertical bar (|), symbolic links with a trailing at-sign (@), and AF_UNIX address family sockets with a trailing equals sign (=).
-g The same as -l, except that the owner is not printed.
-i For each file, print the i-node number in the first
column of the report.
-l List in long format, giving mode, ACL indication, number of links, owner, group, size in bytes, and time of last modification for each file (see above). If the file is a special file, the size field instead contains the major and minor device numbers. If the time of last modification is greater than six months ago, it is shown in the format `month date year' for the POSIX locale. When the LC_TIME locale category is not set to the POSIX locale, a different format of the time field may be used. Files modified within six months show `month date time'. If the file is a symbolic link, the filename is printed followed by "->" and the path name of the referenced file.
-L If an argument is a symbolic link, list the file or directory the link references rather than the link itself.
-m Stream output format; files are listed across the page, separated by commas.
-n The same as -l, except that the owner's UID and group's GID numbers are printed, rather than the associated character strings.
-o The same as -l, except that the group is not printed. 
-p Put a slash (/) after each filename if the file is a directory.
-q Force printing of non-printable characters in file names as the character question mark (?).
-r Reverse the order of sort to get reverse alphabetic or oldest first as appropriate.
-R Recursively list subdirectories encountered.
-s Give size in blocks, including indirect blocks, for each entry.
-t  Sort by time stamp (latest first) instead of by name.The default is the last modification time. (See -u and -c.)
-u Use time of last access instead of last modification for sorting (with the -t option) or printing (with the -l option).
-x Multi-column output with entries sorted across rather than down the page.

Helpful Hints:

Command Line Editing

The default shell for the student server, the faculty/staff server and the monolith workstations is the korn shell.  By default, we have command line editing enabled for the korn shell using vi editor commands.  In MSDOS the up and down arrows can be used to recall previous commands issued at the command prompt.  Unix can do this also but the method of access is different.  Press the "Esc" key and then the "-" key to activate command line editing.  The last command issued will be displayed on the screen.  If you want to use it again, simply press the "return" key.  If you want to edit it before using it, use vi editor commands on the line before pressing the "return" key.  Be warned that the left and right arrow keys do not work as editing keys but the "h" and "l" keys do work.  If you want to recall a command used farther back, continue pressing the "-" key until the correct command appears.  If you overshoot the command, you can go forward by pressing the "+" key.

Default Shell

Although the default shell is normally the korn shell (ksh), it is possible to change your default shell to another shell.  The most popular alternative to the korn shell is the bash shell.  The bash shell has command line editing also and it uses the normal up and down arrows to recall previous commands.  Shell scripts run with the bash shell will behave differently than shell scripts run with the korn shell.  If you want to change your default shell to the bash shell, contact the helpdesk. Keep in mind that only the korn shell is officially supported by ITS.


FAQ's | ITS | CBU Home
Christian Brothers University
Maintained by: Webmaster
Copyright © Christian Brothers University, Memphis, Tennessee