mardi 22 décembre 2009

ls command

-t 以时间排序。
-r 对目录反向排序
-f -U 对输出的文件不排序。
-X 以文件的扩展名(最后一个 . 后的字符)排序。
-S 以文件大小排序。
-u 以文件上次被访问的时间排序。

只显示目录 :#ls -l |grep ^d
只显示非目录文件:#ls -l |grep ^[^d]

lundi 21 décembre 2009

emacs的列(rectangle)编辑

原始列模式

emacs以C-x r开头的命令来进行矩形操作。先用C-space或者C-@设一个mark,移动光标到另一点,用以下命令进行列操作:

C-x r k 剪切一个矩形块

C-x r y 粘贴一个矩形块

C-x r o 插入一个矩形块

C-x r c 清除一个矩形块(使其变成空白)

C-x r t 在选定区域的所有列前插入样的字符

cua-mode支持的可视化列模式

除了emacs本身支持的列模式外,emacs还可以通过cua-mode支持一种可视化的列模式。在cua- mode下,按[C-return]会进入cua rectangle模式。在这个模式下可以通过鼠标点击确认起点,然后通过光标键来选中一个rect范围,这个rect会用另外的颜色显示出来。之后我们 就可以很方便地对这个rect进行操作。比如[M-up],[M-down],[M-left],[M-right]可以移动这个rect,[C- return]可以取消这个rect,[C-space]可以退出cua-rect模式并激活普通模式下的选择。

cua-mode下可以用以下命令进行列操作:

直接输入字符: 在每行前(或后)都插入这个字符

[M-b]: 用空格(tabs或者spaces)替换所有rect中的字符

[M-c]: 去掉所有行左侧的空格

[M-f]: 用单个字符替换所有rect中的字符(提示输入一个字符)

[M-i]: 对每行中第一个找到的数字进行加1操作(自动把0x开头的当作十六进制数字)

[M-k]: 剪切rect

[M-l]: 把rect中的内容全部转换为小写

[M-m]: 拷贝rect

[M-n]: 用一串自增的数字替换rect中的每一行(这个功能可以用来给每行编号)

[M-o]: rect的内容右移,选中的rect用空格填充

[M-r]: 用字符串替换符满足正则表达式的字符串

[M-R]: 上下反转

[M-s]: 把rect中的每一行替换为一个字符串(提示输入)

[M-t]: 把rect整个替换为一个字符串(提示输入)

[M-u]: 把rect中的内容全部转换为大写

[M-|]: 对rect执行一个shell命令

还有一些其他的命令可以直接看cua-base.el(emacs22之后已经自带cua-mode)。

emacs2.3 中输入中文

在~/.emacs中添加:
;;用win+space为set-mark键,留出ctrl+space热键作为输入法
(global-set-key (kbd "C-SPC") 'nil)
(global-set-key (kbd "s-SPC") 'set-mark-command)

在~/.bashrc中添加:
alias emacs="LANG=zh_CN.UTF-8 emacs"

重启后就可以在emacs中使用scim和ibus了。

dimanche 20 décembre 2009

压缩与解压缩

.tar
解包: tar xvf FileName.tar
打包:tar cvf FileName.tar DirName
(注:tar是打包,不是压缩!)
---------------------------------------------
.gz
解压1:gunzip FileName.gz
解压2:gzip -d FileName.gz
压缩:gzip FileName
.tar.gz
解压:tar zxvf FileName.tar.gz
压缩:tar zcvf FileName.tar.gz DirName
---------------------------------------------
.bz2
解压1:bzip2 -d FileName.bz2
解压2:bunzip2 FileName.bz2
压缩: bzip2 -z FileName
.tar.bz2
解压:tar jxvf FileName.tar.bz2
压缩:tar jcvf FileName.tar.bz2 DirName
---------------------------------------------
.bz
解压1:bzip2 -d FileName.bz
解压2:bunzip2 FileName.bz
压缩:未知
.tar.bz
解压:tar jxvf FileName.tar.bz
压缩:未知
---------------------------------------------
.Z
解压:uncompress FileName.Z
压缩:compress FileName
.tar.Z
解压:tar Zxvf FileName.tar.Z
压缩:tar Zcvf FileName.tar.Z DirName
---------------------------------------------
.tgz
解压:tar zxvf FileName.tgz
压缩:未知
.tar.tgz
解压:tar zxvf FileName.tar.tgz
压缩:tar zcvf FileName.tar.tgz FileName
---------------------------------------------
.zip
解压:unzip FileName.zip
压缩:zip FileName.zip DirName

zip -r FileName.zip DirName/
---------------------------------------------
.rar
解压:rar e FileName.rar


rar请到:http://www.rarsoft.com/download.htm
下载!
解压后请将rar_static拷贝到/usr/bin目录(其他由$PATH环境变量指定的目录也可以):
[root@www2 tmp]# cp rar_static /usr/bin/rar
---------------------------------------------
.lha
解压:lha -e FileName.lha
压缩:lha -a FileName.lha FileName

lha请到:http://www.infor.kanazawa-it.ac.jp/.../lhaunix/下载!
>解压后请将lha拷贝到/usr/bin目录(其他由$PATH环境变量指定的目录也可以):
[root@www2 tmp]# cp lha /usr/bin/
---------------------------------------------
.rpm
解包:rpm2cpio FileName.rpm | cpio -div
---------------------------------------------

一些参数的说明

  1) a 添加文件到操作文档

举例rar a test.rar file1.txt :若test.rar文件不存在,则打包file1.txt文件成test.rar

rar a test.rar file2.txt : 若test.rar文件已经存在,则添加file2.txt文件到test.rar中(这样 test.rar中就有两个文件了)

注,如果操作文档中已有某文件的一份拷贝,则a命令更新该文件 另,对目录也可以进行操作 eg. rar a test.rar dir1 。

  2) e test.rar

