Pages - Menu

Showing posts with label terminal. Show all posts
Showing posts with label terminal. Show all posts

Friday, October 19, 2012

Terminal - How to color it like mac?

Hi fellas!

Here you go:

function git_branch_name() {
git branch 2>/dev/null | grep -e '^*' | sed -E 's/^\* (.+)$/(\1) /'
}

function show_colored_git_branch_in_prompt() {
PS1="\[\033[01;32m\]\u@\h:\[\033[01;34m\]\w\[\033[31m\]\$(git_branch_name)\[\033[m\]$ "
}

show_colored_git_branch_in_prompt


Just place it on your .baschrc or something else depending on your distro.

Don't thank me, thank this guy.

Adios!

Thursday, October 4, 2012

Terminal - Divide screen

Hi fellas!
Divide the terminal screen can be handy in some cases and here is how I do it:


sudo apt-get install terminator
For more information: http://www.tenshu.net/p/terminator.html

Some quick tips:


Ctrl + Shift + E: will divide the screen vertically
Ctrl + Shift + O: will divide the screen horizontally
Ctrl + Shift + P: go to previous terminal
Ctrl + Shift + N: go to next terminal
Ctrl + Shift + W: close current terminal
Ctrl + Shift + Q: close terminator
F11: go fullscreen


Adios!

Wednesday, October 3, 2012

Terminal - Start application the background

Hi fellas!

My objective was to make sublime text run from terminal, simple task solved with:

sudo ln -s /opt/SublimeText2/sublime_text /usr/bin/sublime

Now the problem is that when I start it from terminal the process will run in foreground and is not what I was looking for, sad!

The "solution"?

~$ sublime &

The problem?
Close the terminal and the application will also be closed.

The real solution?
~$ nohup sublime &

From nohup documentation:

Run a command immune to hangups, runs the given COMMAND with hangup signals ignored, so that the command can continue running in the background after you log out.

Problem solved.