Table of Contents

Introduction, UNIX Fundamentals


Accessing Your UNIX Account


A Bit of UNIX History

UNIX "standards": SysV and BSD


Some UNIX Features


UNIX File System Hierachy

            $ ls /

            bin/        df.txt   initrd/        media/  root/     sys/       var/
            boot/       etc/     lib/           mnt/    sbin/     tftpboot/
            denyhosts/  export/  linux-images/  opt/    selinux/  tmp/
            dev/        home/    lost+found/    proc/   srv/      usr/



            $ df
            Filesystem           1K-blocks      Used Available Use% Mounted on
            /dev/sda1               522028    404048    117980  78% /
            none                   1557628        48   1557580   1% /dev/shm
            /dev/sda2             10241088   8681048   1560040  85% /usr
            /dev/sda3               819232    639592    179640  79% /var
            /dev/sda5             21823584  20355644   1467940  94% /linux-images
            ...
            ...
            netapp:/home/cslab   286703264 129809216 156894048  46% /export/home

File System Organization

                   $ find /etc -name '*.conf' | less

Program organization

         $ whereis geany
         geany: /usr/bin/geany /usr/include/geany /usr/share/geany /usr/share/man/man1/geany.1.gz

The UNIX Philosophy or Style

(See also https://wikiless.tiekoetter.com/wiki/Unix_philosophy)

(See also http://www.faqs.org/docs/artu/ch01s06.html)

Avoid large, monolithic programs

# upside down cal
cal | tac
  
# number of processes that are associated with me
ps aux | grep jchung | wc -l
  
# ??????
wget -q -O - https://www.gutenberg.org/cache/epub/11231/pg11231.txt | sed 's/ /\n/g' | sed 's/[^A-Za-z0-9]*$//g' | sed 's/^[^A-Za-z0-9]*//g' | tr A-Z a-z | sort | uniq -c | sort -rn

Don't reinvent the wheel

Existing utilities


UNIX Shell Introduction

Environment variables

Shell config files

Shell command history

# Display your command history
history
   
...
   
548  cat .bash_history
549  man bash
550  nano .bashrc
551  source .bashrc
   
!549       # issues 'man bash' command again
!man       # reissues last command starting w/ 'man'
!nan       # reissues the 'nano .bashrc' command

Shell command and filename completion

Shell command aliases


Intro to Basic UNIX Utilities

Getting help: man pages

man -k vim   # Search for all man pages containing keyword 'vim'
            
eview (1)            - easy Vim, edit a file with Vim and setup for modeless editing
evim (1)             - easy Vim, edit a file with Vim and setup for modeless editing
gvim (1)             - Vi IMproved, a programmers text editor
gvimdiff (1)         - edit two, three or four versions of a file with Vim and show differences
gvimtutor (1)        - the Vim tutor
rgvim (1)            - Vi IMproved, a programmers text editor
rvim (1)             - Vi IMproved, a programmers text editor
vim (1)              - Vi IMproved, a programmers text editor
vimdiff (1)          - edit two, three or four versions of a file with Vim and show differences
vimtutor (1)         - the Vim tutor

The cat utility

cat filename
cat > fileFromCat.txt # The '>' means that keyboard input is 'redirected' to fileFromCat.txt
The first line
second line
third line
EOF          # EOF is usually entered using Control-D
   
cat fileFromCat.txt
   
The first line
second line
third line
# output contents of four files to screen
$ cat file1 file2 file3 file4

# output to a file, overwriting contents of allFilesTogether   
$ cat file1 file2 file3 file4 > allFilesTogether

# output to a file, appending to contents of allFilesTogether
$ cat file1 file2 file3 file4 >> allFilesTogether

# using a shell wildcard (*),
# cat the contents of all files whose names begin w/ 'file'; files are
# concatenated in sorted order, i.e. file1 file2 file3 file4
$ cat file*

Processes and jobs

File management

Permissions and security

Printing

Using the mouse

Secure Shell (ssh)

ssh some_host_name  # Example: ssh plato, ssh plato.monmouth.edu
ssh s1100841@plato  # or ssh s1100841@plato.monmouth.edu (if off-campus)