注,用e解压的话,所有文件都被解压到当前目录下,不能保持压缩前的目录结构。如果想保持压缩前的目录结构,用 x 解压。

  3) c 对操作文档添加说明注释 eg. rar c test.rar

  (会出现Reading comment from stdin字样,然后输入一行或多行注释,以ctrl+d结束)。

  4) cf 添加文件注释,类似上面的c,不过这个是对压缩文档中每个文件进行注释 cw 将文档注释写入文件 eg. rar cw test.rar comment.txt。

  5) d 从文件中删除文件 eg. rar d test.rar file1.txt e

  将文件解压到当前目录 eg. rar。

  6) r 修复文档 eg. rar r test.rar

  当rar文件有问题时,可以尝试用该命令进行修复 。

  7) s 转换文档成自解压文档 eg. rar s test.rar

  会生成一个test.sfx的可执行文档,运行它的效果就相当于rar x test.rar, 适合于向没有rar的用户传输文件。

  8) t 检测文档 eg. rar t test.rar

  检测test.rar的完整性。

  9) k 锁定文档 eg. rar k test.rar

  锁定文档后,该文档就无法进行任何更新操作了。

samedi 19 décembre 2009

About photos

1. view and print

gv *.eps
okular *.eps
gqview:view and print photos expect .eps

gwenview :view all photos in a file
2. Convert

imagemagick
ImageMagick is a software suite to create, edit, and compose bitmap images.
It can read, convert and write images in a variety of formats (over 100)
including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript,
SVG, and TIFF. Use ImageMagick to translate, flip, mirror, rotate, scale,
shear and transform images, adjust image colors, apply various special
effects, or draw text, lines, polygons, ellipses and Bézier curves.
All manipulations can be achieved through shell commands as well as through
an X11 graphical interface (display).

/usr/bin/compare
/usr/bin/animate
/usr/bin/convert
/usr/bin/composite
/usr/bin/conjure
/usr/bin/import
/usr/bin/identify
/usr/bin/stream
/usr/bin/display
/usr/bin/montage
/usr/bin/mogrify

vendredi 18 décembre 2009

Gnu Emacs Reference Card

pdf version is in emacs directory "/usr/local/share/emacs/23.0.0/etc/refcard.ps"

Starting Emacs

To enter GNU Emacs 22 or 23, just type its name: emacs

Leaving Emacs

suspend Emacs (or iconify it under X) C-z
exit Emacs permanently C-x C-c

Files

read a file into Emacs C-x C-f
save a file back to disk C-x C-s
save all files C-x s
insert another file into this buffer C-x i
replace this file with another file C-x C-v
write buffer to a specified file C-x C-w
toggle read-only status of buffer C-x C-q

Getting Help

The help system is simple. Type C-h (or F1) and follow the directions. If you are a first-time user, type C-h t for a tutorial.

remove help window C-x 1
scroll help window C-M-v
apropos: show commands matching a string C-h a
describe the function a key runs C-h k
describe a function C-h f
get mode-specific information C-h m

Error Recovery

