2009 Linux (rsf subaru.naoj.org) (YAGI.Masafumi nao.ac.jp) May 21, 2009
Contents 1 3 1.1................................................. 3 1.2......................................... 4 1.3............................................... 4 2 5 2.1 man.............................................. 5 2.2 apropos............................................ 5 2.3............................................ 6 3! 7 3.1......................................... 7 3.1.1.................................... 7 3.1.2................................. 7 3.1.3................ 7 3.2 (= )........................ 8 3.3.............................................. 8 3.4............................................. 8 3.5............................... 8 3.6................................................... 9 3.7 (copy)............................................... 9 3.8 mv.................................... 9 3.8.1............................................... 9 3.8.2........................................... 9 3.9 find......................... 10 3.10 grep................................ 10 3.11.......................................... 10 3.11.1...................................... 10 3.11.2......................................... 10 3.12.................................. 11 3.13.................................. 11 3.13.1.......................................... 11 3.13.2.............................................. 11 3.14....................................... 12 3.15................................................... 12 4 13 4.1................................... 13 4.2.................................... 13 4.3 (path)........................................... 14 1
4.4............................................. 14 4.4.1................................ 14 4.4.2............................... 14 4.4.3........................... 14 4.4.4................................... 15 5 16 5.1....................................... 16 5.2 : sftp....................... 16 5.3........................ 16 5.4 web.................................................. 16 6 17 6.1.................... 17 6.2 FITS myfiles.txt................................... 17 6.3.......... 17 6.4 2.................................. 17 6.5...................................... 17 6.6.................... 18 6.7 ( ).......... 18 7 19 7.1 tar sftp............................... 19 7.1.1..................................... 19 7.1.2.......................... 19 7.2 ; rsync............................................. 20 7.3 CD DVD................................. 20 7.4 (e.g., USB HD)................ 21 Version Date 2008 May 19 2008 ( ) by R.S.F & M.Y. 2009 May 21 2009 (May 1 ) by R.S.F & M.Y. 2
Chapter 1 1.1 subaru (subaru01 subaru12 ) 1. ws ws01 subaru ws subaru12 ws01 2. subaru12 ws01 subaru12 home 3. startx Xwindow ( ) 1 ws01 4. ssh ana03 ana ana03 ( ) ana03 5. ana03 home home ( ) ana03 /wa03a, /wa03b /wa03a subaru12 /wa03a cd /wa03a mkdir subaru12 /wa03a subaru12 6. /wa03a/subaru12 cd /wa03a/subaru12 1 ( ) 3
7. uname pwd /wa03a/subaru12 # 1.2 Unix/Linux passwd ws03 modify_userinfo -p 2 1.3 1. ana03 jobs 2. exit 3. ws** jobs ( 4.4.3 ps ) exit 4. System Logout subaru** XWindow 5. exit ws** login: 4
Chapter 2 2.1 man man man man man man ( ) man(1) man(1) NAME man - format and display the on-line manual pages SYNOPSIS man [-acdffhkktww] [--path] [-m system] [-p string] [-C config_file] [-M pathlist] [-P pager] [-B browser] [-H htmlpager] [-S section_list] [section] name... DESCRIPTION man formats and displays the on-line manual pages. If you specify section, man only looks in that section of the manual. name is normally the name of the manual page, which is typically the name of a command, function, or file. However, if name contains a slash (/) then man interprets it as a file specification, so that you can do man./foo.5 or even man /cd/foo/bar.1.gz. See below for a description of where man looks for the manual page files. 2.2 apropos apropos apropos pass 5
apropos pass more ( 3.13.2 ) apropos pass grep change 2.3 http://www.adc.nao.ac.jp/j/cc/misc/lm2008/html/ 6
Chapter 3! 3.1 3.1.1 emacs whatidid.txt & ( 3.2 ) copy&paste 3.1.2 script ( whatidid.txt) script whatidid.txt exit whatidid.txt 3.1.3 ksnapshot & ( myscreen.png) display myscreen.png & display /usr/bin/display unix IRAF 7
3.2 (= ) emacs filename.txt & xemacs filename.txt & vi filename.txt & ( ; ampersand) 4.4.1 3.3 pwd cd cd.. cd ~/mydata cd /wa03a mkdir 3.4 ls ls /wa03a/rsf/data.( ) ls -a [ ] ls *.FITS ls DATA0?.FITS ls DATA[1-3].FITS [m-n] m n ls DATA[!1-3].FITS m n ls DATA{1,3,4,a,c,e}.FITS {} ls DATA[4-5].{FITS,fits} ls DATA{1,2}[^3].FITS *,?, [ ], { }, ^ [! 3.5 less more 8
3.6 rm myfile.txt rmdir mydir rm -r mydir 3.7 (copy) A.txt B.txt cp A.txt B.txt ( ) cp../a.txt. cp -r hisdir/ herdir/ -p cp -rp original.txt copied.txt 3.8 mv 3.8.1 DATA1.FITS scr mv DATA1.FITS scr [ ]? mv DATA1.FITS /wa03a/rsf/08a/ mv DATA1.FITS ~/temp/ mv DATA1.FITS. 2 ~ home 3.8.2 YourDATA.FITS MyDATA.FITS mv YourDATA.FITS MyDATA.FITS 9
3.9 find.f find. -name *.f find. -mtime 3 3.pro find. -name "*.pro" -mtime -3 3 +3 3 man find 3.10 grep ( abc abc def) grep abc myfile.txt grep abc def myfile.txt 3.11 3.11.1 /wa03a/rsf/data/08a/ ls /wa03a/rsf/data/08a ln -s /wa03a/rsf/data/08a./08a ls /wa03a/rsf/data/08a ls 08a 3.11.2 DATA1.FITS /wa03a/rsf/data/08a ln -s /wa03a/rsf/data/08a/data1.fits DATA1.FITS DATA1.FITS /wa03a/rsf/data/08a/ 10
3.12 Permission denied (= ) ls -lh a.tar.gz -rwxr-xr-x+ 1 rsf naoj 218K Apr 24 16:07 a.tar.gz - rwx 3 rwx (r) (w) (x) chmod +x hisprogram chmod -x hisprogram!? chmod -R 700 * -R 700 man chmod 3.13 3.13.1 ls MyDATA*.FITS > fitslist.txt filelist.txt (= ) >> ls YourDATA*.FITS >> fitslist 3.13.2 pippo1, pippo2, pippo3,..., and pippo5 5 du -s pippo[1-5] > pippo.list sort -nr pippo.list ( ) du -s pippo[1-5] sort -nr 11
3.14 pippo[1-5] du -sh pippo[1-5] h (human) du -sh..( ) df -kh 3.15 web http://www.adc.nao.ac.jp/j/cc/misc/lm2008/html/node30.html lp2 clp2-a4 12
Chapter 4 bash 4.1 tab!!!( )!ls alias hf= history grep FITS hf FITS.bashrc history ( history grep awk) 789!789 [ ] history grep mv? 3.13.2 4.2 IRAF(cl) SExtractor which cl /usr/local/bin/cl 13
which sex /usr/local/bin/sex / ( ) / 4.3 (path) PATH PATH echo $PATH path ds9 /home/rsf/opt/ds9/ export PATH=$PATH:/home/rsf/opt/ds9 path /home/rsf/opt/ds9 export PATH=/home/rsf/opt/ds9:$PATH 4.4 4.4.1 emacs myfile.text & ( & ; ampersand) 4.4.2 & Ctrl-z (control z ) ( ) fg( ) bg( ) & & exit 4.4.3 ps -ax grep commandname commandname CPU 14
top jobs + 4.4.4 kill jobid jobid kill -KILL jobid -KILL 15
Chapter 5 5.1 ssh -X -l rsf pueo pueo rsf logout 5.2 : sftp sftp -l rsf machinename cd /wa03a/rsf/data/08a mget DATA*.FITS./ bye pueo DATA.FITS (mget) (= ) mput 5.3 scp -r targetdir rsf@pueo:/home/rsf/ ( targetdir ) (.) scp -r rsf@pueo:/home/rsf/targetdir/. 5.4 web URL ( whatiwant.txt) wget wget -i whatiwant.txt man wget 16
Chapter 6 6.1 cd mkdir temp cd temp cp /home/yagims/sample.tar.gz. tar xvzf sample.tar.gz 6.2 FITS myfiles.txt ls *FITS > myfiles.tzt 6.3 paste myfile.txt yourfile.txt > ourfile.txt 6.4 2 diff myfile.txt yourfile.txt 6.5 wc -l filename.txt wc -l line man wc cat -n myfile.txt 17
6.6 3 awk {print $3} myfile.txt > my3rdparm.txt 3 awk {if(nr==3)print} myfile.txt > my3rdcolumn.txt 6.7 ( ) sed -e s/my/your/g myfile.txt > results.txt my your / ( ) (\) sed -e s/\/home\/rsf/\/scr\/jansky/g myfile.txt > results.txt /home/rsf /scr/jansky 18
Chapter 7 7.1 tar sftp 7.1.1 1. tar tar cvzf mydata.tar.gz mydata ( tar ) sftp ($5.2 ) 2. tar cvf mydata.tar mydata tar tar tvf mydata.tar grep FITS FITS happy gzip -v mydata.tar (-v ) ls -lh mydata.tar.gz sftp scp($5.2 ) 7.1.2 tar tar tvzf mydata.tar.gz gunzip -c mydata.tar.gz tar xvf - tar xzvf mydata.tar.gz 19
7.2 ; rsync ( ) 1 link ( 3.11) rsync rsync rsync -av /home/rsf/subaru/ /media/myhd/tmp_subaru/ rsync -av -e ssh /Users/rsfuruya/public_html/ rsf@shell:/home/public_html/ man rsync (!) 7.3 CD DVD 1. ( mydata ) ( 3.14 ) 2. mkisofs (make iso file system) ISO 9660 ( mydata.iso) mkisofs -J -r -o mydata.iso -V 2008MAY11 mydata -J Joliet Windows 2 -V ( ) mydata CD 3. CD-R cdrecord -v dev=1,0,0 mydata.iso CD-R CD-R/W cdrecord -v -tao dev=1,0,0 mydata.iso 4. eject CD CD SCSI 1,0,0 cdrecord -scanbus (dev) FAQ http://www.adc.nao.ac.jp/j/cc/misc/lm2008/html/node27.html 1 3.9 3.10 tar sftp ( 7.1.1 ) 2 -J CD Windows 8 3.FITS.FIT 20
7.4 (e.g., USB HD) ls /media ( myhuge-hd) ( 3.7) cd /media/myhuge-hd/ mkdir subaru08 cd subaru08 cp -r /wa03a/subaru12/. 21