Chapters 1,2,4,5 - GoZips.uakron.edu

advertisement
2440:145 Introduction to UNIX/Linux
Study Guide #1
The University of Akron
Summit College
Dept of Business Technology
Computer Information Systems
Components of an Information System
 The six basic components of a computer information system are hardware, software, procedures, data,
people, and network.
o Software (program) – a set of instructions that direct the computer to accomplish certain tasks
 The two major categories of software are: system software and application software.
 System Software – enables the application software to interact with the
computer hardware. There are 4 types of system software: operation systems,
utility software, device drivers, and programming languages.
 Application Software –”end-user” software that performs useful tasks such as
word processing, desktop publishing, etc. Kinds of application software
include: word processing, spreadsheet, database, and presentation and
communication software.
Operating Systems
 The operating system is software that helps other programs control the computer hardware and interact with
users. An operating system consists of:
o Kernel – the core of the operating system which allocates computer resources such as memory
and CPU time between multiple applications
o Device drivers – software that permits the kernel to access hardware devices such as a keyboard,
mouse, hard disk, scanner, or network card
o Basic Input/Output System (BIOS) – provides the basic input/output functions to communicate
with system devices, such as monitors, keyboard, disks, etc
o Application Programming Interface (API) – software designed to communicate with the
application software and the user
 Shell – software that accepts input from a user via a command line and processes that
input to manage system resources
o Utility programs – software programs that manage the hardware and operating system features
The UNIX Operating System
 UNIX is a multiuser, multitasking operating systems with built-in network functions. Consists of:
o Kernel – main program to control the CPU and all other hardware
o Filesystem – a structure for keeping and locating data in files on the hard drive
o Utilities – a collection of user and system programs
 Several UNIX versions include: AT&T UNIX version V, Berkeley UNIX (FreeBSD), Solaris,
UnixWare, Linux
The Linux Operating System
 Linux is a UNIX-like operating system kernel. Some popular Linux versions include: Ubuntu, Red Hat,
Fedora, OpenSuse, Debian, Knoppix , OpenSolaris, Linux Mint, CentOS, Mandriva, Gentoo Linux
The Unix/Linux Shell
 Shell – a command interpreter that accepts input from the keyboard to control the computer system. Common
types of Linux shells include:
o Bourne shell (sh) – the original UNIX shell
o Bourne Again shell (bash) – an enhanced and extended version of the Bourne shell created by the
GNU Project. The default Linux shell.
o C shell (csh) – the first to contain history, tab completion features, etc
o Korn shell (ksh) – a proprietary revised Bourne shell with interactive features of the C shell
o TC shell (tcsh) – enhancement of the C shell commonly used on Linux as the C shell
o Public domain Korn shell (pdksh) – a free version of the Korn shell
Major Functions of a UNIX/Linux Shell
 The seven main functions of UNIX/Linux shells are:
o Command Execution – major function of the shell to analyze and execute commands
Document1
Enoch E. Damson
Page 1 of 4
2440:145 Introduction to UNIX/Linux
Study Guide #1
o
o
o
o
o
o
The University of Akron
Summit College
Dept of Business Technology
Computer Information Systems
Filename Substitution – substitutes characters in filenames with the asterisk (*) and question
mark (?)
Input/Output Redirection – redirects outputs and inputs to/from files
Pipes – connect the out of a command to another command
Environment Control – customizes the shell environment using appropriate variables
Background Processing – runs programs in the background while performing other tasks
Shell Scripting – sequences commands in a shell script (file) to be executed
Common Unix/Linux Shell Commands
 su – changes the effective UID to take on another user’s identity
 man – displays the online manual
 passwd – changes the current password
 date – displays the current date and time on the screen
 cal – displays the calendar for the specified year
 who – shows who is logged in to a system
o who am i – displays information the current logged in user
o who - -count – displays the name and number of users
o who –b – displays the time and date of the last reboot
 alias – assigns a string of characters to a substitute string of characters
 unalias – removes an alias for a command.
 history – displays all stored commands in the history list
UNIX/Linux File System
 File system – arrangement of information on a storage device. E.g. FAT, NTFS (Windows), ext2, ext3 (Linux)
o The UNIX/Linux storage disk structure is divided into the following four blocks (regions):
o Boot blocks – holds the boot program
o Superblock – a record containing detailed status information about a file system.
o i-node – data record, identified by an ID number in a file system
o Files and directories block – record within a file system that contains file/directory name and
their i-nodes
 Files – the 3 types of UNIX/Linux files are:
