1B Getfreeauto e
hsearch%sesearchrsearchh Getfreeauto Csearch% Getfreeauto 5%searchE%BC%AB%C6%B7%C0%CB%C5%AE%D3%B0%D4%BACA Getfreeauto D7
D Tech %search3 Getfreeauto p Tech 2 Getfreeauto Getfreeauto o Getfreeauto ssearch Tech Jo Jobs ssearchl Tech ersearchh Jobs 记录自己生活的点滴
因为服务器的 ssh-server 端口不是 22 端口,所以在用 ssh-copy-id 拷贝自己的公钥到服务器上时,出了点小问题。看了下 ssh-copy-id 的代码,实际上就是一个 shell 脚本,里面有这么一句
# strip any trailing colon
host=`echo $1 | sed 's/:$//'`
{} | ssh $host "umask 077; test -d ~/.ssh || mkdir ~/.ssh ; cat >> ~/.ssh/authorized_keys" || exit 1
明白了。 它只接受 $1 的参数作为 host
可以考虑将所有的 ssh 命令参数作为一个参数传入 ssh-copy-id
ssh-copy-id '-p xxxx xx@server'
搞定
最近将 screen 替换为了 tmux, 看中的是 tmux 可以 split-window 的功能,
有时候需要在一个终端里分几个屏,摁,这个还是蛮酷的;另外在图形界面下也有一个
terminator 的工具也可以做这个事情
screen 也可以分屏,但是用起来不方便
花了一点时间,配置了下我的 tmux , vim 操作风格,保留下来了以前用 screen 用习惯了的 Ctrl + a
# set prefix like screen Ctrl + a set-option -g prefix C-a unbind-key C-b bind-key C-a send-prefix setw -g mode-keys vi setw -g xterm-keys on unbind % bind | split-window -h bind - split-window -v # " windowlist -b unbind '"' bind '"' choose-window # Status line set-option -g visual-activity on setw -g monitor-activity on setw -g automatic-rename off setw -g utf8 on set -g base-index 1 set -g terminal-overrides "*88col*:colors=88,*256col*:colors=256,xterm*:colors=256" set -g default-terminal "screen-256color" set -g status-utf8 on set -g status-justify centre set -g status-bg default set -g status-left "#[fg=cyan]:#[fg=blue]: #[fg=red][ #[fg=green]#H #[fg=red]]#[default]" set -g status-left-length 20 set -g status-right-length 25 set -g status-right "#[fg=red][ #[fg=green]%H:%M #[fg=magenta]%a %m-%d #[fg=red]] #[fg=blue]:#[fg=cyan]:#[default]" setw -g window-status-format '#[fg=blue,bold]#I #T#[default] ' setw -g window-status-current-format '#[fg=blue,bold,reverse]#I #T#[default] ' setw -g window-status-alert-fg red # resize panes like vim # feel free to change the "1" to however many lines you want to resize by, only # one at a time can be slow bind resize-pane -R 1 bind - resize-pane -D 1 bind + resize-pane -U 1 # move around panes with hjkl, as one would in vim after pressing ctrl-w bind h select-pane -L bind j select-pane -D bind k select-pane -U bind l select-pane -R # next ^@ ^N sp n unbind ^@ bind ^@ next-window unbind ^N bind ^N next-window unbind " " bind " " next-window unbind n bind n next-window # other ^A unbind ^A bind ^A last-window # prev ^H ^P p ^? unbind ^H bind ^H previous-window unbind ^P bind ^P previous-window unbind p bind p previous-window unbind BSpace bind BSpace previous-window
Z 是字母最后一位,所以他是终极 Shell.
为什么要选 ZSHELL?
现有的 BASH 自动补全的功能不够用,至少不够我用。
如果有一个路径 [[/home/yxy/project/]] 可以把这个路径命名为 ~project
hash -d project=/home/yxy/project
zsh 可以当作计算器使用
#载入数学函数模块 可以进行一些比较高级的运算 #(也可以将此句写在配置文件中) $ zmodload zsh/mathfunc #$((数学表达式)) 进行运算,使用 echo 显示结果 $ echo $(( sin(1/4.0)**2 + cos(1/4.0)**2 - 1 )) -1.1102230246251565e-16 $ echo $(( pi = 4.0 * atan(1.0) )) 3.1415926535897931 $ echo $(( f = sin(0.3) )) 0.29552020666133955 $ print $((1e12 * rand48())) 847909677310.23413 $ print $(( rand48(seed) )) 0.01043488334700271
# bash 中使用这种形式 $ emacs `find . -name "*.html"` # zsh 同样支持,并可以使用以下形式 $ emacs $(ls **/*.html) # zsh 还可以将命令结果生成临时文件,并返回文件名 #支持更复杂的输出和过滤。例如,比较 new/ 和 old/ 两个文件夹的内容 $ diff =(ls new/) =(ls old/)
#查看生成的临时文件 ls =()
把我的 zshrc 配置贴上来。
t20 Getfreeauto Bg Tech Jobs Ar Get Free Auto Yangxiaoyong's Blogl Get Free Auto Auto Get z20 Getfreeauto Bg Tech Jobs Ar Get Free Auto Yangxiaoyong's Bloga Get Free Auto 1 Get Free Auto