I run 10+ different commands from 10+ different directories, and I need a better process to track everything.

I do a lot of debugging, and often times I need to work on multiple issues in parallel. I have lots of scripts that take 30-240 min to run, like:

  • create work area
  • compile code
  • run code to reproduce issue with debug info
  • run qualifications

I find myself asking the following questions:

  • What is running?
  • Why is it running? What was I trying to accomplish when I started the script?
  • What completed running and when? What was the exit code (pass/fail)?

Currently I make notes in a text file regarding what I was doing in each directory, and I manually check terminals or log files to get the running status of everything. Seems like there should be a better way.


If the issue is you're finding it difficult to keep track of what you're working on as you bounce from task to task you might want to take the time to look at using a tool such as tmux and/or screen. These are virtual terminal window servers and allow you to setup a terminal within them and name it. This allows you to put some context on a terminal and keep multiple terminals going without cluttering up your desktop.

I typically use screen so I'm more familiar with it's work flow but in general I setup a screen session like so:

screen -S appX

I then connect to it like so:

screen -r appX

Then within the space of appX you can setup different tabs/windows for work related to appX. I might setup a windows called compiling while another might be log, where I tail the log file for the app. I can then either use key combinations Ctrl+A+Ctrl+A to move from one tab/window to another or you can split your terminal up so that one of them is in the upper 1/2 of the terminal, while the other is in the lower 1/2.

| improve this answer | |
  • Yes, using tmux or screen would help grouping related things (like running command and monitoring log) in one terminal window. Currently I'm using simple terminal tabs in gnome terminal. Sometimes it is hard to have a short tab name that sufficiently describes what I'm doing in that terminal tab. – Victor Lyuboslavsky Jun 6 '13 at 15:10
  • you may want to try terminator, so you could have many terminals at once on screen – AnonymousLurker Jun 6 '13 at 21:14

If you're running similar commands many times, put the similar parts in a shell script or in a makefile. Give the script or the target meaningful names. That way, when you look at what your various terminals are doing, the command line (plus possibly the host name and the current directory) will tell clearly you all you need to know.

Set your terminal's title to show the current directory and running command from $PROMPT_COMMAND (bash) or preexec (zsh). That way you can tell what's going on directly on your window list, without having to switch to the window. When the command terminates, set the title to the current directory and the exit status of the last command ($?).

Log all commands that produce output, and make sure the log includes an indication of success or failure (if it doesn't happen naturally, finish with echo $?). This logging should be included in your wrapper script (see above). That way, you can look back and see what happened before. Log the dates of start and completion as well if you find them useful.

| improve this answer | |

To answer the questions directly:

  • "What is running?" ps afux, pstree and similar can give you a good idea of what's running at the moment. If you name your scripts in a reasonable way it should be easy to get an overview from this. You can also name your terminal window using printf "\033]0;Window title\007"
  • "Why is it running? What was I trying to accomplish when I started the script?" You can redirect the command output to log files named according to the issue you're handling (optionally using tee if you want to see it while running as well).
  • "What completed running and when? What was the exit code (pass/fail)?" By logging the time and echo $? output at the end of the tasks to the same files (or even better, making it a standard part of the script) you can get a very good idea of what happened at the end.
| improve this answer | |

Task Spooler is a generic job management system for Linux.

It lets you use 1 or more queues to kick off commands. New commands can be dependent on completion of previous commands. You can use labels to keep track of meta information in tasks. Task Spooler also has email notification for completed tasks. You can view all running and completed commands.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.