abort partially typed or executing command C-g
recover files lost by a system crash M-x recover-session
undo an unwanted change C-x u, C-_ or C-/
restore a buffer to its original contents M-x revert-buffer
redraw garbled screen C-l

Incremental Search

search forward C-s
search backward C-r
regular expression search C-M-s
reverse regular expression search C-M-r

in i-search mode:

select previous search string M-p
select next later search string M-n
exit incremental search RET
undo effect of last character DEL
abort current search C-g

Use C-s or C-r again to repeat the search in either direction. If Emacs is still searching, C-g cancels only the part not done.

Motion

entity to move over backward forward
character C-b C-f
word M-b M-f
line C-p C-n
goto line beginning (or end) C-a C-e
sentence M-a M-e
paragraph M-{ M-}
page C-x [ C-x ]
sexp (balanced expression) C-M-b C-M-f
function C-M-a C-M-e
goto buffer beginning (or end) M-< M->
scroll to next screen C-v
scroll to previous screen M-v
scroll left C-x <
scroll right C-x >
scroll current line to center of screen C-u C-l

Kill and Deleting

entity to kill backward forward
character (delete, not kill) DEL C-d
word M-DEL M-d
line (to end of) M-0 C-k C-k
sentence C-x DEL M-k
sexp (balanced expression) M— C-M-k C-M-k
kill region C-w
copy region to kill ring M-w
kill through next occurrence of char M-z char
yank back last thing kill C-y
replace last yank with previous kill M-y

Marking

set mark here C-@ or C-SPC
exchange point and mark C-x C-x
set mark arg words away M-@
mark paragraph M-h
mark page C-x C-p
mark sexp C-M-@
mark function C-x h

Query Replace

interactively replace a text string M-%
using regular expressions M-x query-replace-regexp

Valid responses in query-replace mode are:

replace this one, go on to next SPC
replace this one, don't move ,
skip to next without replacing DEL
replace all remaining matches !
back up to previous match ^
exit query-replace RET
enter recursive edit (C-M-c to exit) C-r

Multiple Windows

When two commands are shown, the second one is a similar command for a frame instead of a window.

delete all other windows C-x 1 C-x 5 1
split window, above and below C-x 2 C-x 5 2
delete this window C-x 0 C-x 5 0
split window, side by side C-x 3
scroll other window C-M-v
switch cursor to other window C-x o C-x 5 o
select buffer in other window C-x 4 b C-x 5 b
display buffer in other window C-x 4 C-o C-x 5 C-o
find file in other window C-x 4 f C-x 5 f
find file read-only in other window C-x 4 r C-x 5 r
run Dired in other window C-x 4 d C-x 5 d
find tag in other window C-x 4 . C-x 5 .
grow window taller C-x ^
shrink window narrower C-x {
grow window wider C-x }

Formatting

indent current line (mode-dependent) TAB
indent region (mode-dependent) C-M-\
indent sexp (mode-dependent) C-M-q
indent region rigidly arg columns C-x TAB
insert newline after point C-o
move rest of line vertically down C-M-o
delete blank lines around point C-x C-o
join line with previous (with arg, next) M-^
delete all white space around point M-\
put exactly one space at point M-SPC
fill paragraph M-q
set fill column C-x f
set prefix each line starts with C-x .
set face M-o

Case Change

uppercase word M-u
lowercase word M-l
capitalize word M-c
uppercase region C-x C-u
lowercase region C-x C-l

The Minibuffer

The following keys are defined in the minibuffer.

complete as much as possible TAB
complete up to one word SPC
complete and execute RET
show possible completions ?
fetch previous minibuffer input M-p
fetch next minibuffer input or default M-n
regexp search backward through history M-r
regexp search forward through history M-s
abort command C-g

Type C-x ESC ESC or C-x M-: to edit and repeat the last command that used in the minibuffer. Type F10 to active the menu bar using the minibuffer.

Buffers

select another buffer C-x b
list all buffers C-x C-b
kill a buffer C-x k

Transposing

transpose characters C-t
transpose words M-t
transpose lines C-x C-t
transpose sexps C-M-t

Spelling Check

check spelling of current word M-$
check spelling of all words in region M-x ispell-region
check spelling of entire buffer M-x ispell-buffer

Tags

find a tag (a definition) M-.
find next occurrence of tag C-u M-.
specify a new tags file M-x visit-tags-table
regexp search on all files in tags table M-x tags-search
run query-replace on all the files M-x tags-query-replace
continue last tags search or query-replace M-,

Shells

