unix talk 2007 l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
UNIX Talk 2007 PowerPoint Presentation
Download Presentation
UNIX Talk 2007

Loading in 2 Seconds...

play fullscreen
1 / 47

UNIX Talk 2007 - PowerPoint PPT Presentation


  • 122 Views
  • Uploaded on

UNIX Talk 2007. For CEG Y07 Tang Wai Chung, Matthew (MaFai) Date: 27th AUG, 2007. Overview. CSE working environment UNIX basics UNIX file system Process Management Common UNIX utilities Internet Applications Text Editor: VIM. You are here. SHB 122. SHB 924. SHB 904. 7 x 24 hrs.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'UNIX Talk 2007' - kameryn


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
unix talk 2007

UNIX Talk 2007

For CEG Y07

Tang Wai Chung, Matthew (MaFai)

Date: 27th AUG, 2007

overview
Overview
  • CSE working environment
  • UNIX basics
  • UNIX file system
  • Process Management
  • Common UNIX utilities
  • Internet Applications
  • Text Editor: VIM
cse student laboratories

You are here

SHB 122

SHB 924

SHB 904

7 x 24 hrs

CSE Student Laboratories

undergrad.

postgrad.

user account

1 GB Storage

User Account

samba server

username: tmchan7

password: i_love_u2

* use the same p/w for XP and UNIX.

connect to unix workstations
Connect to UNIX Workstations

ssh

sparc??

ssh

linux?

username: tmchan7

password: *********

user account cont
User Account (Cont)

Personal Homepagehttp://www.cse.cuhk.edu.hk/~[username]orhttp://appsrv.cse.cuhk.edu.hk/~[username]

  • Put your webpages under directory www &allow world readable permission (discuss later)

Email address:[username]@cse.cuhk.edu.hk

printers printing
Printers & Printing

Run out of quota?

  • Quota transfer
  • Purchase more quota

More detailshttp://www.cse.cuhk.edu.hk/corner/tech/account

etiquette in labs

Chan Tai Man

07123456 / tmchan7

31-Aug-2010

Etiquette in Labs
why unix
Why UNIX?

Efficient manipulation (regexp, batch, scripting)

Accessible account everywhere

Convenient programming environment

Java

C

C++

unix basics
UNIX Basics

Users issue commands to the OS.

commands
Commands
  • Users type in commands to execute their jobs.
  • Predefined mnemonics with known meaningse.g. ls = list, cp = copy, rm = remove, etc…
  • Case-sensitive
  • Basic syntax[command] –[option(s)] [argument(s)]

Instruction for how it acts

Target to act on

more about commands
More About Commands
  • Multiple commands can be separated with a semicolon (;)
    • Example: [command 1]; [command 2]; [command 3]
  • Enter command in several lines using backslash (\)
    • Example: [a very long command 1]; \ (enter)[a very long command 2]
terminal

u

Ctrl

+

clear line

l

Ctrl

+

clear screen

d

c

Ctrl

Ctrl

+

+

disconnect / logout

break a command

Terminal
prompt shell
Prompt & Shell
  • You will find a prompt for you to type commands.e.g. sparc1:/uac/y07/tmchan6>
  • Shell: command interpreter
    • Review command history
    • Auto-complete

Ctrl

Machine Name

Current directory

lab exercise 1 startup
Lab Exercise 1: Startup

Setup your own UNIX environment.

  • Login the PC
  • Start “SSH Secure Shell Client”
  • Edit  Settings  Global Settings: Appearance: Colors  Foreground: White; Background: Black
  • Quick Connect – Host Name = sparcXX; login using your own account
  • ls
  • /uac/gds/wctang/bin/startup.script
  • source .cshrc
  • ls(this time the listing should be colourful!)
unix file system

y07

uac

usr

/

UNIX File System
  • Multi-leveled hierarchy: directory tree

Path

/uac/y07

/uac

/usr

/

unix file system18
UNIX File System
  • Filename: max. length 256 characters – numbers, alphabets, {_ . [ ]} or other symbols
  • Hidden file began with ‘.’
  • Directory: a special file which stores a group of other files (incl. directory).
  • Every user has a home directory.
  • Path
    • Absolute (relative to /)
    • Relative (current directory)
unix file system19
UNIX File System
  • Special directories
    • . = current directory
    • .. = parent directory (one level up)
    • ~ = home directory
    • ~[userA] = home directory of “userA”
demo 1

Demo 1

File & Directory

Redirection & Pipe

lab exercise 2 save file listing in a file
Lab Exercise 2: Save File Listing in a file
  • mkdir utalkcreate a new directory called “utalk”
  • cd utalkgo into the new directory
  • ls –l ~ > home.ls.txtlist the home directory and save the output in “home.ls.txt”
  • more home.ls.txtread back the content
  • rm home.ls.txtremove the file
  • cd ..go up one level
  • rmdir utalkdelete the directory
