Archive for March 19th, 2015

How to colorize your Mac OS X Terminal – Beautify your Mac OS terminal and proper Page Up / Page Down and Home / End bindings

Thursday, March 19th, 2015


If you're a sysadmin (like me) or a programmer and love working on console most of the time on a recently bought Apple (Mac) PC, probably not like that by default Terminal App lacks nice color highlighting, color highlighly is already standard on Ubuntu / Debian / Mint and many of the streamline Linux distros for years, so it's weird that the shiny Mac lacks that in console 🙂
 I'm not blaming Mac OS developers for shipping by default Mac's console so much greyish as most Mac userbase almost never use terminals, however adding some appearance candy makes my boring digital life much more entertaining.

beautify-add-colors-to-Mac-OSX-default-app-program-add-shiny-clolors-improve-mac-os-x-terminal-screenshot.png

Put in your home directory $HOME/.profile or in .bash_profile file below code:

 

vim ~/.profile
PS1='\[\e[0;33m\]\u\[\e[0m\]@\[\e[0;32m\]\h\[\e[0m\]:\[\e[0;34m\]\w\[\e[0m\]\$ '
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls='ls -GFh'

 

echo "PS1='\[\e[0;33m\]\u\[\e[0m\]@\[\e[0;32m\]\h\[\e[0m\]:\[\e[0;34m\]\w\[\e[0m\]\$ '
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"" >> ~/.profile

echo "export CLICOLOR=1" >> ~/.profile
echo "export LSCOLORS=ExFxBxDxCxegedabagacad" >> ~/.profile
echo "alias ls='ls -GFh'"  >> ~/.profile

 


PS1 with above string do colorize Terminal's default “username@hostname:cwd $” following alias makes by default ls (dir) command to have colors enabled (show files and folders in shiny colors like on GNU / Linux). As you see the ls command perameter -G which actually adds colors is the same like in FreeBSD (since very big part of Mac OS is based on BSD UNIX utils), -F makes directories to be marked with / and -h (stands for human readable).
If you want to enable terminal ls colors for all existing Mac computer users open /etc/profile and (uncomment) / include:

 

export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced

 


If you want to customize further Mac OS's default Terminal App (add different Colorize Theme), change default shell, change default Title, add Transparency, Change Term Encoding etc.  go and check settings in:
 

Terminal -> Settings


Mac-OS-default-Terminal-shell-settings-interface-change-theme-mountain-lion-screenshot
One really annoying thing about Mac OS X terminal for being users is that by default Command + D which is like CTRL + D on a non-Mac PC sends Split Window command, splitting the screen by two,  if you're a new Mac user like me you will have to get used to Command + Shift + D which is the Mac equivalent of regular PC keyboard CTRL + D. Note that it is not possible to move between Splitted screens but instead the upper part of the split screen is just like a buffer where old output from terminal is put and can be used to keep an eye constantly on old content displayed on terminal …
If you're too lazy to edit files and stuff and just want to receive already well configured Terminal which has many of the features of gnome-terminal / konsole which are not there in  Mac's default Terminal App, just download and use iTerm2 (OS X Terminal Replacement)

iterm2-mac-osx-mounta-lion-10.8.5-best-terminal-application-for-mac-OSX-screenshot

Once over with Terminal customizations if you happen to use VI Improved (VIM) text editor as an editor of choice on Mac create at least following .vimrc in your HOME directory
 

$ vim ~/.vimrc

" End
map <C-E> <End>
imap <C-E> <C-O><End>

" Home
map <C-A> <Home>
map <C-A> <C-O><Home>

 


This maps Command + A / Command + E to (emulate) act like normal PC Home / End Keyboard key button, to emulate Page Up / Page Down keys on Mac OS keyboard inside Terminal app use Fn (key) + Up / Down arrows.
To make HOME / END buttons answer to Control + A / E on a Terminal App level:

 

Inside Terminal.app
Open the Preferences window (CMD+,)
Click the Settings tab
Select your current Settings theme, and click on the Keyboard tab
Edit (or Add) the entry for Home
Set Action: to send string to shell:
Set the string to \001 (or press Ctrl+a)
Edit (or Add) the entry for End
Set Action: to send string to shell:
Set the string to \005 (or press Ctrl+e)
Edit (or Add) the entry for Page Up
Set Action: to send string to shell:
Set the string to \033[5~ (copy and paste this in)
Edit (or Add) the entry for Page Down
Set Action: to send string to shell:
Set the string to \033[6~ (copy and paste this in)
Close the settings window.

All great empires in the world (short video showing ) the biggest empires that existed in the world

Thursday, March 19th, 2015

All great empires in the world (short video showing ) the biggest empires that existed in the world

The Hindenburg disaster took place on Thursday, May 6, 1937, as the German passenger airship LZ 129 Hindenburg caught fire and was destroyed during its attempt to dock with its mooring mast at Naval Air Station Lakehurst, which is located adjacent to the borough of Lakehurst, New Jersey, United States. Of the 97 people on board (36 passengers and 61 crewmen), there were 35 fatalities (13 passengers and 22 crewmen). One worker on the ground was also killed, making a total of 36 dead. The disaster was the subject of spectacular newsreel coverage, photographs, and Herbert Morrison’s recorded radio eyewitness reports from the landing field, which were broadcast the next day. A variety of hypotheses have been put forward for both the cause of ignition and the initial fuel for the ensuing fire. The incident shattered public confidence in the giant, passenger-carrying rigid airship and marked the end of the airship era.

Thursday, March 19th, 2015

zeppelin-explodes-scores-dead

The Hindenburg disaster took place on Thursday, May 6, 1937, as the German passenger airship LZ 129 Hindenburg caught fire and was destroyed during its attempt to dock with its mooring mast at Naval Air Station Lakehurst, which is located adjacent to the borough of Lakehurst, New Jersey, United States. Of the 97 people on board (36 passengers and 61 crewmen), there were 35 fatalities (13 passengers and 22 crewmen). One worker on the ground was also killed, making a total of 36 dead. The disaster was the subject of spectacular newsreel coverage, photographs, and Herbert Morrison's recorded radio eyewitness reports from the landing field, which were broadcast the next day. A variety of hypotheses have been put forward for both the cause of ignition and the initial fuel for the ensuing fire. The incident shattered public confidence in the giant, passenger-carrying rigid airship and marked the end of the airship era.

 

https://upload.wikimedia.org/wikipedia/commons/e/e4/1937-05-10_Special_Release_-_Zeppelin_Explodes_Scores_Dead.ogv