execute a shell command M-!
run a shell command on the region M-|
filter region through a shell command C-u M-|
start a shell command in window \*shell\* M-x shell

Rectangles

copy rectangle to register C-x r r
kill rectangle C-x r k
yank rectangle C-x r y
open rectangle, shifting text right C-x r o
blank out rectangle C-x r c
prefix each line with a string C-x r t

Abbrevs

add global abbrev C-x a g
add mode-local abbrev C-x a l
add global expansion for this abbrev C-x a i g
add mode-local expansion for this abbrev C-x a i l
explicitly expand abbrev C-x a e
expand previous word dynamically M-/

Regular Expressions

any single character except a newline . (dot)
zero or more repeats *
one or more repeats +
zero or one repeat ?
quote regular expression special character \c
alternative ("or") \|
grouping \( ... \)
same text as nth group \n
at word break \b
not at word break \B
entity match start match end
line ^ $
word \< \>
buffer \` \'
class of characters match these match others
explicit set [ ... ] [^ ... ]
word-syntax character \w \W
character with syntax c \sc \Sc

International Character Sets

specify principal language C-x RET l
show all input methods M-x list-input-methods
enable or disable input method C-\
set coding system for next command C-x RET c
show all coding systems M-x list-coding-systems
choose preferred coding system M-x prefer-coding-system

Info

enter the Info documentation reader C-h i
find specified function or variable in Info C-h S

Moving within a node:

scroll forward SPC
scroll reverse DEL
beginning of node . (dot)

Moving between nodes:

next node n
previous node p
move up u
select menu item by name m
select nth menu item by number (1-9) n
follow cross reference (return with l) f
return to last node you saw l
return to directory node d
go to top node of Info file t
go to any node by name g

Other:

run Info tutorial h
quit Info q
search nodes for regexp M-s

Registers

save region into register C-x r s
insert register contents into buffer C-x r i
save value of point in register C-x r SPC
jump to point saved in register C-x r j

Keyboard Macros

start defining a keyboard macro C-x (
end keyboard macro definition C-x )
execute last-defined keyboard macro C-x e
append to last keyboard macro C-u C-x (
name last keyboard macro M-x name-last-kbd-macro
insert Lisp definition in buffer M-x insert-kbd-macro

Commands dealing with Emacs Lisp

eval sexp before point C-x C-e
eval current defun C-M-x
eval region M-x eval-region
read and eval minibuffer M-:
load from standard system directory M-x load-library

Simple Customization

customize variables and faces M-x customize

.emacs -20091221

(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(blink-cursor-mode nil)
'(column-number-mode t)
'(display-time-mode t)
)
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)

;;-----------------------------------------------------------------------------
;;用win+space为set-mark键,留出ctrl+space热键作为输入法
(global-set-key (kbd "C-SPC") 'nil)
(global-set-key (kbd "s-SPC") 'set-mark-command)
;;设置字体大小
(set-default-font "DejaVu Sans Mono-8")
;;在窗口左侧显示行号
(global-linum-mode t)
;;在状态栏(mode line)上显示行号
(setq column-number-mode t)
(setq line-number-mode t)
;;鼠标自动避开指针,如当你输入的时候,指针到了鼠标的位置,鼠标有点挡住视线了
(mouse-avoidance-mode 'animate)
;;指针不要闪
(blink-cursor-mode -1)
(transient-mark-mode 1)
;;当指针到一个括号时,自动显示所匹配的另一个括号
(show-paren-mode 1)
;;去掉烦人的警告铃声
(setq visible-bell nil)
;;去掉Emacs和gnus启动时的引导界面
(setq inhibit-startup-message t)
(setq gnus-inhibit-startup-message t)
;; 显示时间
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
(display-time)
;;当前行高亮
(require 'hl-line)
(global-hl-line-mode t)
;;滚动条在窗口右侧
'(scroll-bar-mode (quote right))
;;在窗口的标题栏上显示文件名称
(setq frame-title-format "%n%F/%b")
;;允许emacs和外部其他程序的粘
(setq x-select-enable-clipboard t)
;;支持中键粘贴
(setq mouse-yank-at-point t)
;;所有的问题用y/n方式,不用yes/no方式
(fset 'yes-or-no-p 'y-or-n-p)
;;显示屏幕大小
(setq default-frame-alist
(append '((top . 0)(left . 0)(width . 85)(height . 40)) default-frame-alist))

;;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
;; Add the directories to your load path
(add-to-list 'load-path "~/elisp")
;;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
;;-----------------------------------------------------------------------------
(require 'cursor-chg) ; Load this library
(change-cursor-mode 1) ; On for overwrite/read-only/input mode
(toggle-cursor-type-when-idle 1) ; On when idle
;;-----------------------------------------------------------------------------
;;调用smart-compile
(require 'smart-compile)
(global-set-key [f7] 'smart-compile)
;;-----------------------------------------------------------------------------
;; Add the directories to your load path
(add-to-list 'load-path "~/elisp/emacs-wiki-2.72")
;;调用emacs-wiki
(require 'emacs-wiki)
(require 'emacs-wiki-menu)
(load "emacs-wiki")
;;----------------------------------------------------------------------------
;;调用tabbar
(require 'tabbar)
(tabbar-mode)
;;(define-prefix-command 'lwindow-map)
;;For emacs 23.1,to get list all buffers as one group and
;;only the non-scratch buffers can be made to be displayed
(when (require 'tabbar- nil t)
(setq tabbar-buffer-groups-function
(lambda () (list "All Buffers")))
(setq tabbar-buffer-list-function
(lambda ()
(remove-if
(lambda(buffer)
(find (aref (buffer-name buffer) 0) "*"))
(buffer-list))))
)

(global-set-key (kbd "") 'tabbar-backward-group)
(global-set-key (kbd "") 'tabbar-forward-group)
(global-set-key (kbd "") 'tabbar-backward)
(global-set-key (kbd "") 'tabbar-forward)

;;----------------------------------------------------------------------------
;;使用一个简单的 Elisp 函数
;;:如果选定了区域,那么按 M-w 就复制这个区域;如果没有选定区域,那么 M-w 就复制一行
(defun huangq-kill-ring-save (&optional n)
"If region is active, copy region. Otherwise, copy line."
(interactive "p")
(if mark-active
(kill-ring-save (region-beginning) (region-end))
(if (> n 0)
(kill-ring-save (line-beginning-position) (line-end-position n))
(kill-ring-save (line-beginning-position n) (line-end-position)))))

(global-set-key (kbd "M-w") 'huangq-kill-ring-save)

;;-----------------------------------------------------------------------------
;;备份设置
;;emacs还有一个自动保存功能,默认在~/.emacs.d/auto-save-list里,
;;这个非常有用,具体可以参见Sams teach yourself emacs in 24hours(我简称为sams24)
;;启用版本控制,即可以备份多次
(setq version-control t)
;;备份最原始的版本两次,记第一次编辑前的文档,和第二次编辑前的文档
(setq kept-old-versions 2)
;;备份最新的版本五次,理解同上
(setq kept-new-versions 5)
;;删掉不属于以上7中版本的版本
(setq delete-old-versions t)
;;设置备份文件的路径
(setq backup-directory-alist '(("." . "~/.emacs.tmp")))
;;备份设置方法,直接拷贝
(setq backup-by-copying t)
;;-----------------------------------------------------------------------------
;;启用minibuffer,好像是默认设置吧
(minibuffer-electric-default-mode 1)
;;启用部分补全功能,如输入M-x q r r相当于M-x query-replace-regexp
(partial-completion-mode 1)

;; 当光标在行尾上下移动的时候,始终保持在行尾
(setq track-eol t)
;;-----------------------------------------------------------------------------
;;目的是开一个shell的小buffer,用于更方便地测试程序(也就是运行程序了),我经常会用到。
;;f8就是另开一个buffer然后打开shell,C-f8则是在当前的buffer打开shell
;(defun open-eshell-other-buffer ()
;"Open eshell in other buffer"
;(interactive)
;(split-window-horizontally)
;(eshell))
;(global-set-key [C-f8] 'open-eshell-other-buffer)

;;-----------------------------------------------------------------------------
;;当前buffer的文件名,前加“./”,后去掉后面4位数字,输入到minibuffer
(define-key minibuffer-local-map [f8]
(lambda ()
(interactive)
(insert (concat "./") )
(insert (substring (buffer-name (current-buffer-not-mini)) 0 -4 ))
(insert (concat ".exe") )
)
)

(defun current-buffer-not-mini ()
"Return current-buffer if current buffer is not the *mini-buffer*
else return buffer before minibuf is activated."
(not (window-minibuffer-p)) (current-buffer)
(if (eq (get-lru-window) (next-window))
(window-buffer (previous-window)) (window-buffer (next-window))))

;;-----------------------------------------------------------------------------

;;-----------------------------------------------------------------------------
;;保存前,删除当前buffer中行尾空格和TAB等whitespace
(add-hook 'before-save-hook 'delete-trailing-whitespace)

shell command- Using History Interactively

ex. command = a b c d
!! = a b c d
!:0 = a
!:1 = !^ = b
!:2 = c!
!$ =d

http://www.linuxselfhelp.com/gnu/bash/html_chapter/bashref_7.html
Using History Interactively

This chapter describes how to use the GNU History Library interactively, from a user's standpoint. It should be considered a user's guide. For information on using the GNU History Library in other programs, see the GNU Readline Library Manual.
Bash History Facilities

When the `-o history' option to the set builtin is enabled (see section The Set Builtin), the shell provides access to the command history, the list of commands previously typed. The text of the last HISTSIZE commands (default 500) is saved in a history list. The shell stores each command in the history list prior to parameter and variable expansion but after history expansion is performed, subject to the values of the shell variables HISTIGNORE and HISTCONTROL. When the shell starts up, the history is initialized from the file named by the HISTFILE variable (default `~/.bash_history'). HISTFILE is truncated, if necessary, to contain no more than the number of lines specified by the value of the HISTFILESIZE variable. When an interactive shell exits, the last HISTSIZEHISTFILE. If the histappend shell option is set (see section Bash Builtin Commands), the lines are appended to the history file, otherwise the history file is overwritten. If HISTFILE is unset, or if the history file is unwritable, the history is not saved. After saving the history, the history file is truncated to contain no more than $HISTFILESIZE lines. If HISTFILESIZE is not set, no truncation is performed. lines are copied from the history list to

