1

I'm looking for a way to have list of all files/folders of the current directory in my terminal that updates automatically and runs while I'm actively navigating and editing files.

I imagine it to be somehow possible with a terminal multiplexer. But I don't know how you could notify another process about the change in the current process.

If I run watch ls -a in one split-view, it will only update when files in that same directory change, not when the directory of my other split-view changes.

Basically, I want it to look somewhat like this:
enter image description here

How could this be accomplished?

1
  • I was going to suggest Midnight Commander as well, though I don't think it updates the listing dynamically. If you have Emacs, you could easily have a shell buffer communicate with a Dired buffer, perhaps using inotify-watch.
    – tripleee
    Apr 29 '17 at 13:08
3

You could use the PID of shell 1 and use it's process information (CWD) to update ls in shell 2.

shell 1:

$ echo $$
24678

shell 2:

$ watch ls /proc/24678/cwd/

Now you can use cd in shell 1 and the view in shell 2 will be updated in shell 2 (per default every 2 seconds).

An nice gimmick: You could use watch -d to highlight the differences between successive updates (file creations/deletions etc.)

1

Possibly Midnight Commander or a similar program does what you want? You can overlay the terminal window with two lists of files, there are keyboard shortcuts, but you can still switch to a full shell.

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.