2013年5月28日 星期二

Linux Screen 小技巧

在.screenrc加入下面這段指令可以讓你的Screen畫面變的更好用。

caption always "%{=u .G} %-w%<%{=ub .y}%n %t%{=u .G}%+w "
#caption always "%{= wk} %{= KY} [%n]%t %{-} %="
#caption always "%{= wk} %{= KY} [%n]%t @ %H %{-} %= %{= KR} %l %{-} | %{= KG} %Y-%m-%d %{-} "
#caption always "%{=B Bb} %{=B WK}%-w%<%{=B Yk} %n %t /%{=B WK}%+w%-02=%{=B B"
#hardstatus alwayslastline "%{=b bW} {%l}%018= %{=B WK} $HOST %-027=%{YK} %Y-%m"
bindkey ^[z prev
bindkey ^[x next
bindkey ^[, prev
bindkey ^[. next

defscrollback 10000
altscreen
autodetach on
vbell off

termcapinfo xterm|xterms|xs ti@:te=\E[2J

2013年4月11日 星期四

Get GNU screen resurrection after rebooting There are two options that I'm aware of which get close to resurrection. First, you can put some startup screens in your .screenrc, like this:
# ------------------------------------------------------------------------------
# STARTUP SCREENS
# ------------------------------------------------------------------------------

screen bash
screen emacs -nw
chdir /home/me/src
screen -t code


Second, take a look at this project which will
Re-create the screen windows
Populate them with the session history you once had before the reboot
Log you into your previously logged in host via ssh
Place you into the same working directory you were once in.
Most of this data is derived from the prompt. Running any previously ran commands would be extremely dangerous, so this is as far as I can get you.

2013年2月7日 星期四

為你的Terminal Bash Prompt加上顏色

為了在落落長的Terminal畫面中快速看到前先下指令點,在Prompt上加上顏色是個不錯的方法,在.bashrc加入以下指令即可達到這樣的效果
export PS1='\[\033[01;35m\][\A]\[\033[00;32m\][\h \[\033[32m\]\W]\[\033[m\]\$ '

//PS:原先使用這種方式會有游標無法對齊的情況,將replace "\e[" to "\[\033[" 即可解決。
export PS1='\e[\[0;32m[\A][\h \W]$ \e[m'

Reference:how-do-i-fix-my-colour-bash-prompt-wrapping
Reference:http://tldp.org/HOWTO/Bash-Prompt-HOWTO/c327.html