The builtin command fc may be used to list or edit and re-execute a portion of the history list. The history builtin can be used to display or modify the history list and manipulate the history file. When using the command-line editing, search commands are available in each editing mode that provide access to the history list.

The shell allows control over which commands are saved on the history list. The HISTCONTROL and HISTIGNORE variables may be set to cause the shell to save only a subset of the commands entered. The cmdhist shell option, if enabled, causes the shell to attempt to save each line of a multi-line command in the same history entry, adding semicolons where necessary to preserve syntactic correctness. The lithist shell option causes the shell to save the command with embedded newlines instead of semicolons. See section Bash Builtin Commands, for a description of shopt.
Bash History Builtins

Bash provides two builtin commands that allow you to manipulate the history list and history file.

fc

fc [-e ename] [-nlr] [first] [last]
fc -s [pat=rep] [command]

Fix Command. In the first form, a range of commands from first to last is selected from the history list. Both first and last may be specified as a string (to locate the most recent command beginning with that string) or as a number (an index into the history list, where a negative number is used as an offset from the current command number). If last is not specified it is set to first. If first is not specified it is set to the previous command for editing and -16 for listing. If the `-l' flag is given, the commands are listed on standard output. The `-n' flag suppresses the command numbers when listing. The `-r' flag reverses the order of the listing. Otherwise, the editor given by ename is invoked on a file containing those commands. If ename is not given, the value of the following variable expansion is used: ${FCEDIT:-${EDITOR:-vi}}. This says to use the value of the FCEDIT variable if set, or the value of the EDITOR variable if that is set, or vi if neither is set. When editing is complete, the edited commands are echoed and executed. In the second form, command is re-executed after each instance of pat in the selected command is replaced by rep. A useful alias to use with the fc command is r='fc -s', so that typing `r cc'cc and typing `r' re-executes the last command (see section Aliases). runs the last command beginning with
history

