UNIX 1.5 wakk@eps.s.u-tokyo.ac.jp W 711 2010/04/14 Unix OS CUI Unix 2008.
1 1 1.1 1 1.2 1-1............. 2 1.3..... 2 1.4 1-2............. 4 2 4 2.1 4 2.2 5 2.3........ 7 3 8 3.1............. 8 3.2 /etc/profile..... 8 3.3 /.bash_profile... 8 3.4 /.bashrc...... 9 3.5 9 3.6............... 12 4 13 4.1.bashrc.............. 13 4.2.aliases.............. 14 4.3.xsession............. 15 4.4.emacs.............. 15 5 16 5.1.bashrc.............. 16 5.2.aliases.............. 16 5.3.xsession............. 17 5.4.emacs.............. 17 6 18 7 19
1, 1.1 Table 1 cd change directory pwd print working directory ls list cp copy mkdir make directory mv move / rm remove rmdir remove directory ls -R man ls ls -la man < > firefox & Google TA TA 89 drwxr-xr-x 12 wakabayashi student 704 2007-08-19 10:44./ drwxr-xr-x 172 root root 4224 2008-03-23 04:44../ -rw-r--r-- 1 wakabayashi ta 5698 2007-04-16 12:53.Xresources -rw-r--r-- 1 wakabayashi ta 607 2007-04-16 12:53.aliases -rw------- 1 wakabayashi ta 1300 2007-08-19 10:48.bash_history -rw-r--r-- 1 wakabayashi ta 310 2007-04-16 12:53.bash_profile -rw-r--r-- 1 wakabayashi ta 3259 2007-04-16 12:53.bashrc -rw-r--r-- 1 wakabayashi ta 4433 2007-04-16 12:53.emacs drwxr-xr-x 2 wakabayashi ta 624 2007-05-09 13:07.fontconfig/ drwx------ 2 wakabayashi ta 80 2007-05-09 13:11.gconfd/ drwx------ 2 wakabayashi ta 80 2007-05-01 10:39.ssh/ -rw-r--r-- 1 wakabayashi ta 14399 2007-04-16 12:53.wl 1
-rwxr-xr-x 1 wakabayashi ta 1744 2007-04-16 12:53.xsession drwxrwxrwx 3 wakabayashi ta 256 2007-04-18 12:41 TA2007/ drwxrwxrwx 3 wakabayashi ta 256 2008-04-10 12:45 TA2008/ ( ) ls -l 1.2 1-1 sl man sl cal -jy du du -sh man du du -sh * /home2/wakabayashi/ta2010/ exercise TA 1.3 UNIX head tail students.txt cd exercise cat -n students.txt 1 s102601 Aoki Hiroka.. less cat -n students.txt less 2
head tail cat head tail Table 2 man Table 2 cat cat <file> head head -n lines <file> tail tail -n lines <file> 10 head -n 10 students.txt 10 tail -n 20 students.txt 20 head -n 10 students.txt 1 s102601 Aoki Hiroka.. 10 s102610 Kaneko Takahumi students.txt 10 tail -n 1 head -n 10 students.txt /exercise$ head -n 10 students.txt tail -n 1 s102610 Kaneko Takahumi /exercise$ cat students.txt head -n 10 tail -n 1 KISS (Keep It Simple and Smart) UNIX cat students.txt cut -f 1,3 -d " " " " cut d f cut 3
1.4 1-2 students.txt 5 10 5 10 15 20 exercise.txt exercise2.txt > >> Emacs 100 1000 Bash ls head tail UNIX 2 2.1 Windows Mac OS X ls UNIX UNIX Fig 1 /bin find /bin -name ls $ find /bin -name ls /bin/ls /bin ls head /bin find /bin -name head whereis head 4
Fig 1 UNIX $ whereis head head: /usr/bin/head head /usr/bin Fig 1 /usr man whereis whereis man 2.2 ls /bin head /usr/bin /bin/ls -l $ /bin/ls -l drwxrwxrwx 3 wakabayashi ta 256 2007-04-18 12:41 TA2010 5
ls Windows Mac OS X /etc/profile lv /etc/profile TA bin lv less / <search term> / bin PATH =... if [ " id -u " -eq 0 ]; then PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" else PATH="/usr/local/bin:/usr/bin:/bin:/usr/games" fi export PATH export bash PATH : /usr/local/bin/ls /bin/ls ls /usr/local/bin/ls PATH CUI ls head PATH PATH /bin /usr/bin ls head ~/exercise line.sh.sh cat < > < > $./exercise/line.sh 10 ~/exercise/students.txt 6
$ line.sh 10 ~/exercise/students.txt $ PATH=$PATH:~/exercise $ line.sh 10 ~/exercise/students.txt ~/exercise ~/exercise line.sh 2.3 env (environment ) MANPATH=/usr/local/intel/idb/man:/usr/local/intel/ifc/man: /usr/local/intel/icc/man:/usr/local/intel/icc/man:/usr/local/man: /usr/local/share/man:/usr/share/man INTEL_LICENSE_FILE=/usr/local/intel/icc/licenses:/opt/intel/licenses: /home1/s102600/intel/licenses:/users/shared/library/application Support/Intel/Licenses: /usr/local/intel/ifc/licenses:/opt/intel/licenses:/home1/s102600/intel/licenses: /Users/Shared/Library/Application Support/Intel/Licenses TERM=xterm-color SHELL=/bin/bash SSH_CLIENT=133.11.229.15 36513 22 SSH_TTY=/dev/pts/0 USER=s102600 LD_LIBRARY_PATH=/usr/local/intel/ifc/lib:/usr/local/intel/icc/lib MAIL=/var/mail/s102600 PATH=/usr/local/intel/idb/bin:/usr/local/intel/ifc/bin:/usr/local/intel/icc/bin: /usr/local/bin:/usr/bin:/bin:/usr/games PWD=/home1/s102600 LANG=ja_JP.EUC-JP SHLVL=1 HOME=/home1/s102600 DYLD_LIBRARY_PATH=/usr/local/intel/ifc/lib:/usr/local/intel/icc/lib LOGNAME=s102600 SSH_CONNECTION=133.11.229.15 36513 192.168.1.120 22 DISPLAY=localhost:10.0 _=/usr/bin/env 7
3 /bin /usr/bin PATH /etc/profile /etc/profile emacs /etc/profile & *1 3.1 210 * UNIX *2 3.2 /etc/profile bash /etc/profile 3.3 /.bash_profile /etc/profile.bash_profile.bash_profile /etc/profile /etc/profile *1 210 *2 ( ) 210 8
3.4 /.bashrc.bashrc.bashrc ( ).bash_profile.bash_profile.bashrc.bash_profile.bashrc PATH.bashrc # PATH etc export PATH=/usr/local/intel/idb/bin:/usr/local/intel/ifc/bin: /usr/local/intel/icc/bin:/usr/local/bin:/usr/bin:/bin:/usr/games /etc/.profile.d ~/.bash_login ~/.bash_logout 3.1 3.4 Fig 2 For All Users, Login Shell /etc/profile For You, Login Shell /.bash profile For You, When Shell Starts /.bashrc Fig 2.bash_history lv.bash_history 3.5 /etc/profile lv /etc/profile 1 # /etc/profile: system-wide.profile file for the Bourne shell (sh(1)) 2 # and Bourne compatible shells (bash(1), ksh(1), ash(1),...). 3 4 if [ " id -u " -eq 0 ]; then 5 PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" 6 else 9
7 PATH="/usr/local/bin:/usr/bin:/bin:/usr/games" 8 fi 9 10 if [ "$PS1" ]; then 11 if [ "$BASH" ]; then 12 PS1= \u@\h:\w\$ 13 else 14 if [ " id -u " -eq 0 ]; then 15 PS1= # 16 else 17 PS1= $ 18 fi 19 fi 20 fi 21 22 export PATH 23 24 umask 022 4 if id man id PATH 24 umask PS1 22 export export export ( /etc/profile ) ( ) ~/.bash_profile 1 # ---- language-env DON T MODIFY THIS LINE! 2 #.bash_profile 3 if [ -f ~/.bashrc ] 4 then 5 #.bash_profile.bashrc 6 # 7 if [ -z "$BASHRC_DONE" ] 8 then 9. ~/.bashrc 10 fi 11 fi 12 # ---- language-env end DON T MODIFY THIS LINE! 10
.bash_profile 3.bashrc (# ) 5 6 7 11.bashrc.bash_profile (.bashrc ).bash_profile source ~/.bashrc.bashrc /etc/profile PATH umask.bash_profile.bashrc Mac.bashrc.bashrc.bashrc cat -n.bashrc lv *3 3 TA BASHRC_DONE.bashrc.bashrc.bash_profile #.bash_profile BASHRC_DONE=1 11 20 PS1 27 aliases 28 if [ -f ~/.aliases ]; then 29. ~/.aliases 30 fi.aliases.aliases *3 11
22 /etc/bash_completion *4 3.6.bashrc 11 PS1 11 # man bash 12 if [ "$TERM" = "dumb" -o "$TERM" = "emacs" ]; then 13 PS1= \w\$ 14 else 15 if [ "$UID" = "0" ]; then 16 PS1= \[\e[41m\]\w\$\[\e[m\] 17 else 18 PS1= \[\e[7m\]\w\$\[\e[m\] 19 fi 20 fi PS1 ( ) = > $ PS1= > PS1.bashrc PS1 TERM env UID id 12 -o or PS1 export env source.bashrc set *4 Tab TA 12
Table 3 $ PS1= \h $ PS1= \h \u \n \d \t $ PS1= :-) $ PS1= ^^; Table 3 PS1 \h \u \d \t (24 ) \T (12 ) \w ( ) \W \n 4 4.1.bashrc 13
4.2.aliases.allias.bashrc lv.aliases alias md= mkdir alias rd= rmdir if [ "$TERM" = "dumb" -o "$TERM" = "emacs" ]; then alias ls= ls -F else alias ls= ls -F --color=auto fi alias lf= ls -F alias la= ls -a alias ll= ls -l alias l.= ls -ld.* alias rm= rm -i alias..= cd.. alias ggre= firefox http://www.google.co.jp alias grep= grep --color alias a2ps= a2psj alias wl= emacs -nw -f wl alias kterm= kterm -bg gray30 -fg white -cr yellow if [ -x /usr/bin/xdvi-ja ]; then alias xdvi= xdvi-ja fi function xtitle() { /bin/echo -e "\033]0;$*\007\c" } la ll mkdir md.. line 14
4.3.xsession Linux CUI Windows Mac OS X UNIX Windows X Window System X ( ) Alt + Control + Fn + 3 X Alt + Control + Fn + 7 startx X X.xsession X Window System X.xsession x X Window System.xsession cat -n.xsession lv 17 application X # Console window Terms and Editors 42 wallpaper 68 Screensaver 79 Window manager X fluxbox Windows Macintosh UI ( ) *5 GUI 210 admin 4.4.emacs Emacs.bashrc.emacs Emacs *5 fluxbox 15
210 23 27 57 X *6 88 120 TEX Fortran.emacs ;.emacs Emacs Lisp Emacs Emacs Lisp Emacs Lisp 5 X Window System.emacs Emacs 5.1.bashrc.bashrc.bashrc source.bashrc 5.2.aliases alias ll= ls -l =.bashrc.allias $ alias ls= ls -R $ alias ls= sl *6 Emacs emacs -nw 16
( ).bashrc alias.bashrc *7 5.3.xsession.xsession X vi X.xsession $ xv -root -quit ~/exercises/images/dance.gif $ xv -root -quit -geometry 1280x1024 ~/exercise/images/nyan_01.jpg.xsession xv UNIX xv & 5.4.emacs Emacs *8 Emacs.emacs ; Emacs (set-foreground-color "white") (set-background-color "dark green") (set-cursor-color "yellow") (set-mouse-color "white") *7 xlock *8 17
TEX ;; (for remark of the other paren) (show-paren-mode t) exercise emacsdownload.emacs ;; (setq load-path (cons "~/exercise/emacsdownload" load-path)) (setq wb-line-number-scroll-bar t) (set-scroll-bar-mode nil) (require wb-line-number) (wb-line-number-toggle) 6 UNIX UNIX UNIX Windows OS UNIX Windows UNIX OS (TA ) 18
7 4 28 ( ) miki ta ls -l *9 exercise catalogue.txt 2007 2009 Mw6.0 100 200 (2 4 ) (9 ) kadai1.txt /home2/wakabayashi/ta2010/s1026??/ (s1026?? ) cut c awk PATH PATH $ whereis touch head: /bin/touch /usr/bin/touch /usr/share/man/man1/touch.1.gz $ which touch /usr/bin/touch which touch /bin /usr/bin ( man ) /usr/bin kadai2.txt /home2/wakabayashi/ta2010/s1026??/ lpr lpr lpr 210 lpr -Pionia ~/exercise/images/nyan_01.jpg admin210 lpr lpr 210 *9... 19
lpr lpr (PATH ) lpr kadai3.txt /home2/wakabayashi/ta2010/s1026??/ kadai4.txt /home2/wakabayashi/ta2010/s1026??/ 20