Chapter 0 A “Quick-Start” into the UNIX Operating System.

23
Chapter 0 A “Quick- Start” into the UNIX Operating System

Transcript of Chapter 0 A “Quick-Start” into the UNIX Operating System.

Chapter 0

A “Quick-Start” into the UNIX Operating System

Copyright © 2005 Pearson Addison-Wesley. All rights reserved.

Objectives

• To introduce the UNIX Text User Interface and show the generic structure of UNIX commands

• To describe how to connect and log on to a computer running UNIX operating system

• To explain how to manage and maintain files and directories• To show where to get online help for UNIX commands• To demonstrate the use of a beginner’s set of utility commands• To cover the basic commands and operators alias, biff, cal, cat, cd, cp, exit, hostname, login, lp, lpr, ls, ma,

mesg, mkdir, more, mv, passwd, pg, pwd, rm, rmdir, talk, telnet, unalias, uname, whatis, whereis, who, whoami, write

Copyright © 2005 Pearson Addison-Wesley. All rights reserved.

Structure of a UNIX command

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

Examples:

• $ ls

• $ ls -la

• $ ls -la m*

• $ lpr -Pspr -n 3 proposal.ps

Copyright © 2005 Pearson Addison-Wesley. All rights reserved.

Logging On and Logging Off

• General Categories– Local Area Network (LAN) Connection.

– Internet Connection.

– Stand-Alone Connection.

Copyright © 2005 Pearson Addison-Wesley. All rights reserved.

1. Connecting via a UNIX Terminal

login: your_username <Enter>password: your_password <Enter>NOTICE: 1. This machine is rebooted at 4:15

am daily. 2. Please keep accounts below 100

MB. (du) 3. Limit TOTAL modem connect

times to ONE hour from the hours of 5:00 PM to midnight.

You have new mail.DISPLAY = (upsun17.egr.up.edu:0.0) <Enter>TERM = (FreeBSD) <Enter>Upibm7.egr.up.edu:~ 1$

Copyright © 2005 Pearson Addison-Wesley. All rights reserved.

2. Connecting via PuTTY on a Microsoft Windows Machine

Copyright © 2005 Pearson Addison-Wesley. All rights reserved.

Copyright © 2005 Pearson Addison-Wesley. All rights reserved.

3. Connecting via a Telnet Client on a Microsoft Windows Machine.

Copyright © 2005 Pearson Addison-Wesley. All rights reserved.

Copyright © 2005 Pearson Addison-Wesley. All rights reserved.

File Maintenance Commands and Help on UNIX Command Usage

• What is File Maintenance?

• File and Directory Structure– Home Directory

– Current Working Directory

Copyright © 2005 Pearson Addison-Wesley. All rights reserved.

Copyright © 2005 Pearson Addison-Wesley. All rights reserved.

File Maintenance Commands and Help on UNIX Command Usage (Contd)

• Viewing the Contents of Files– cat, more

$ cat > myfileThis is an example of how to use the cat command to add plain text to a file

<Ctrl-D>

$ more myfileThis is an example of how to use the cat command to add plain text to a file

$

Copyright © 2005 Pearson Addison-Wesley. All rights reserved.

File Maintenance Commands and Help on UNIX Command Usage (Contd)

• Creating, Deleting and Managing Files– cp, mv, rm, ls$ cp myfile myfile2

$ mv myfile2 renamed_file

$ mv “latest revisions october.txt” laterevs.txt

$ rm renamed_file

$ ls

Desktop

Mail

XF86Config.new

kdeinit.core

order.asp.html

order.asp_files

myfile myfile2

$ ls –al

...

$

Copyright © 2005 Pearson Addison-Wesley. All rights reserved.

File Maintenance Commands and Help on UNIX Command Usage (Contd)

• Creating, Deleting and Managing Directories

– mkdir, cd, pwd, rmdir$ mkdir first

$ cd first

$ pwd

/usr1.b/bobk/first

$ cd

$ pwd

/usr1.b/bobk

$ cp myfile myfile2

$ ls my*

myfile myfile2

$ rmdir first

rmdir: first: Directory not empty

$

Copyright © 2005 Pearson Addison-Wesley. All rights reserved.

File Maintenance Commands and Help on UNIX Command Usage

• Obtaining Help with the man Command

Copyright © 2005 Pearson Addison-Wesley. All rights reserved.

File Maintenance Commands and Help on UNIX Command Usage (Contd)

• Obtaining Help with the man Command– man [options][-s section] command-list

$ man ls

LS(1) FreeBSD General Commands Manual LS(1)

NAME

ls - list directory contents

SYNOPSIS

ls [-ABCFGHLPRTWZabcdfghiklmnopqrstuwx1] [file ...]

DESCRIPTION

For each operand that names a file of a type other than directory, ls displays

its name as well as any requested, associated information. For each operand

that names a file of type directory, ls displays the names of files contained

within that directory, as well as any requested, associated information.

If no operands are given, the contents of the current directory are displayed.

If more than one operand is given, nondirectory operands are displayed first;

directory and nondirectory operands are sorted separately and in lexicographical

order.

The following options are available:

Press <SPACE> to continue, or q to quit q

$ man -s2 read

Copyright © 2005 Pearson Addison-Wesley. All rights reserved.

• Other Methods of Obtaining Help– whatis $ whatis login set setenv

login(1) -sign on

set(1) -set runtime parameters for session

setenv (1) -change or add an environment variable

$

File Maintenance Commands and Help on UNIX Command Usage (Contd)

Copyright © 2005 Pearson Addison-Wesley. All rights reserved.

Utility Commands

• Examining System Setups– whereis, whoami$ whoami

bobk

$ whereis mkdir

mkdir: /usr/bin/mkdir

$

• Printing and General Utility Commands– lpr, cal$ lpr -Pspr order.eps

$

• Communication Commands– write username

Copyright © 2005 Pearson Addison-Wesley. All rights reserved.

Utility Commands (Contd)

Copyright © 2005 Pearson Addison-Wesley. All rights reserved.

Command Aliases

• The alias command can be used to create pseudonyms (nicknames) for commands

• Syntax for the alias command is:– alias [name [ = string ] …] Bourne, Korn, Bash shells

– alias [name [ string ] ] C shell

Copyright © 2005 Pearson Addison-Wesley. All rights reserved.

The alias Command Examples

Copyright © 2005 Pearson Addison-Wesley. All rights reserved.

Copyright © 2005 Pearson Addison-Wesley. All rights reserved.