bashterminalterminator

How to limit what the Linux Teminal prints by defaults (prompt)? (i.e. number of subfolder)


Context:

The problem comes from the work folder location: if I should work in a subfolder of a subfolder of a subfolder et cetera... The command line of the shell bask in Linux is so long that can use two lines to be correctly printed.

Question:

Is there a way of showing only the last (or the few last) working subfolder?

Example:

What is actually printed:

user@user-pc:~/Documents/robotic_arm/Monitoring/difference/develop/component/example/subfolder/subexample/module$

What I would love to see:

user@user-pc:~/.../subexample/module$

More Info:


Solution

  • I do not know why but the previous answer does not work on my machine. However, an alternative solution that works fine is:

    PROMPT_DIRTRIM=N
    

    where N is the number of subfolders you want to see.

    Example:

    user@user-pc:~/Documents/robotic_arm/difference/develop/component/ $ PROMPT_DIRTRIM=2
    user@user-pc:~/.../develop/component/ $
    

    The solution was suggested by one of the answers above this question.