I've got the a flat directory structure like this.

├── kanban
│   ├── 1_backlog
│   ├── 2_analyze
│   ├── 3_doing
│   ├── 4_test
│   ├── 5_approval
│   └── 6_done

Each directory contains text files while each represents a task. A typical kanban board displays columns. I want to show the content of each directory column-wise like this.

1_backlog       2_analyze      ...
├── 1234_task   ├── 34235_task
├── 4567_task   ├── 32322_task

How is that possible?


  • Have a look at join(1) and ls -1, for f in * or simply find -print. You might be able to coax them into doing what you want through an appropriate for loop or similar construct, although it'll probably be somewhat brittle. Pure ls almost certainly won't help you. – a CVn Jul 15 '13 at 11:32
  • @MichaelKjörling I tried with paste, but is does look ugly, because of variable column width from ls -1 – Bernhard Jul 15 '13 at 11:40
  • @Bernhard Try playing around with printf. Here's a little something to get you started: printf "Hello %20s %-20s World\n" "abc" "def" – a CVn Jul 15 '13 at 11:41
  • It's not my problem, so if it gets too complicated, there are probably better solutions. – Bernhard Jul 15 '13 at 11:43

If you have the column command and it supports the -s, -n and -t options and none of the filenames contain tab or non-printable characters.

cd kanban &&
  set -- */ &&
  eval "eval paste '<(tree \"\${'{1..$#}'}\")'" |  column -nts $'\t'

(replace tree with your preferred command to display a directory as a tree)

(ksh/bash/zsh syntax above).


Created a tool that does this: https://github.com/xyproto/lc

Requires Python 2 or Python 3. Pull requests are welcome.

lc in action

  • 1
    +1 for turning Stephane Chazelas' 3-liner into a full-fledged Python program :) – MattDMo Jul 15 '13 at 17:37
  • to make it a little more compatible with the user's current environment, you could try to parse the $COLORS env. variable – MattDMo Jul 15 '13 at 17:50
  • I was thinking more along the lines of customization - for example, I have a customized ~/.dir_colors. But, upon further thought after posting my last comment, I realized that term programs have their own themes, and they don't (to my knowledge) modify any system files/env. variables - so how to match what the end-user sees with ls vs. lc? Perhaps I'll open an issue after I test it more tonight... – MattDMo Jul 15 '13 at 22:16

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.