1 chapter 2 unix for users 2 contents l basic things in unix - login, logout, password, online...
TRANSCRIPT
![Page 1: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/1.jpg)
1
Chapter 2 UNIX for Users
![Page 2: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/2.jpg)
2
Contents
Basic things in Unix
- login, logout, password, online manual
- X-window
- file system
- commands for files and directories
- file attributes
- editor
![Page 3: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/3.jpg)
3
Login and Logout
Login account you already have one account in cs.sookmyung.ac.kr
Login telnet X-window
Logout Ctrl-D logout
![Page 4: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/4.jpg)
4
Login
Systems you can use cs.sookmyung.ac.kr cslinux1.sookmyung.ac.kr cslinux2.sookmyung.ac.kr
Telnet telnet cs.sookmyung.ac.kr
Modem Hyperterminal, 새롬데이터맨 : 710-9251 전화접속 네트워킹 : 3789-5656
telnet, ftp, netscape, …
![Page 5: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/5.jpg)
5
X-window
X-window developed at MIT
window system based on client/server model
standard window system for UNIX and Linux
X-window 의 종류 X11 by MIT
OpenWin on Sun Solaris, HP/UX, IBM AIX, ...
XFree86 on Linux
![Page 6: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/6.jpg)
6
Login to X-window
On Unix or Linux Console login and startx on Linux openwin on Solaris
On Window PC Xmanager on PC http://www.netsarang.co.kr
![Page 7: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/7.jpg)
7
X-window 의 윈도우 매니저
윈도우 매니저의 역할
스크린에 나타나는 윈도우를 조정하고 관리한다 .
윈도우 확대 , 축소 , 이동 , 아이콘으로 변환 등
윈도우 매니저 종류 CDE on Sun Solaris, IBM AIX, HP/UX, ...
KDE on Linux http://www.kde.org
GNOME on Linux http://www.gnome.org
Twm, Mwm, Fvwm, Window Maker … on Linux
http://www.windowmaker.org
![Page 8: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/8.jpg)
8
윈도우 매니저 GNOME
Panel panel applet 과 menu 들을 포함한다 .
Panel applets 은 판넬 내의 작은 프로그램
예 : the clock applet
Main Menu Button Window 98 의 시작 버튼과 같은 역할
Desktop 프로그램
데이터
디렉토리
![Page 9: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/9.jpg)
9
윈도우 매니저 GNOME
파일 관리자 (File Manager)
이동 , 실행
복사 , 이름 변경 , 삭제 등
- 마우스 오른쪽 버튼을 이용
참조 http://www.gnome.org/users-guide/index.html
![Page 10: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/10.jpg)
10
X-window 의 동작 과정
X server
X client
X client
X client
TerminalScreen
Mouse Keyboard
Display
![Page 11: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/11.jpg)
11
X-window 의 동작 과정
Display
consists of a terminal screen, a keyboard, and a mouse
X server
handles all the input and output of data at the display
one X server to each display
보통 X-window 는 X server 를 의미함 .
![Page 12: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/12.jpg)
12
X-window 의 동작 과정
.X client
디스플레이의 사용자와 대화하는 X 응용 프로그램
X client 의 예
- xterm, xclock, netscape, ….
출력을 X server 에 요청
X server 로부터 입력을 받음
- 마우스 클릭 , 윈도우 이동 , 키보드 누름 , …
![Page 13: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/13.jpg)
13
X-window 의 특징
Client/Server 기반 윈도우 시스템
X server 와 X client
네트워크 기반 윈도우 시스템
X server 와 X client 가 같은 호스트 혹은
다른 호스트에 위치할 수 있다 .
![Page 14: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/14.jpg)
14
Running Commands
Shell a command line interpreter on UNIX Bourne shell, Korn shell, C shell
date [yymmddhhmm [.ss] display or set current date and time
Online manual man [chapter] word man -k keyword
$man -k mode
$man chmod
$man 2 chmod
![Page 15: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/15.jpg)
15
Special Characters
Special characters
$ stty all
erase kill werase rprnt flush lnext susp
intr quit stop eof
Terminating a process
- Control-C
- standard way to interrupt the foreground job
Pausing output
- Control-S/Control-Q
![Page 16: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/16.jpg)
16
Special Characters
End-of-input- Control-D
passwd- to set or change your password
- at least six letters, should not a word from a dictionary
![Page 17: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/17.jpg)
17
File System
Directory hierarchy- tree structure
- root directory
bin usr dev home
chang
![Page 18: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/18.jpg)
18
File System
Home directory– shell starts in your home directory when you login– assigned by the system administrator
Current working directory- a directory where your shell is currently working
- home directory, when you login
- How to change cwd ?
Moving to a directory- cd [directoryName]
![Page 19: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/19.jpg)
19
Pathname
Absolute path name– specify a file or directory by a pathname from the root directory /– /home/chang
Relative path name
- specify a file or directory by a pathname relative to the cwd
. : current directory
.. : parent directory
![Page 20: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/20.jpg)
20
Commands for files
Listing the contents of a directory
ls -adglsFR {fileName}* {directoryName}*
-a : hidden files starting with .
-l : long listing including permission, owner,
modification time
-d : directory not files
-g : file's group
-s : size
-F : file type ( *, /)
-R : recursively
![Page 21: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/21.jpg)
21
Commands for files
Listing a file
cat -n {fileName}*
more -f [+lineNumber] {fileName}*
page -f [+lineNumber] {fileName}*
head -n {fileName}*
tail -n {fileName}*
![Page 22: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/22.jpg)
22
Commands for files
Renaming a file- mv -i oldFileName newFileName
- mv -i {fileName}* directoryName
- mv -i oldDirectoryName newDirectoryName
Making a directory- mkdir [-p] newDirectoryName
- creates a new directory
![Page 23: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/23.jpg)
23
Commands for files
Copying a file
cp -ir {fileName}* directoryName
cp -i oldFileName newFileName
Deleting a file or directory
rmdir {directoryName}+
rm -fir {fileName}
![Page 24: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/24.jpg)
24
Commands for files
Printing a file
lpr -m [-Pprinter] [-#copies] {fileName}*
Counting the words in a file
wc -lwc {fileName}*
![Page 25: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/25.jpg)
25
File attributes
file name– the number of physical blocks
file modification time- the the time that the file was last modified
file owner/group- the owner of the file
– every process has an owner, which is the login user id
– whenever a process creates a file, the file's owner is set to the process's owner
![Page 26: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/26.jpg)
26
File attributes
file type
character file type- regular filed directory fileb buffered special file like a disk
drivec unbuffered special file like a
terminall symbolic linkp pipes socket
![Page 27: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/27.jpg)
27
File attributes
permission mode
user group others
rwx rwx rwx
![Page 28: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/28.jpg)
28
Changing files
Changing a file's permissions
chmod -R permission {fileName}+
owner group othersrwx rwx rwx111 111 1117 7 7
$chmod 750 .
$chmod 644 filename
![Page 29: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/29.jpg)
29
Changing files
Changing a file's owner
chown -R UserId {fileName}+
change the ownership of files
$chown chang filename
Changing groups
chgrp -R GrpId {fileName}+
change the group of files
![Page 30: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/30.jpg)
30
Determining terminal's type
Terminal type
- vi or emacs need to know your terminal type !
- Set shell envirionment variable $TERM to your terminal type
(csh) %setenv TERM ansi
%tset
(sh) $set TERM=ansi
$tset
– Setting terminal type in shell's startup file
.cshrc (csh) .profile (sh)
![Page 31: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/31.jpg)
31
Changing terminal's characteristics
• Changing metacharacter setting
– The default metacharacter settings may be overriden
– stty -a {option}* {metacharacterString <value>}*
erase, kill, lnext susp, intr, stop, eof
$ stty erase ^b
![Page 32: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/32.jpg)
32
Editor vi
A standard editor in UNIX%vi filename
Two modes– command mode
initial mode, editing commands
– text entry mode
enter text you'd like to enter
![Page 33: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/33.jpg)
33
Editor vi
How to enter text entry mode
– By typing i, a, o, O, or R in command mode
• i Text is inserted in front of the cursor
• a Text is added after the cursor
• o/O Text is added after/before the current
line
• R Text is replaced (overwritten)
– You can not move around the screen using the cursor keys
in text entry mode
– Back to command mode by typing Esc
![Page 34: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/34.jpg)
34
Command mode
C u r s o r M o v e m e n t
- r i g h t , l e f t , u p , d o w n : )( ,)( ,)( ),( kjhl
- s t a r t o r e n d o f l i n e : ^ , $
- b a c k o r f o r w a r d o n e w o r d : b , w
- d o w n o r u p o n e s c r e e n
C o n t r o l - F , C o n t r o l - B
- d o w n o r u p h a l f s c r e e n
C o n t r o l - D , C o n t r o l - U
- T o l i n e n n
: n n < E n t e r >
![Page 35: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/35.jpg)
35
Command mode
Deleting Text
Item to delete Key sequence
character x, nx
word dw, ndw
line dd, or ndd
to end of current line D
block of lines :<range>d<Enter>
![Page 36: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/36.jpg)
36
Command mode
Replacing Text
Item toreplace
Key sequence
character r, and type a character
word cw, and type the replacement text followed by Esc
line cc, and type the replacement text followed by Esc
![Page 37: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/37.jpg)
37
Command mode
Pasting Text
Action Key sequence
Copy(yank) n lines intopaste buffer
n Shift y
:<range>y<Enter>
Insert(put) paste buffterafter current line
Shift p
:pu<Enter>
Insert paste buffer afterline nn.
:nnpu<Enter>
![Page 38: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/38.jpg)
38
Command mode
Searching
Action Key sequence
Search forward /string < Enter>
Search backward ?string < Enter>
Repeat last search n
![Page 39: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/39.jpg)
39
Command mode
Search/Replace
Action Key sequence
Replace the first string1on each line with string2
:<range> s/string1/string2/<Enter>
Replace every string1with string2
:<range> s/string1/string2/g<Enter>
![Page 40: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/40.jpg)
40
Command mode
Saving/Loading Files
Action Key sequence
Save file as <name> :w <name><Enter>
Save file with current name :w<Enter>
Edit file <name> instead ofcurrent file
:e <name><Enter>
Edt next file on initialcommand line
:n<Enter>
![Page 41: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/41.jpg)
41
Command mode
Miscellaneous
Action Key sequence
Redraw screen Control-L
Execute command andreturn to vi
:!<command><Enter>
Quit if work is saved :q<Enter>
Quit vi and discardunsaved work
:q!<Enter>
![Page 42: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/42.jpg)
42
Electronic Mail
Elm– a popular mail system in UNIX
– sending mail
% elm [email protected]
(1) automatically vi is invoked and edit a mail
(2) quit by typing :wq and send by typing <Enter>
– reading mail
% elm
graphical user interface : move cursor and type return
![Page 43: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/43.jpg)
43
Electronic Mail
mail – mail -H [-f fileName] {address}*
– sending mail
% mail [email protected]
% mail [email protected] < filename
– reading mail
![Page 44: 1 Chapter 2 UNIX for Users 2 Contents l Basic things in Unix - login, logout, password, online manual - X-window - file system - commands for files and](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb45503460f94bbccab/html5/thumbnails/44.jpg)
44
Electronic Mail
Netscape mailer
– 윈도우에서 사용하는 netscape mailer 와 동일하게 사용 가능