{
  "created": "2015-12-20T19:56:48Z",
  "hierarchy": [
    {
      "name": "ROOT",
      "type": "folder",
      "uri": "/ROOT"
    },
    {
      "name": "Foreground and Background Processes Management",
      "type": "article",
      "uri": "Foreground_and_Background_Processes_Management"
    }
  ],
  "html": "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\"/>\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"/>\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"/>\n    <meta property=\"og:image\" content=\"/img/logo512.png\"/>\n    <meta property=\"og:site_name\" content=\"Nikhil's Personal Wiki\"/>\n    <link rel=\"og:image\" href=\"/img/logo512.png\"/>\n    <link rel=\"icon\" href=\"/img/favicon.png\"/>\n    <link rel=\"apple-touch-icon\" href=\"/img/logo192.png\"/>\n    <link rel=\"stylesheet\" href=\"/css/styles.css\"/>\n    <link rel=\"stylesheet\" href=\"/css/highlight.css\"/>\n    <title>Foreground and Background Processes Management &ndash; Nikhil's Personal Wiki</title>\n    <script type=\"text/javascript\" id=\"MathJax-script\" defer src=\"https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js\"></script>\n    <script defer data-domain=\"wiki.nikhil.io\" src=\"https://plausible.io/js/plausible.js\"></script>\n  </head>\n  <body>\n    <noscript>\n      👉 A few things won&#8217;t work if you have JavaScript disabled.\n    </noscript>\n    <div class=\"container article\">\n      <header>\n        <nav>\n          <ul>\n            <li>\n              <a href=\"/archive\"  title=\"Archive\">\n                <span>Archive</span>\n              </a>\n            </li>\n            <li>\n              <a href=\"/Home\"  title=\"Home\">\n                <span>Home</span>\n              </a>\n            </li>\n            <li>\n              <a href=\"/random\"  title=\"See a random article\">\n                <span>Random</span>\n              </a>\n            </li>\n            \n            \n              \n                <li>\n                  <a href=\"/Foreground_and_Background_Processes_Management/raw.txt\"  title=\"View Source\">\n                    <span>Raw</span>\n                  </a>\n                </li>\n              \n              \n            \n            \n            \n            \n              \n                <li>\n                  <a href=\"/Foreground_and_Background_Processes_Management/revisions\" >\n                    <span>Revisions</span>\n                  </a>\n                </li>\n              \n            \n            \n              \n                \n                  <li>\n                    <a href=\"/Foreground_and_Background_Processes_Management/index.json\" title=\"View JSON Object\">\n                      <span>JSON</span>\n                    </a>\n                  </li>\n                \n              \n            \n          </ul>\n        </nav>\n      </header>\n      <main>\n        \n  <nav>\n  <ul>\n    \n      <li>\n        <a data-entity-type=\"folder\" href=\"/ROOT\" title=\"ROOT\">Root</a>\n      </li>\n    \n      <li>\n        <a data-entity-type=\"article\" href=\"/Foreground_and_Background_Processes_Management\" title=\"Foreground and Background Processes Management\">Foreground and Background Processes Management</a>\n      </li>\n    \n    \n    \n    \n    \n  </ul>\n</nav>\n\n  <h1>Foreground and Background Processes Management\n    \n  </h1>\n  <p>To illustrate, here&rsquo;s a directory listing:</p>\n<pre><code>user@example:~/scripts/trunk/backup_scripts# ls -l\ntotal 76\n-rwxr-xr-x 1 user user   894 2011-06-27 10:00 backup.hwaddr.sh\n-rwxr-xr-x 1 user user 12175 2011-05-02 22:54 backup.local.sh\n-rwxr-xr-x 1 user user  6194 2011-04-12 16:53 backup.mysql.sh\n-rwxr-xr-x 1 user user 14638 2011-04-28 11:29 backup.network.sh\n-rwxr-xr-x 1 user user  3201 2011-05-02 09:06 backup.opendirectory.sh\n-rwxr-xr-x 1 user user  7871 2011-04-28 11:32 backup.rotate.sh\n-rwxr-xr-x 1 user user  3743 2011-04-12 16:53 backup.rpms.sh\n-rwx------ 1 user user  5037 2011-06-28 15:03 backup.sh\n-rwxr-xr-x 1 user user  4184 2011-06-27 10:01 backup.staging.sh\n-rwxr-xr-x 1 user user  3128 2011-06-27 10:58 backup.subversion.sh\n</code></pre>\n<p>Let&rsquo;s say I started editing a file (e.g. <code>vim backup.sh</code>. I now hit <code>Ctrl+z</code> to &lsquo;push&rsquo; the process into the background. This is what I see:</p>\n<pre><code>[1]+  Stopped                 vim backup.sh\nuser@support:~/scripts/trunk/backup_scripts#\n</code></pre>\n<p>Now I edit another file (or start another process) and hit <code>Ctrl+z</code> again:</p>\n<pre><code>[2]+  Stopped                 vim backup.subversion.sh\nuser@support:~/scripts/trunk/backup_scripts#\n</code></pre>\n<p>And so on. To list all my background jobs, I can either issue <strong><code>ps</code></strong> or (better) <strong><code>jobs</code></strong>:</p>\n<pre><code>user@support:~/scripts/trunk/backup_scripts# ps\n  PID TTY          TIME CMD\n 3561 pts/0    00:00:00 bash\n 3697 pts/0    00:00:00 vim\n 3728 pts/0    00:00:00 vim\n 3773 pts/0    00:00:00 vim\n 3790 pts/0    00:00:00 top\n 3797 pts/0    00:00:00 ps\n\nuser@support:~/scripts/trunk/backup_scripts# jobs\n[1]   Stopped                 vim backup.sh\n[2]+  Stopped                 vim backup.subversion.sh\n[3]   Stopped                 vim backup.network.sh\n[4]-  Stopped                 top\n</code></pre>\n<p>The &ldquo;+&rdquo; and &ldquo;-&rdquo; signs indicate the first and second most recent jobs respectively. Typing <code>fg</code> will bring the job tagged with a &ldquo;+&rdquo; into the foreground. From the output above, let&rsquo;s say you wanted to bring <code>top</code> into the foreground instead:</p>\n<pre><code>user@support:~/scripts/trunk/backup_scripts# fg 4\n</code></pre>\n<p>To keep <code>top</code> running in the background for example (&ldquo;amping off&rdquo;), you would just type <code>bg 4</code></p>\n<h2>References</h2>\n<ul>\n<li><a href=\"http://www.dsl.org/cookbook/cookbook_5.html\">The Shell - The Linux Cookbook</a></li>\n</ul>\n\n\n      </main>\n      <footer>\n        <p>\n          \n        </p>\n        <ul>\n          \n  <li>2,591 bytes</li>\n  \n    <li>Created on Sunday, 20 December 2015 at 19:56 UTC</li>\n    <li>Modified on Thursday, 28 May 2026 at 13:06 UTC</li>\n    <br/>\n    <li>\n      <a\n        href=\"https://github.com/afreeorange/wiki.nikhil.io.articles/edit/master/Foreground and Background Processes Management.md\"\n        title=\"Edit this article\">Edit this article</a>\n    </li>\n  \n\n          <li>\n            <a href=\"https://github.com/afreeorange/bock\" title=\"View the project that generates this wiki on Github\">bock\n            5.3.0-beta</a>\n          </li>\n        </ul>\n      </footer>\n    </div>\n    \n    \n      <script type=\"text/javascript\">\n        /**\n         * Quick shortcut to take me to the search box which is 90% of how I navigate\n         * this wiki anyway.\n         */\n        document.body.addEventListener(\n          \"keypress\", (e) => e.key === \"f\"\n          ? window.location.assign(\"/archive\")\n          : null);\n        window.MathJax = {\n          tex: {\n            inlineMath: [\n              [\n                '$', '$'\n              ],\n              [\n                '\\\\(', '\\\\)'\n              ]\n            ]\n          },\n          svg: {\n            fontCache: 'global'\n          }\n        };\n      </script>\n    \n  </body>\n</html></head></html>\n",
  "id": "c0ce56b7-6728-5ec1-9fbe-0198844cd634",
  "modified": "2026-05-28T13:06:17Z",
  "revisions": [
    {
      "authorEmail": "mail@nikhil.io",
      "authorName": "Nikhil Anand",
      "date": "2026-05-28T13:06:17Z",
      "id": "e27ea079681fb743181eea70e6a19514a54c0b3e",
      "shortId": "e27ea079",
      "subject": "Formatting fixes -- Claude\n",
      "content": "To illustrate, here's a directory listing:\n\n    user@example:~/scripts/trunk/backup_scripts# ls -l\n    total 76\n    -rwxr-xr-x 1 user user   894 2011-06-27 10:00 backup.hwaddr.sh\n    -rwxr-xr-x 1 user user 12175 2011-05-02 22:54 backup.local.sh\n    -rwxr-xr-x 1 user user  6194 2011-04-12 16:53 backup.mysql.sh\n    -rwxr-xr-x 1 user user 14638 2011-04-28 11:29 backup.network.sh\n    -rwxr-xr-x 1 user user  3201 2011-05-02 09:06 backup.opendirectory.sh\n    -rwxr-xr-x 1 user user  7871 2011-04-28 11:32 backup.rotate.sh\n    -rwxr-xr-x 1 user user  3743 2011-04-12 16:53 backup.rpms.sh\n    -rwx------ 1 user user  5037 2011-06-28 15:03 backup.sh\n    -rwxr-xr-x 1 user user  4184 2011-06-27 10:01 backup.staging.sh\n    -rwxr-xr-x 1 user user  3128 2011-06-27 10:58 backup.subversion.sh\n\nLet's say I started editing a file (e.g. `vim backup.sh`. I now hit `Ctrl+z` to 'push' the process into the background. This is what I see:\n\n    [1]+  Stopped                 vim backup.sh\n    user@support:~/scripts/trunk/backup_scripts#\n\nNow I edit another file (or start another process) and hit `Ctrl+z` again:\n\n    [2]+  Stopped                 vim backup.subversion.sh\n    user@support:~/scripts/trunk/backup_scripts#\n\nAnd so on. To list all my background jobs, I can either issue **`ps`** or (better) **`jobs`**:\n\n    user@support:~/scripts/trunk/backup_scripts# ps\n      PID TTY          TIME CMD\n     3561 pts/0    00:00:00 bash\n     3697 pts/0    00:00:00 vim\n     3728 pts/0    00:00:00 vim\n     3773 pts/0    00:00:00 vim\n     3790 pts/0    00:00:00 top\n     3797 pts/0    00:00:00 ps\n\n    user@support:~/scripts/trunk/backup_scripts# jobs\n    [1]   Stopped                 vim backup.sh\n    [2]+  Stopped                 vim backup.subversion.sh\n    [3]   Stopped                 vim backup.network.sh\n    [4]-  Stopped                 top\n\nThe \"+\" and \"-\" signs indicate the first and second most recent jobs respectively. Typing `fg` will bring the job tagged with a \"+\" into the foreground. From the output above, let's say you wanted to bring `top` into the foreground instead:\n\n    user@support:~/scripts/trunk/backup_scripts# fg 4\n\nTo keep `top` running in the background for example (\"amping off\"), you would just type `bg 4`\n\n## References\n\n-   [The Shell - The Linux Cookbook](http://www.dsl.org/cookbook/cookbook_5.html)\n"
    },
    {
      "authorEmail": "mail@nikhil.io",
      "authorName": "Nikhil Anand",
      "date": "2026-01-13T18:47:28Z",
      "id": "2436477560f26e23d00a24add1cbfeafdca4af78",
      "shortId": "24364775",
      "subject": "No compression\n",
      "content": "To illustrate, here's a directory listing:\n\n    user@example:~/scripts/trunk/backup_scripts# ls -l  \n    total 76  \n    -rwxr-xr-x 1 user user   894 2011-06-27 10:00 backup.hwaddr.sh  \n    -rwxr-xr-x 1 user user 12175 2011-05-02 22:54 backup.local.sh  \n    -rwxr-xr-x 1 user user  6194 2011-04-12 16:53 backup.mysql.sh  \n    -rwxr-xr-x 1 user user 14638 2011-04-28 11:29 backup.network.sh  \n    -rwxr-xr-x 1 user user  3201 2011-05-02 09:06 backup.opendirectory.sh  \n    -rwxr-xr-x 1 user user  7871 2011-04-28 11:32 backup.rotate.sh  \n    -rwxr-xr-x 1 user user  3743 2011-04-12 16:53 backup.rpms.sh  \n    -rwx------ 1 user user  5037 2011-06-28 15:03 backup.sh  \n    -rwxr-xr-x 1 user user  4184 2011-06-27 10:01 backup.staging.sh  \n    -rwxr-xr-x 1 user user  3128 2011-06-27 10:58 backup.subversion.sh\n\nLet's say I started editing a file (e.g. `vim backup.sh`. I now hit\n`Ctrl+z` to 'push' the process into the background. This is what I see:\n\n    [1]+  Stopped                 vim backup.sh  \n    user@support:~/scripts/trunk/backup_scripts#\n\nNow I edit another file (or start another process) and hit `Ctrl+z`\nagain:\n\n    [2]+  Stopped                 vim backup.subversion.sh  \n    user@support:~/scripts/trunk/backup_scripts#\n\nAnd so on. To list all my background jobs, I can either issue **`ps`**\nor (better) **`jobs`**:\n\n    user@support:~/scripts/trunk/backup_scripts# ps  \n      PID TTY          TIME CMD  \n     3561 pts/0    00:00:00 bash  \n     3697 pts/0    00:00:00 vim  \n     3728 pts/0    00:00:00 vim  \n     3773 pts/0    00:00:00 vim  \n     3790 pts/0    00:00:00 top  \n     3797 pts/0    00:00:00 ps\n\n    user@support:~/scripts/trunk/backup_scripts# jobs  \n    [1]   Stopped                 vim backup.sh  \n    [2]+  Stopped                 vim backup.subversion.sh  \n    [3]   Stopped                 vim backup.network.sh  \n    [4]-  Stopped                 top\n\nThe \"+\" and \"-\" signs indicate the first and second most recent jobs\nrespectively. Typing `fg` will bring the job tagged with a \"+\" into the\nforeground. From the output above, let's say you wanted to bring `top`\ninto the foreground instead:\n\n    user@support:~/scripts/trunk/backup_scripts# fg 4\n\nTo keep `top` running in the background for example (\"amping off\"), you\nwould just type `bg 4`\n\nReferences\n----------\n\n-   [The Shell - The Linux Cookbook](http://www.dsl.org/cookbook/cookbook_5.html)\n"
    },
    {
      "authorEmail": "mail@nikhil.io",
      "authorName": "Nikhil Anand",
      "date": "2015-12-27T07:27:56Z",
      "id": "1aa29105a45aa67523ffb61e73bcc415f935a47e",
      "shortId": "1aa29105",
      "subject": "Fix Markdown conversion\n\nSaw half a season of The Office\n",
      "content": "To illustrate, here's a directory listing:\n\n    user@example:~/scripts/trunk/backup_scripts# ls -l  \n    total 76  \n    -rwxr-xr-x 1 user user   894 2011-06-27 10:00 backup.hwaddr.sh  \n    -rwxr-xr-x 1 user user 12175 2011-05-02 22:54 backup.local.sh  \n    -rwxr-xr-x 1 user user  6194 2011-04-12 16:53 backup.mysql.sh  \n    -rwxr-xr-x 1 user user 14638 2011-04-28 11:29 backup.network.sh  \n    -rwxr-xr-x 1 user user  3201 2011-05-02 09:06 backup.opendirectory.sh  \n    -rwxr-xr-x 1 user user  7871 2011-04-28 11:32 backup.rotate.sh  \n    -rwxr-xr-x 1 user user  3743 2011-04-12 16:53 backup.rpms.sh  \n    -rwx------ 1 user user  5037 2011-06-28 15:03 backup.sh  \n    -rwxr-xr-x 1 user user  4184 2011-06-27 10:01 backup.staging.sh  \n    -rwxr-xr-x 1 user user  3128 2011-06-27 10:58 backup.subversion.sh\n\nLet's say I started editing a file (e.g. `vim backup.sh`. I now hit\n`Ctrl+z` to 'push' the process into the background. This is what I see:\n\n    [1]+  Stopped                 vim backup.sh  \n    user@support:~/scripts/trunk/backup_scripts#\n\nNow I edit another file (or start another process) and hit `Ctrl+z`\nagain:\n\n    [2]+  Stopped                 vim backup.subversion.sh  \n    user@support:~/scripts/trunk/backup_scripts#\n\nAnd so on. To list all my background jobs, I can either issue **`ps`**\nor (better) **`jobs`**:\n\n    user@support:~/scripts/trunk/backup_scripts# ps  \n      PID TTY          TIME CMD  \n     3561 pts/0    00:00:00 bash  \n     3697 pts/0    00:00:00 vim  \n     3728 pts/0    00:00:00 vim  \n     3773 pts/0    00:00:00 vim  \n     3790 pts/0    00:00:00 top  \n     3797 pts/0    00:00:00 ps\n\n    user@support:~/scripts/trunk/backup_scripts# jobs  \n    [1]   Stopped                 vim backup.sh  \n    [2]+  Stopped                 vim backup.subversion.sh  \n    [3]   Stopped                 vim backup.network.sh  \n    [4]-  Stopped                 top\n\nThe \"+\" and \"-\" signs indicate the first and second most recent jobs\nrespectively. Typing `fg` will bring the job tagged with a \"+\" into the\nforeground. From the output above, let's say you wanted to bring `top`\ninto the foreground instead:\n\n    user@support:~/scripts/trunk/backup_scripts# fg 4\n\nTo keep `top` running in the background for example (\"amping off\"), you\nwould just type `bg 4`\n\nReferences\n----------\n\n-   [The Shell - The Linux Cookbook](http://www.dsl.org/cookbook/cookbook_5.html)\n"
    },
    {
      "authorEmail": "mail@nikhil.io",
      "authorName": "Nikhil Anand",
      "date": "2015-12-21T02:30:47Z",
      "id": "d658e80d1ecb97b196531c7b15a0f9af709c05de",
      "shortId": "d658e80d",
      "subject": "Incremental\n",
      "content": "To illustrate, here's a directory listing:\n\n` user@example:~/scripts/trunk/backup_scripts# ls -l`  \n` total 76`  \n` -rwxr-xr-x 1 user user   894 2011-06-27 10:00 backup.hwaddr.sh`  \n` -rwxr-xr-x 1 user user 12175 2011-05-02 22:54 backup.local.sh`  \n` -rwxr-xr-x 1 user user  6194 2011-04-12 16:53 backup.mysql.sh`  \n` -rwxr-xr-x 1 user user 14638 2011-04-28 11:29 backup.network.sh`  \n` -rwxr-xr-x 1 user user  3201 2011-05-02 09:06 backup.opendirectory.sh`  \n` -rwxr-xr-x 1 user user  7871 2011-04-28 11:32 backup.rotate.sh`  \n` -rwxr-xr-x 1 user user  3743 2011-04-12 16:53 backup.rpms.sh`  \n` -rwx------ 1 user user  5037 2011-06-28 15:03 backup.sh`  \n` -rwxr-xr-x 1 user user  4184 2011-06-27 10:01 backup.staging.sh`  \n` -rwxr-xr-x 1 user user  3128 2011-06-27 10:58 backup.subversion.sh`\n\nLet's say I started editing a file (e.g. `vim backup.sh`. I now hit\n`Ctrl+z` to 'push' the process into the background. This is what I see:\n\n` [1]+  Stopped                 vim backup.sh`  \n` user@support:~/scripts/trunk/backup_scripts#`\n\nNow I edit another file (or start another process) and hit `Ctrl+z`\nagain:\n\n` [2]+  Stopped                 vim backup.subversion.sh`  \n` user@support:~/scripts/trunk/backup_scripts#`\n\nAnd so on. To list all my background jobs, I can either issue **`ps`**\nor (better) **`jobs`**:\n\n` user@support:~/scripts/trunk/backup_scripts# ps`  \n`   PID TTY          TIME CMD`  \n`  3561 pts/0    00:00:00 bash`  \n`  3697 pts/0    00:00:00 vim`  \n`  3728 pts/0    00:00:00 vim`  \n`  3773 pts/0    00:00:00 vim`  \n`  3790 pts/0    00:00:00 top`  \n`  3797 pts/0    00:00:00 ps`\n\n` user@support:~/scripts/trunk/backup_scripts# jobs`  \n` [1]   Stopped                 vim backup.sh`  \n` [2]+  Stopped                 vim backup.subversion.sh`  \n` [3]   Stopped                 vim backup.network.sh`  \n` [4]-  Stopped                 top`\n\nThe **+** and **-** signs indicate the first and second most recent jobs\nrespectively. Typing `fg` will bring the job tagged with a \"+\" into the\nforeground. From the output above, let's say you wanted to bring `top`\ninto the foreground instead:\n\n` user@support:~/scripts/trunk/backup_scripts# fg `**`4`**\n\nTo keep `top` running in the background for example (\"amping off\"), you\nwould just type `bg 4`\n\nReferences\n----------\n\n-   [The Shell - The Linux\n    Cookbook](http://www.dsl.org/cookbook/cookbook_5.html)\n\n\n\n"
    },
    {
      "authorEmail": "mail@nikhil.io",
      "authorName": "Nikhil Anand",
      "date": "2015-12-20T19:56:48Z",
      "id": "18d18b2cdf8cd155831b661a0afcb9a509a2fc68",
      "shortId": "18d18b2c",
      "subject": "Foreground and Background Processes Management : First Draft\n",
      "content": "To illustrate, here's a directory listing:\n\n` user@example:~/scripts/trunk/backup_scripts# ls -l`  \n` total 76`  \n` -rwxr-xr-x 1 user user   894 2011-06-27 10:00 backup.hwaddr.sh`  \n` -rwxr-xr-x 1 user user 12175 2011-05-02 22:54 backup.local.sh`  \n` -rwxr-xr-x 1 user user  6194 2011-04-12 16:53 backup.mysql.sh`  \n` -rwxr-xr-x 1 user user 14638 2011-04-28 11:29 backup.network.sh`  \n` -rwxr-xr-x 1 user user  3201 2011-05-02 09:06 backup.opendirectory.sh`  \n` -rwxr-xr-x 1 user user  7871 2011-04-28 11:32 backup.rotate.sh`  \n` -rwxr-xr-x 1 user user  3743 2011-04-12 16:53 backup.rpms.sh`  \n` -rwx------ 1 user user  5037 2011-06-28 15:03 backup.sh`  \n` -rwxr-xr-x 1 user user  4184 2011-06-27 10:01 backup.staging.sh`  \n` -rwxr-xr-x 1 user user  3128 2011-06-27 10:58 backup.subversion.sh`\n\nLet's say I started editing a file (e.g. `vim backup.sh`. I now hit\n`Ctrl+z` to 'push' the process into the background. This is what I see:\n\n` [1]+  Stopped                 vim backup.sh`  \n` user@support:~/scripts/trunk/backup_scripts#`\n\nNow I edit another file (or start another process) and hit `Ctrl+z`\nagain:\n\n` [2]+  Stopped                 vim backup.subversion.sh`  \n` user@support:~/scripts/trunk/backup_scripts#`\n\nAnd so on. To list all my background jobs, I can either issue **`ps`**\nor (better) **`jobs`**:\n\n` user@support:~/scripts/trunk/backup_scripts# ps`  \n`   PID TTY          TIME CMD`  \n`  3561 pts/0    00:00:00 bash`  \n`  3697 pts/0    00:00:00 vim`  \n`  3728 pts/0    00:00:00 vim`  \n`  3773 pts/0    00:00:00 vim`  \n`  3790 pts/0    00:00:00 top`  \n`  3797 pts/0    00:00:00 ps`\n\n` user@support:~/scripts/trunk/backup_scripts# jobs`  \n` [1]   Stopped                 vim backup.sh`  \n` [2]+  Stopped                 vim backup.subversion.sh`  \n` [3]   Stopped                 vim backup.network.sh`  \n` [4]-  Stopped                 top`\n\nThe **+** and **-** signs indicate the first and second most recent jobs\nrespectively. Typing `fg` will bring the job tagged with a \"+\" into the\nforeground. From the output above, let's say you wanted to bring `top`\ninto the foreground instead:\n\n` user@support:~/scripts/trunk/backup_scripts# fg `**`4`**\n\nTo keep `top` running in the background for example (\"amping off\"), you\nwould just type `bg 4`\n\nReferences\n----------\n\n-   [The Shell - The Linux\n    Cookbook](http://www.dsl.org/cookbook/cookbook_5.html)\n\n[Category:Nikhil's Notes](Category:Nikhil's_Notes \"wikilink\")\n[Category:From a past sysadmin\nlife](Category:From_a_past_sysadmin_life \"wikilink\")\n"
    }
  ],
  "sizeInBytes": 2591,
  "source": "To illustrate, here's a directory listing:\n\n    user@example:~/scripts/trunk/backup_scripts# ls -l\n    total 76\n    -rwxr-xr-x 1 user user   894 2011-06-27 10:00 backup.hwaddr.sh\n    -rwxr-xr-x 1 user user 12175 2011-05-02 22:54 backup.local.sh\n    -rwxr-xr-x 1 user user  6194 2011-04-12 16:53 backup.mysql.sh\n    -rwxr-xr-x 1 user user 14638 2011-04-28 11:29 backup.network.sh\n    -rwxr-xr-x 1 user user  3201 2011-05-02 09:06 backup.opendirectory.sh\n    -rwxr-xr-x 1 user user  7871 2011-04-28 11:32 backup.rotate.sh\n    -rwxr-xr-x 1 user user  3743 2011-04-12 16:53 backup.rpms.sh\n    -rwx------ 1 user user  5037 2011-06-28 15:03 backup.sh\n    -rwxr-xr-x 1 user user  4184 2011-06-27 10:01 backup.staging.sh\n    -rwxr-xr-x 1 user user  3128 2011-06-27 10:58 backup.subversion.sh\n\nLet's say I started editing a file (e.g. `vim backup.sh`. I now hit `Ctrl+z` to 'push' the process into the background. This is what I see:\n\n    [1]+  Stopped                 vim backup.sh\n    user@support:~/scripts/trunk/backup_scripts#\n\nNow I edit another file (or start another process) and hit `Ctrl+z` again:\n\n    [2]+  Stopped                 vim backup.subversion.sh\n    user@support:~/scripts/trunk/backup_scripts#\n\nAnd so on. To list all my background jobs, I can either issue **`ps`** or (better) **`jobs`**:\n\n    user@support:~/scripts/trunk/backup_scripts# ps\n      PID TTY          TIME CMD\n     3561 pts/0    00:00:00 bash\n     3697 pts/0    00:00:00 vim\n     3728 pts/0    00:00:00 vim\n     3773 pts/0    00:00:00 vim\n     3790 pts/0    00:00:00 top\n     3797 pts/0    00:00:00 ps\n\n    user@support:~/scripts/trunk/backup_scripts# jobs\n    [1]   Stopped                 vim backup.sh\n    [2]+  Stopped                 vim backup.subversion.sh\n    [3]   Stopped                 vim backup.network.sh\n    [4]-  Stopped                 top\n\nThe \"+\" and \"-\" signs indicate the first and second most recent jobs respectively. Typing `fg` will bring the job tagged with a \"+\" into the foreground. From the output above, let's say you wanted to bring `top` into the foreground instead:\n\n    user@support:~/scripts/trunk/backup_scripts# fg 4\n\nTo keep `top` running in the background for example (\"amping off\"), you would just type `bg 4`\n\n## References\n\n-   [The Shell - The Linux Cookbook](http://www.dsl.org/cookbook/cookbook_5.html)\n",
  "title": "Foreground and Background Processes Management",
  "untracked": false,
  "uri": "/Foreground_and_Background_Processes_Management",
  "relativePath": "Foreground and Background Processes Management.md"
}
