Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save udiNur/1367dccf5fa238de81ed2afe17a1a637 to your computer and use it in GitHub Desktop.

Select an option

Save udiNur/1367dccf5fa238de81ed2afe17a1a637 to your computer and use it in GitHub Desktop.
open tmux pane in current directory of ncdu
ncdu is the best terminal based disk space analyzer that I know.
when you browsing using ncdu and you want to something in the current directory, you can open a terminal in the correct directory by pressing "b".
the terminal will be opened instead of ncdu, so there are few annoying downsides for it:
1. you aren't able to continue browsing only after you will be done with the terminal.
2. you can't save directory location for handling later (moving files from there to another location and so...)
3. you can't see the directory from the "ncdu" eyes, files from the larger to the smaller and so.
so like a programmer that uses a LOT with tmux, I came with the idea of open tmux-pane in the current window (in the location that you are in ncdu obviously)
I make one-liner that after you will add it to .bashrc/.bash_profile, you will get a new pane of tmux below the "ncdu" pane by pressing "b"
have fun and tell your friends ;)
# pressing "b" in ncdu, will open new pane in tmux of the current directory (below the ncdu pane)
export NCDU_SHELL="tmux neww \"tmux join-pane -t :ncdu; bash --init-file ~/.bash_profile\""
P.S. pay attention to replace the .bashrc with your bash profile file (I'm using Mac and I put that in ~/.bash_profile)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment