introductory concepts to computing natalie d. tourville january 20 th, 2009 atmospheric science...
TRANSCRIPT
Introductory Concepts to Computing
Natalie D. Tourville
January 20th, 2009
Atmospheric Science
Colorado State University
Summary of Topics
Operating system
Quick history of computing
Unix, Linux computing environments
Basic Unix commands
Shells – how to setup and use
Atmos Computing Environment
Getting help
Why care about the os?
Most critical software in a computer.
OS performance influences the performance of all software on a computerHow to extract the best performance out of an OS?How to work around design flaws? Write software
that takes advantage of the design of the OS
Why care about the os?
You need to understand enough to make informed decisions about things like: Buying and using a personal computer:Why do different PCs with the same CPU perform
differently?Should I get Windows XP? Windows 2000? Linux?
What’s the difference?Should I upgrade my hardware? Should I upgrade my
OS?What’s going on with my PC, especially when I have to
install something?Should I use disk compression? Is there a cost to using
it?
History of Computing
First generation 1945 - 1955 Technology: vacuum tubes & plugboards Programming: setting some switches Programming language: machine language Tasks: tables of sine, cosine, logarithms OS: none
Computer designer is: builder and programmer and operator and “sys admin”
History of Computers
Second generation 1955 – 1965 Technology: Transistors Programming: Punched cards Programming languages: FORTRAN & Assembly Tasks: Scientific Computer: Mainframes OS: Batch system
Universities started to buy computers (millions $)
Separation between computer designers, builders, operators, programmers and maintenance personnel.
– bring cards to IBM 1401 machine (good at card reading)– read cards to tape– put tape on IBM 7094 which does computing– put tape on IBM 1401 which prints output offline
History of Computing
• Third generation 1965 – 1980– Technology: Integrated circuits– Programming: Punched cards– Programming languages: FORTRAN & Assembly– Tasks: Scientific & commercial– Computers: IBM 360, DEC PDPs– OS: Multiprogramming/timesharing, spooling
• OSes Developed:– MULTICS (father of all modern OSes)– UNIX (System V, BSD)– POSIX – Portable Operating System Interface (by IEEE)– MINIX – 16 bit academic os (by Tanenbaum)– Linux (originated by Linus Torvalds, inspired by MINIX)
History of Computing
Fourth generation 1980-PresentProgramming: High level Programming languages: C/C++, Java, ……Computer: PC, rack mount systems, clustersOS: Windows, MacOS, Linux ……www.top500.org – 500 most powerful
computers
Cheap Desktop PCs
What is Linux?•Open source operating system
•Developed by Linus Torvalds at the U. of Helsinki in Finland since 1991.
•Under GNU GPL, its source code is free for everyone to download and use.
•One of the most popular, especially for a server markets
Linux
Source code can be modified to fit your need.
Quite portable – good for new hardware products
Supports various hardware platforms. Majority on x86
True multi-tasking operating system.
Being immunized against all kinds of viruses.
Linux
Linux supports many different types
Most commonly, ext2fs Filenames of 255 characters
File sizes up to 2GB+
File Systems 4TB+
Derived from extfs
Highly reliable and high performer
Many different flavors – Debian, RedHat, Ubuntu, Fedora, slackware, gentoo, etc.
Macintosh History
Mac OS X is a Unix-based operating system, built on technologies developed at NeXT between the second half of the 1980s and Apple's purchase of the company in early 1996
Mac OS X is based on the Mach kernel and is derived from the Berkeley Software Distribution (BSD)
named after large cats (leopard, tiger, etc)
Mac OS
Closed source with open source technology
Mac OS X's core is a POSIX compliant operating system (OS) built on top of the XNU kernel, with standard Unix facilities available from the command line interface.
Apple released this set of software as a free and open source operating system named Darwin.
On top of Darwin, Apple layered a number of components, including the Aqua interface and the Finder, to complete the GUI-based operating system which is Mac OS X.
Unix Basics
Access Control:“cd” “ls –l” and “chmod” commands rwx rwx rwx 7 7 7 rwx r_x r_x 7 5 5
Consulting the on-line manual man command
Compiling with “gcc” and “g++”
I/O Redirection
> Redirect output
< Redirect input
p & Run p in the background (try also jobs, ^Z, bg, fg, ps, and kill)
p1 | p2 Pipe output of p1 as input for p2
p >> f Append output of p into file f
Common operations
ls (list) command: directory’s contents (files and subdirectories)
• ls–l: in detail
• ls–a: hidden files also
• Wildcard: *: any string ?: any character
• Redirection: ls –l > somefile
• date: date and time
• whoami: current user
• finger a username: get someone’s login
Sample Unix commands
A subset of these commands are:
alias/unalias, bg, cat, cc, cd, chmod, cp, csh, diff, du echo, emacs, fg, gcc, grep, history, jobs, kill, ln, logout, lpq, lpr, lprm, ls, man, mkdir, more, mv, printenv, ps, pwd, rlogin, rm, rmdir, rsh, script, set, setenv, source tail, tar, telnet, touch, unset unsetenv uudecode, uuencode, vi, wc, which, xterm
Standard Files
UNIX concept of “standard files”
"standard input (where a command gets its input) -default is the terminal wc <input
"standard output (where a command writes it output) -default is the terminal ls -l >output
"standard error (where a command writes error messages) -default is the terminal
Create/edit a file
Vi, vim, gvim - http://bullium.com/support/vim.html
Emacs – http://refcards.com/docs/wingb/xemacs/xemacs-refcard-a4.pdf
Pico
joe
Any of you favorite editor
File Name ConventionsSome file names are special:
/ The root directory (don’t confuse with the root user)
. The current directory
.. The parent (previous) directory
~ My home directory
~jane - Jane’s home directory
Examples: ./a same as a
../jane/x go up one level then look in directory jane for x
pwd will tell where you are in the directory tree
Creating Files and Directories
Files can be created in a number of ways
The output of a command Being edited using vi or your favorite editor
By using the touch command which creates an empty file or updates the modification and access time information of an existing file
Directories are created using the mkdir command
Links
Links are references to files (aliases)
Two forms: HardSymbolicCan point to files on different physical devices Delete
of original leaves link / Delete of link leaves original Can be created for directoriesCreate using ln or ln -s command The ls –l command
will show you the links
File Permissions
Use the chmod command to change file and directory permissions
Important if you want to execute files/script or view web pages in your directory
The permissions are encoded as an octal number chmod 0755 file # Owner=rwx Group=r-x Other=r-x chmod 0500 file2 # Owner=r-x Group=--- Other=--- chmod 0644 file3 # Owner=rw- Group=r-- Other=r–
chmod +x file # Add execute permission to file for all chmod u-r file # Remove read permission for owner chmod a+w file # Add write permission for everyone
Getting around to other computers
ssh – secure protocol
telnet/ftp – insecure protocols
scp – secure copy transfer
ssh –Y – forward your X11 connections
mount
CSU VPN – recommended for accessing the CSU network from outside the network
Shells
sh - Bourne shell
the original csh - C shell -compatible with Bourne shell
bash - Bourne again shell -most common on Linux
tcsh - The enhanced C shell
zsh - Z shell -new, compatible with Bourne shell
ksh - Korn shell -most popular UNIX shell
Change your shell – chsh
Modify your shell - source
Bash shell - startupWhen Bash is invoked as an interactive login shell, or
as a non-interactive shell with the `--login' option, it first reads and executes commands from the file `/etc/profile', if that file exists.
After reading that file, it looks for `~/.bash_profile', `~/.bash_login', and `~/.profile', in that order, and reads and executes commands from the first one that exists and is readable. The `--noprofile' option may be used when the shell is started to inhibit this behavior.
When an interactive shell that is not a login shell is started, Bash reads and executes commands from `~/.bashrc’ (e.g. starting up a terminal).
Sample .bashrcThe ~/.bashrc file determines the behavior of the shell, and of shell
scripts. A proper understanding of this file can lead to more effective use of scripts.
#Setup: source this file in $HOME/.bashrc with following block$PATH=$PATH:/usr/bin:/usr/sbin:/bin:/sbin:.export PATH=$HOME/scripts:\$JAVA_HOME:/usr/share/java$JAVA_HOME/bin:/opt/javautil/bin:\# System shell commandsalias cp='cp -rvf’alias mv='mv -vf’alias ll='ls -l’alias la='ls -A’alias l='ls -CF’alias f='find . -name’alias s='sort’alias sdate='date +%d-%b-%Y’alias mdate='date +%d-%b-%Y_%H%M’alias ldate='date +%a_%d-%b-%Y_%H%M’alias psg='ps auxwww|grep -v grep | grep’alias hd='od -Ax -tx1z -v’alias printpath='readlink -f’alias tar='tar -vf’alias rsync='rsync -va’alias chmodx='chmod a+x’alias myip='nslookup `hostname`’alias reload='exec bash’# Application specfic commandsalias svnu='svn update’alias svnc='svn ci . -m’alias mb='mate $HOME/scripts/my.bashrc’alias ms='mate $HOME/scripts’#alias sshhub='ssh [email protected]'
Sample .cshrc file The .cshrc file in your home directory is read every time a new C-shell is
launched, and is used to ensure that the working environment is always correct. ----- Aliases ----- #
alias h history alias rm "rm i"
alias dir "ls -al | more" alias md mkdir alias rd rmdir
alias vt100 "set term=vt100" alias wy60 "set term=wyse60" # # ----- Environment Control ----- # mesg y # let other users write messages to my screen notify -y # inform me when mail arrives set history = 50 # remember the last 50 commands set path = ( /usr/bin /bin /usr/ucb/bin /usr/local/bin . ) #
Atmos Computing
Typically each group has own set of computers and or clusters for use to students.
Backbone network of 100 mbps to campus – gb backbone to annex, chemistry and acrc
Each group is different with a variety of platforms from Linux, Mac and Windows desktop
Atmos Computing
New computing facility located sw of the Annex
2000 sq ft with room for 84 racks
Tentatively scheduled for completion ~ January 2010
Current server room in middle of atmos build to accommodate 1970’s computing technology.
Modular components – AC and power
Getting Help
The Linux equivalent of HELP is man (manual)
"Use man -k <keyword> to find all commands with that keyword
"Use man <command>to display help for that command
#Output is presented a page at a time. Use b for to scroll backward, for a space to scroll forward and q to quit
Example – man ssh
Computing Help
System Administrator
internet/google for questions
Ask around – someone has already experienced the same problem you have
Questions?
Comments?