1. Trang chủ
  2. » Ngoại Ngữ

Sun Fundamentals of Solaris 7 EU-118 Student Guide With Instructor Notes phần 4 potx

51 280 0
Tài liệu đã được kiểm tra trùng lặp

Đ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

Thông tin cơ bản

Định dạng
Số trang 51
Dung lượng 266,3 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Enterprise Services August 1999, Revision D Objectives Upon completion of this module you should be able to: ● Contrast absolute and relative pathnames ● Access files and directories wit

Trang 1

Exercise: Getting Help

Exercise objective – In this lab you will practice using the help

functions available with CDE and the command-line man pages

Tasks

Complete the following steps:

1 Open a Help Viewer window by clicking on the appropriate FrontPanel icon

2 In the Help Viewer window, select Index and choose All Volumes

3 Find information on how to play an audio file After reading thisinformation, open the Audio player from the Workspace menuand play the /usr/demo/SOUND/sounds/spacemusic.au audiofile

4 Display the on-line manual (man) page for thelscommand

5 Display the on-line manual pages for the passwdcommand andthepasswdfile

6 Find the on-line manual page that describes how to clear theterminal screen (use the keyword “clear”)

7 Display the Help subpanel and determine whether AnswerBook2has been made available on your system

8 If you do have AnswerBook2, invoke it from the subpanel and

look through the Solaris CDE User’s Guide.

9 When you are finished, close the AnswerBook2 window

Trang 2

Getting Help 4-19

Copyright 1999 Sun Microsystems, Inc All Rights Reserved Enterprise Services August 1999, Revision D

Exercise: Getting Help

Workshop Labs

Use what you have learned so far in this course to work through thefollowing:

1 Using the Calendar Manager, add an appointment for lunchtime

on every Wednesday for the next month Have the system sendyou an email message 30 minutes before the appointment andplace a reminder on your desktop 10 minutes before theappointment Use any version of help you need to perform thistask

2 What meaning would an ampersand “&” in thegcosfield of apassword file entry carry for the system?

Trang 3

Exercise: Getting Help

Exercise Summary

Discussion – Take a few minutes to discuss what experiences, issues,

or discoveries you had during the lab exercises

Manage the discussion here based on the time allowed for this module, which was given

in the “About This Course” module If you find you do not have time to spend on

discussion, then just highlight the key concepts students should have learned from the lab exercise.

● Experiences

Ask students what their overall experiences with this exercise have been You might want

to go over any trouble spots or especially confusing areas at this time.

Explore with students how they might apply what they learned in this exercise to

situations at their workplace.

Trang 4

Getting Help 4-21

Copyright 1999 Sun Microsystems, Inc All Rights Reserved Enterprise Services August 1999, Revision D

Exercise: Getting Help

6 Find the on-line manual page that describes how to clear theterminal screen (use the keyword “clear”)

man -k clear

Trang 5

Check Your Progress

Before continuing on to the next module, check that you are able toaccomplish or answer the following:

❑ Describe how to obtain help from the Front Panel

❑ Describe how to obtain application-specific help

❑ Invoke the Help Viewer from the Front Panel

❑ Invoke help from an application window

❑ Display on-line manual pages, including different sections of themanual

❑ Search the on-line manual pages by keyword

Trang 8

Copyright 1999 Sun Microsystems, Inc All Rights Reserved Enterprise Services August 1999, Revision D

Objectives

Upon completion of this module you should be able to:

● Contrast absolute and relative pathnames

● Access files and directories within the file structure using absoluteand relative pathnames

● Identify and describe the parts of a command line

● Access files and directories within the file structure usingpathname abbreviations

● List the contents of directories and their file types

● Identify various metacharacters

● Enter more than one command on a single command line

● Demonstrate the use of wildcard characters

Trang 9

Relevance

Present the following question to stimulate the students and get them thinking about the issues and topics presented in this module While they are not expected to know the answer to the question, the answer should be of interest to them and inspire them to learn the content presented in this module.

Discussion – How does the Solaris system know how to find files and

directories?

Additional Resources

Additional resources – The following reference can provide additional

details on the topics discussed in this module:

Solaris User’s Guide, Part Number 802-6499

Trang 10

Accessing Files and Directories 5-3

Copyright 1999 Sun Microsystems, Inc All Rights Reserved Enterprise Services August 1999, Revision D

File System Structure

Figure 5-1 shows a typical Solaris system file structure; you will refer

to this again later in this course

Figure 5-1 Solaris File System Structure

notes planets

mars pluto

flowers home

/

Trang 11

Pathnames

A pathname uniquely identifies a particular file or directory by

specifying its location Pathnames are similar to a road map or a set ofdirections that tells you how to get from one place in the directoryhierarchy to another

Note – Depending on the setup of your system, home directories can

be found in either/homeor/export/home For the purposes of thisdiscussion,/homeis used

