To know, what is my CWD in console, I added the following to ~/.bash_profile:export PS1='$(pwd)$ 'So, pwd result it shown before the $ symbol. It was very nice.But when I go to a directory with a long name: /var/www/vhosts/beta.sitename.co.uk/httpdocs/sites/beta.sitename.co.uk/modules/bundlesIn the command prompt I see:.co.uk/modules/bundles$ sitename.co.uk/httpdocs/sites/beta.sitename.This makes the shell almost impossible to work with. Is it possible to trim it, keeping only the last part or the dir name? Say, 30 characters.Or, maybe the better idea would be to print the pwd after every cd command, so I could know, where I am? This can be done using an alias.
How to trim the CWD, shown in the command promt
bash;prompt;pwd
In my .bashrc, my PS1 is configured to display the last component of my current working directory. This can be done using \W (PS1 allows some special sequences along with variables). In your case, that would be:$ export PS1='\W$'More of these sequences may be found in man bash, at Prompting, see here. You may also use \w to use complete paths, but with $HOME abbreviated to ~ (which would shorten most of your paths). Now, if you really want to put a character limit, you may use...$ export PS1='$(pwd | tail -c30)$' # Limited to 30 characters$ export PS1='...$(pwd | tail -c30)$'... or with a little bashism:$ export PS1='${PWD: -30}$'$ export PS1='${PWD:(-30)}$'$ export PS1='...${PWD: -30}$'$ export PS1='...${PWD:(-30)}$'