The unix programming environment
Edition 2.0, June 1997
Mark Burgess
Centre of Science and Technology
Faculty of Engineering, Oslo College
Foreword
Welcome
Overview
What is unix?
Flavours of unix
How to use this reference guide
NEVER-DO's in UNIX
What you should know before starting
One library: several interfaces
Unix commands are files
Kernel and Shell
The role of C
Stdin, stdout, stderr
The superuser (root) and
nobody
The file hierarchy
Symbolic links
Hard links
Getting started
Logging in
Mouse buttons
E-mail
Simple commands
Text editing and word processing
The login environment
Shells
Shell commands generally
Environment and shell variables
Wildcards
Regular expressions
Nested shell commands and "
UNIX command overview
Important keys
Alternative shells
Window based terminal emulators
Remote shells and logins
Text editors
File handling commands
File browsing
Ownership and granting access permission
Extracting from and rebuilding files
Locating files
Disk usage.
Show other users logged on
Contacting other users
Mail senders/readers
File transfer
Compilers
Other interpreted languages
Processes and system statistics
System identity
Internet resources
Text formatting and postscript
Picture editors and processors
Miscellaneous
Terminals
The X window system
The components of the X-window system
How to set up X windows
X displays and authority
Multiple screens
Files and access
Protection bits
chmod
Umask
Making programs executable
chown and chgrp
Making a group
s-bit and t-bit (sticky bit)
C shell
.cshrc and .login files
Defining variables with set, setenv
Arrays
Pipes and redirection in csh
`tee'
and
`script'
Command history
Command/filename completion
Single and double quotes
Job control, break key,
`fg'
,
`bg'
Unix Processes and BSD signals
Child Processes and zombies
C-shell builtins:
`jobs'
,
`kill'
,
`fg'
,
`bg'
, break key
Scripts with arguments
Sub-shells ()
Tests and conditions
Switch example: configure script
Loops in csh
Input from the user
Extracting parts of a pathname
Arithmetic
Examples
Bourne shell
.profile
Variables and export
Stdin, stdout and stderr
Arithmetic in sh
Scripts and arguments
Return codes
Tests and conditionals
Input from the user in sh
Loops in sh
Procedures and traps
setuid and setgid scripts
Summary: Limitations of shell programming
Exercises
Perl
Sed and awk, cut and paste
Program structure
Perl variables
Scalar variables
The default scalar variable.
Array (vector) variables
Special array commands
Associated arrays
Array example program
Loops and conditionals
The for loop
The foreach loop
Iterating over elements in arrays
Iterating over lines in a file
Files in perl
A simple perl program
== and
`eq'
chop
Perl subroutines
die - exit on error
The
stat()
idiom
Perl example programs
The passwd program and
`crypt()'
function
Example with
`fork()'
Example reading databases
Searching and replacing text
Example: convert mail to WWW pages
Generate WWW pages automagically
Other supported functions
Summary
Exercises
Project
WWW and CGI programming
Permissions
Protocols
HTML coding of forms
Interpreting data from forms
A complete guestbook example
C programming
Shell or C?
C program structure
The form of a C program
Macros and declarations
Several files
A note about UNIX system calls and standards
Compiling:
`cc'
,
`ld'
and
`a.out'
Libraries and
`LD_LIBRARY_PATH'
Include files
Shared and static libraries
Knowing about important paths: directory structure
Make
Compiling large projects
Makefiles
New suffix rules for C++
argv, argc and envp
Environment variables in C
Text parsing tools:
`lex'
and
`yacc'
Files and directories
opendir, readdir
System structs
lstat and readlink
stat() test macros
readdir() example program
Process control, fork, exec, popen and system
Traps and signals
Difficult example: Process table
Device control: ioctl
Exercises
Network Programming
Sockets
NIS - The Network Information Service
DNS - The Domain Name Service
nslookup
gethostbyname()
NFS
C support for NFS
Exercises
Basic System Administration
Booting and shutting down the system
The boot procedure
The shutdown procedure
Mount, export and filesystems
`mount'
and
`umount'
Disk device names
Automating Mounts
Mount options and cross mounting
exports or share
Passwords, groups and netgroups
DNS/BIND: /etc/resolv.conf and /etc/host.conf etc
Network interface configuration: ifconfig
cfengine -- who needs a script?
Summary
Summary of programming idioms.
Command and Variable Index
Concept Index
This document was generated on 24 June 1997 using the
texi2html
translator version 1.50.