Unix/Linux

Tip of the Day: have your mac command prompt tell you which git branch you're in

Wiki Terms: 

A colleague just shared this tip with me to have my Mac command prompt tell me which git branch I'm in:  Put the following in your .bash_profile

 

function parse_git_branch () {

  git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'

}

 

export PS1="\h:\W \u\$(parse_git_branch)\$ "

Now my command prompt looks like this in a git directory:  belldev2:docroot barnettech (master)$

Basic Linux Hardware analysis Notes:

Wiki Terms: 

How many php procs are running:  ps -A | grep php-cgi | grep -v grep | wc -l

 

A box with a 1 minute load average of 6.92 should have been below 2 if it had a 2 cpu core.

 

To find how many cpu cores there are:

cat /proc/cpuinfo  (or just type cat /proc/cpuinfo| grep processor| wc -l to get how many cpus)

4 processor core would look like

processor : 0

vendor_id : GenuineIntel

<---SNIP--->

processor : 1

vendor_id : GenuineIntel

<---SNIP--->

processor : 2

vendor_id : GenuineIntel

Managing multiple ssh keys

Wiki Terms: 

linkback: http://www.karan.org/blog/index.php/2009/08/25/multiple-ssh-private-keys

ssh-keygen -t rsa -f ~/.ssh/id_rsa.acquia -C "Key for my Acquia accounts"
touch ~/.ssh/config
chmod 600 ~/.ssh/config

~/.ssh/config looks like this :

Host *acquia*
  IdentityFile ~/.ssh/id_dsa.home
  User jbarnett

Host *babson*
  IdentityFile ~/.ssh/id_rsa.work
  User jbarnett
  Port 44787

To install lamp with PDO on Ubuntu (worked on rackspace server)

Wiki Terms: 

To install lamp with PDO on Ubuntu (worked on rackspace server)
http://churchit.com/php-pdo-errors-while-installing-ubuntu-10-4-php-5-3-... (here's a linkback for this guy that saved me from loosing even more time on this since apt-get didn't install pdo)

sudo tasksel install lamp-server
sudo a2enmod rewrite (to enable mod rewrite)

Pages

Subscribe to Unix/Linux