42
UNIX Workshop Series: Quick-Start Part I

UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y [email protected]

  • Upload
    others

  • View
    13

  • Download
    0

Embed Size (px)

Citation preview

Page 1: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

UNIX Workshop Series:Quick-Start

Part I

Page 2: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Objectives

Overview – Connecting with ssh

Command Window Anatomy

Command Structure

Command Examples

Getting Help

Files and Directories

Wildcards, Redirection and Pipe

Create and edit files

Page 3: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Overview

Page 4: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Connecting with ssh

Open a Terminal program

Mac: Applications > Utilities > Terminalssh –Y [email protected]

Linux: In local shellssh –Y [email protected]

Windows: Start Xming and PuTTYCreate a saved session for the remote host name centos.css.udel.edu using username

Page 5: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Connecting with ssh

First time you connect

Page 6: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Unix Basics

Multi-user

Case-sensitive

Bash shell, command-line

Commands

Page 7: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Command Window Anatomy

Title bar

Click in the title bar to bring the window to the front and make it active.

Page 8: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Command Window Anatomy

Login banner

Appears as the first line of a login shell.

Page 9: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Command Window Anatomy

Appears at the beginning of a line and usually ends in $.

Prompts

Page 10: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Command Window Anatomy

Command input

Place to type commands, which may have options and/or arguments.

Page 11: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Command Window Anatomy

Place for command response, which may be many lines long.

Command output

Page 12: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Command Window Anatomy

Input cursor

Typed text will appear at the cursor location.

Page 13: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Command Window Anatomy

Scroll Bar

Will appear as needed when there are more lines than fit in the window.

Page 14: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Command Window Anatomy

Resize Handle

Use the mouse to change the window size from the default 80x24.

Page 15: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Command Structure

command [arguments]

Commands are made up of the actual command and its arguments.

command -options [arguments]

The arguments are further broken down into the command options which are single letters prefixed by a “-” and other arguments that identify data for the command.

Page 16: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Basic Command Examples

Page 17: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Advanced Command Examples

Page 18: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Command Input Keys Summary

return

delete

A

to insert a character.

to erase character to left.

to enter the command.

to move to the left or right.to retrieve previous command.

At the cursor location use

Tab for command line completion.

Page 19: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Command Input Keys Summary

control C or CTRL-c or just C-c use the control key as a shift

Control

C

Control Dcontrol D or CTRL-d or just C-d use the control key as a shift

Control Ucontrol U or CTRL-u or just C-u use the control key as a shift

Page 20: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Command Output Summary Lines longer then the column width

are wrapped.

Lines are scrolled off the top and the prompt will appear at the bottom of the screen.

Use the mouse in the resize handle to increase the width of the screen and unwrap the lines.

Use the mouse in the scroll bar to see lines that have scrolled off the screen.

Page 21: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Getting Help

man command

man is a command that formats and displays on-line manual pages for command.

info [subject]

info formats and displays online documents that are easily searchable.

apropos keyword

apropos searches the whatis database for commands containing the keyword

Page 22: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Getting Help

man bash

Page 23: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Getting Help

info bash

Page 24: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Getting Help: Info Keys

H

L

delete

To read linearly through all sections

‘h’ special link to help.

back up after SPC

‘l’ return from help link.

Q ‘q’ to quit.

Page 25: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Getting Help: Info Keys

tab

L

return

Jump to next link or cross reference.

back up to previous link.

follow the link at the cursor.

‘l’ return from link.

Q ‘q’ to quit.

tab

esc

M ‘m’ to go to the menu.

Page 26: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Getting Help

apropos bash

Page 27: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Files and Directories

Files

Data in UNIX is stored in files.

Directories

Files are organized hierarchically into directories.

Top-level directory is called “root” represented as a slash (/).

Every file (and directory) is listed and separated by a slash (/).

Page 28: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Files and Directories

The UNIX file system is like an inverted tree.

root

/home/its/ug1/ee51vn/report.doc

Page 29: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Working with Files

Page 30: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Working with Files

Page 31: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Working with Directories

Page 32: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Working with Directories:Home (~) and Wildcards

Page 33: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Working with Directories

Page 34: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Working with Directories and Files:Wildcards

Page 35: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Creating Files: Redirection (STDOUT)

^D (control d for EOF)

Page 36: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Creating Files: Redirection

Page 37: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Creating Files: Append and Pipe

^D (control d to stop)

Page 38: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Creating Files: Redirection (STDIN) and Pipe

Page 39: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Editing Files

The VIM editor has two modes:

1. Command: interprets a letter or sequence of letters as a command.

2. Insert: puts anything typed into the file. The ESC key ends insert mode and returns you to command mode.

Command line entry at the bottom of the screen appears when the command “:” is typed. VIM starts up in command mode.

Page 40: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

VIM Tutor: Getting Started

Page 41: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

VIM tutor: Getting Started

Page 42: UNIX Workshop Series: Quick-Start - University of Delaware · Connecting with ssh Open a Terminal program Mac: Applications > Utilities > Terminal ssh –Y username@centos.css.udel.edu

Resources

Unix Tutorial for Beginnershttp://info.ee.surrey.ac.uk/Teaching/Unix/

VTC (Unix Shell Fundamentals) – need to request an accounthttp://www.udel.edu/it/learnit/course/vtccom.html

VIM Tutor (vimtutor)

Linux vi and vim editor: Tutorial and advanced featureshttp://www.yolinux.com/TUTORIALS/LinuxTutorialAdvanced_vi.html

Graphical vi-vim Cheat Sheet and Tutorialhttp://www.viemu.com/a_vi_vim_graphical_cheat_sheet_tutorial.html