Sun Fundamentals of Solaris 7 Student Guide With Instructor Notes phần 10 ppt

75 305 0
Sun Fundamentals of Solaris 7 Student Guide With Instructor Notes phần 10 ppt

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

A A-10 Fundamentals of Solaris 7 Copyright 1999 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services August 1999, Revision D History in the C Shell Command-Line Substitution Use !! to execute the most recent command exactly as it was executed previously. If you entered lpstat, sent some print jobs from other terminal windows, and want to enter the lpstat command again from the original terminal window, type !! at the shell prompt to execute lpstat the second time. For example: % lpstat -o no entries % !! lpstat -o sparky-3 root 15 Jun 9 14:55 filtered printer1-5 root 573 Jun 9 13:14 on printer 1 print1-6 root 545 Jun 9 08:10 filtered % Use !* to repeat all arguments of the previous command. Use !$ to repeat the last argument of the previous command. For example: % cd % mkdirabc % ls !* lsabc a: b: c: % rm -ir !$ rm -ir c rm: examine files in dir c (y/n)? y rm: remove c: (y/n)? y % A Features of the C Shell A-11 Copyright 1999 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services August 1999, Revision D History in the C Shell Command-Line Substitution % ls -l > /tmp/list.file % more !$ more /tmp/list.file total 90 -rw-r r 1 user2 other 72 Jun 21 15:07 dante -rw-r r 1 user2 other 72 Jun 21 15:07 dante_1 drw-r r 5 user2 other 512 Sep 28 16:39 dir1 . . . drw-r r 2 user2 other 512 Sep 29 09:45 letters drw-r r 4 user2 other 512 Sep 29 10:01 practice % A A-12 Fundamentals of Solaris 7 Copyright 1999 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services August 1999, Revision D C Shell Features Customizing Your Prompt The C shell enables customization of your system prompt. Command Format set prompt= value Changing Your Prompt % set prompt="What’s Next? " What’s Next? set prompt="Hello, ‘hostname‘ " Hello, venus set prompt="% " % When you change your current command prompt to something new, the new prompt will remain until you change it again or until you log out. To make your change permanent, add the set prompt command to the .cshrc file for the C shell. A Features of the C Shell A-13 Copyright 1999 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services August 1999, Revision D C Shell Features Aliases Command aliases are available in the Korn and C shells, but they are not available in the Bourne shell. A command alias enables you to ● Substitute a short command for a long one ● Create a single command for a series of commands ● Create alternate forms of existing commands ● Change a command set Command Format alias alias_name value Setting Aliases % alias c clear % alias gohome ’cd;ls’ A A-14 Fundamentals of Solaris 7 Copyright 1999 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services August 1999, Revision D C Shell Features Aliases Use the unalias command when you want to remove an alias. Command Format unalias alias_name Unsetting an Alias % unalias c % c c: Command not found % Aliases are only valid for the window in which they are created. However, you can add the aliases to the .cshrc file for the C shell to activate them whenever you invoke a shell. B-1 Copyright 1999 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services August 1999, Revision D Command-LineMail B This appendix provides the following information for accessing mail from the command line: ● Sending mail from the command line using the mailx program ● Reading and printing messages ● Creating and using a mail alias B B-2 Fundamentals of Solaris 7 Copyright 1999 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services August 1999, Revision D Introduction to mailx The Solaris operating environment provides a program called mailx for sending and receiving electronic mail (email). The mailx program provides facilities for reading, writing, sending, receiving, saving, and deleting messages from the command line. The mailx program (utility) is not window-based; therefore, it can be run in either a window environment or from any terminal. B Command-Line Mail B-3 Copyright 1999 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services August 1999, Revision D Command-Line Mail Use the mailx program from the command-line when: ● You are using a command-line login shell ● You are using a terminal ● You remotely log in to your workstation to read your mail Command Format mailx mailx username@hostname Each user has a mailbox file in which to receive mail. By default, this mailbox is located in /var/mail/ username , where username is your login ID. The mailx program notifies you when you receive mail and places the mail in your mailbox. After you have read your mail, mailx automatically places these letters in a storage file called mbox, which is located in your home directory. Reading Your Mail $ mailx No mail for user2 $ ✓ In the Solaris 7 environment, the mail utility offers two versions, mailx and mail . You can use either one; however, the mailx version has more options. This appendix covers the mailx version. /usr/ucb/mail is symbolically linked to /usr/bin/mailx . B B-4 Fundamentals of Solaris 7 Copyright 1999 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services August 1999, Revision D Sending a Mail Message To send mail: 1. Specify username@hostname as an argument to the mailx command. 2. Enter the subject of your mail and press Return. 3. Enter the text of your message, and press the . (period) key or Control-d (to transmit message) on a line by itself to signal the end of the message. For example: $ mailx user3@saturn Subject: lunch! Hi there! Do you have any plans for lunch today? If not, would you care to join me? user2 . (Type a dot [.] and press Return) EOT $ (EOT is an acronym for end of transmission.) B Command-Line Mail B-5 Copyright 1999 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services August 1999, Revision D Canceling a Mail Message Press Control-c to cancel a mail message. $ mailx user3@saturn Subject: lunch! Do you have any plans (press Control-c) ^C (Interrupt one more to kill letter) (press Control-c) ^C “/home/user2/dead.letter” 3/29 $ Note – Each line of text within your letter can be up to 256 characters long. When you exceed this limitation, your screen will freeze. If this occurs, press Control-c to abort your letter. If you cancel a message, it is saved in your home directory under the name dead.letter. Either remove this file or save the text under another name for later transmission. [...]... letters in your mailbox, the displayed list may not show all of your mail headers If this is the case, type one of the following options: Options z+ z- Displays the previous screenful of mail headers h B-6 Displays the next screenful of mail headers Redisplays the list of mail headers at any time Fundamentals of Solaris 7 Copyright 1999 Sun Microsystems, Inc All Rights Reserved Enterprise Services... Note – You can undelete messages only until you quit mailx B -10 Fundamentals of Solaris 7 Copyright 1999 Sun Microsystems, Inc All Rights Reserved Enterprise Services August 1999, Revision D B Replying to a Mail Message Use the r command within mailx to reply to the current message For example: $ mailx mailx version 5.0 Thu Aug 5 10: 36: 57 PDT 1999 Type? for help "/var/mail/user2": 2 messages 2 new... writing mail messages, remember to press Return at the end of each line There is no automatic line wrap with mail  B-16 Note – A piece of email is not a single file A piece of email is made into pages, which are appended into one file By default, the storage area for all mail messages is /var/mail/username Fundamentals of Solaris 7 Copyright 1999 Sun Microsystems, Inc All Rights Reserved Enterprise Services... ~/shell_commands Workshop Lab Solutions C -7 Copyright 1999 Sun Microsystems, Inc All Rights Reserved Enterprise Services August 1999, Revision D C Module 8 – File Security 1 $ chmod 75 0 directory 2 $ mkdir ~/Textfiles 3 $ cd $ cp file1 file2 dante fruit Textfiles 4 $ chmod 75 0 Textfiles 5 $ ls Textfiles > names; chmod 660 names C-8 Fundamentals of Solaris 7 Copyright 1999 Sun Microsystems, Inc All Rights Reserved... message was sent w The size of the message (the number of lines and number of characters in the message) w The subject of the message Mail Headers $ mailx mailx version 5.0 Thu Aug 5 10: 36: 57 PDT 1999 type ? for help “/var/mail/user2”: 2 messages 2 new >N 1 user3 Mon May 14 14:4416/334 About lunch! N 2 user4 Mon May 14 14:5314/326 Your lunch ? Command-Line Mail B -7 Copyright 1999 Sun Microsystems, Inc All... Module 10 – Bourne and Korn Shell Variables 1.$ mkdir $HOME/dir1/coffees/flavors Workshop Lab Solutions C-9 Copyright 1999 Sun Microsystems, Inc All Rights Reserved Enterprise Services August 1999, Revision D C Module 12 – Basic Features of the Korn Shell 1 $ vi kshrc a set -o noclobber b alias p=pwd alias l=’ls -l’ c set -o vi 2 $ vi profile ENV=$HOME/.kshrc; export ENV 3 $ profile $ kshrc C -10 Fundamentals. .. typed by user, listing of options to look for To read the first mail message, press Return at the mail prompt (?) The first (or current) message appears on your screen Press Return to read any subsequent messages If you want to select a specific mail message to read, type the number of the mail message at the mail prompt and press Return B-8 Fundamentals of Solaris 7 Copyright 1999 Sun Microsystems, Inc... from the specified letter into the current letter; valid only when sending a message while reading mail Fundamentals of Solaris 7 Copyright 1999 Sun Microsystems, Inc All Rights Reserved Enterprise Services August 1999, Revision D B Using Tilde Commands The following example demonstrates the use of some of the tilde commands to make a change to the Subject line (~s string) and to refresh and print the... the Front Panel C-4 Fundamentals of Solaris 7 Copyright 1999 Sun Microsystems, Inc All Rights Reserved Enterprise Services August 1999, Revision D C Module 4 – Getting Help 1 Use Front Panel Help to get information on Calendar Manager If difficulties arise with specifics after using the general help, use application-specific help by clicking on the Help menu in the upper right corner of the Calendar Manager... Copyright 1999 Sun Microsystems, Inc All Rights Reserved Enterprise Services August 1999, Revision D C Module 5 – Accessing Files and Directories 1 Look at the man page for an option to the ls command that will display directory listings with last access time rather than last modified time 2 You can either use: $ ls /usr/bin/c* or $ man -k calendar C-6 Fundamentals of Solaris 7 Copyright 1999 Sun Microsystems, . A A -10 Fundamentals of Solaris 7 Copyright 1999 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services August 1999,. other 512 Sep 29 09:45 letters drw-r r 4 user2 other 512 Sep 29 10: 01 practice % A A-12 Fundamentals of Solaris 7 Copyright 1999 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services. a mail alias B B-2 Fundamentals of Solaris 7 Copyright 1999 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services August 1999, Revision D Introduction to mailx The Solaris operating

Ngày đăng: 13/08/2014, 02:23

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan