(Compatibility Mode
(Compatibility Mode
What is UNIX? Basic UNIX Commands Working with Directories Running Programs Editors The Shell Exercise
What is UNIX?
Unix is a operating system A software development environment Built in late '60s, early '70s by Ken Thompson and Dennis Ritchie Originally written in assembler, later rewritten in C (allowing greater portability), a language invented by Ritchie.
UNIX Features
Basic X Concepts
X Server runs on local machine
PC Apple Mac Exceed UNIX Workstation Included in OS Exodus
Basic X Concepts
Shell
Command Interpreter Programming language
UNIX Structure
UNIX Shells
C-Shell Bourne Shell Korn Shell T-Shell bash
Parts of UNIX
The kernel The standard utility programs The system configuration files.
The kernel
The kernel is the core of the Unix operating system. The kernel is a large program that is loaded into memory when the machine is turned on, and it controls the allocation of hardware resources from that point forward. The kernel knows what hardware resources are available (like the processor(s), the on-board memory, the disk drives, network interfaces, etc.), and it has the necessary programs to talk to all the devices connected to it.
Session Startup
Rules of Unix
UNIX is case sensitive Commands are in lower case Backspace and Del Keys correct typing errors Ctrl U clears the command line Ctrl C Aborts a program or command Do Not use the arrow keys
File System
All files are "flat": just a sequence of bytes File system is hierarchical
File System
File System
File System
Filenames
Filenames can comprise: a-z, A-Z alphabetic characters 0-9 digits .-_+ special characters mon+tue_01.06-03-96 Wildcards * means any character or sequence of characters
List Directory
ls ls -l ls -a
-rw------ l
list directory list directory in long format list all (inc. hidden) files
course01 57 Oct 18 11:05 hello.c
Access Permissions
more
filename
Copy a file cp oldfile newfile Rename a file mv oldname newname Remove a file rm afile
Searching Files
grep string file string = word or phrase file = file or list of files
Redirection
The output of a command usually goes to the screen Redirect the output to a file using > ls -l > dirlist
Piping
Feeding the output of one command into the input of another command The symbol | is called a pipe command | command eg: ls -al | more
ls -la | grep Nov
Manual Pages
Directories
print working directory change directory move to home directory move up one level move into a subdirectory move to an absolute directory
Running programs
Two modes of operation foreground and background
Foreground Interact with program via keyboard/screen Background No connection with keyboard/screen Submit to backbround by Appending & EG: myprog > myfile &
The symbols >& redirect output and any errors to the file myfile
Another method of submitting programs to the background is via a batch processing system, such as Sun Grid Engine (as used on Titania)
Kill a program Ctrl C Stop a program Ctrl Z Note a stopped program still exists in the system
ps -f -u username
UID PID PPID C STIME TTY username 24816 24585 0 16:23:04 pts/50 username 20169 19956 0 16:05:45 pts/50 username 24585 20169 0 16:35:07 pts/50
kill
kill 24585
Terminate process
Find its process ID (PID) using the ps command Kill the process using the kill command Sometimes kill on its own does not work so try
kill -KILL 24585
Setup
Add the following to your .cshrc file set filec
eg: Setup
!vi
Setup
Add alias definitions to your .cshrc file