history [-c] [n]
history [-anrw] [filename]
history -ps arg

Display the history list with line numbers. Lines prefixed with with a `*' have been modified. An argument of n says to list only the last n lines. Options, if supplied, have the following meanings:

-w
Write out the current history to the history file.
-r
Read the current history file and append its contents to the history list.
-a
Append the new history lines (history lines entered since the beginning of the current Bash session) to the history file.
-n
Append the history lines not already read from the history file to the current history list. These are lines appended to the history file since the beginning of the current Bash session.
-c
Clear the history list. This may be combined with the other options to replace the history list completely.
-s
The args are added to the end of the history list as a single entry.
-p
Perform history substitution on the args and display the result on the standard output, without storing the results in the history list.

When the `-w', `-r', `-a', or `-n' option is used, if filename is given, then it is used as the history file. If not, then the value of the HISTFILE variable is used.

History Expansion

The History library provides a history expansion feature that is similar to the history expansion provided by csh. This section describes the syntax used to manipulate the history information.

History expansions introduce words from the history list into the input stream, making it easy to repeat commands, insert the arguments to a previous command into the current input line, or fix errors in previous commands quickly.

History expansion takes place in two parts. The first is to determine which line from the history list should be used during substitution. The second is to select portions of that line for inclusion into the current one. The line selected from the history is called the event, and the portions of that line that are acted upon are called words. Various modifiers are available to manipulate the selected words. The line is broken into words in the same fashion that Bash does, so that several words surrounded by quotes are considered one word. History expansions are introduced by the appearance of the history expansion character, which is `!' by default. Only `\' and `'' may be used to escape the history expansion character.