The slashes within the pathnames are delimiters between objectnames A slash in the first position represents the / (root) directory.For example:

/home/user2/dir1/coffees

Delimitersroot directory

Trang 12

Accessing Files and Directories 5-5

Copyright 1999 Sun Microsystems, Inc All Rights Reserved Enterprise Services August 1999, Revision D

Notes

The concept of pathnames is critical to the student’s understanding of how to access files

in the file structure Pathnames identify every file in the file structure.

Briefly describe the Solaris file structure in terms of a hierarchy of directories,

subdirectories, and files The file cabinet analogy works well with the Solaris computing environment file structure If the file cabinet analogy does not work for everyone, you might draw a “tree” structure Use root (/) and some directories to illustrate the root, branches, limbs, and so on.

At some point it should be noted that this is not what the students’ file structure will look like back at the office In other words, the file names, and possibly the location of the home directory, will be different in their work environment The structure shown is an example only.

If the classroom lab is set up in such a way that students’ home directories are under

/export/home, explain that when home directories reside on the local system they are put,

by convention, under /export/home When home directories are provided by a home directory server, by convention, they are found under /home.

Trang 13

Pathnames

There are two types of pathnames: absolute and relative

Absolute Pathname

An absolute pathname specifies a file or directory in relation to the entire

Solaris file hierarchy The hierarchy begins at the / (root) directory.Absolute pathnames always:

● Start at the root (/) directory and list each directory along the path

to the destination file (or directory)

● Use a slash (/) between each directory name in the path to indicatedifferent directories

Trang 14

Accessing Files and Directories 5-7

Copyright 1999 Sun Microsystems, Inc All Rights Reserved Enterprise Services August 1999, Revision D

Trang 15

Pathnames

Relative Pathname

A relative pathname describes the location of a file or directory as it

relates to the current directory If you are in a directory and you want

to move down the directory tree, it is not necessary to type theabsolute pathname You can just type the path starting with the name

of the next directory in the directory structure If a pathname does notbegin with a slash, it is a relative pathname

Relative pathnames are useful because they are shorter than absolutepathnames

Trang 16

Accessing Files and Directories 5-9

Copyright 1999 Sun Microsystems, Inc All Rights Reserved Enterprise Services August 1999, Revision D

Pathnames

Relative Pathname

Use Figure 5-1 on page 5-3 to support these examples:

● The current directory

Trang 17

Command-Line Syntax

When using a terminal window, a shell prompt appears on the screen.For the Bourne and Korn shells, the shell prompt for a user is a dollarsign ($) For a C shell user, the prompt is a percent sign (%)

At the shell prompt, you can type commands Commands areinstructions which tell the system to perform an action

The general format for Solaris 7 commands is:

command Executable (specifies what you want the system to do)

options Modify the executable (specifies how you want the

command run)

argument File or directory, including the path name, or text If a

pathname is not specified for a file or directoryargument, then the operating system will use thecurrent directory

$ command [option(s)] [argument[s]]

Trang 18

Accessing Files and Directories 5-11

Copyright 1999 Sun Microsystems, Inc All Rights Reserved Enterprise Services August 1999, Revision D

Command-Line Syntax

● A space must be used as a delimiter between each part of thecommand line

● Up to 256 characters can be entered on a single command line

● Many commands do not require all three parts

Some examples are:

$ banner "hi there" (Command and argument)

Trang 19

Changing Directories Using the cd Command

Files you need to access are often stored in subdirectories below yourhome directory Because of the way in which a UNIX file system is set

up, it is often desirable to change directory locations

Use thecdcommand to change to a new current directory Thiscommand, like all UNIX commands, accepts both absolute and relativepathnames

Command Format

cd [directory_name]

Trang 20

Accessing Files and Directories 5-13

Copyright 1999 Sun Microsystems, Inc All Rights Reserved Enterprise Services August 1999, Revision D

Changing Directories Using the cd Command

Moving Around the Directory Hierarchy

You can use cdwith:

Trang 21

Displaying the Current Directory Using the pwd Command

Remembering which directory you are currently working in is oftendifficult Use thepwd(print working directory) command to displaythe absolute pathname of your current directory

Command Format

pwd

Trang 22

Accessing Files and Directories 5-15

Copyright 1999 Sun Microsystems, Inc All Rights Reserved Enterprise Services August 1999, Revision D

Displaying the Current Directory Using the pwd Command

Determining Your Current Directory

Trang 23

Displaying the Current Directory Using the pwd Command

Pathname abbreviations are a form of shorthand when movingbetween or referring to directories

Table 5-1 Pathname Abbreviations

The symbol ~+ refers to the current working diretory ($PWD) It is used mostly when writing scripts.

Current (working) directory

Parent directory; the directory directly

above the current directory

~ User’s home directory (Korn and C

shells)

~- The full path to the previous working

directory (Korn shell only)

