basic of unix for fresh members of sparcs eungkyu@sparcs

18
Basic of UNIX For fresh members of SPARCS eungkyu@sparcs

Upload: bernard-bailey

Post on 29-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Basic of UNIX For fresh members of SPARCS eungkyu@sparcs

Basic of UNIX

For fresh members of SPARCSeungkyu@sparcs

Page 2: Basic of UNIX For fresh members of SPARCS eungkyu@sparcs

What is UNIX?

AT&T’s UNIX Ken Thompson and Dennis Ritchie BSD and System V Release Solaris, AIX, IRIX, HP-UX, FreeBSD, … Linux

Page 3: Basic of UNIX For fresh members of SPARCS eungkyu@sparcs

Features of UNIX

Multi-user, Multitasking Written in C – portability Simple and elegant Very good at networking server

Page 4: Basic of UNIX For fresh members of SPARCS eungkyu@sparcs

Basic Commands of UNIX

Please help me!!! Using file system Permissions Compression and archiving Displaying system information

Page 5: Basic of UNIX For fresh members of SPARCS eungkyu@sparcs

Basic Commands of UNIX – cont.

Searching and find Job control Redirection and pipe Various utilities Using network

Page 6: Basic of UNIX For fresh members of SPARCS eungkyu@sparcs

Please help me!!!

man – to see on-line reference manual $ man man $ man ls

info – for reading documentation (GNU) $ info info $ info ls

-h, --help option

Page 7: Basic of UNIX For fresh members of SPARCS eungkyu@sparcs

Using file system

All in UNIX is file Tree structure ls – listing directory contents

$ ls -al cp, mv – copying, moving files

$ cp file1 file2 $ mv file1 file2 directory

Page 8: Basic of UNIX For fresh members of SPARCS eungkyu@sparcs

Using file system – cont.

rm – removing files $ rm file1 file2 $ rm -rf directory

mkdir, rmdir, cd– making, removing, changing directory $ mkdir directory; cd directory $ cd ..; rmdir directory

pwd – printing working directory

Page 9: Basic of UNIX For fresh members of SPARCS eungkyu@sparcs

Permissions

UNIX is multi-user system user, group, other rwxrwxrwx – 777 chmod – changing file access permissions

$ chmod 644 file1 file2 $ chmod go-rw file3

chown, chgrp (for superuser) – changing user, group ownership

Page 10: Basic of UNIX For fresh members of SPARCS eungkyu@sparcs

Compression and archiving

gzip, bzip2 – compress or expand files $ gzip file1 file2 $ bzip2 -d *.bz2

tar – archiving files $ tar cvf files.tar file1 file2 $ bzip2 files.tar $ tar xzvf directory.tar.gz directory $ tar xjvf directory.tar.bz2 directory

Page 11: Basic of UNIX For fresh members of SPARCS eungkyu@sparcs

Displaying system information

du, df – displaying usage of space w, who – show who is logged in finger – lookup user information whoami – who am I id – printing real eUID and GID

Page 12: Basic of UNIX For fresh members of SPARCS eungkyu@sparcs

Searching and find

which, whereis, type – simple searching utilities

find – finding files $ find directory [expression] … $ find / -name hanterm $ find . -name “*~” -exec rm -f {} \; $ man find

Page 13: Basic of UNIX For fresh members of SPARCS eungkyu@sparcs

Redirection and pipe

$ command > file $ command < file $ command1 | command2 Ask details to netj

Page 14: Basic of UNIX For fresh members of SPARCS eungkyu@sparcs

Various functions

kill – sending signal to process ps – printing process status cat – to see file (?) more, less – paging text file to see grep, egrep – print line matching

pattern $ grep pattern [file] …

Page 15: Basic of UNIX For fresh members of SPARCS eungkyu@sparcs

Various functions

head, tail – see head, tail of files cut, sort – cut or sort text file write – send message to other user Mail alias Xmanager – required

Page 16: Basic of UNIX For fresh members of SPARCS eungkyu@sparcs

Using network

telnet – telnet client mutt, pine – Mail User Agent ftp, ncftp – ftp client wget - a utility to retrieve files lynx, w3mmee – text web browser talk

Page 17: Basic of UNIX For fresh members of SPARCS eungkyu@sparcs

For C/C++ programming

Use ‘:set cindent’ in vim gcc, g++ - C/C++ compiler

$ gcc -o target1 source1.c source2.c … $ g++ -o target2 source1.cc source2.cc

… make

– very good program using Makefile

Page 18: Basic of UNIX For fresh members of SPARCS eungkyu@sparcs

Simple example of Makefile