file permission
File Permission

y07

user(u)

others(o)

group(g)

  • r: read
  • w: write
  • x: execute

rwxrwxrwx\u/\g/\o/

changing permission
Changing Permission
  • Basic Syntaxchmod [permission_triads/mode] [filename]
  • permission_triads := [who][action][permissions]who = {u, g, o, a} action = {+, -}permissions = {r, w, x}e.g. chmod a+r allcanread.txt
  • mode := [u][g][o]r = 4, w = 2, x = 13=w+x; 5 = r+x; 7=r+w+xe.g.1: chmod 640 a.txte.g.2: chmod 751 mydir
archive backup gtar
Archive & Backup: gtar
  • Very often we would like store an archive of your files (source codes, reports).
  • gtar is an utility to compress a set of files to an archive (or vice versa).
  • Compress: gtar zcvf [archive name] [file list]
  • Expand: gtar zxvf [archive name]
managing print queues
Managing Print Queues
  • You can check and remove print jobs only on UNIX (even jobs from XP)
  • Check print queue & find print job IDlpq –P[printer name]
  • Remove the job from the queuelprm –P[printer name] [job ID]
  • Print a postscript file directlylpr –P[printer name] [postscript file]
  • Check print quotasprintquota
using man
Using “man”
  • The command man will display the manual of other commands.e.g. man lsexplains the details & options with ls
  • d,f: Forward; b,Ctrl+b: back
  • /: search for keywords in the manualn: next matched items
  • q: quit
email client pine
Email Client: Pine
  • Pine is a fast, simple and easy-to-use email client on UNIX systems.
  • With a simple terminal, you can check and send emails everywhere.
  • You will never be afraid of being infected by unknown attachment from emails!
  • You can also edit your own email filter script for efficient categorization. (ref: procmail)
demo 2

Demo 2

File Permission

Email: Pine

powerful editor vim
Powerful Editor: VIM
  • VIM is one of the most powerful text editor in which you can enter the most letters with less number of keystrokes
  • Syntax highlight is available in nearly all languages you will use here(C, C++, Java, Pascal, HTML, PHP, SQL)
  • Automatic backup (.swp file)
  • Highly customizable
  • Strong support community

including

modes in vim
Modes in VIM
  • In normal mode of VIM, you issue commands instead of inserting letters.
  • You can enter to insert mode by pressing <i>, <a>, <o>, etc ..
  • Insert mode, you can type as you do in notepad.
  • Return to normal mode by pressing <Esc>
modes in vim cont
Modes in VIM (Cont)

<i>, <a>, <o>

COMMAND

copy & paste

formatting

INSERT

type your codes

edit your text

<Esc>

visual

move around command mode
Move around (Command Mode)
  • You can use cursor keys or <h> = left; <l> = right; <j> = down; <k> = up
  • <Ctrl-u> = up half page<Ctrl-d> = down half page<Ctrl-b> = back 1 page<Ctrl-f> = forward 1 page
move around command mode38
Move around (Command Mode)
  • <$>: end of line; <^>: beginning of line; <0>: first position.
  • <{no}G>: go to line {no}
  • <gg>: beginning of file
  • <G>: end of file
save quit
Save & Quit
  • <ZZ>: write file and exit (time to sleep!)
  • <:w>: save with same name
  • <:q>: quit
  • <:wq>: save and quit
  • When you add ‘!’ at the end of w or q, you force to execute the command.
  • <:sav {filename}>: save as.
deleting undo redo
Deleting ... Undo / Redo
  • <d{type}>: delete 1 object of {type}
  • <dd>: delete a line
  • <dw>: delete one word
  • <d3w>: delete 3 words
  • <y{type}>: yank (copy) 1 object
  • <yy>: copy a line to buffer
  • <p>: paste the buffer content
  • <u>: undo
  • <Ctrl-r>: redo
nntp news reader tin
NNTP News Reader: Tin
  • Most of our courses have newsgroup in the NNTP server.
  • Tin is fast, simple and easy-to-use news reader on UNIX.
  • Tin keeps you with the latest news from courses (hints? delay?).
  • Check and post your news everywhere with a terminal.
demo 3

Demo 3

Powerful Editor: VIM

News Reader: TIN

lab exercise 3 internet utilities
Lab Exercise 3: Internet Utilities
  • Use pine to send an email to me (wctang) using the subject “Y07 [username]”
  • Use tin to subscribe the newsgroup cuhk.testUse VIM to edit and post in this group.
q a free chat

Q & A / Free Chat

Thank you for your attention!

See you all again in ERG2020B!