Several shell options settable with the shopt builtin (see section Bash Builtin Commands) may be used to tailor the behavior of history expansion. If the histverifyhistreedit shell option is enabled, a failed history expansion will be reloaded into the Readline editing buffer for correction. The `-p' option to the history builtin command may be used to see what a history expansion will do before using it. The `-s' option to the history builtin may be used to add commands to the end of the history list without actually executing them, so that they are available for subsequent recall. This is most useful in conjunction with Readline. shell option is enabled, and Readline is being used, history substitutions are not immediately passed to the shell parser. Instead, the expanded line is reloaded into the Readline editing buffer for further modification. If Readline is being used, and the

The shell allows control of the various characters used by the history expansion mechanism with the histchars variable.
Event Designators

An event designator is a reference to a command line entry in the history list.

!
Start a history substitution, except when followed by a space, tab, the end of the line, `=' or `('.
!n
Refer to command line n.
!-n
Refer to the command n lines back.
!!
Refer to the previous command. This is a synonym for `!-1'.
!string
Refer to the most recent command starting with string.
!?string[?]
Refer to the most recent command containing string. The trailing `?' may be omitted if the string is followed immediately by a newline.
^string1^string2^
Quick Substitution. Repeat the last command, replacing string1 with string2. Equivalent to !!:s/string1/string2/.
!#
The entire command line typed so far.

Word Designators

Word designators are used to select desired words from the event. A `:' separates the event specification from the word designator. It may be omitted if the word designator begins with a `^', `$', `*', `-', or `%'. Words are numbered from the beginning of the line, with the first word being denoted by 0 (zero). Words are inserted into the current line separated by single spaces.

0 (zero)
The 0th word. For many applications, this is the command word.
n
The nth word.
^
The first argument; that is, word 1.
$
The last argument.
%
The word matched by the most recent `?string?' search.
x-y
A range of words; `-y' abbreviates `0-y'.
*
All of the words, except the 0th. This is a synonym for `1-$'. It is not an error to use `*' if there is just one word in the event; the empty string is returned in that case.
x*
Abbreviates `x-$'
x-
Abbreviates `x-$' like `x*', but omits the last word.

If a word designator is supplied without an event specification, the previous command is used as the event.
Modifiers

After the optional word designator, you can add a sequence of one or more of the following modifiers, each preceded by a `:'.

h
Remove a trailing pathname component, leaving only the head.
t
Remove all leading pathname components, leaving the tail.
r
Remove a trailing suffix of the form `.suffix', leaving the basename.
e
Remove all but the trailing suffix.
p
Print the new command but do not execute it.
q
Quote the substituted words, escaping further substitutions.
x
Quote the substituted words as with `q', but break into words at spaces, tabs, and newlines.
s/old/new/
Substitute new for the first occurrence of old in the event line. Any delimiter may be used in place of `/'. The delimiter may be quoted in old and new with a single backslash. If `&' appears in new, it is replaced by old. A single backslash will quote the `&'. The final delimiter is optional if it is the last character on the input line.
&
Repeat the previous substitution.
g
Cause changes to be applied over the entire event line. Used in conjunction with `s', as in gs/old/new/, or with `&'.

mercredi 16 décembre 2009

pdflatex.bat

pdflatex thesis.tex

bibtex thesis

pdflatex thesis.tex

pdflatex thesis.tex

pdflatex thesis.tex

thesis.pdf

exit

ABOUT *.pdf

1. Read *.pdf

evince *.pdf
Document (postscript, pdf) viewer

Evince is a simple multi-page document viewer. It can display and print
PostScript (PS), Encapsulated PostScript (EPS), DJVU, DVI and Portable
Document Format (PDF) files.
When supported by the document, it also allows searching for text,
copying text to the clipboard, hypertext navigation, and
table-of-contents bookmarks.

Okular *.pdf
document viewer for KDE 4

Okular is a universal document viewer with support for advanced document
features, such as annotations, forms, and embedded files.

It can open a wide variety of document formats, including:
* PostScript (PS)
* Portable Document Format (PDF)
* OpenDocument format (ODF)
* TeX Device independent file format (DVI)
* various electronic book formats

This package is part of the KDE 4 graphics module.

2. post-processing

pdfjam
collection of PDF document handling utilities

PDFjam is a small collection of shell scripts that work similarly to
the well known psutils (psmerge, psnup). They provide a simple
interface to some of the functionality of the pdfpages package for
pdfLaTeX. At present, the utilities available are pdfnup, pdfjoin, and
pdf90. PDFjam depends on a working installation of (pdf)LaTeX.

- pdfnup puts multiple document pages together on one physical page at
a reduced size
- pdfjoin concatenates multiple PDF documents
- pdf90 rotates the pages of PDF documents

/usr/bin/pdf90
/usr/bin/pdfjoin
/usr/bin/pdfnup

dia

like visio in Windows, can output .eps

mercredi 9 décembre 2009

emacs 添加 .el

;;添加放置.el文件的路径,比如路径为“~/elisp”
(add-to-list 'load-path "~/elisp")
;;调用.el,比如“linum.el”
(require 'linum)
;;修改.el中的设置
(global-linum-mode 1)

lundi 7 décembre 2009

define Keyboard Shortcuts

System / Preferences / Keyboard Shortcuts

gnome-terminal = F12

install tecplot360

1) unpack
2) burn / mount
3) install
4) crack dir

