Solaris Advanced User's Guide
Total Page:16
File Type:pdf, Size:1020Kb
Solaris Advanced User’s Guide Sun Microsystems, Inc. 2550 Garcia Avenue Mountain View, CA 94043-1100 U.S.A. Part No: 802-5826 September, 1996 Copyright 1997 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California 94303-4900 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, SunSoft, SunDocs, SunExpress, 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 SunTM 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. RESTRICTED RIGHTS: Use, duplication, or disclosure by the U.S. Government is subject to restrictions of FAR 52.227–14(g)(2)(6/87) and FAR 52.227–19(6/87), or DFAR 252.227–7015(b)(6/95) and DFAR 227.7202–3(a). 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 1997 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, Californie 94303-4900 Etats-Unis. 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, SunSoft, SunDocs, SunExpress, 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 SunTM 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. Please Recycle Contents About This Book xiii 1. Logging In to SunOS and Starting OpenWindows 1 1.1 Logging In 1 1.2 Your Login Shell 2 1.3 Logging Out 3 1.4 Keyboard Equivalents 3 1.5 OpenWindows Start-up Considerations 5 1.5.1 The OPENWINHOME Environment Variable 5 1.5.2 Using the Correct Start-Up File 6 1.6 Starting the OpenWindows User Environment 8 1.6.1 Displaying the OpenWindows Software 8 1.6.2 If OpenWindows Won’t Display 10 1.7 Quitting the OpenWindows Environment 10 1.8 Special OpenWindows Start-up Options 11 1.8.1 Starting with Reduced Network Security 12 1.8.2 Starting with Various Monitor Types 12 2. Basic SunOS Commands 15 2.1 The Command Prompt 15 2.2 Entering Commands 15 Contents iii 2.2.1 Correcting Typing Mistakes 16 2.2.2 Entering Multiple Commands and Long Commands 16 2.2.3 Repeating Previous Commands 17 2.2.4 Adding Command Options 18 2.2.5 Redirecting and Piping Command Output 19 2.2.6 Running Commands in the Background 19 2.3 Getting Help with OS Commands 20 2.3.1 Displaying Manual Pages with man 21 2.3.2 Displaying a One-line Summary with whatis 21 2.3.3 Keyword Lookup with apropos 21 3. Working with Files and Directories 23 3.1 File Concepts 23 3.2 Using File Commands 24 3.2.1 Before You Begin 24 3.2.2 Creating a Test File 24 3.2.3 Listing Files (ls)25 3.2.4 Copying Files (cp)25 3.2.5 Moving and Renaming Files (mv)25 3.2.6 Deleting Files (rm)26 3.2.7 Displaying File Contents (more, cat)26 3.2.8 Displaying File Type (file)27 3.3 Directories and Hierarchy 27 3.3.1 Directory Hierarchy 27 3.3.2 Print Working Directory (pwd)28 3.3.3 Your Home Directory 29 3.3.4 Change Working Directory (cd)29 3.3.5 Creating a Directory (mkdir)30 3.3.6 Relative Path Names 31 iv Solaris Advanced User’s Guide ♦ September, 1996 3.3.7 Moving and Renaming Directories 31 3.3.8 Copying Directories 32 3.3.9 Removing Directories (rmdir)32 3.4 Looking at Differences Between Files (diff)33 3.4.1 Comparing Three Different Files (diff3)34 3.4.2 Using bdiff on Large Files 35 3.5 Looking Up Files (find)35 3.6 File and Directory Security 37 3.6.1 Displaying Permissions and Status (su ls −l)38 3.6.2 Listing “Hidden” Files (ls −a)39 3.6.3 Changing Permissions (chmod)39 3.6.4 Setting Absolute Permissions 41 4. Searching Files 45 4.1 Searching for Patterns with grep 45 4.1.1 grep as a Filter 46 4.1.2 grep with Multi-Word Strings 47 4.1.3 Searching for Lines without a Certain String 48 4.1.4 More on grep 48 4.1.5 Searching for Metacharacters 49 4.1.6 Single or Double Quotes on Command Lines 50 5. Passwords, Processes, and Disk Storage 53 5.1 Using a Password 53 5.1.1 Changing Your Password 54 5.1.2 Password Aging 54 5.2 Processes and PIDs 55 5.2.1 What Commands Are Running Now (ps)55 5.2.2 Terminating Processes (kill)56 5.3 Managing Disk Storage 57 Contents v 5.3.1 Displaying Disk Usage (df −k)57 5.3.2 Displaying Directory Usage (du)58 6. Using the vi Editor 59 6.1 Starting vi 59 6.1.1 Creating a File 60 6.1.2 The Status Line 60 6.2 The Two Modes of vi 60 6.2.1 Entry Mode 61 6.2.2 Command Mode 61 6.3 Ending a Session 62 6.3.1 Saving Changes and Quitting vi 63 6.4 Printing a File 64 6.5 Basic vi Commands 64 6.5.1 Moving Around in a File 64 6.5.2 Inserting Text 67 6.5.3 Changing Text 68 6.5.4 Undoing Changes 69 6.5.5 Deleting Text 69 6.5.6 Copying and Moving Text — Yank, Delete, and Put 71 6.5.7 Using a Count to Repeat Commands 72 6.6 Using ex Commands 72 6.6.1 Turning Line Numbers On and Off 73 6.6.2 Copying Lines 73 6.6.3 Moving Lines 74 6.6.4 Deleting Lines 74 6.7 Searching and Replacing with vi 75 6.7.1 Finding a Character String 75 6.7.2 Refining the Search 76 vi Solaris Advanced User’s Guide ♦ September, 1996 6.7.3 Replacing a Character String 77 6.7.4 Going to a Specific Line 78 6.8 Inserting One File into Another 78 6.9 Editing Multiple Files 78 6.9.1 Editing a Series of Files 79 6.9.2 Copying Lines Between Files 79 6.10 Setting vi Parameters 80 6.11 Recovering from a Crash 80 6.12 Summary of Basic vi Commands 81 7.