Solaris Advanced User's Guide
Total Page:16
File Type:pdf, Size:1020Kb
Solaris Advanced User’s Guide Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054 U.S.A. Part No: 806–7612–10 May 2002 Copyright 2002 Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, CA 95054 U.S.A. All rights reserved. This product or document is protected by copyright and distributed under licenses restricting its use, copying, distribution, and decompilation. No part of this product or document may be reproduced in any form by any means without prior written authorization of Sun and its licensors, if any. Third-party software, including font technology, is copyrighted and licensed from Sun suppliers. Parts of the product may be derived from Berkeley BSD systems, licensed from the University of California. UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd. Sun, Sun Microsystems, the Sun logo, docs.sun.com, AnswerBook, AnswerBook2, SunOS, and Solaris are trademarks, registered trademarks, or service marks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the U.S. and other countries. Products bearing SPARC trademarks are based upon an architecture developed by Sun Microsystems, Inc. The OPEN LOOK and Sun™ Graphical User Interface was developed by Sun Microsystems, Inc. for its users and licensees. Sun acknowledges the pioneering efforts of Xerox in researching and developing the concept of visual or graphical user interfaces for the computer industry. Sun holds a non-exclusive license from Xerox to the Xerox Graphical User Interface, which license also covers Sun’s licensees who implement OPEN LOOK GUIs and otherwise comply with Sun’s written license agreements. Federal Acquisitions: Commercial Software–Government Users Subject to Standard License Terms and Conditions. DOCUMENTATION IS PROVIDED “AS IS” AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID. Copyright 2002 Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, CA 95054 U.S.A. Tous droits réservés Ce produit ou document est protégé par un copyright et distribué avec des licences qui en restreignent l’utilisation, la copie, la distribution, et la décompilation. Aucune partie de ce produit ou document ne peut être reproduite sous aucune forme, par quelque moyen que ce soit, sans l’autorisation préalable et écrite de Sun et de ses bailleurs de licence, s’il y en a. Le logiciel détenu par des tiers, et qui comprend la technologie relative aux polices de caractères, est protégé par un copyright et licencié par des fournisseurs de Sun. Des parties de ce produit pourront être dérivées du système Berkeley BSD licenciés par l’Université de Californie. UNIX est une marque déposée aux Etats-Unis et dans d’autres pays et licenciée exclusivement par X/Open Company, Ltd. Sun, Sun Microsystems, le logo Sun, docs.sun.com, AnswerBook, AnswerBook2, SunOS, et Solaris sont des marques de fabrique ou des marques déposées, ou marques de service, de Sun Microsystems, Inc. aux Etats-Unis et dans d’autres pays. Toutes les marques SPARC sont utilisées sous licence et sont des marques de fabrique ou des marques déposées de SPARC International, Inc. aux Etats-Unis et dans d’autres pays. Les produits portant les marques SPARC sont basés sur une architecture développée par Sun Microsystems, Inc. L’interface d’utilisation graphique OPEN LOOK et Sun™ a été développée par Sun Microsystems, Inc. pour ses utilisateurs et licenciés. Sun reconnaît les efforts de pionniers de Xerox pour la recherche et le développement du concept des interfaces d’utilisation visuelle ou graphique pour l’industrie de l’informatique. Sun détient une licence non exclusive de Xerox sur l’interface d’utilisation graphique Xerox, cette licence couvrant également les licenciés de Sun qui mettent en place l’interface d’utilisation graphique OPEN LOOK et qui en outre se conforment aux licences écrites de Sun. CETTE PUBLICATION EST FOURNIE “EN L’ETAT” ET AUCUNE GARANTIE, EXPRESSE OU IMPLICITE, N’EST ACCORDEE, Y COMPRIS DES GARANTIES CONCERNANT LA VALEUR MARCHANDE, L’APTITUDE DE LA PUBLICATION A REPONDRE A UNE UTILISATION PARTICULIERE, OU LE FAIT QU’ELLE NE SOIT PAS CONTREFAISANTE DE PRODUIT DE TIERS. CE DENI DE GARANTIE NE S’APPLIQUERAIT PAS, DANS LA MESURE OU IL SERAIT TENU JURIDIQUEMENT NUL ET NON AVENU. 020115@3062 Contents Preface 9 1 Differences Between Command Line Interface and Graphical User Interface 13 Command Line Interface 13 Graphical User Interfaces 13 Common Desktop Environment 14 GNOME Desktop 14 2 Logging In and Using Basic SunOS Commands 15 Logging In 15 Your Login Shell 16 Logging Out 17 Keyboard Equivalents 17 Command Prompt 18 Typing Commands 19 Correcting Typing Mistakes 19 Typing Multiple Commands and Long Commands 19 Repeating Previous Commands 20 Adding Command Options 22 Redirecting and Piping Command Output 22 Running Commands in the Background 23 Using a Password 24 Changing Your Password 25 Password Aging 25 Getting Help With OS Commands 26 3 Displaying Manual Pages With man 26 Displaying a One-line Summary With whatis 26 Keyword Lookup With apropos 27 3 Working With Files and Directories 29 File Concepts 29 Using File Commands 30 Before You Begin 30 Creating a Test File 30 Listing Files (ls)31 Copying Files (cp)31 Moving and Renaming Files (mv)31 Deleting Files (rm)32 Displaying File Contents (more, cat)32 Displaying File Type (file)32 Directories and Hierarchy 33 Directory Hierarchy 33 Printing the Working Directory (pwd)34 Your Home Directory 34 Changing the Working Directory (cd)34 Creating a Directory (mkdir)35 Relative Path Names 36 Moving and Renaming Directories 36 Copying Directories 37 Removing Directories (rmdir)37 Viewing Differences Between Files (diff)37 Comparing Three Different Files (diff3)39 Using bdiff on Large Files 39 Searching for Files (find)39 File and Directory Security 41 Displaying Permissions and Status (ls -l)42 Listing Hidden Files (ls -a)43 Changing Permissions (chmod)43 Setting Absolute Permissions 45 4 Searching Files 49 Searching for Patterns With grep 49 4 Solaris Advanced User’s Guide • May 2002 grep as a Filter 50 grep With Multiword Strings 51 Searching for Lines Without a Certain String 51 Using Regular Expressions With grep 51 Searching for Metacharacters 52 Single or Double Quotes on Command Lines 53 5 Managing Processes and Disk Usage 55 Processes and PIDs 55 What Commands Are Running Now (ps)55 Terminating Processes (pkill)56 Managing Disk Storage 57 Displaying Disk Usage (df -k)57 Displaying Directory Usage (du)57 6 Using the vi Editor 59 Starting vi 59 Creating a File 60 Status Line 60 Two Modes of vi 61 Entry Mode 61 Command Mode 62 Ending a Session 62 Saving Changes and Quitting vi 63 Printing a File 64 Basic vi Commands 64 Moving Around in a File 64 Inserting Text 67 Changing Text 68 Undoing Changes 68 Deleting Text 69 Copying and Moving Text — Yank, Delete, and Put 69 Using a Count to Repeat Commands 70 Using ex Commands 71 Turning Line Numbers On and Off 71 Copying Lines 72 Moving Lines 72 Contents 5 Deleting Lines 73 Searching and Replacing With vi 73 Finding a Character String 73 Refining the Search 74 Replacing a Character String 75 Going to a Specific Line 75 Inserting One File Into Another 76 Editing Multiple Files 76 Summary of Basic vi Commands 76 7 Using Mail 83 mailx Basics 83 Starting mailx 84 Sending Yourself a Sample Message 84 Reading Your Sample Message 85 Quitting mailx 86 Reading Messages 86 Deleting (and Undeleting) Messages 87 Printing Messages 88 Sending Messages 89 Undeliverable Messages 90 Canceling an Unsent Message 90 Adding Carbon and Blind Carbon Copies 90 Inserting a Copy of a Message or File 91 Replying to a Message 92 Saving and Retrieving Messages 93 Saving and Copying Messages in Files 93 Saving and Copying Messages in Folders 93 Reading Messages in Files and Folders 95 Using vi With mailx 96 Mail Aliases 96 Setting Up Mail Aliases in .mailrc 97 Setting Up Mail Aliases in /etc/aliases 98 Tilde Commands 100 Getting Help: Other mailx Commands 102 6 Solaris Advanced User’s Guide • May 2002 8 Using Printers 103 Submitting Print Requests 103 Submitting Print Requests to the Default Printer 103 Submitting Print Requests Using a Printer Name 104 Requesting Notification When Printing Is Complete 105 Printing Multiple Copies 105 Summary Table of lp Options 105 Determining Printer Status 106 Checking on the Status of Your Print Requests 106 Checking Available Printers 107 Displaying All Status Information 107 Displaying Status for Printers 108 Summary Table of lpstat Options 108 Canceling a Print Request 109 Canceling a Print Request by ID Number 109 Canceling a Print Request by Printer Name 110 9 Using the Network 111 Networking Concepts 111 Logging In Remotely (rlogin)112 rlogin Without a Home Directory 112 rlogin as Someone Else 113 rlogin to an Unknown Machine 113 Aborting an rlogin Connection 114 Suspending an rlogin Connection 114 Verifying Your Location (who am i)115 Copying Files Remotely (rcp)115 Copying Files From a Remote Machine 115 Copying Files From Your Machine to Another 116 Executing Commands Remotely (rsh)116 Viewing User Information (rusers)117 Running Networked Applications 118 Using rlogin to Run a Networked Application 118 More About Security 119 10 Customizing Your Working Environment