Introduction to UNIX51434S H.02Module 1
What Is an Operating System?                                                                          Disks              U...
History of the UNIX Operating SystemLate 1960s    AT&T development of MULTICS1969          AT&T Bell Labs UNIX system star...
Features of UNIX                                        Shell                            Tools & Applications             ...
More Features of UNIX • Hierarchical file system • Multi-tasking • Multi-user51434S H.02             © 2003 Hewlett-Packar...
The UNIX System and Standards                                                          ISO        SVID      BSD       othe...
What Is HP-UX?       BSD 4.2                                                          XPG    BSD 4.3                      ...
Logging In and GeneralOrientation51434S H.02Module 2
A Typical Terminal Session • Log in to identify yourself and gain access. • Execute commands to do work. • Log off to term...
Logging In and Outlogin: user1                                                    Log inpassword:         ReturnWelcome to...
The Shell – Command Interpretation                                               Execute                  Interpretive    ...
Command Line FormatSyntax:   $ command [-options] [arguments]                     ReturnExamples:   $ date Return         ...
The Secondary Prompt$ banner hi            Return                       Enter and opening apostrophe    > there           ...
The ManualThe HP-UX Reference Manual contains:Section       Number and DescriptionSection 1:    User CommandsSection 1m:  ...
Content of the Manual PagesNAME                                      EXAMPLESSYNOPSIS                                  WAR...
The Online ManualSyntax: man [-k | X ]           keyword | commandin which X is the number of one of the manual sectionsEx...
Some Beginning Commandsid            Display your user and group identifications.who           Identify other users logged...
The id CommandSyntax: id     Displays user and group identification for sessionExample: $ id   uid =303 (user3) gid=300 (c...
The who CommandSyntax: who [am i]             Reports information about users who are   whoami               currently log...
The date CommandSyntax: date          Reports the date and timeExample: $ date   Fri Jul    1 11:15:55 EDT 199851434S H.02...
The passwd CommandSyntax: passwd         Assigns a login passwordExample: $ passwd   Changing password for user3   Old pas...
The echo CommandSyntax: echo [arg ...]                   Writes argument(s) to the terminalExamples: $ echo how are you   ...
The banner CommandSyntax:   banner arg [arg ...]                       Displays arguments in large lettersExample: $ banne...
The clear CommandSyntax:   clear      Clears terminal screen51434S H.02   © 2003 Hewlett-Packard Development Company, L.P....
The write CommandSyntax:   write username [tty]                           Sends message to username if logged inExample:  ...
The mesg CommandSyntax: mesg [y|n]   Allows or denies "writes" to your terminalExample: $ mesg   is y   $ mesg n   $ mesg ...
The news CommandSyntax: news [-a] [-n] [headline]                    Displays the system newsExample: $ news          Disp...
Using CDE51434S H.02Module 3
Front Panel Elements51434S H.02   © 2003 Hewlett-Packard Development Company, L.P.   2
Front Panel Pop-up Menus51434S H.02   © 2003 Hewlett-Packard Development Company, L.P.   3
Workspace Switch51434S H.02   © 2003 Hewlett-Packard Development Company, L.P.   4
Getting Help51434S H.02    © 2003 Hewlett-Packard Development Company, L.P.   5
File Manager51434S H.02    © 2003 Hewlett-Packard Development Company, L.P.   6
File Manager Menu Tasks51434S H.02   © 2003 Hewlett-Packard Development Company, L.P.   7
Using File Manager to Locate Files51434S H.02    © 2003 Hewlett-Packard Development Company, L.P.   8
Deleting Objects51434S H.02    © 2003 Hewlett-Packard Development Company, L.P.   9
Using the Text Editor51434S H.02    © 2003 Hewlett-Packard Development Company, L.P.   10
Running Applications from the ApplicationManager51434S H.02    © 2003 Hewlett-Packard Development Company, L.P.   11
Using Mailer51434S H.02    © 2003 Hewlett-Packard Development Company, L.P.   12
Sending Mail51434S H.02    © 2003 Hewlett-Packard Development Company, L.P.   13
Customizing Mailer51434S H.02    © 2003 Hewlett-Packard Development Company, L.P.   14
Using Calendar51434S H.02      © 2003 Hewlett-Packard Development Company, L.P.   15
Scheduling Appointments51434S H.02   © 2003 Hewlett-Packard Development Company, L.P.   16
To Do Items51434S H.02   © 2003 Hewlett-Packard Development Company, L.P.   17
Browsing Calendars on a Network51434S H.02   © 2003 Hewlett-Packard Development Company, L.P.   18
Granting Access to your Calendar51434S H.02    © 2003 Hewlett-Packard Development Company, L.P.   19
Navigating the File System51434S H.02Module 4
What Is a File System?              Report                                   ENGINEERING                                 M...
The Tree Structure                                                        Cabinet              engineering.drw            ...
The File System Hierarchy                                                                     /                    sbin   ...
Path Names                                               /                                                                ...
Some Special Directories                                      4                                   ../..                   ...
Basic File System Commandspwd           Displays the directory name of your current location in the              hierarchy...
pwd — Present Working Directory                 /          ...                                                           Y...
ls — List Contents of a DirectorySyntax: ls [-adlFR] [pathname(s)]Example: $ ls                                           ...
cd — Change DirectorySyntax: cd [dir_pathname]Example:                                            /                       ...
The find CommandSyntax: find path_list expression Performs an ordered search through                           the file sy...
mkdir and rmdir — Create and RemoveDirectoriesSyntax: mkdir [-p] dir_pathname(s) rmdir dir_pathname(s)                    ...
Review                                                                      /                                             ...
The File System — SummaryFile          A container for dataDirectory     A container for files and other directoriesTree  ...
Managing Files51434S H.02Module 5
What Is a File?A container for data or a link to a device. • Every file has a name and may hold data that resides on a dis...
What Can We Do with Files?ls            Look at the characteristics of a filecat           Look at the contents of a filem...
File Characteristics         $ ls –l         -rw-r--r--          1      user3         class          37           Jul 24 1...
cat — Display the Contents of a FileSyntax: cat [file...]   Concatenate and display the contents of file(s)Examples: $ cat...
more — Display the Contents of a FileSyntax: more [filename]...             Display files one screen at a timeExample: $ m...
tail — Display the End of a FileSyntax:   tail [-n]   [filename]...                     Display the end of file(s)Example:...
The Line Printer Spooler System • The lp spooler system is a utility that coordinates printer jobs. • Allows users to:    ...
The lp Command • Queues files to be printed. • Assigns a unique ID number. • Many options are available for customizing ro...
The lpstat CommandSyntax:  lpstat [-t] • lpstat reports the requests that you have queued to be printed. • lpstat -t repor...
The cancel CommandSyntax:  cancel id [ id ... ]  cancel printer   [ printer ... ]Examples: • Cancel a job queued by lp.   ...
cp — Copy FilesSyntax: cp [-i] file1 new_file                                      Copy a file cp [-i] file [file...] dest...
mv — Move or Rename FilesSyntax:   mv [-i] file new_file                                      Rename a file   mv [-i] file...
ln — Link FilesSyntax:  ln file new_file                               Link to a file  ln file [file ... ] dest_dir       ...
rm — Remove FilesSyntax: rm [-if] filename [filename...] Remove files rm -r[if] dirname [filename...] Remove directoriesEx...
File/Directory Manipulation Commands —Summaryls –l         Display file characteristicscat           Concatenate and displ...
File Permissions andAccess51434S H.02Module 6
File Permissions and AccessAccess to files is dependent on a users identification and the permissionsassociated with a fil...
Who Has Access to a File? • The UNIX system incorporates a three-tier structure to define who has   access to each file an...
Types of AccessThere are three types of access for each file and directory:Readfiles:              Contents can be examine...
Permissions      Permissions are displayed with ls -l:                         $ ls -l                         - rw-   r--...
chmod — Change Permissions of a FileSyntax:chmod mode_list file…                Change permissions of file(s)mode_list    ...
umask — Permission MaskSyntax: umask [-S] [mode]                     User file-creation mode maskExample:                 ...
touch — Update Timestamp on FileSyntax:   touch [-amc] file...      update access and/or modification times of fileExample...
chown — Change File OwnershipSyntax: chown owner [:group] filename ...                                          Changes ow...
The chgrp CommandSyntax: chgrp newgroup filename ...                      Changes group access to a file                  ...
su — Switch User IDSyntax:   su [user_name]   Change your user ID and group ID designationExample:  $ ls -l /usr/local/bin...
The newgrp CommandSyntax:   newgrp [group_name]             Changes the group IDExample:  $ ls -l /usr/local/bin/class_set...
Access Control ListsSyntax:   lsacl filename            list the ACL for a file   chacl ACL filename        change the ACL...
File Permissions and Access — SummaryPermissions Define who has what access to a file user, group, others            read,...
Shell Basics51434S H.02Module 7
What Is the Shell?                                                   Users                                                ...
Commonly Used Shells/usr/bin/sh       POSIX shell/usr/bin/ksh      Korn shell/usr/old/bin/sh   Bourne shell/usr/bin/csh   ...
POSIX Shell Features • A shell user interface with some advanced features:      –   Command aliasing      –   File name co...
AliasingSyntax: alias [name[=string]]Examples: $ alias dir=ls $ alias mroe=more $ alias mstat=/home/tricia/projects/micron...
File Name Completion$ more fra ESC ESC$ more frankenstein Return   .   .   .$ more abc ESC ESC$ more abcdef ESC      =1)ab...
Command History • The shell keeps a history file of commands that you enter. • The history command displays the last 16 co...
Re-entering Commands • You type r c to re-enter command number c.Example: $ history 3 5             List command numbers 3...
Recalling Commands • Uses the history mechanism. • Must have the EDITOR environment variable set.   EDITOR=vi   export EDI...
Command Line Editing • Provides the ability to modify text entered on current or previous   command lines. • Press Esc to ...
Command Line Editing (Continued) • To position the cursor    – Use l, or space key to move right      –   Use h, or backsp...
The User EnvironmentYour environment describes your session to the programs you run.Syntax: envExample: $ env  HOME=/home/...
Setting Shell Variables • A shell variable is a name that represents a value. • The value associated with the name can be ...
Two Important Variables • The PATH variable      –   A list of directories where the shell will search for the commands   ...
What Happens at Login?               login:                                   getty                                       ...
The Shell Startup FilesIf the Shell is ...                                           The Local Login Script is ...Korn (/u...
Shell Intrinsics versus UNIX Commands • Shell intrinsics are built into the shell.     Examples:     cd     ls     pwd    ...
Looking for Commands — whereisSyntax: $ whereis [-b|-m|-s] command                     Searches a list of                 ...
Shell Advanced Features51434S H.02Module 8
Shell Substitution CapabilitiesThere are three types of substitution in the shell: • Variable substitution • Command subst...
Shell Variable Storage          Local Variables                                                    color=blue             ...
Setting Shell VariablesSyntax:       name=valueExamples:     $ color=lavender                                        Assig...
Variable SubstitutionSyntax: $name        Directs the shell to perform variable substitutionExample: $ echo $PATH /usr/bin...
Variable Substitution (Continued)$ dir_name=tree/car.models/ford$ echo $dir_nametree/car.models/ford$ ls -F $dir_namesedan...
Command SubstitutionSyntax: $(command)Example: $ pwd /home/user2 $ curdir=$(pwd) $ echo $curdir /home/user2 $ cd /tmp $ pw...
Tilde Substitution$ echo $HOME/home/user3$ echo ~/home/user3$ cd tree$ echo $PWD/home/user3/tree$ ls ~+/dog.breedscollie p...
Displaying Variable Values$ echo $HOME/home/user3$ envHOME=/home/user3PATH=/usr/bin:/usr/contrib/bin:/usr/local/binSHELL=/...
Transferring Local Variables to theEnvironment Syntax:  export variable     Transfer variable to environment              ...
Passing Variables to an Application         $ vi                                                   local variables        ...
Monitoring Processes$ ps -f   UID PID    PPID         C           STIME   TTY                      TIME COMMAND user3 4702...
Child Processes and the Environment export color=lavender$ ksh          (create child shell process)$ ps -f    UID   PID P...
File Name Generation51434S H.02Module 9
Introduction to File Name Generation                                        Command               Interpretive            ...
File Name Generating Characters?             Matches any single character except a leading dot[ ]           Defines a clas...
File Name Generation and Dot Files • File name generating characters will never generate a file name that   has a leading ...
File Name Generation — ?? matches any single character.    $ ls -a    . .. .zz abc abcd abcdef abcz bbabb cyz zzayy    $  ...
File Name Generation — [ ][ ] defines a class of characters from which one will be matched.        $ ls -a        . .. .zz...
File Name Generation — ** matches zero or more characters except a leading dot (.).    $ ls -a    . .. .profile ab.dat abc...
File Name Generation — Review $ ls -a   .                   Abc             e35f   ..                  Abcd            efg...
Quoting51434S H.02Module 10
Introduction to Quoting • Many characters have "special“ meaning to the shell:      –   white space      –   carriage retu...
Quoting CharactersBackslash       Single Quotes   Double Quotes   "51434S H.02         © 2003 Hewlett-Packard Development ...
Quoting — Syntax:             Removes the special meaning of the next characterExample:  $ echo the  escapes the next char...
Quoting — Syntax: ‘            Removes the special meaning of all characters surrounded by              the single quotesE...
Quoting — "Syntax: ”      Removes the special meaning of all characters surrounded by the        double quotes except  , $...
Quoting — SummaryMechanism       PurposeBackslash       Escapes next characterSingle Quotes   Escapes all characters insid...
Input and OutputRedirection51434S H.02Module 11
Input and Output Redirection —Introduction         Interpretive           Command        programming             execution...
stdin, stdout, and stderr               File                                                          Device              ...
Input Redirection — <Any command that reads its input from stdin can have its input redirected tocome from another file.Ex...
Output Redirection — > and >>Any command that produces output to stdout can have its output redirectedto another file.Exam...
Error Redirection — 2> and 2>>Any command that produces error messages to stderr can havethose messages redirected to anot...
What Is a Filter? • Reads standard input and produces standard output. • Filters the contents of the input stream or a fil...
wc — Word CountSyntax:  wc [-lwc] [file...]           Counts lines, words, and characters in a fileExamples:$ wc funfile  ...
sort — Alphabetical or Numerical SortSyntax:  sort [-ndutX] [-k field_no] [file...] Sorts linesExamples:$ sort funfile    ...
grep — Pattern MatchingSyntax:  grep [-cinv] [-e] pattern [-e pattern] [file...]  grep [-cinv] -f patterns_list_file [file...
Input and Output Redirection — Summarycmd < file        Redirects input to cmd from filecmd > file        Redirects standa...
Pipes51434S H.02Module 12
Pipelines — Introduction                 Interpretive              Command                programming                execu...
Why Use Pipelines               $ who > temp_file              $ wc -l < temp_file                            who         ...
The | Symbol                                                           accept                          accept             ...
Pipelines versus Input and OutputRedirectionInput and Output Redirection                  PipelinesSyntax: cmd_out > file ...
Redirection in a PipelineThree streams for each command: • stdin • stdout • stderrYou can redirect streams that are not de...
Some Filters cut          Cuts out specified columns or fields and display to stdout tr           Translates characters te...
The cut CommandSyntax:  cut         -clist [file...]                                Cuts columns or fields  cut         -f...
The tr CommandSyntax:  tr [-s] [string1][string2]                        Translates charactersExamples:  $ who | tr -s " "...
The tee CommandSyntax: tee [-a] file [file. . .]                                   Tap the pipelineExample: $ who |       ...
The pr CommandSyntax:  pr [-option] [file...]              Formats stdin and produces stdoutExamples:  $    pr -n3 funfile...
Printing from a Pipeline  ... | lp    Located at end of pipe; sends output to printerExamples:  $ pr -l58 funfile | lp  Re...
Pipelines — SummaryPipeline      cmd_out | cmd_in              cmd_out | cmd_in_out | cmd_incut           Cuts out columns...
Using Network Services51434S H.02Module 13
What Is a Local Area Network?     What the network looks like:         HP Series 300/400      HP Series 800               ...
LAN Services • Two groups of LAN services are      –   ARPA Services      –   Berkeley Services • The services allow you t...
The hostname CommandSyntax:  hostname     Reports your computers network nameExample:  $ hostname  fred  $  $ more /etc/ho...
The telnet CommandSyntax:  telnet hostname      ARPA Service to remotely log in to another                       computerE...
The ftp CommandSyntax:  ftp         hostname              ARPA Service to copy files to and from a                        ...
The rlogin CommandSyntax:  rlogin      hostname        Berkeley Service to remotely log in to another                     ...
The rcp CommandSyntax:  rcp         source_pathname target_pathname Berkeley Service to copy files                        ...
The remsh CommandSyntax:  remsh       hostname command              Berkeley Service to run a command on                  ...
Berkeley — The rwho CommandSyntax:  rwho Displays users on machines in the LAN running the rwh daemon;       produces outp...
Berkeley — The ruptime CommandSyntax:  ruptime     Displays the status of each machine in the LAN;              Each syste...
Introduction to the viEditor51434S H.02Module 14
What Is vi? • A screen-oriented text editor • Included with most UNIX system distributions • Command driven • Categories o...
Why vi? • On every UNIX platform • Runs on any type terminal • Very powerful editor • Shell command stack uses it • Other ...
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Fundamentos de unix
Upcoming SlideShare
Loading in …5
×

Fundamentos de unix

2,319 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,319
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
55
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Fundamentos de unix

  1. 1. Introduction to UNIX51434S H.02Module 1
  2. 2. What Is an Operating System? Disks Users Memory Operating CPU System Network Programs Printers Consumers Resources51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 2
  3. 3. History of the UNIX Operating SystemLate 1960s AT&T development of MULTICS1969 AT&T Bell Labs UNIX system startsEarly 1970s AT&T development of UNIX systemMid 1970s University of California at Berkeley (BSD) and other universities also research and develop UNIX systemEarly 1980s Commercial interest in UNIX system DARPA interest in BSD Hewlett-Packard introduces HP-UXLate 1980s Development of standards Open Software Foundation (OSF) foundedEarly 1990s POSIX, standardization of the interactive user interface51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 3
  4. 4. Features of UNIX Shell Tools & Applications Kernel sort ksh ls Hardware csh mail vi date sh sh-posix51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 4
  5. 5. More Features of UNIX • Hierarchical file system • Multi-tasking • Multi-user51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 5
  6. 6. The UNIX System and Standards ISO SVID BSD others Portability IEEE/POSIX X/OPEN XPG Interoperability ANSI NIST/FIPS Scalability51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 6
  7. 7. What Is HP-UX? BSD 4.2 XPG BSD 4.3 POSIX HP-UX SVID FIPS51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 7
  8. 8. Logging In and GeneralOrientation51434S H.02Module 2
  9. 9. A Typical Terminal Session • Log in to identify yourself and gain access. • Execute commands to do work. • Log off to terminate your connection.51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 2
  10. 10. Logging In and Outlogin: user1 Log inpassword: ReturnWelcome to HP-UX Login messagesErase is BackspaceKill is Ctrl-U$ date Do workFri Jul 1 11:03:42 EDT 1994$ other commands$ exit Return or Ctrl + d Log outlogin:51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 3
  11. 11. The Shell – Command Interpretation Execute Interpretive commands programming language Environment settings Command substitution Variable Shell assignment Pipelines Variable substitution I/O Filename redirection generation51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 4
  12. 12. Command Line FormatSyntax: $ command [-options] [arguments] ReturnExamples: $ date Return No argument Fri Jul 1 11:10:43 EDT 1994 $ banner hi Return One argument # # # # # # ##### # # # # # # # $ bannerHi Return Incorrect syntax sh: bannerHi : not found $ ls –F Return One option dira/ dirb/ f1 f2 prog1* prog2*51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 5
  13. 13. The Secondary Prompt$ banner hi Return Enter and opening apostrophe > there Return Provide a closing apostrophe# # # ##### # # ##### #### ##### # # # # # # # # ###### # # ##### ##### # # ##### # # # # # # #### ## # # # # # # # # ## # # # # # #### # # ####$ ( Return Enter an opening parenthesis > Ctrl + c$ if Return Begin an if statement > Ctrl + c$51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 6
  14. 14. The ManualThe HP-UX Reference Manual contains:Section Number and DescriptionSection 1: User CommandsSection 1m: System Maintenance Commands (formerly Section 8)Section 2: System CallsSection 3: Functions and Function LibrariesSection 4: File FormatsSection 5: Miscellaneous TopicsSection 7: Device (Special) FilesSection 9: Glossary51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 7
  15. 15. Content of the Manual PagesNAME EXAMPLESSYNOPSIS WARNINGSDESCRIPTION DEPENDENCIESEXTERNAL INFLUENCES AUTHORNETWORKING FEATURES FILESRETURN VALUE SEE ALSODIAGNOSTICS BUGSERRORS STANDARDS CONFORMANCE51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 8
  16. 16. The Online ManualSyntax: man [-k | X ] keyword | commandin which X is the number of one of the manual sectionsExamples: $ man date Display the "date" man page. $ man -k copy Display entries with keyword "copy". $ man passwd Display the "passwd" man page-Section 1. $ man 4 passwd Display the "passwd" man page-Section 4.Use Space to view next page.Use Return to view next line.Use q to quit the man command.51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 9
  17. 17. Some Beginning Commandsid Display your user and group identifications.who Identify other users logged on to the system.date Display the system time and date.passwd Assign a password to your user account.echo Display simple messages to your screen.banner Display arguments in large letters.clear Clears terminal screen.write Sends messages to another users terminal.mesg Allows/denies messages to your terminal.news Display the system news.51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 10
  18. 18. The id CommandSyntax: id Displays user and group identification for sessionExample: $ id uid =303 (user3) gid=300 (class)Note: The ‘gid’ is the primary group. If the user belongs to additional groups, these are listed at the end as ‘groups’51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 11
  19. 19. The who CommandSyntax: who [am i] Reports information about users who are whoami currently logged on to a systemExamples: $ who root tty1p5 Jul 01 08:01 user1 tty1p4 Jul 01 09:59 user2 tty0p3 Jul 01 10:01 $ who am i user2 tty0p3 Jul 01 10:01 $ whoami user251434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 12
  20. 20. The date CommandSyntax: date Reports the date and timeExample: $ date Fri Jul 1 11:15:55 EDT 199851434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 13
  21. 21. The passwd CommandSyntax: passwd Assigns a login passwordExample: $ passwd Changing password for user3 Old password: New password: Re-enter new password:Password Restrictions: • minimum of six characters • at least two alpha characters • at least one non-alpha character51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 14
  22. 22. The echo CommandSyntax: echo [arg ...] Writes argument(s) to the terminalExamples: $ echo how are you how are you $ echo 123 abc 123 abc51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 15
  23. 23. The banner CommandSyntax: banner arg [arg ...] Displays arguments in large lettersExample: $ banner hello # # ###### # # ###### # # # # # # # ###### ###### # # # # # # # # # # # # # # # # # # # # ###### ###### ###### ######51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 16
  24. 24. The clear CommandSyntax: clear Clears terminal screen51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 17
  25. 25. The write CommandSyntax: write username [tty] Sends message to username if logged inExample: user3 user4 $ write user4 Are you going to the meeting? Message from user3 (tty05) Are you going to the meeting? $ write user3 I will be there. Message from user4 (tty52) Ctrl + d I will be there. I wont be there. Take good notes! Ctrl + d Message from user3 (tty05) I wont be there. Take good notes!51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 18
  26. 26. The mesg CommandSyntax: mesg [y|n] Allows or denies "writes" to your terminalExample: $ mesg is y $ mesg n $ mesg is n $ mesg y $ mesg is y51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 19
  27. 27. The news CommandSyntax: news [-a] [-n] [headline] Displays the system newsExample: $ news Displays new news $ news -a Displays all news $ news -n Displays new headlines51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 20
  28. 28. Using CDE51434S H.02Module 3
  29. 29. Front Panel Elements51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 2
  30. 30. Front Panel Pop-up Menus51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 3
  31. 31. Workspace Switch51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 4
  32. 32. Getting Help51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 5
  33. 33. File Manager51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 6
  34. 34. File Manager Menu Tasks51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 7
  35. 35. Using File Manager to Locate Files51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 8
  36. 36. Deleting Objects51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 9
  37. 37. Using the Text Editor51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 10
  38. 38. Running Applications from the ApplicationManager51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 11
  39. 39. Using Mailer51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 12
  40. 40. Sending Mail51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 13
  41. 41. Customizing Mailer51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 14
  42. 42. Using Calendar51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 15
  43. 43. Scheduling Appointments51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 16
  44. 44. To Do Items51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 17
  45. 45. Browsing Calendars on a Network51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 18
  46. 46. Granting Access to your Calendar51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 19
  47. 47. Navigating the File System51434S H.02Module 4
  48. 48. What Is a File System? Report ENGINEERING MA BE R C H GIN 1-7 INV . cabinet ~ ~ file system drawer ~ ~ directory FINANCE folder ~ ~ directory report ~ ~ file PERSONNEL51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 2
  49. 49. The Tree Structure Cabinet engineering.drw finance.drw personnel.drw assmbly.1 assmbly.2 jan.fdr feb.fdr march.fdr week1 week2 week3 week1 week2 = directory = file51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 3
  50. 50. The File System Hierarchy / sbin usr dev etc opt var stand tmp home vmunix group passwd profile user1 user2 user3 bin contrib lib local sbin share vue man mail news tmp vue cp ls man sh tar vi = directory = file51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 4
  51. 51. Path Names / You are here. tmp usr home f1 user1 user2 user3 bin 4 f1 f1 cp ls vi man 2 1 f1 memo 3 f151434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 5
  52. 52. Some Special Directories 4 ../.. / HOME /home/user3 1 .. Directory tmp usr home . .. .. f1 5 bin 2 f1 user1 user2 user3 memo cp ls man vi 6 3 f1 f1 memo f1 f151434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 6
  53. 53. Basic File System Commandspwd Displays the directory name of your current location in the hierarchyls Sees what files and directories are under the current directorycd Changes your location in the hierarchy to another directoryfind Finds filesmkdir Creates a directoryrmdir Removes a directory51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 7
  54. 54. pwd — Present Working Directory / ... You are home here. user1 user2 user3 f1 f1 f1 memo f151434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 8
  55. 55. ls — List Contents of a DirectorySyntax: ls [-adlFR] [pathname(s)]Example: $ ls / f1 f2 memo ... ... $ ls -F tmp home You are here. f1 f2* memo/ $ ls -aF f1 user1 user2 user3 .profile f1 f2* memo/ $ ls memo f1 f1 f1 f2 $ ls -F /home user1/ user2/ user3/ .profile f1 f2 memo $ ls -F ../user2 f1 f1 f251434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 9
  56. 56. cd — Change DirectorySyntax: cd [dir_pathname]Example: / ... ... $ pwd You start here. tmp home /home/user3 HOME directory $ cd memo; pwd f1 user1 user2 user3 /home/user3/memo $ cd ../..; pwd f1 f1 /home $ cd /tmp; pwd .profile f1 f2 memo /tmp $ cd; pwd /home/user3 f1 f251434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 10
  57. 57. The find CommandSyntax: find path_list expression Performs an ordered search through the file system. path_list is a list of directories to search. expression specifies search criteria and actions.Examples: $ find . -name .profile ./.profile $51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 11
  58. 58. mkdir and rmdir — Create and RemoveDirectoriesSyntax: mkdir [-p] dir_pathname(s) rmdir dir_pathname(s) /Example: ... $ pwd home You start here. /home/user3 $ mkdir fruit user1 user2 user3 $ mkdir fruit/apple $ cd fruit $ mkdir grape orange $ rmdir orange .profile f1 f2 fruit memo $ cd .. $ rmdir fruit apple grape orange rmdir: fruit not empty $ rmdir fruit/apple fruit/grape fruit51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 12
  59. 59. Review / usr home tmp Start here. bin user3 user4 tree51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 13
  60. 60. The File System — SummaryFile A container for dataDirectory A container for files and other directoriesTree Hierarchical structure of a UNIX systemPath name Identifies a files or directorys location in the hierarchyHOME Represents the path name of your login directorypwd Displays your current location in the hierarchycd Changes your location in the hierarchy to another directoryls Lists the contents of a directoryfind Finds files specified by optionsmkdir Creates directoriesrmdir Removes directories51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 14
  61. 61. Managing Files51434S H.02Module 5
  62. 62. What Is a File?A container for data or a link to a device. • Every file has a name and may hold data that resides on a disk. • There are several different types of files: – Regular files • text, data, drawings • executable programs – Directories – Device files51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 2
  63. 63. What Can We Do with Files?ls Look at the characteristics of a filecat Look at the contents of a filemore Look at the contents of a file, one screenful at a timelp Print a filecp Make a copy of a filemv Change the name of a file or directorymv Move a file to another directoryln Create another name for a filerm Remove a file51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 3
  64. 64. File Characteristics $ ls –l -rw-r--r-- 1 user3 class 37 Jul 24 11:06 f1 -rwxr-xr-x 1 user3 class 52 Jul 24 11:08 f2 drwxr-xr-x 2 user3 class 1024 Jul 24 12:03 memo File Links Group Name Type Timestamp Owner Size Permissions51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 4
  65. 65. cat — Display the Contents of a FileSyntax: cat [file...] Concatenate and display the contents of file(s)Examples: $ cat remind Your mothers birthday is November 29. $ cat note remind TO: Mike Smith The meeting is scheduled for July 29. Your mothers birthday is November 29.51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 5
  66. 66. more — Display the Contents of a FileSyntax: more [filename]... Display files one screen at a timeExample: $ more funfile . . . --funfile (20%)-- Q or q Quit more Return One more line Space One more page51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 6
  67. 67. tail — Display the End of a FileSyntax: tail [-n] [filename]... Display the end of file(s)Example: $ tail -1 note soon as it is available.51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 7
  68. 68. The Line Printer Spooler System • The lp spooler system is a utility that coordinates printer jobs. • Allows users to: – Queue files to printers. – Obtain status of printers and print queues. – Cancel any print job. Output User1 Output User2 Output LP User3 Spooler System Printer Output Usern51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 8
  69. 69. The lp Command • Queues files to be printed. • Assigns a unique ID number. • Many options are available for customizing routing and printing.Syntax: lp [ -dprinter] [-options] filename ...Example: $ lp report request id is dp-112 (1 file) $ lp -n2 memo1 memo2 request id is dp-113 (2 files) $ lp -dlaser -t"confidential" memo3 request id is laser-114 (1 file) $51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 9
  70. 70. The lpstat CommandSyntax: lpstat [-t] • lpstat reports the requests that you have queued to be printed. • lpstat -t reports the status of the scheduler, default printer name, device, printer status, and all queued print requests.51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 10
  71. 71. The cancel CommandSyntax: cancel id [ id ... ] cancel printer [ printer ... ]Examples: • Cancel a job queued by lp. $ cancel dp-115 • Cancel the current job on a specific printer. $ cancel laser51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 11
  72. 72. cp — Copy FilesSyntax: cp [-i] file1 new_file Copy a file cp [-i] file [file...] dest_dir Copy files to a directory cp -r [-i] dir [dir...] dest_dir Copy directoriesExample: $ ls -F f1 f2* memo/ note remind $ cp f1 f1.copy $ ls -F f1 f1.copy f2* memo/ note remind $ cp note remind memo $ ls -F memo note remind51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 12
  73. 73. mv — Move or Rename FilesSyntax: mv [-i] file new_file Rename a file mv [-i] file [file...] dest_dir Move files to a directory mv [-i] dir [dir...] dest_dir Rename or move directoriesExample: $ ls -F $ mv note remind memo f1 f2* memo/ note remind $ ls -F $ mv f1 file1 file1 memo/ $ ls -F $ls -F memo file1 f2* memo/ note remind file2* note remind $ mv f2 memo/file2 $ mv memo letters $ ls -F $ ls -F file1 memo/ note remind file1 letters/ $ ls -F memo file2*51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 13
  74. 74. ln — Link FilesSyntax: ln file new_file Link to a file ln file [file ... ] dest_dir Link files to a directoryExample: $ ls -l f1 -rw-rw-r-- 1 user3 class 37 Jul 24 11:06 f1 $ ln f1 /home/user2/f1.link $ ls -l f1 -rw-rw-r-- 2 user3 class 37 Jul 24 11:06 f1 $ ls -l /home/user2 -rw-rw-r-- 2 user3 class 37 Jul 24 11:06 f1.link $ ls -i f1 /home/user2/f1.link 1789 f1 1789 /home/user2/f1.link / You are here. home user2 user3 f1.link f1 This is a sample file to be copied.51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 14
  75. 75. rm — Remove FilesSyntax: rm [-if] filename [filename...] Remove files rm -r[if] dirname [filename...] Remove directoriesExamples: $ ls -F f1 f2 fruit/ memo/ $ rm f1 $ ls -F f2 fruit/ memo/ $ rm -i f2 f2: ? (y/n) $ rm fruit rm: fruit directory $ rm -r fruit51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 15
  76. 76. File/Directory Manipulation Commands —Summaryls –l Display file characteristicscat Concatenate and display contents of files to screenmore Format and display contents of files to screentail Display the end of files to screencp Copy files or directoriesmv Move or rename files or directoriesln Link file names togetherrm Remove files or directorieslp Send requests to a line printerlpstat Print spooler status informationcancel Cancel requests in the line printer queue51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 16
  77. 77. File Permissions andAccess51434S H.02Module 6
  78. 78. File Permissions and AccessAccess to files is dependent on a users identification and the permissionsassociated with a file. This module will show how to understand the read,write, and execute access to a filels (ll, ls -l) Determine what access is granted on a filechmod Change the file accessumask Change default file accesschown Change the owner of a filechgrp Change the group of a filesu Switch your user identifiernewgrp Switch your group identifier51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 2
  79. 79. Who Has Access to a File? • The UNIX system incorporates a three-tier structure to define who has access to each file and directory: user The owner of the file group A group that may have access to the file other Everyone else • The ls -l command displays the owner and group who has access to the file. $ ls –l -rw-r--r-- 1 user3 class 37 Jul 24 11:06 f1 -rwxr-xr-x 1 user3 class 37 Jul 24 11:08 f2 drwxr-xr-x 2 user3 class 1024 Jul 24 12:03 memo | | owner group51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 3
  80. 80. Types of AccessThere are three types of access for each file and directory:Readfiles: Contents can be examined.directories: Contents can be examinedWritefiles: Contents can be changed.directories: Contents can be changed.Executefiles: File can be used as a command.directories: Can become current working directory51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 4
  81. 81. Permissions Permissions are displayed with ls -l: $ ls -l - rw- r-- r-- 1 user3 class 37 Jul 24 11:06 f1 - rwx r-x r-x 1 user3 class 37 Jul 24 11:08 f2 d rwx r-x r-x 2 user3 class 1024 Jul 24 12:03 memo user (owner)access file owner group access other access file group51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 5
  82. 82. chmod — Change Permissions of a FileSyntax:chmod mode_list file… Change permissions of file(s)mode_list [who[operator]permission] [ ,... ]who user, group, other or alloperator + (add), - (subtract), = (set equal to)permission read, write, executeExample:Original permissions: mode user group other rw-r--r-- rw- r-- r--$ chmod u+x,g+x,o+x file or $ chmod +x fileFinal permissions: mode user group other rwxr-xr-x rwx r-x r-x51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 6
  83. 83. umask — Permission MaskSyntax: umask [-S] [mode] User file-creation mode maskExample: user group other default permissions: rw- rw- rw- set default permissions: rw- r-- --- $ umask g=r,o=51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 7
  84. 84. touch — Update Timestamp on FileSyntax: touch [-amc] file... update access and/or modification times of fileExamples: $ ll -rw-r--r-- 1 karenk users 25936 Aug 24 09:53 firstfile -rw-r--r-- 1 karenk users 10245 Aug 24 09:53 secondfile $ touch newfile $ ll -rw-r--r-- 1 karenk users 25936 Aug 24 09:53 firstfile -rw-r--r-- 1 karenk users 0 Aug 25 10:02 newfile -rw-r--r-- 1 karenk users 10245 Aug 24 09:53 secondfile $ touch secondfile $ ll -rw-r--r-- 1 karenk users 25936 Aug 24 09:53 firstfile -rw-r--r-- 1 karenk users 0 Aug 25 10:02 newfile -rw-r--r-- 1 karenk users 10245 Aug 25 10:05 secondfile $51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 8
  85. 85. chown — Change File OwnershipSyntax: chown owner [:group] filename ... Changes owner of a file(s) and, optionally, the group IDExample: $ id uid=303 (user3), gid=300 (class) $ cp f1 /tmp/user2/f1 $ ls -l /tmp/user2/f1 -rw-r----- 1 user3 class 3967 Jan 24 13:13 f1 $ chown user2 /tmp/user2/f1 $ ls -l /tmp/user2/f1 -rw-r----- 1 user2 class 3967 Jan 24 13:13 f1Only the owner of a file (or root) can change the ownership of the file.51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 9
  86. 86. The chgrp CommandSyntax: chgrp newgroup filename ... Changes group access to a file Only the owner of a file (or root) can change the group of the file.Example: $ id uid=303 (user3), gid=300 (class) $ ls -l f3 -rw-r----- 1 user3 class 3967 Jan 24 13:13 f3 $ chgrp class2 f3 $ ls -l f3 -rw-r----- 1 user3 class2 3967 Jan 24 13:13 f3 $ chown user2 f3 $ ls -l f3 -rw-r----- 1 user2 class2 3967 Jan 24 13:13 f3 $51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 10
  87. 87. su — Switch User IDSyntax: su [user_name] Change your user ID and group ID designationExample: $ ls -l /usr/local/bin/class_setup -rwxr-x--- 1 class_admin teacher 3967 Jan 24 13:13class_setup $ id uid=303 (user3), gid=300 (class) $ su class_admin Password: $ id uid=400 (class_admin), gid=300 (class) $ /usr/local/bin/class_setup $ log out of su session $ Ctrl + D51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 11
  88. 88. The newgrp CommandSyntax: newgrp [group_name] Changes the group IDExample: $ ls -l /usr/local/bin/class_setup -rwxr-x--- 1 class_admin teacher 3967 Jan 24 13:13class_setup $ id uid=303 (user3) gid=300 (class) $ newgrp teacher $ id uid=303 (user3) gid=33 (teacher) $ /usr/local/bin/class_setup $ newgrp return to login group status $ newgrp other Sorry $51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 12
  89. 89. Access Control ListsSyntax: lsacl filename list the ACL for a file chacl ACL filename change the ACL for a fileExamples: $ lsacl funfile (user3.%,rw-)(%.class,r--)(%.%,r--) funfile $ chacl "user2.class=rw,%.%-r" funfile $ lsacl funfile (user2.class,rw-)(user3.%,rw-)(%.class,r--)(%.%,---) funfile $ chacl -d "user2.class" funfile $ ll funfile rw-r----- 1 user3 class 3081 May 28 16:12 funfile $ lsacl funfile (user3.%,rw-)(%.class,r--)(%.%,---) funfileNote: ACLs are not supported with certain versions of JFS filesystems.51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 13
  90. 90. File Permissions and Access — SummaryPermissions Define who has what access to a file user, group, others read, write, executechmod Change the permissions of a fileumask Define the default permissions for new fileschown Change the owner of a filechgrp Change the group of a filesu Switch user IDnewgrp Switch group ID51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 14
  91. 91. Shell Basics51434S H.02Module 7
  92. 92. What Is the Shell? Users command interpretive Shell execution programming language Kernel environment pipelines settings Hardware variable I/O redirection assignment Operating System variable filename generation substitution command substitution51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 2
  93. 93. Commonly Used Shells/usr/bin/sh POSIX shell/usr/bin/ksh Korn shell/usr/old/bin/sh Bourne shell/usr/bin/csh C Shell/usr/bin/keysh A context-sensitive softkey shell/usr/bin/rksh Restricted Korn shell/usr/bin/rsh Restricted Bourne shell51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 3
  94. 94. POSIX Shell Features • A shell user interface with some advanced features: – Command aliasing – File name completion – Command history mechanism – Command line recall and editing – Job control – Enhanced cd capabilities – Advanced programming capabilities51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 4
  95. 95. AliasingSyntax: alias [name[=string]]Examples: $ alias dir=ls $ alias mroe=more $ alias mstat=/home/tricia/projects/micron/status $ alias laser="lp -dlaser" $ laser fileX request id is laser-234 (1 file) $ alias Displays aliases currently defined $ alias mroe Displays value of alias mroe mroe=more51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 5
  96. 96. File Name Completion$ more fra ESC ESC$ more frankenstein Return . . .$ more abc ESC ESC$ more abcdef ESC =1)abcdefXlmnop2)abcdefYlmnop$ more abcdefThen type X or Y, then ESC ESC .Associated file name will be completed51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 6
  97. 97. Command History • The shell keeps a history file of commands that you enter. • The history command displays the last 16 commands. • You can recall, edit, and re-enter commands previously entered.Syntax: history [-n| a z] Display the command history.Example: $ history -2 List the last two commands 15 cd 16 more .profile $ history 3 5 List command numbers 3 through 5 3 date 4 pwd 5 ls51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 7
  98. 98. Re-entering Commands • You type r c to re-enter command number c.Example: $ history 3 5 List command numbers 3 through 5 3 date 4 pwd 5 ls $ $ r 4 Run command number 4 pwd /home/kelley51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 8
  99. 99. Recalling Commands • Uses the history mechanism. • Must have the EDITOR environment variable set. EDITOR=vi export EDITOR – At $, press Esc and use normal vi commands to scroll through previous commands. • k scrolls backward through the command history. • j scrolls forward through the command history. • nG takes you to command number n. – Press Return to execute the command.51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 9
  100. 100. Command Line Editing • Provides the ability to modify text entered on current or previous command lines. • Press Esc to enter command mode. • Recall desired command by either – Pressing K until it appears – Typing the command number, then G51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 10
  101. 101. Command Line Editing (Continued) • To position the cursor – Use l, or space key to move right – Use h, or backspace to move left • Do Not Use the Arrow Keys! • To modify text – Use x to delete a character – Use i or a to insert or append characters – Press Esc to stop adding character • Press Return to execute the modified command51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 11
  102. 102. The User EnvironmentYour environment describes your session to the programs you run.Syntax: envExample: $ env HOME=/home/gerry PWD=/home/gerry/develop/basics EDITOR=vi TERM=70092 ... PATH=/usr/bin:/usr/contrib/bin:/usr/local/bin: /home/gerry/bin51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 12
  103. 103. Setting Shell Variables • A shell variable is a name that represents a value. • The value associated with the name can be modified. • Some shell variables are defined during the login process. • A user can define new shell variables.Syntax: name=valueExample: $ PATH=/usr/bin/X11:/usr/bin51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 13
  104. 104. Two Important Variables • The PATH variable – A list of directories where the shell will search for the commands you type • The TERM variable – Describes your terminal type and screen size to the programs you run $ env ... PATH=/usr/bin:/usr/contrib/bin:/usr/local/bin $ TERM=70092 $ $ tset Erase is Backspace Kill is Ctrl-U $51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 14
  105. 105. What Happens at Login? login: getty 1 – displays the contents of /etc/issue – issues the login prompt Kernel – runs login 2 login: sue login Password: $ 3 – validates user name and password – places user in home directory – runs the user’s shell /usr/bin/sh login: sue – executes /etc/profile or /etc/csh.login (csh) Password: $ – executes .profile or .login – issues the shell51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 15
  106. 106. The Shell Startup FilesIf the Shell is ... The Local Login Script is ...Korn (/usr/bin/ksh) .profile .KshrcBourne (/usr/old/bin/sh) .profilePOSIX (/usr/bin/sh) .profile .shrcRestricted (/usr/bin/rsh, /usr/bin/rksh) .profileC (/usr/bin/csh) .login .cshrc51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 16
  107. 107. Shell Intrinsics versus UNIX Commands • Shell intrinsics are built into the shell. Examples: cd ls pwd echo • UNIX commands live in /usr/bin. Examples: more file • Some intrinsics are also available as separate commands. The system locates UNIX commands by using the PATH variable.51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 17
  108. 108. Looking for Commands — whereisSyntax: $ whereis [-b|-m|-s] command Searches a list of directories for a commandExamples: $ whereis if if : $ $ whereis ls ls : /sbin/ls /usr/bin/ls /usr/share/man/man1.Z/ls.1 $ $ whereis cd cd : /usr/bin/cd /usr/share/man/man1.Z/cd.1 $ $ whereis holdyourhorses holdyourhorses : $51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 18
  109. 109. Shell Advanced Features51434S H.02Module 8
  110. 110. Shell Substitution CapabilitiesThere are three types of substitution in the shell: • Variable substitution • Command substitution • Tilde substitution51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 2
  111. 111. Shell Variable Storage Local Variables color=blue count=3 dir_name=/home/user3/tree Program Code /usr/bin/sh PS1=$ PATH=/usr/bin:/usr/contrib/bin:/usr/local/bin Environment HOME=/home/user3 Variables TERM=70094a SHELL=/usr/bin/sh51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 3
  112. 112. Setting Shell VariablesSyntax: name=valueExamples: $ color=lavender Assign local variable. $ count=3 Assign local variable. $ dir_name=tree/car.models/ford Assign local variable. $ PSl=hi_there$ Update environmental variable. hi_there$set Display all variables and values. color=lavender count=3 dir_name=tree/car.models/ford /usr/bin/sh PATH=/usr/bin:/usr/contrib/bin:/usr/local/bin HOME=/home/user3 SHELL=/usr/bin/sh . . .51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 4
  113. 113. Variable SubstitutionSyntax: $name Directs the shell to perform variable substitutionExample: $ echo $PATH /usr/bin:/usr/contrib/bin:/usr/local/bin $ PATH=$PATH:$HOME:. $ echo $PATH /usr/bin:/usr/contrib/bin:/usr/local/bin:/home/user3:. $ echo $HOME /home/user3 $ file_name=$HOME/file1 $ more $file_name <contents of /home/user3/file1>51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 5
  114. 114. Variable Substitution (Continued)$ dir_name=tree/car.models/ford$ echo $dir_nametree/car.models/ford$ ls -F $dir_namesedan/ sports/$ my_ls="ls -aFC"$ $my_ls./ file.1 tree/../ file.2$ $my_ls $dir_name./ ../ sedan/ sports/$ cd /tmp$ dir_name=/home/user2/tree/dog.breeds/retriever$ $my_ls $dir_name./ ../ golden labrador mixed51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 6
  115. 115. Command SubstitutionSyntax: $(command)Example: $ pwd /home/user2 $ curdir=$(pwd) $ echo $curdir /home/user2 $ cd /tmp $ pwd /tmp $ cd $curdir $ pwd /home/user251434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 7
  116. 116. Tilde Substitution$ echo $HOME/home/user3$ echo ~/home/user3$ cd tree$ echo $PWD/home/user3/tree$ ls ~+/dog.breedscollie poodle retriever shepherd$ echo $OLDPWD/home/user3/mail$ ls ~-/home/user3/mail/from.mike /home/user3/mail/from.jim$ echo ~tricia/file1/home/tricia/file151434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 8
  117. 117. Displaying Variable Values$ echo $HOME/home/user3$ envHOME=/home/user3PATH=/usr/bin:/usr/contrib/bin:/usr/local/binSHELL=/usr/bin/sh$ setHOME=/home/user3PATH=/usr/bin:/usr/contrib/bin:/usr/local/binSHELL=/usr/bin/shcolor=lavendercount=3dir_name=/home/user3/tree$ unset dir_name51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 9
  118. 118. Transferring Local Variables to theEnvironment Syntax: export variable Transfer variable to environment color=lavender count=3 /usr/bin/sh PS1 PATH HOME SHELL $env count=3 color=lavender $export51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 10
  119. 119. Passing Variables to an Application $ vi local variables local variables color=lavender parent sleeps $ color=lavender /usr/bin/sh /usr/bin/sh env var TERM=98550 env var TERM=98550 local variables local variables /usr/bin/vi color=lavender env var /usr/bin/sh TERM=98550 env var TERM=98550 STEP 2: exec: program and local data STEP 1: fork: program space are replaced with program and data spaces and data of requested program are duplicated (/usr/bin/vi) and program is executed. When program completes, control returns to the parent (/usr/bin/sh) and the prompt is displayed.51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 11
  120. 120. Monitoring Processes$ ps -f UID PID PPID C STIME TTY TIME COMMAND user3 4702 1 1 08:46:40 ttyp4 0:00 -sh user3 4895 4702 18 09:55:10 ttyp4 0:00 ps -f$ ksh$ ps -f UID PID PPID C STIME TTY TIME COMMAND user3 4702 1 0 08:46:40 ttyp4 0:00 -sh user3 4896 4702 1 09:57:20 ttyp4 0:00 ksh user3 4898 4896 18 09:57:26 ttyp4 0:00 ps -f$ exec ps -f UID PID PPID C STIME TTY TIME COMMAND user3 4702 1 0 08:46:40 ttyp4 0:00 -sh user3 4896 4702 18 09:57:26 ttyp4 0:00 ps -f$51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 12
  121. 121. Child Processes and the Environment export color=lavender$ ksh (create child shell process)$ ps -f UID PID PPID C STIME TTY TIME COMMAND user3 4702 1 0 08:46:40 ttyp4 0:00 -sh user3 4896 4702 1 09:57:20 ttyp4 0:00 ksh user3 4898 4896 18 09:57:26 ttyp4 0:00 ps -f$ echo $colorlavender$ color=red$ echo $colorred$ exit (exit child shell)$ ps -f (back in parent shell) UID PID PPID C STIME TTY TIME COMMAND user3 4702 1 0 08:46:40 ttyp4 0:00 -sh user3 4895 4702 1 09:58:20 ttyp4 0:00 ps -f$ echo $colorlavender51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 13
  122. 122. File Name Generation51434S H.02Module 9
  123. 123. Introduction to File Name Generation Command Interpretive execution Environment export varname Programming settings env language Variable variable=value Pipelines Shell assignment set I/O Variable $varname redirection substitution File name Generation *?[} Command var=$(cmd) substitution • File name generating characters are interpreted by the shell. • The shell will generate file names that satisfy the requested pattern. • File name generation is done before the command is executed. • The command will operate on the generated file names.51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 2
  124. 124. File Name Generating Characters? Matches any single character except a leading dot[ ] Defines a class of characters- Defines an inclusive range! Negates the defined class* Matches zero or more characters except a leading dot51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 3
  125. 125. File Name Generation and Dot Files • File name generating characters will never generate a file name that has a leading dot. • The leading dot in dot files must be explicitly provided.51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 4
  126. 126. File Name Generation — ?? matches any single character. $ ls -a . .. .zz abc abcd abcdef abcz bbabb cyz zzayy $ echo ??? Executes: echo abc cyz $ echo abc? Executes: echo abcd abcz $ echo ??a?? Executes: echo bbabb zzayy $ echo .?? Executes: echo .zz $ echo ? Executes: echo ?51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 5
  127. 127. File Name Generation — [ ][ ] defines a class of characters from which one will be matched. $ ls -a . .. .zz 1G 2G 7G 15G Ant Cat Dog abc abcdef ba cyz $ echo [abc]?? Executes: echo abc cyz $ echo [1-9][A-Z] Executes: echo 1G 2G 7G $ echo [!A-Z]?? Executes: echo 15G abc cyz51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 6
  128. 128. File Name Generation — ** matches zero or more characters except a leading dot (.). $ ls -a . .. .profile ab.dat abcd.dat abcde abcde.data $ echo * Executes: echo ab.dat abcd.dat abcde abcde.data $ echo .* Executes: echo . .. .profile $ echo *.dat Executes: echo ab.dat abcd.dat $ echo *e Executes: echo abcde51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 7
  129. 129. File Name Generation — Review $ ls -a . Abc e35f .. Abcd efg .test1 abc fe3f .test2 abcdemf fe3fgGiven the above directory, list all file names that • contain only five characters • contain at least five characters • begin with an "a" or an "A" • have at least four characters and begin with an "a" or an "A" • end with the sequence "e", a single number, and an "f" • begin with a dot • begin with a dot, except . • begin with a dot, except . and ..51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 8
  130. 130. Quoting51434S H.02Module 10
  131. 131. Introduction to Quoting • Many characters have "special“ meaning to the shell: – white space – carriage return – $ – # – * – < > • Quoting removes (escapes) the special meaning of the special characters.51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 2
  132. 132. Quoting CharactersBackslash Single Quotes Double Quotes "51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 3
  133. 133. Quoting — Syntax: Removes the special meaning of the next characterExample: $ echo the escapes the next character the escapes the next character $ color=red white and blue $ echo the value of $color is $color the value of $color is red white and blue $ echo one two > three four one two three four51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 4
  134. 134. Quoting — Syntax: ‘ Removes the special meaning of all characters surrounded by the single quotesExample: $ color=red white and blue $ echo the value of $color is $color the value of $color is $color $ echo the value of $color is $color the value of $color is red white and blue $ echo this doesnt work > Ctrl + c $ echo ************** ************51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 5
  135. 135. Quoting — "Syntax: ” Removes the special meaning of all characters surrounded by the double quotes except , $, {variable name}, $(command), and "Examples: $ color="red white and blue" $ echo "the value of $color is $color" the value of $color is red white and blue $ cur_dir="$LOGNAME - your current directory is $(pwd)" $ echo $cur_dir user3 - your current directory is /home/user3/tree $ echo "theyre all here, , , " " theyre all here, , , "51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 6
  136. 136. Quoting — SummaryMechanism PurposeBackslash Escapes next characterSingle Quotes Escapes all characters inside Double Quotes Escapes all characters inside " ", except , $, {variable name}, and $(command)51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 7
  137. 137. Input and OutputRedirection51434S H.02Module 11
  138. 138. Input and Output Redirection —Introduction Interpretive Command programming execution Environment export varname language settings env Variable variable=value Pipelines Shell assignment set I/O Variable $varname redirection substitution File name generation Command $(cmd) cmd >file substitution cmd 2>f.err *?[] cmd< file51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 2
  139. 139. stdin, stdout, and stderr File Device File Descriptor Reset f1 f2 f3 f4 Menu User f5 f6 f7 f8 Stop Break System stdin 0 ~ ! @ # $ % ^ & * ( ) _ = Back Insert Delete ` 1 2 3 4 5 6 7 8 9 0 - + Space line line . / + - Q W E R T Y U I O P { } | Insert Delete Tab [ ] char char 7 8 9 Caps CTRL A S D F G H J K L : " Return Prev ; 4 5 6 , DEL Shift Z X C V B N M < > ? Select 1 2 3 Shift Next ESC , . / Tab Extend Extend char char 0 . keyboard stdout 1 stderr 2 terminal51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 3
  140. 140. Input Redirection — <Any command that reads its input from stdin can have its input redirected tocome from another file.Example: $ cat remind Your mothers birthday is November 29 $ mail user3 < remind $ mail From user3 Mon July 15 11:30 EDT 1993 Your mothers birthday is November 29 ?d $51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 4
  141. 141. Output Redirection — > and >>Any command that produces output to stdout can have its output redirectedto another file.Examples: Create/Overwrite Create/Append $ date > date.out $ ls >> ls.out $ date > who.log $ who >> who.log $ cat > cat.out $ ls >> who.log input text here Ctrl + d51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 5
  142. 142. Error Redirection — 2> and 2>>Any command that produces error messages to stderr can havethose messages redirected to another file.Examples: $ cp 2> cp.err Create/Overwrite $ cp 2>> cp.err Create/Append $ $ more cp.err Usage: cp [-f|-i] [-p] source_file target_file cp [-f|-i] [-p] source_file ...target_directory cp [-f|-i] [-p] -R|-r source_directory...target_directory Usage: cp [-f|-i] [-p] source_file target_file cp [-f|-i] [-p] source_file ... target_directory cp [-f|-i] [-p] -R|-r source_directory...target_directory51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 6
  143. 143. What Is a Filter? • Reads standard input and produces standard output. • Filters the contents of the input stream or a file. • Sends results to screen, never modifies the input stream or file. • Processes the output of other commands when they are used in conjunction with output redirection.Examples: cat, grep, sort, wc51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 7
  144. 144. wc — Word CountSyntax: wc [-lwc] [file...] Counts lines, words, and characters in a fileExamples:$ wc funfile funfile provided as a command line argument116 529 3134 funfile$$ wc -l funfile116 funfile$$ ls > ls.out$$ wc -w ls.out count the number of entries in your directory72 ls.out51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 8
  145. 145. sort — Alphabetical or Numerical SortSyntax: sort [-ndutX] [-k field_no] [file...] Sorts linesExamples:$ sort funfile funfile provided as a command line argument$ tail -1 /etc/passwduser3:xyzbkd:303:30:studentuser3:/home/user3:/usr/bin/sh 1 2 3 4 5 6 7$ sort -nt: -k 3 < /etc/passwd$ who > whoson$ sort whoson sort logged in users alphabetically$ sort -u -k 1,1 whoson sort and suppress duplicate lines51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 9
  146. 146. grep — Pattern MatchingSyntax: grep [-cinv] [-e] pattern [-e pattern] [file...] grep [-cinv] -f patterns_list_file [file...]Examples: $ grep user /etc/passwd $ grep -v user /etc/passwd $ grep -in -e like -e love funfile $ who > whoson $ grep rob whoson51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 10
  147. 147. Input and Output Redirection — Summarycmd < file Redirects input to cmd from filecmd > file Redirects standard output from cmd to filecmd >> file Redirects standard output from cmd and append to filecmd 2> file.err Redirects errors from cmd to file.errA filter A command that accepts stdin and generates stdoutwc Line, word, and character countSort Sorts lines alphabetically or numericallygrep Searches for lines that contain a pattern51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 11
  148. 148. Pipes51434S H.02Module 12
  149. 149. Pipelines — Introduction Interpretive Command programming execution Environment export varname language settings env Variable variable=valuecmdA | cmdB Pipelines Shell assignment set I/O Variable $varname redirection substitution File name generation Command $(cmd) cmd >file substitution cmd 2>f.err *?[] cmd< file 51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 2
  150. 150. Why Use Pipelines $ who > temp_file $ wc -l < temp_file who wc -l $ rm temp_file51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 3
  151. 151. The | Symbol accept accept stdin stdin cmd_A cmd_B* cmd_C generates generates stderr stdout generates generates generates generates stderr stdout stderr stdout Example: $ ps -ef | more $ ls | more $ ls | sort -r | more *cmd_B must be a filter.51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 4
  152. 152. Pipelines versus Input and OutputRedirectionInput and Output Redirection PipelinesSyntax: cmd_out > file cmd_out | cmd_in or cmd_in < fileExample: who > who.out who | sort sort < who.out51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 5
  153. 153. Redirection in a PipelineThree streams for each command: • stdin • stdout • stderrYou can redirect streams that are not dedicated to the pipeline: stdout stdin cmd_A cmd_BAvailable for stdin stdoutredirection: stderr stderr stdout stdin stdout stdin cmd_A cmd_B cmd_CAvailable for stdin stderr stdoutredirection: stderr stderrExample: $ grep user /etc/passwd | sort > sort.out51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 6
  154. 154. Some Filters cut Cuts out specified columns or fields and display to stdout tr Translates characters tee Passes output to a file and to stdout pr Prints and format output to stdout51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 7
  155. 155. The cut CommandSyntax: cut -clist [file...] Cuts columns or fields cut -flist [-dchar][-s][file...] from files or stdinExamples: $ date | cut -c1-3 $ tail -1 /etc/passwd user3:mdhbmkdj:303:30:student user3:/home/user3:/usr/bin/sh 1 2 3 4 5 6 7 $ cut -f1,6 -d: /etc/passwd $ cut -f1,6 -d: /etc/passwd | sort -r $ ps -ef | cut -c49- | sort -d51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 8
  156. 156. The tr CommandSyntax: tr [-s] [string1][string2] Translates charactersExamples: $ who | tr -s " " $ $ date | cut -c1-3 | tr "[:lower:]" "[:upper:]"51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 9
  157. 157. The tee CommandSyntax: tee [-a] file [file. . .] Tap the pipelineExample: $ who | sort $ who | tee unsorted | sort $ who | tee unsorted | sort | tee sorted $ who | wc -l $ who | tee whoson | wc -l stdin stdout file51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 10
  158. 158. The pr CommandSyntax: pr [-option] [file...] Formats stdin and produces stdoutExamples: $ pr -n3 funfile $ pr -n3 funfile | more $ ls | pr -3 $ grep home /etc/passwd | pr -h "User Accounts"51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 11
  159. 159. Printing from a Pipeline ... | lp Located at end of pipe; sends output to printerExamples: $ pr -l58 funfile | lp Request id is laser-226 (standard input). $ $ ls -F $HOME | pr -3 | tee homedir | lp Request id is laser-227 (standard input). $ $ grep home /etc/passwd | pr -h "user accounts" | lp Request id is laser-228 (standard input).51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 12
  160. 160. Pipelines — SummaryPipeline cmd_out | cmd_in cmd_out | cmd_in_out | cmd_incut Cuts out columns or fields to standard outputtee Sends input to standard output and a specified filepr Prints formatter to the screen, commonly used with lptr Translates characters51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 13
  161. 161. Using Network Services51434S H.02Module 13
  162. 162. What Is a Local Area Network? What the network looks like: HP Series 300/400 HP Series 800 PC Non-HP System System HP Vectra Non-UNIX ARPA ARPA ARPA System Berkeley Berkeley ARPA NS NS Terminator Terminator ThinLAN HP 1000 HP 3000 Non-HP UNIX HP Series 700 System System System ARPA ARPA ARPA ARPA Berkeley NS NS Berkeley51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 2
  163. 163. LAN Services • Two groups of LAN services are – ARPA Services – Berkeley Services • The services allow you to perform – remote logins – remote file copies – remote file access51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 3
  164. 164. The hostname CommandSyntax: hostname Reports your computers network nameExample: $ hostname fred $ $ more /etc/hosts 192.1.2.1 fred 192.1.2.2 barney 192.1.2.3 wilma 192.1.2.4 betty51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 4
  165. 165. The telnet CommandSyntax: telnet hostname ARPA Service to remotely log in to another computerExample: $ telnet fred Trying ... Connected to fred. Escape character is ^]. HP-UX fred 10.0 9000/715 login:51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 5
  166. 166. The ftp CommandSyntax: ftp hostname ARPA Service to copy files to and from a remote computerftp Commands: get Gets a file from the remote computer put Sends a local file to the remote computer ls Lists files on the remote computer ? Lists all ftp commands quit Leaves ftp51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 6
  167. 167. The rlogin CommandSyntax: rlogin hostname Berkeley Service to remotely log in to another computer; rlogin attempts to log you in using local user nameExample: $ hostname barney $ rlogin fred Password: $ hostname fred $ exit $ hostname barney51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 7
  168. 168. The rcp CommandSyntax: rcp source_pathname target_pathname Berkeley Service to copy files to and from a remote computer; works just like the cp command Remote file names are specified as hostname:pathnameExample: $ rcp funfile fred:/tmp/funfile $51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 8
  169. 169. The remsh CommandSyntax: remsh hostname command Berkeley Service to run a command on a remote computerExample: $ hostname barney $ remsh fred ls /tmp backuplist croutOqD00076 fred.log Update.log $ ls EX000662 tmpfile Update.log $51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 9
  170. 170. Berkeley — The rwho CommandSyntax: rwho Displays users on machines in the LAN running the rwh daemon; produces output similar to whoExample: $ rwho user1 barney:tty0p1 Jul 18 8:23 :10 user2 wilma:tty0p1 Jul 18 10:13 :03 user3 fred:tty0p1 Jul 18 11:32 :0651434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 10
  171. 171. Berkeley — The ruptime CommandSyntax: ruptime Displays the status of each machine in the LAN; Each system must be running the rwho daemon. Example: $ ruptime barney up 3:10 1 users load 1.32, 0.80, 0.30 fred up 1+5:15 4 users load 1.47, 1.16, 0.80 wilma down 0:0051434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 11
  172. 172. Introduction to the viEditor51434S H.02Module 14
  173. 173. What Is vi? • A screen-oriented text editor • Included with most UNIX system distributions • Command driven • Categories of commands include – General administration – Cursor movement – Insert text – Delete text – Paste text – Modify text51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 2
  174. 174. Why vi? • On every UNIX platform • Runs on any type terminal • Very powerful editor • Shell command stack uses it • Other UNIX tools require it51434S H.02 © 2003 Hewlett-Packard Development Company, L.P. 3

×