Posted By

ChloeD on 05/07/11


Tagged

Shell Bash screen debian root multiplex organization


Versions (?)

Change root in a bash shell.


 / Published in: Bash
 

This is for debian but can be adapted with little trickery to any Linux distro. This enables changing the root of a shell so that the directories displayed are not too long.

Useful for dir-verbose frameworks like symfony or when managing a huge website directory.

Usage: setroot $PWD

  1. function setroot
  2. {
  3. web_root=$1
  4. PS1='${debian_chroot:+($debian_chroot)}\u@\h:$(echo \w| sed s@'$web_root'@@g)\$ \[\033k\]$(basename "\w")\[\033\\\]'
  5. export PS1
  6. alias ca="cd $PWD"
  7. }
  8.  
  9. # this can be adapted

Report this snippet  

You need to login to post a comment.