basic of unix for fresh members of sparcs eungkyu@sparcs
TRANSCRIPT
Basic of UNIX
For fresh members of SPARCSeungkyu@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
Features of UNIX
Multi-user, Multitasking Written in C – portability Simple and elegant Very good at networking server
Basic Commands of UNIX
Please help me!!! Using file system Permissions Compression and archiving Displaying system information
Basic Commands of UNIX – cont.
Searching and find Job control Redirection and pipe Various utilities Using network
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
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
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
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
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
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
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
Redirection and pipe
$ command > file $ command < file $ command1 | command2 Ask details to netj
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] …
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
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
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
Simple example of Makefile