~logname The home directory of the user

specified bylogname

Trang 24

Accessing Files and Directories 5-17

Copyright 1999 Sun Microsystems, Inc All Rights Reserved Enterprise Services August 1999, Revision D

Displaying the Current Directory Using the pwd Command

Use pathname abbreviations with the cdcommand to move aroundthe file structure For example:

Trang 25

Using the ls Command

To determine the contents of a directory, use thelscommand Thiscommand will display a listing of all files and directories withinspecified directories If no pathname is given as an argument,lswilldisplay the contents of the current directory

Command Format

ls [-option(s)] [pathname[s]]

Trang 26

Accessing Files and Directories 5-19

Copyright 1999 Sun Microsystems, Inc All Rights Reserved Enterprise Services August 1999, Revision D

Using the ls Command

Listing the Contents of a Directory

Have the students try using absolute and relative pathnames.

Displaying Hidden Files

File names that begin with a dot (.) are called hidden files Hidden files

are frequently used to customize a user’s work environment They arenot shown by default because they are infrequently edited

Use ls -a to list all files in a directory, including hidden (.) files

Using ls to Display Hidden Files

Trang 27

Using the ls Command

Displaying File Types

Usels -Fto display file types The various file types are displayedusing the following symbols:

Showing File Type

$ pwd

/home/user2

$

$ ls -F

dante dir1/ dir3/ file1 file3 practice/

dante_1 dir2/ dir4/ file2 file4

Table 5-2 File Type Symbols

Executable *

Plain text file/ASCII (none)Symbolic link @

Trang 28

Accessing Files and Directories 5-21

Copyright 1999 Sun Microsystems, Inc All Rights Reserved Enterprise Services August 1999, Revision D

Displaying a Long Listing

To see detailed information about the contents of a directory use the

ls -lcommand

Getting Detailed Information Using the ls Command

$ ls -l

total 8-rw-r r 1 user2 staff 320Dec 7 11:43 dante-rw-r r 1 user2 staff 368Dec 7 11:45 dante_1drwxr-xr-x 5 user2 staff 512Dec 4 13:43 dir1drwxr-xr-x 4 user2 staff 512Dec 4 13:36 dir2drwxr-xr-x 3 user2 staff 512Dec 4 13:44 dir3drwxr-xr-x 3 user2 staff 512Dec 4 13:44 dir4-rw-r r 1 user2 staff 0Dec 2 09:05 file1

$

✓ total 8indicates the number of 512-byte blocks used at this level of the directory

structure.

This command provides the following file information:

Note – Using ls -twill list files with the most recently modified atthe top of the list

File type (– for regular file ord for directory, for example)Permissions

LinksOwnerGroupSizeLast modification date and timeFile name

Trang 29

Using the ls Command

Listing Individual Directories

Usels -ldto display detailed information about a directory, but notits contents This is useful when you want to see the permissions on adirectory and not the information about its contents (Permissions arediscussed in detail in Module 8.)

Obtaining Detailed Directory Information

$ cd

$ ls -l dir1

total 6drwxr-xr-x 2 user2 other 512 Dec 9 11:10 coffeesdrwxr-xr-x 2 user2 other 512 Dec 9 11:10 fruitdrwxr-xr-x 2 user2 other 512 Dec 9 11:10 trees

dir1/trees:

Note – TheR(or sometimesr) option is commonly used with manyUNIX commands to indicate a recursive action Recursive generallyrefers to the contents of a directory and all of its subdirectories

Trang 30

Accessing Files and Directories 5-23

Copyright 1999 Sun Microsystems, Inc All Rights Reserved Enterprise Services August 1999, Revision D

Trang 32

Accessing Files and Directories 5-25

Copyright 1999 Sun Microsystems, Inc All Rights Reserved Enterprise Services August 1999, Revision D

Metacharacters

Asterisk

Examples

$ ls

dante dir1 dir3 file1 file3 fruit practice

dante_1 dir2 dir4 file2 file4 fruit2

Trang 33

Metacharacters

Question Mark

The question mark (?) matches any single character, except for the

leading dot on a hidden file

Trang 34

Accessing Files and Directories 5-27

Copyright 1999 Sun Microsystems, Inc All Rights Reserved Enterprise Services August 1999, Revision D

Metacharacters

Question Mark

Examples

$ ls

dante dir1 dir3 file1 file3 fruit practice

dante_1 dir2 dir4 file2 file4 fruit2

Trang 35

[cab] However, if you are looking for a range of characters, theymust be in proper order (for example, [a–z] or [3–9]) If you want tosearch for all alphabetic characters, whether lowercase or uppercase,use [A–z] for the pattern to match You can use alphabetic or numericcharacters for the search pattern.

Ngày đăng: 24/07/2014, 02:20

TỪ KHÓA LIÊN QUAN

🧩 Sản phẩm bạn có thể quan tâm