umount U disk

sudo umount /media/..

mount .iso

for example: tec.iso to ~/temp/tec

mount -o loop tec.iso ~/temp/tec

Dolphin

like commander in Windows

email setting

gmail setting
------------------------------------------------------------------------
evolution是ubuntu自带的一个邮件管理软件,可以帮助你方便的管理和收发邮件,刚刚设置成功,把步骤写出来,和大家一起分享。
1.确认你的gmail的POP已经打开: 登录gmail-settings-forwarding and POP, 确认“Enable POP for all mail”被选上
2.打开Application→Internet→Evolution Mail
3.添加用户,如果已经创建了gmail用户,直接点击edit。
4. 在Receive mail选项,
server type 选 POP
server: pop.gmail.com
username: 你的gmail用户名(eg.'myname@gmail.com'则填入'myname')
use secure connection: SSL encryption
authentication type: password, remember password
5. 在sending mail选现,
server type: SMTP
server: smtp.gmail.com
选中server require authentication
use secure connection: SSL encryption
authentication type: PAIN
username: 你的gmail用户名(eg.'myname@gmail.com'则填入'myname')
选中remember password
6. OK

ec-lyon.fr setting
--------------------------------------------------------------------------
pop.ec-lyon.fr
wma
No encryption

language input

System / Administration / Synaptic Package Manage
INSTALL: scim + scim-chinese

System / Administration / Synaptic Package Manage
Settings /Repositories
Download from: ->>Main server

System / Administration / Language Support
Keyboard input method system: ->>scim
Install / Remove Languages ->> Chinese (simplified) + Chinese (traditional) + Franch

解决光标跟随问题:
http://forum.ubuntu.org.cn/viewtopic.php?t=81859
升级到ubuntu 7.10,有可能会遇到修改文件名时不能输入,在firefox中不能光标跟随,在gaim,pidgin,amsn,emesene,eva,gtalk等聊天软件不能输入文字等等的问题.解决方法如下:

# im-switch -s scim -z default
# sudo apt-get install scim-qtimm
# sudo apt-get install scim scim-pinyin scim-tables-zh im-switch scim-qtimm scim-bridge scim-bridge-client-gtk scim-bridge-client-qt scim-bridge-agent
编辑im-switch生成的scim配置文件
# gksu gedit /etc/X11/xinit/xinput.d/scim
将默认的 GTK_IM_MODULE=scim 修改为 GTK_IM_MODULE="scim-bridge"。保存退出.

在scim输入法中进行了如下设定:

scim设置->全局设置->将预编辑字符串嵌入到客户端中 前的勾去掉
scim设置->gtk->嵌入式候选词标的勾去掉.

重启scim

打开终端,输入 pkill scim
然后输入 scim -d
OK

set ip

156.18.38.239
255.255.255.0
156.18.38.254

156.18.22.3
156.18.19.5

energ.ec-lyon.fr