1 2010 k-okada@jsk.t.u-tokyo.ac.jp http://www.jsk.t.u-tokyo.ac.jp/~k-okada/lecture/ 2010 4 5 Linux 1 Ubuntu Ubuntu Linux 1 Ubuntu Ubuntu 3 1. 1 Ubuntu 2. OS Ubuntu OS 3. OS Ubuntu https://wiki.ubuntulinux.jp/ubuntutips/install/installdualboot OS http://www.ubuntulinux.jp/products/ JA-Localized/vmware Windows PC 1 Linux GNU OS GNU/Linux
2 1. Ubuntu 1.1 OS OS OS ( OS ) OS ( OS ) 2 1.2 VMware Player VMware Player http://www.vmware.com/ jp/download/player/ URL VMware Plaeyr 3.0.1 VMware Player for Windows 32-bit and 64-bit Registor or Login Continue 2,Windows7 WindowsXP, WindowsXP
1.2. VMware Player 3 I agree to the terms and conditions ontlined in Evaluation End User License Agreement Registor VMWare Activate your VMware Player Download Activate Evaluation Now VMware Need to resend your activation email? clink heare 15 (VMWare-player-3.0.1-227600.exe) (N)
4 1. Ubuntu 1.3 VMware Ubuntu VMWare Ubuntu ( OS http://www.ubuntulinux.jp/products/ JA-Localized/vmware ubuntu-ja-8.04-vmware-i386. zip Ubuntu Ubuntu.vmx Ubuntu Ubuntu VMware Tools Linux Ubuntu 1.4 Ubuntu 1.4.1
1.4. Ubuntu 5 1.4.2 k-okada@ubuntu-vm:~$ sudo apt-get update sudo k-okada@ubuntu-vm:~$ sudo apt-get upgrade Ubuntu 1.4.3 Ctrl+Space emacs Ctrl+\ SCIM SCIM Ctrl+\ anthy ON/OFF
6 2. Linux 1.4.4 emacs Ctrl Ctrl Caps Ctrl Ctrl CapsLock 2 Linux 2.1 shell shell
2.2. Unix 7 k-okada@ubuntu-vm:~$ mkdir work k-okada@ubuntu-vm:~$ cd work k-okada@ubuntu-vm:~/work$ mkdir soft2 k-okada@ubuntu-vm:~/work$ ls soft2 k-okada@ubuntu-vm:~/work$ ls -al 12 drwxr-xr-x 3 k-okada k-okada 4096 2010-04-03 18:02. drwxr-xr-x 27 k-okada k-okada 4096 2010-04-03 18:02.. drwxr-xr-x 3 k-okada k-okada 4096 2010-04-03 18:02 soft2 k-okada@ubuntu-vm:~/work$ cd soft2 k-okada@ubuntu-vm:~/work/soft2$ ls UNIX k-okada@ubuntu-vm:~/work$ cd ~ k-okada@ubuntu-vm:~$ (/home/k-okada) 2.2 Unix Unix ( ) http://kanji. zinbun.kyoto-u.ac.jp/~yasuoka/publications/dareuni/ k-okada@ubuntu-vm:~$ mkdir doc k-okada@ubuntu-vm:~$ cd doc k-okada@ubuntu-vm:~/doc $ wget -nh --cut-dirs=4 -np -r http://www.kanji.zinbun.kyoto-u.ac.jp/~yasuoka/publications/dareuni/ index.html k-okada@ubuntu-vm:~$ gnome-open index.html
8 3. Ubuntu #/bin/sh Unix 1 3 4 2.3 PrtSc Alt PrtSc 3 Ubuntu Ubuntu deb emacs 3.1 emacs k-okada@ubuntu-vm:~$ emacs -nw emacs : * emacs21-nox * emacs22 * emacs-snapshot * e3 * emacs-snapshot-nox * emacs22-gtk * emacs21 * emacs22-nox * jove : sudo apt-get install < > bash: emacs: command not found emacs
3.2. 9 emacs k-okada@ubuntu-vm:~$ apt-get search emacs emacs 3.2 k-okada@ubuntu-vm:~$ sudo sudo apt-get install emacs22...... : emacs22-bin-common emacs22-common emacsen-common libgif4 liblockfile1 xaw3dg : emacs22-el : emacs22 emacs22-bin-common emacs22-common emacsen-common libgif4 liblockfile1 xaw3dg : 0 : 7 : 0 : 406 20.9MB 65.5MB [Y/n]? Y emacs 3.3 https://wiki.ubuntulinux.jp/ https://wiki.ubuntulinux. jp/ubuntutips Tips. http://ubuntuforums.org/ 4 Emacs Emacs k-okada@ubuntu-vm:~$ emacs -nw
10 4. Emacs C-z shell C-z Ctrl z fg Emacs 4.1.emacs ~/.emacs Emacs Emacs ~/.emacs Emacs EmacsLisp Lisp Emacs C-x C-f (Ctrl x Ctrl f Ctrl ) Find file: ~/.emacs ~/.emacs C-g ~/.emacs ;;; M-x g goto-line ;;; (global-set-key "\M-g" goto-line) Emacs ~/.emacs M-g ESC g (global-set-key "\C-h" backward-delete-char) C-h 4.2 Emacs emacs C-f C-b C-p C-n C-a C-e
4.3. Emacs shell 11 C-x 2 C-x 3 C-x o C-x 1 C-x C-s C-x C-f C-x C-w Emacs C-x C-c Emacs C-d C-s C-k C-y C-k Emacs Beginner s HOWTO (http://www.linux.or.jp/jf/jfdocs/emacs-beginner- HOWTO.html) 2.3 (http://www.linux.or.jp/jf/jfdocs/emacs- Beginner-HOWTO-2.html#ss2.3) GNU Emacs (http://www.bookshelf.jp/texi/emacs- 20.6-man-jp/emacs.html) (http://www.bookshelf.jp/texi/emacs-20.6-manjp/emacs 10.html) 4.3 Emacs shell Emacs bash Emacs M-x shell ESC x shell shell Emacs shell shell
12 5. test0.c test0.c( ) test0.s cat, more, less test0.o hexdump test0.o UNIX hexdump test0.o less $ ls /* test0.c */ #include <stdio.h> test0.c $ gcc -S test0.c int test(int i, int j) { return (i * j); $ cat test0.s $ gcc -c test0.c int main(int argc, char *argv) { int i,j,k; i = 3; j = 2; k = test(i,j); if (k > 5) printf(">5\n"); else printf("<=5\n"); return 0; $ objdump -d test0.o $ gcc -o test0 test0.o $ nm test0.o $ nm test0 $ ls test0.c test0test0.o test0.s $./test0 1 gcc -S gcc -c gcc -o gcc nm objdump -d 5 k-okada-soft2@jsk.t.u-tokyo.ac.jp 1-3 Mac emacs
13 2 add.sh ps aux 1 Mac ifconfig 2,3 #/bin/sh 3 k-okada@k-okada-laptop:~/doc/soft2/2010$ ps-by-user.sh uniq -c sort -nr 123 root 69 k-okada 5 www-data 2 daemon 2 avahi 2 111 1 syslog 1 statd 1 ntp 1 gdm 1 canna 1 120 1 108
14 5. k-okada-soft2@jsk.t.u-tokyo.ac.jp http://www.google.com/ 3!!! Linux man Linux 4 man gcc man make man ar man objdump man man, man ps, man uniq, man sort, man cut Makefile Makefile ( ) Makefile Makefile : make ( ) Tab Tab 5 Emacs C-b C-f 3 you can google it 4 gnome 5 0x0a Tab 0x09
15 test1 main.c hello.c goodbye.c Makefile test1: main.c hello.c goodbye.c gcc -o test1 main.c hello.c goodbye.c make make Makefile % ls Makefile main.c hello.c goodbye.c % make test1 gcc -o test1 main.c hello.c goodbye.c 1 Makefile make test1 /* main.c */ #include <stdio.h> int main() { printf("main.\n"); hello(); goodbye(); return 0; /* hello.c */ #include <stdio.h> void hello(void) { printf("hello!!\n"); /* goodbye.c */ #include <stdio.h> void goodbye(void) { printf("goodbye!!\n"); hello.c main.c goodbye.c main.c main.o, hello.c hello.o, goodbye.c goodbye.o Makefile test2 hello.o goodbye.o main.o hello.c make test2 hello.c main.c goodbye.c
16 5. test2: main.o hello.o goodbye.o gcc -o test2 main.o hello.o goodbye.o main.o: main.c gcc -o main.o -c main.c hello.o: hello.c gcc -o hello.o -c hello.c goodbye.o: goodbye.c gcc -o goodbye.o -c goodbye.c test3: main.o hello.o goodbye.o gcc -o $@ $^ main.o: main.c gcc -o $@ -c $^ hello.o: hello.c gcc -o $@ -c $^ goodbye.o: goodbye.c gcc -o $@ -c $^ $@ $^ Makefile $% $ $? $ $+ Makefile $*.c.o %.o: %.c gcc -o $@ -c $< Makefile
17 test4: main.o hello.o goodbye.o gcc -o $@ $^ %.o: %.c gcc -o $@ -c $< Makefile 6 google 6 (BK) (http://0xcc.net/misc/badknowhow.html) BK
18 5. C Java Java Java 1995 javac.class java. class ( Windows Linux) java Java Web Java javac,java k-okada@ubuntu-vm:~$ sudo apt-get install sun-java6-jdk DJL $ cat test0.java class test0 { public static int test(int i, int j) { return ( i * j ); public static void main(string args[]) { int i, j, k; i = 3; j = 2; k = test(i,j); if ( k > 5 ) { else { $ javac test0.java $ ls > 5 System.out.println(">5"); System.out.println("<=5"); test0.class test0.java $ java test0
19 Perl Perl Larry Wall 1987 Larry Wall patch Perl C web CGI Perl $ cat test0.pl sub test { ($i, $j) = @_; return ( $i * $j ); sub main { $i = 3; $j = 2; $k = &test($i,$j); if ( $k > 5 ) { print ">5\n"; else { print "<=5\n"; & main(); $ perl test0.pl Python Python 1995 Guido van Rossum 7 C Google Yahoo! 7 C Java javac java class Java
20 5. $ cat test0.py def test(i,j): return ( i * j) def main(): i = 3 j = 2 k = test(i,j) if k > 5: print ">5"; else: print "<=5"; main() $ python test0.py python if Python python >5 $ python >>> execfile("test0.py") test0.py test def test(i,j): print "i = " + repr(i) + ", j = " + repr(j); return ( i * j) $ python >>> execfile("test0.py") i = 3, j = 2 > 5 12 >>> test(3,4) i = 3, j = 4