백그라운드 실행은 다시 포그라운드로 바꾸는법

zzsay의 이미지

예를 들어 제가 백그라운드 로 프로 그램을 실행 시킬때는

./game &

이런 식으로 실행을 시킵니다.

그럼 프롬 모트 상태가 되자나요.

이걸 다시 포그라운도로 끌어 온다구 해야 하나.. 포그라운도로 되돌리는
방법을 알고 싶습니다.

즉 ./game (포크라운드) 입력한 상태 처럼의 상태로 만드는 방법이 없나여?

그리고 ./game & 말구 백그라운드 명령어가 또 있나요?

혹시 옵션이라던지요..

Saintlinu의 이미지

imsi&

imsi라는 프로그램을 back-ground로 실행 했다면

다시 fg 라고 하시면

fore-ground로 실행이 됩니다.

[saintlinu@heaven test]$ sleep 100&
[1] 27363
[saintlinu@heaven test]$ sleep 200&
[2] 27364
[saintlinu@heaven test]$ sleep 300&
[3] 27365
[saintlinu@heaven test]$ jobs
[1] Running sleep 100 &
[2]- Running sleep 200 &
[3]+ Running sleep 300 &
[saintlinu@heaven test]$ fg 3
sleep 300

이렇게 jobs를 이용해 선택적으로 fore-ground로 실행시키게 할수도

있습니다.

back-ground 실행모드를 지원하는 프로그램이 아니면 다른 프로그램

예를 들어 crontab등의 도움을 받아야 합니다.

그럼..

행복하세요 ^_^

sunyzero의 이미지

참고로 fg 다음에 숫자는 사실 앞에 %가 생략되어있습니다. fg 3는 사실 fg %3이지요.

여기에 kill 도 사용할 수 있습니다. 예를 들어 kill %3 하면 3번 잡 프로세스에 시그널을 보내게 됩니다.

그냥 지나가는 말이었습니다. ^^*

========================================
* The truth will set you free.

icmplayer의 이미지

지금 포(Fore)그라운드에서 돌리시는 프로그램을 백그라운드로 보네시려면:
^z (컨트롤 z)로 서스팬드 시키시고
bg라고 찍으시면 됩니다.
조금 더 복잡한 예를 들자면 (screen이 없을 경우), 실행하고 있는 프로그램을 백그라운드로 보네고, 로그아웃 하시려면:

$ ./progname
$ ^z
$ bg
$ disown                      (1) # bash
$ exit

(1) bash에만 있는 명령 입니다. 옛날에 솔라리스랑 AIX쓸떼 bash가 안 깔려있어서 nohup을 쓴 기억이...
(1.1) disown하고 나시면 그 PID가 jobs에 안 나타나니 kill pid로 죽이셔야겠죠 ^^ -> 포그라운드로 다시 못가지고 옵니다:
screen을 쓰세요.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.