Archives

All posts for the month October, 2013

So recently I updated my bash prompt to be a little easier on my eyes, however, after I was done for some reason if I typed in long commands they would not automatically wrap to the next line, it would just overwrite the current line. This made things a little interesting..hah

Here’s my new prompt, (which had the problem..)

export PS1="\e[32m[\@] \u@\h:\e[33m\w \e[32m\$ "

[11:16 PM] phatdee@thebeaver:/tmp $

To fix this, you need to do this, you need to wrap each escape section using [\  \]. This is needed so that readline will be able to correctly evaluate the where the margin ends thus automatically switching to the new line and not just writting over the same line. I’m sure this can be explained a little better but hopefully you get it. Here’s the working PS1 line, pay special attention to the 4 new [\ \] , two for each escape (\e) section.
Also instead of switching to the “green” color in the above which is escape 32m, I just reset the color back to the original to do that, just use \e[0m

export PS1="[\@] \u@\h:\[\e[1;33m\]\w\[\e[0m\] $ "

[12:24 AM] phatdee@thebeaver:/var/tmp $

 

Some syntax help:

\@ = does the time in 12H mode

\u = username of logged in user ($LOGNAME)

\h = hostname

\w = current directory

\e[1;33m = yellow text

\e[0m = resets text to original

———————————————

I use terminator for my terminal client, and often have multiple windows open with different sizes.  I was finding that sometimes my window would not word wrap no matter what I did.  However after turning this on, I no longer had that issue.

$ shopt | grep checkwinsize

If this is off, try turning this on

$ shopt -s checkwinsize

Add this to your .bashrc if you find it working.

Mileage will vary depending on your version of Linux..but first grab your disk device names

$ df

Filesystem Size Used Avail Use% Mounted on
/dev/sda1 55G 1.9G 50G 4% /
/dev/sda5 126G 46G 80G 37% /home
/dev/sda9 26G 522M 24G 3% /tmp
/dev/sda7 103G 15G 84G 15% /usr
/dev/sda6 32G 1.4G 29G 5% /var

$ sudo file -s /dev/sda{,1,5,6,7,9}

/dev/sda: x86 boot sector
/dev/sda1: Linux rev 1.0 ext4 filesystem data, UUID=1bdf35a5-6ae0-402d-ab61-853ca3877d94 (needs journal recovery) (extents) (large files) (huge files)
/dev/sda5: Linux rev 1.0 ext4 filesystem data, UUID=b9646594-a7b2-4cfd-a909-d9b6df2ff698 (needs journal recovery) (extents) (large files) (huge files)
/dev/sda6: Linux rev 1.0 ext4 filesystem data, UUID=fc0355a1-05f8-416e-8bde-24287782d45b (needs journal recovery) (extents) (large files) (huge files)
/dev/sda7: Linux rev 1.0 ext3 filesystem data, UUID=64395184-64bf-4b52-90cb-e0afff7c678c (needs journal recovery) (large files)
/dev/sda9: Linux rev 1.0 ext4 filesystem data, UUID=9c56ff6c-052d-4329-a956-43d7df88e6d7 (needs journal recovery) (extents) (large files) (huge files)

This is a newer API library into the CPAN repositories. It has a bunch of added functionality that CPAN doesn’t have. To install it, you can use CPAN:

Once done, exit

Has added functionality: Some of the nicer features are ability to search by modules (m Test::TCP) or authors (a DMAKI) from within the API. The output displays numbers next to the outputted modules so you can quickly install “i 1” (install #1 in the list). Ability to automatically install all dependencies a particular module install needs. Print error stacks (p), able to self-update itself. I’m sure there are many other cool features that I’m not covering but these are the main ones I tend to use.

So this sometimes drives me crazy, having to sit there and watch your CPAN perl module installation as it will stop the process only to ask you ..do you wish to also install whatever other needed dependency module. [yes] enter [yes] enter [yes] enter..

cpan> o conf build_requires_install_policy yes
cpan> o conf commit

Or using by using CPANPLUS, you can choose yes to all for each individual module.