400 likes | 487 Views
CIT 500: IT Fundamentals. Hardware and Shells. Topics. Computer hardware CPU Memory Storage Shells Types of Shells Globbing Command History Command Line Editing I/O Redirection. Hardware to Provide Four Functions. The Boot Process.
E N D
CIT 500: IT Fundamentals Hardware and Shells
Topics • Computer hardware • CPU • Memory • Storage • Shells • Types of Shells • Globbing • Command History • Command Line Editing • I/O Redirection
The Boot Process The Basic Input/Output System (BIOS) setup program loads and runs. The Power-On-Self-Test (POST) runs. Bootloader runs. Operating system loads. OS starts user programs.
Motherboard Layout Floppy Drive Connector IDE Connectors Main ATX Power Connector SATA Hard Drive Connectors Memory (RAM) Sockets PCI Expansion Card Slots CPU Socket Rear I/O Panel
The Processor Aspects of performance • Clock speed (GHz.) • Instructions/clock cycle. • Number of cores. Architectures • IBM Power 5 • Intel Core 2 • AMD Athlon64
Processor Operation • Fetch instruction from RAM. • Decode instruction. • Translate instruction to micro ops. • Determine what data is operated on. • Execute instruction.
Inside a Processor Athlon block diagram from Anandtech.com.
System Memory (RAM) • Volatile, loses its contents when the power is turned off. • All program instructions must be loaded into RAM before execution. • Performance • Access time: time to first read is ~25ns. • Throughput: DDR3-1333 SDRAM is 8.53 GB/s.
Hard Disks Non-volatile magnetic storage. Capacities range from 80GB – 2 TB. Latency: ~8ms, Throughput: ~100 MB/s. Interfaces Parallel ATA (PATA) 133 MB/s Up to 2 HDs, ribbon cable. Serial ATA (SATA) 300 MB/s Up to 128 HDs, serial cable. SCSI: high end servers 400 MB/s Flexible interface for servers.
Hard Drive Components Enclosure Data Platters Read/Write Heads 40-Pin IDE Connector Jumpers Molex Power Connector
Hard Drive Form Factors 1 inch – Made to fit in a Compact Flash Card slot 1.8 inch – UltraLight Notebook PC’s, MP3 Players, Digital Video Cameras 2.5 inch – Notebook PC’s 3.5 inch – Desktop PC’s
Optical Storage Non-volatile optical storage Read-only, write-once, and read-write types. Double layer can double storage capacity. Slow: ~ 5 MB/s for CDs. Storage types CD (650 MB) DVD (4.7 GB) Blue Ray (25 GB)
Solid State Storage Solid State Drive • Battery-backed up DRAM or • Flash memory + DRAM cache. • Latency: ~25µs, Throughput: ~250 MB/s • No moving parts much higher reliability. USB Flash Drive • Small flash memory with USB interface. • Slow: ~20 MB/s
Factors in Choosing a Case Form Factors Rack-mount server Desktop Mid-Size Tower Full-Size Tower Little, Teeny, Tiny Cases (VSFF) External and Internal Drive Bays Front (Top) Panel Multi-Media Connectors Cooling System (can also add-on)
What is a shell? A command interpreter. • Runs external commands like cp and rm. • Built-in commands change shell environment: • cd – change directory • VAR=value • I/O redirection. • cat /etc/shells >shells • Ease of use • Command line editing, tab completion, history. • Programming • Conditionals, loops, etc.
How to change your shell? Change your login shell permanently. > chsh zsh Run another shell directly > echo $SHELL /bin/bash > zsh %
Shell Initialization Files Configure shell settings at login. • Create aliases. • Set environment variables. bash initialization files /etc/bash.bashrc System-wide startup file. ~/.bashrc User startup file.
Shell Metacharacters • Non-alphanumeric characters that have special meaning to the shell. • They cannot be used in shell commands. • Allow you to specify multiple files in multiple directories in one command line.
Globbing, a/k/a Wildcards ? Matches any one character. * Matches zero or more characters. [] Matches list of characters inside brackets.
Globbing > ls *html announce.html guidelines.html readings.html sites.html assignments.html index.html schedule.html > cd assignments > ls a[2-3]?html a2.html a3.html
Command History Up-arrow Previous command Down-arrow Next command history List old commands !! Previous command !# Command # !$ Last arg of previous command
Command line editing Ctrl-a Beginning of line Ctrl-e End of line Left-arrow Move back one character Right-arrow Move forward one character Ctrl-u Erase line Ctrl-c Abandon current line without executing any commands.
Filename completion TAB Completes filename TAB-TAB Show list of possible completions.
Aliases Creates a name for command + options. alias=command string Need quotes if there are spaces in command string. Examples alias copy=cp alias ll=“ls –al” alias cb=‘’cat ~/.bashrc”
Standard I/O STDIN • Default source of input. • Keyboard. STDOUT • Default output destination. • Screen. STDERR • Default error output destination. • Screen.
I/O Redirection Redirecting output command > outfile command >> outfile Redirecting input command < infile Redirecting error command 2> outfile Redirecting all at once command < infile > outfile 2> errorfile
I/O Redirection Examples Redirecting output ls –lR > /tmp/ls-lR man bash > bash-manual cat /etc/shells /etc/hosts > hosts-and-shells Redirecting input mail waldenj@nku.edu <assignment.txt Redirecting errors find / -name foo.txt 2>/dev/null
Piping Redirecting I/O from a program instead of a file. command1 | command2 Equivalent to command1 > /tmp/file command2 < /tmp/file rm /tmp/file
Pipe Examples Print the bash man page man bash | lpr Sort the list of files found in /etc ls /etc | sort Count the number of files in /etc ls /etc | wc –l Mail sorted list of files in /etc ls /etc | sort | mail waldenj@nku.edu
References • Syed Mansoor Sarwar, Robert Koretsky, Syed Ageel Sarwar, UNIX: The Textbook, 2nd edition, Addison-Wesley, 2004. • Lee Weiner, CIT 141 notes, 2009. • Nicholas Wells, The Complete Guide to Linux System Administration, Thomson Course Technology, 2005.