o Regular files – contain sequence of bytes
o Directory Files – contain information about other files
o Special Files – has specific information about devices
Common Unix/Linux File System Commands
 pwd – displays the current working directory
 mkdir – creates directories
 rmdir – deletes directories
 touch – creates a new, empty file, or updates the timestamp of an existing file
 rm – deletes files
 ls – lists files
 cd – changes to a different directory
 cp – copies files from one directory to another
 mv – moves files from one directory to another
 ln – creates links between an existing file and another filename or directory to allow more than one name
 lp or lpr – prints a file as it is without changing the appearance or format of the file
 lpstat – shows the status of the print jobs
 cancel – cancels a print job
Unix/Linux Shell Redirections
 The Unix output redirection operators are:
o > stores the output of a process in a file
o >> appends the output of a process into a file
Document1
Enoch E. Damson
Page 2 of 4
2440:145 Introduction to UNIX/Linux
Study Guide #1


The University of Akron
Summit College
Dept of Business Technology
Computer Information Systems
The Unix input redirection operators are:
o < issue commands that get their input from a specified file
o << issue commands that append their input from a specified file
The pipe (|) connects the output channel of one command to the input channel of another command
Common UNIX/Linux Shell Environment Symbols
 ;
Separate commands on one line. E.g. ls ; date; pwd
 & Run process in background. E.g. date &
 !n Repeat command number n (from the history of commands). E.g., !5
 \
Quote following character literally
 “ “ Literal string to remove the meaning of metacharacters except for dollar sign ($), grave accept (`) and the
double quotes (“)
 ‘ Literal string to remove the meaning of metacharacters except for the single quotes (‘)
 ` ` Command substitution to insert a command’s output as an argument to anther command
 $v Access or display value stored in a variable v. E.g. echo $PS1
 ( ) Execute commands in a group. E.g. (ls ; date; pwd)
 [ ] Match any characters enclosed
 > redirect the output of a process into a file
 >> appends the output of a process into a file
 < redirect input from a file
 << redirect input from a file
 |
Pipe (redirect) output of a command to another command
UNIX/Linux File/Text Processing Commands
 cat – creates files, concatenates files, or displays contents of files
 more – displays long files one screen at a time and only allows scrolling down a file
 less – displays long files and allows for scrolling up and down in a file
 head – displays the first few lines of a file. Shows the first 10 by default. –n displays first n lines
 tail – displays the last few lines of a file. Shows the last 10 by default. –n displays last n lines
 pg – displays files one screen at a time
 find or locate – locates files that match a given set of criteria
 wc – counts the number of lines (-l), bytes or characters (-c), or words (-w) in a file
 cut – “cut out” specific columns or fields from a file
 paste – join files together line by line or create new files by pasting fields from two or more files together
 pr – provides formatted files before printing or viewing it on the screen
Unix/Linux Filename Substitution Metacharacters
 . or ? – matches any single character
 * – matches zero or more characters, including empty string

[list] – matches any one of the characters specified in the list
 [!list] – matches any one of the characters not specified in the list
Unix/Linux File Permission Commands
 umask – blocks default file permissions that would be assigned when creating a new file or directory. Uses only
numeric values.
 chmod – changes the access mode (file permissions) of a file or directory. Implemented in two ways:
o numeric values – using 4 (read), 2 (write) and 1 (execute) for the permissions.
o mnemonics – using u (user), g (group), o (others) for the 3 sets of users; r (read), w (write), x
(execute) for the permissions; = (assign permissions), + (add permissions), - (remove permissions)
UNIX/Linux File Permissions & Ownerships
 Types of users:
o a  all
o u  user
Document1
Enoch E. Damson
Page 3 of 4
2440:145 Introduction to UNIX/Linux
Study Guide #1


The University of Akron
Summit College
Dept of Business Technology
Computer Information Systems
o g  group
o o  other
Permissions:
o d  directory
o r  read (4)
o w  write (2)
o x  execute (1)
o -  none (0)
Actions:
o =  assigns permission
o +  adds permission
o -  removes permission
o Note: Use commas to separate assignment units, with no spaces
Examples
 Setting default file permissions for read, write, and execute permissions on files for all three sets of users:
o umask 000
 Setting default file permissions for read, write permissions on files to user, and read for group and others:
o umask 133
 Assigning read, write and execute permissions to all three sets of users on a file:
o chmod a=rwx file (Using mnemonics)
o chmod ugo=rwx file (Using mnemonics)
o chmod 777 (Using numeric values)
 Adding read, write permissions to all three sets of users on a file:
o chmod ugo+rw file (Using mnemonics)
o chmod a+rw file (Using mnemonics)
 Removing write permission from group and others on a file:
o chmod go-w file (Using mnemonics)
 Adding execute permission to user and removing read, write permissions from group and others on a file:
o chmod u+x,go-rw file (Using mnemonics)
Document1
Enoch E. Damson
Page 4 of 4
Download