è£ã¨è¡¨ã®ã¸ã§ãã使ãåãã
ãã¤ã¦...
- ä»ã©ãã®ã¿ã¼ããã«ã¯ã¿ããã¦ã£ã³ãã¦ãããã¤ã§ãéããããã
- ãã©ã¢ã°ã©ã¦ã³ãã§ã³ãã³ãå®è¡ä¸ã«ä½ãå¥ã®ãã¨ãããããªã£ãããæ°ãã«ã¿ããéãã¦ãããã§ã³ãã³ããå®è¡ããã°ååç¨ã足ããã
- ããã¯ã°ã©ã¦ã³ãã§ã³ãã³ããå®è¡ã§ãããã¨ãç¥ã£ã¦ãããã©ãä½ç³»çã«ç解ãã¦ãªãã®ã§ãã£ãããã¹ãç¹°ãè¿ããã
- ãã£ããããã¯ã°ã©ã¦ã³ãã§å¦çãã¦ãããã¨ãå¿ãã¦ãã...ã
- å¦çä¸ã ã¨æã£ã¦ãããåæ¢ãã¦ãã...ã
- çµäºããã¨æã£ã¦ãããåæ¢ãã¦ãã...ã
- åæ¢ä¸ã®ããã»ã¹ãåéããã«ã¯ã©ãããï¼
- ãã£ã±ãçµäºããããã ãã©ãã©ãããã°ããã®ãï¼
- ãããªãã£ãããç¹°ãè¿ããã¡ã«ãè¦ããªãããã¯ã°ã©ã¦ã³ãã§å®è¡ãã¦æ©ãããããªãã常ã«ç¶æ ãè¦ãããã©ã¢ã°ã©ã¦ã³ãã«ãã¦ãããæ¹ãçãã
- 好ããªã ãã¿ããéãã¦ãã¾ããã¨ããæ¹éã«ãªã£ã¦ãã¾ã£ãã
ããã...
- ä½ãã®è£ä½ã§ä¸æçã«ããã¯ã°ã©ã¦ã³ãã«ãã¦ãããããã¨ã£ã¦ãããããã
- manã§ããã¥ã¢ã«è¦ãªãããã³ãã³ããªãã·ã§ã³ãæå®ãããã¨ãã
- git commitãã¦viã§ã¡ãã»ã¼ã¸ç·¨éä¸ã«éå»ã®ã³ãããã¡ãã»ã¼ã¸ã®æ¸ãæ¹ãè¦ãããªã£ãã¨ãã
- Rubyã§éçºä¸ã¯gem serverããã£ã¨èµ·åãã¦ããããï¼ãã°ä¸è¦ï¼ã¨ãã
- ãããªæã§ããã©ã¢ã°ã©ã¦ã³ãä¸çãªèªåã¯ãããããããã¿ããéãã¦èª¿åè¯ãå¦çããã®ã ãã©ã
- ãã®å¾éããã®å¿ãã¦ãã¿ã¼ããã«ã¯ã¿ãã ãã...ã
- å ã ã©ã®ã¿ãã§ä½æ¥ãã¦ããã®ããè¦å¤±ã£ã¦ãã¾ã£ããããã
ã¨ãã訳ã§ããã©ã¢ã°ã©ã¦ã³ãã¨ããã¯ã°ã©ã¦ã³ããç確ã«åãæ¿ãã¦ä½¿ãããªãæã身ã«ä»ããã®ã ã
ä¸ã¤éå ·
- ãã£ã7ã¤ã®ã³ãã³ãã¨ãã¼æä½ãè¦ããã ãã§ããã©ã¢ã°ã©ã¦ã³ãã¨ããã¯ã°ã©ã³ããèªå¨ã«è¡ãæ¥ã§ããã
& | ã³ãã³ãã«&ãä»å ãããã¨ã§ãããã¯ã°ã©ã¦ã³ãã§å®è¡ãã |
jobs | 稼åä¸ã®ã¸ã§ãã表示ãã |
fg [ã¸ã§ãæå®] | ã¸ã§ãããã©ã¢ã°ã©ã¦ã³ãã§å®è¡ãã |
bg [ã¸ã§ãæå®] | ä¸æåæ¢ä¸ã®ã¸ã§ããããã¯ã°ã©ã¦ã³ãã§å®è¡ãã |
control-Z | ãã©ã¢ã°ã©ã¦ã³ãã¸ã§ããä¸æåæ¢ãã |
control-C | ãã©ã¢ã°ã©ã¦ã³ãã¸ã§ããçµäºãã |
kill ã¸ã§ãæå®orããã»ã¹æå® | ã¸ã§ããå¼·å¶çµäºã»ä¸æåæ¢ãããªã© |
-
-
- fg bgã³ãã³ãã¯ã[ã¸ã§ãæå®]ãçç¥ããã¨ã«ã¬ã³ãã¸ã§ããæå®ãããã¨ã«ãªãã
- killã³ãã³ãã¯ãã¸ã§ãæå®orããã»ã¹æå®ãçç¥ã§ããªããå¿ ãæå®ãããã¨ã
-
ã¸ã§ãã¨ããã»ã¹ã®éã
ã¸ã§ãã¨ããã»ã¹ã¨ããè¨èãå ¥ãæ··ãã£ã¦ããã®ã§ããã®æå³ãæ確ã«ãã¦ããã
- ããã»ã¹ï¼OSã管çããå®è¡ä¸ã®ããã°ã©ã ã®åä½
- ã¸ã§ãï¼ã·ã§ã«ã管çããå®è¡ä¸ã®ããã°ã©ã ã®åä½
- ããã»ã¹ã¯ãOSç°å¢ã®ä¸ã§éè¤ããªãçªå·ãå²ãæ¯ããããã©ã®ã·ã§ã«ãããåç §å¯è½ã
- ã¸ã§ãã¯ãèµ·åããã·ã§ã«ãã¨ã«çªå·ç®¡çããããèµ·åããã·ã§ã«ã®ã¿åç §å¯è½ãï¼ä»ã®ã·ã§ã«ã¯åç §ã§ããªãï¼
- è¤æ°ã®ããã»ã¹ãé£æºãã¦ãä¸ã¤ã®ã¸ã§ããæ§æãããã¨ãããã
-
- ä¾ï¼history|awk '{ print $2 }'|sort|uniq -c|sort -r|head
- ä¸è¨ã¯ã³ã©ã¤ãã¼ï¼ãã使ãã³ãã³ãã®ãã¹ã10ã表示ï¼ã¯ãè¨6ã¤ã®ããã»ã¹ã次ã ã¨é£æºãã¦ãä¸ã¤ã®ã¸ã§ããå¦çããã®ã ã
-
- ä¾ï¼ä»¥åä½ã£ãtimerãrec_radikoru.shã¨ãã£ãã·ã§ã«ã¹ã¯ãªãããèµ·åããã¨ä¸ã¤ã®ã¸ã§ãã¨ãªããããã®ä¸ã§å¤æ°ã®ã³ãã³ãï¼ããã»ã¹ï¼ãèµ·åãã¦ãé£æºããã¦ããã
- äºç´æ¥æã«ãªã£ããã¡ããã¨ç®è¦ããtimerã³ãã³ãã欲ãã - ã¶ãªã¬ããè¦ã¦ãã...ã
jobsã³ãã³ã
- å®é¨ç¨ã«3ã¤ã®ã¸ã§ããããã¯ã°ã©ã¦ã³ãã§èµ·åãã¦ããã
$ gem server -l &>/dev/null & $ git help log & $ top &
- jobsã³ãã³ãã¯ã稼åä¸ã®ã¸ã§ããªã¹ããè¿ãã
$ jobs
[1] Running gem server -l >&/dev/null &
[2]- Stopped git help log
[3]+ Stopped top
- åºåããããªã¹ãã«ã¯ä»¥ä¸ã®ãããªæå³ãããã
JobID | ã«ã¬ã³ãè¨å· | ç¶æ | èµ·åã³ãã³ã |
---|---|---|---|
[1] | Running | gem server -l >&/dev/null & | |
[2] | - | Stopped | git help log |
[3] | + | Stopped | top |
ã¸ã§ãã®æå®æ¹æ³
- JobIDã»ã«ã¬ã³ãè¨å·ã»èµ·åã³ãã³ãã®ã©ããã使ã£ã¦ãä»»æã®ã¸ã§ããæå®ã§ããã
- %ã«ç¶ãã¦å ¥åãããã¨ã§ãã¸ã§ãæå®ã«ãªãã®ã ã
%çªå·
- %çªå·ã§ãJobIDãæå®ããã
$ fg %1 # gem server -l >&/dev/null &ããã©ã©ã°ã©ã¦ã³ã㸠$ fg %2 # git help logããã©ã©ã°ã©ã¦ã³ã㸠$ fg %3 # topããã©ã©ã°ã©ã¦ã³ãã¸
%ã«ã¬ã³ãã¸ã§ãè¨å·
- %+ã¯ãã«ã¬ã³ãã¸ã§ããæå³ãããï¼%%ãã«ã¬ã³ãã¸ã§ãï¼
- %-ã¯ãä¸ã¤åã®ã«ã¬ã³ãã¸ã§ããæå³ããã
- ã«ã¬ã³ãã¸ã§ãï¼ãã¡ã°ãç´è¿ã«æä½ï¼èµ·åã»åæ¢ã»fg bgã®åæ¿ãªã©ï¼ãããã¸ã§ã
- ä¸ã¤åã®ã«ã¬ã³ãã¸ã§ãï¼ã«ã¬ã³ãã¸ã§ãã®åã«æä½ãããã¸ã§ã
$ fg %- # git help logããã©ã©ã°ã©ã¦ã³ã㸠$ fg %+ # topããã©ã©ã°ã©ã¦ã³ã㸠$ fg # topããã©ã©ã°ã©ã¦ã³ãã¸ï¼fgã»bgã³ãã³ãã§ã¯ãçç¥ããã¨ã«ã¬ã³ãã¸ã§ãã¨è¦ãªãããï¼
%ã³ãã³ãå
- %ã³ãã³ãåã§ã¯ãã³ãã³ãåã§å§ã¾ãã¸ã§ããæå®ã§ãããï¼åæ¹ä¸è´æ¤ç´¢ï¼
- ã¸ã§ããåºå¥å¯è½ãªæå°éã®å ¥åã§OKã
$ fg %gem # gem server -l >&/dev/null &ããã©ã©ã°ã©ã¦ã³ã㸠$ fg %git # git help logããã©ã©ã°ã©ã¦ã³ã㸠$ fg %top # topããã©ã©ã°ã©ã¦ã³ãã¸
- %?ã³ãã³ãåãªããã³ãã³ãåãå«ãã¸ã§ããæå®ã§ãããï¼é¨åä¸è´æ¤ç´¢ï¼
$ fg %?server # gem server -l >&/dev/null &ããã©ã©ã°ã©ã¦ã³ãã¸
対話çãªã³ãã³ãã®ããã¯ã°ã©ã¦ã³ãå®è¡ã¯ã§ããªã
- topãmanã»helpã®ãã¼ã¸ã£ã¼ãªã©ã対話çãªã³ãã³ãå®è¡ä¸ã¯ãããã¯ã°ã©ã¦ã³ãã«ç§»è¡ããã¨èªåçã«ä¸æåæ¢ç¶æ ã«ãªãã
- bgã§ããã¯ã°ã©ã¦ã³ãå®è¡ã®ã·ã°ãã«ãéã£ã¦ããä¸æåæ¢ç¶æ ã®ã¾ã¾ã
- 対話çãªã³ãã³ããå®è¡ç¶æ ã«ããã«ã¯ããã©ã¢ã°ã©ã¦ã³ãã«ç§»è¡ããå¿ è¦ãããã®ã ã
ã ãããä¸è¨ã®git help logãtopã³ãã³ãã¯ãããã¯ã°ã©ã¦ã³ãã§ã¯å¸¸ã«Stoppedç¶æ ã«ãªã£ã¦ãã¾ãã®ã ï¼
ã¸ã§ãæä½ã®ä¾
ããã¯ã°ã©ã¦ã³ãã®ããã»ã¹ãçµäºãã
- gem serverãããã¯ã°ã©ã¦ã³ãã§èµ·åãã¦ããã
$ gem server -l &>/dev/null &
[1] 72740
- [1]ã¯ã¸ã§ãIDã72740ã¯ããã»ã¹IDã
-
-
- ã¡ãªã¿ã«ããã¯ã°ã©ã¦ã³ãã§ãã£ã¦ããgem server -l &ã ãã§ã¯ãåä½ä¸ã®åºåããã©ã¢ã°ã©ã¦ã³ãã«è¡¨ç¤ºããã¦ãã¾ãã
- &>/dev/nullãä»ãããã¨ã§ãåä½ä¸ã®åºåã¯ãã¹ã¦ç ´æ£ãããã
- å¿ è¦ãªããã¡ã¤ã«ã«åºåãããã¨ããããä¾ï¼gem server -l &> gem_server.log
-
- gem serverããã©ã¢ã°ã©ã¦ã³ãã«å¼ã³æ»ãã
$ fg
- gem serverãçµäºããã
[control-C]
viã§ã³ãããã¡ãã»ã¼ã¸ç·¨éä¸ã«git logã確èªããã
- git commitã§viãèµ·åãã¦ã³ãããã¡ãã»ã¼ã¸ç·¨éä¸ã
$ git commit
- 以åã®ã³ãããå±¥æ´ã確èªããããªã£ãã®ã§ãä¸æåæ¢ãã¦ãgit logã確èªãã¦ã
[control-Z]
$ git log --oneline
- åã³viã®ã³ãããã¡ãã»ã¼ã¸ç·¨éä¸ã®ç¶æ ã«æ»ãã
$ fg
killã³ãã³ã
- killã³ãã³ãã¯ã¸ã§ããããã»ã¹ãå¼·å¶çµäºããæã«ãã使ãã®ã ãã©ã
- ããæ£ç¢ºã«ã¯ãã¸ã§ããããã»ã¹ã«ãã·ã°ãã«ããéãã³ãã³ããªã®ã ã
- å¼·å¶çµäºããã·ã°ãã«ãéä¿¡ããã°ãã¸ã§ãã¯çµäºããã
- å¼·å¶çµäºä»¥å¤ã«ãæ§ã
ãªã·ã°ãã«ãããã
- ãã使ãããã·ã°ãã«ã®ã¿èª¿ã¹ãã
- 詳細ã¯ã·ã°ãã« (ã½ããã¦ã§ã¢)ã¸ã
$ kill -l|awk '{print $1 $2"\n"$3 $4"\n"$5 $6"\n"$7 $8}'
1) SIGHUP
2) SIGINT 端æ«ããã®å²è¾¼çµäºï¼control-Cï¼
3) SIGQUIT çµäºã¨ã³ã¢ãã³ãï¼control-\ï¼
4) SIGILL
5) SIGTRAP
6) SIGABRT
7) SIGEMT
8) SIGFPE
9) SIGKILL ç¡è¦ã§ããªãå¼·å¶çµäºï¼kill -KILLï¼
10) SIGBUS
11) SIGSEGV
12) SIGSYS
13) SIGPIPE
14) SIGALRM
15) SIGTERM å¼·å¶çµäºï¼killï¼
16) SIGURG
17) SIGSTOP ç¡è¦ã§ããªãä¸æï¼kill -STOPï¼
18) SIGTSTP 端æ«ããã®ä¸æï¼control-Zï¼
19) SIGCONT åéï¼bgã»fgï¼
20) SIGCHLD
21) SIGTTIN
22) SIGTTOU
23) SIGIO
24) SIGXCPU
25) SIGXFSZ
26) SIGVTALRM
27) SIGPROF
28) SIGWINCH
29) SIGINFO
30) SIGUSR1
31) SIGUSR2
- ä¸è¨ã®ã¨ãããcontrol-Zãcontrol-Cãbgãfgã¯ãã¸ã§ãã«ã·ã°ãã«ãéã£ã¦ããã
-
- fgã«ã¤ãã¦ã¯ãå ãã¦ãã©ã¢ã°ã©ã¦ã³ãã¸ã§ãã«ããå¦çãè¡ã£ã¦ããã¨æãã
-
- å®è¡ä¸ã®ããã¯ã°ã©ã¦ã³ãã¸ã§ããä¸æåæ¢ããã«ã¯ãfgãã¦ãããcontrol-Zããã®ã ãã©ã
- kill -TSTP %ã¸ã§ãçªå·ãæå®ããã°ããã¡ãã¡ãã©ã¢ã°ã©ã¦ã³ãããã«ä¸æåæ¢ã§ããã®ã ã
$ sleep 100 & [1] 78927 $ jobs [1]+ Running sleep 100 & $ kill -TSTP %% [1]+ Stopped sleep 100
- ã¸ã§ãçªå·ã¯çç¥ã§ããªããã©ãstopã³ãã³ããã¨ã¤ãªã¢ã¹ã§è¨å®ãã¦ã¿ãã
$ alias stop='kill -TSTP'
å³è§£
ããã¾ã§ã®ã¸ã§ãæä½ãå³ã«ã¾ã¨ããã¨ã以ä¸ã®ããã«ãªãã
- 太åã¯ãã³ãã³ãã¾ãã¯[ãã¼æä½]ã
|Background|-------------->|Background|
| | | | | |
| | fg | | kill -TSTP | |
|Running |<--------------|Stopped |<--------------|Running |
| | +----|-----+ | |
| | | fg | |
| |<-------------------|---------------------| |
+----|-----+ | +----|-----+
|[control-C] | kill | kill
| | |
+----V--------------------------V--------------------------V-----+
| Terminated |
+----------------------------------------------------------------+
|
-
- >
- [control-Z]ã»[control-C]ã¯ãã¼æä½ã
- ãã¼æä½ã¯ãã©ã¢ã°ã©ã¦ã³ãã®ã¸ã§ãã«å¯¾ãã¦ã®ã¿ä½ç¨ããã
- ä¸æ¹ããã©ã¢ã°ã©ã¦ã³ãã§å®è¡ä¸ã¯ã³ãã³ããåãä»ãã¦ãããªãã®ã§ã
- ä¸æ¦[control-Z]ã§ä¸æåæ¢ãã¦ãããbgãªã©ã®ã³ãã³ãã§æä½ããã
- ã¸ã§ãå®è¡ä¸ã«...
- ã·ã§ã«ã®ã³ãã³ãå ¥åãã§ããªãç¶æ ï¼ãã©ã¢ã°ã©ã¦ã³ãã¸ã§ã
- ã·ã§ã«ã®ã³ãã³ãå ¥åãã§ããç¶æ ï¼ããã¯ã°ã©ã¦ã³ãã¸ã§ã
- ãã£ã¦ããã©ã¢ã°ã©ã¦ã³ãã¸ã§ãã¯[control-Z]ã»[control-C]ãªã©ã®ãã¼æä½ã®ã¿åãä»ãããã³ãã³ãã¯ä½¿ããªãã
- éã«ãããã¯ã°ã©ã¦ã³ãã¸ã§ãã¯å¸¸ã«ã³ãã³ãï¼bgã»fgã»killï¼ã§æä½ããããã¼æä½ã¯ä½¿ããªãã
åèãã¼ã¸
以ä¸ã®ãã¼ã¸ãããã¸ãåèã«ãªãã¾ãããæè¬ã§ãï¼