1

I use a program that recreates a certain directory structure each time it is run, then populates it with all kinds of data.

I keep a terminal window "open at" one of the subdirectories of that directory, where I wish to list and browse the data being created.

However in that window, each time the program re-runs, listing the current directory shows 0 files - bash isn't up-to-date on the directory - presumably because it had been recreated. My workaround is to cd again to the same directory, but is there something else that will maintain the shell window's correct view of the recreated directory at all times?

Currently I found cd . being the simplest workaround, but of course it needs to be used every time. Would be nice being able to avoid that alltogether.

If relevant, this is Ubuntu.

4
  • 1
    Better may be: cd ..; watch "ls subdir" Commented Nov 14, 2015 at 18:03
  • @JeffSchaller you might want to post watch ls subdir as an answer Commented Nov 14, 2015 at 21:24
  • If the existing answer solved your problem, please consider accepting it with the checkmark; thank you! Commented Sep 1, 2017 at 1:04
  • Thanks for reawakening this post and thanks for the answer few years ago, but no, the provided answer was a nice suggestion, but I do not consider it a solution. Not sure why you are trying to press on that, but thanks again for the answer. Commented Sep 1, 2017 at 8:00

1 Answer 1

2

I use a program that recreates a certain directory structure each time it is run ... Is there something else that will maintain the shell window's correct view of the recreated directory at all times?

Not directly, no. Your shell is in no-man's-land after re-running your program. The safest solution (if you insist on removing the top-level directory) is to keep your shell cd'd above it (cd ..) and run something like:

watch "ls subdir" 

...to have it show you updates as they happen.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.