Archive

Posts Tagged ‘linux’

GNU/Linux Advanced Administration

February 4th, 2010 ricky.zhu 2 comments

非常不错的一本电子书,从GNU/Linux的来历,发行版,内核,一直讲到GNU/Linux的管理(包括工具,网络管理,数据管理,服务器管理,安全管理,配置管理和优化以至于集群技术)非常的全面和细致,共享一下。

PDF下载

Categories: 脚本语言 Tags:

Linux System and Performance Monitoring

January 15th, 2010 ricky.zhu 1 comment

新年第一篇

转载sanotes的这篇非常实用的Linux System and Performance Monitoring 翻译文档,包括CPU篇,内存篇,IO篇,网络篇,总结篇等五个部分,整理成了pdf方便下载。

Linux system and performance monitoring PDF下载
原文

Categories: 主机 Tags:

Learning Vim

November 17th, 2009 ricky.zhu No comments

最新发现的Vim里面的一些不太常用,但是非常强大的功能,包括列选定,分屏等等,学习并记录之。

这个思维导图来自于Joe Marinez的blog

vim

PDF版本下载

摘录下来从中学到的几个命令:

Marking Text:
v = start visual mode
V = start linewise visual mode
ctrl-v = start blockwise visual mode
o = move to other end of marked area
U = upper case of marked area
O = move to Other corner of block

> = shift right
< = shift left
y = yank
d = delete
~ = switch case

Multi-File:
:sp fn = open a file in new buffer and split window
ctrl-w s = split window
ctrl-w w = switch windows
ctrl w – window commands
ctrl-w q = quit a window
ctrl-w v = split windows vertically

Tab Commands:
:tabe fn = edit file in new tab
gt = next tab
gT = previous tabs
:tabr = First tab
:tabl = Last tab
:tabm [N] = move current tab after tab N

Categories: 脚本语言 Tags: ,

NTFS分区修复记

November 11th, 2009 ricky.zhu No comments

用Ubuntu已经一年多了,月初更新到了最新的版本9.10,在update的时候不小心把grub列表中Windows的entry弄丢了,麻烦的事情开始了。

虽然我自己已经正式在Linux办公多时了,但是有时候还是私人要回到Windows下处理一下网银之类的应用(可恶的招行网银,不知道什么时候才能支持Linux)。首先在/boot/grub/menu.lst中加上了Windows的菜单,但是还需要知道是哪个引导分区,但是一下子想不起来哪个是Windows的引导分区,只好进到grub,用root (hdx, y)的方法去列出来,一个一个的尝试一遍,这一尝试不要紧,卷莫名的把我的一个NTFS分区的引导给破坏了。
尝试的最后结果是引导分区找到了,但是NTFS分区识别不了了。在Linux下面的现象就是无法mount,回到Windows下面,结果是此分区尚未格式化,是否格式化?吓个心惊肉掉,里面是这两年的全部收藏,包括无数的重要文档,资料,图片,工具等等. 当您尝试做某些事情,例如当涉及到像这样的例子在网站上散布类似 InterTrader (http://www.intertrader.com/ ) 投注某些事情,那么就需要使用Windows作为Linux是不能支持的软件。不过Linux的工作确实让事情更快。

想办法,搜索了一下,遇到这个问题的人还不在少数,Linux WIKI上说用微软自己开发的dskprobe去手动修改,,我下载了一个,尝试了一下,够复杂,全部是十六进制数据,看了半天,楞没敢下手。

还有一些其他办法,比如在Linux下面把分区头dd多大一个大小,然后修改,如何在恢复,感觉还是不太靠谱,还有简单的办法就是用Windows安装盘进去直接修复MBR,这个方法简单是简单,问题是多年不用windows,一时半会找个安装盘是个大问题,放弃。

最后继续搜索,找到了分区表医生软件PTTD (partition table doctor),几百k的绿色软件,下载下来,一眼就看到分区D有把大大的叉,右键单击修复,修复成功,重启机器,搞定,前后不到5分钟。东西全部回来了!

Categories: 主机 Tags:

自由软件运动和Richard Stallman大师

October 18th, 2009 ricky.zhu 4 comments

昨天跟szlug的同学们一起组团去珠海参加哲思社区的2009自由软件峰会,会议地点在珠海金山公司总部。
其实此行最重要的还是去围观大牛Richard.M. Stallman,相信熟悉GNU/Linux的人一定都不会错过这样近距离接触世界级大师的机会。

gnu

stallman

众所周知,Richard Stallman大师是世界自由软件运动的创始者和先驱,是GNU的发起者和FSF主席。自从上世纪70年代以来,一直致力于自由软件为人类的思想。近距离聆听大师布道,确实感想和收获颇多。

大师每每讲到精彩处,都会爆发阵阵掌声,大师崇尚的自由软件颇有点我为人人,人人为我的共产主义意味,从他1970s在MIT打印机驱动程序的故事讲起,演讲持续了一个多小时,过程中他反复强调:software should be free

他的自由软件的哲学思想是:
Free software is a matter of the users’ freedom to run, copy, distribute, study, change and improve the software
详细的阐述为四个自由,自由0到自由3,详细的解释参考

在一定程度上,自由软件跟我们通常所说的开源软件还不是一码事,事实上,大师并不认同开源软件,一个同行的哥们拿了一个Gentoo的光盘,想请大师签名,被他坚定的拒绝了,他解释说,这不是真正的GNU/Linux,他并不认同,有性格!

回来后才知道,著名的gcc,gdb,emacs都是大师的作品,orz…

关于更多,请参考徐继哲写的Richard stallman和自由软件运动

photo with stallman
和stallman大师的合影(他还在忙着帮别人签名)

church of emacs
the Church of Emacs(穿上戏服,带上光环,还真有那么回事哈)

Categories: 业界 Tags:

Ubuntu的两个bug

October 9th, 2009 ricky.zhu 2 comments

这两天在office的电脑和家里的laptop上分别遇到了两个ubuntu的bug,记录一下。

office的ubuntu从最初的8.04,到8.10一直到9.04用的挺好,很少关机和重启,放假八天,为了省电,就顺手把电脑关了。回来的时候,发现两个屏幕无法切换成扩展模式了,只能显示为mirror了(之前买了一个单独的显卡,这样一台主机接两个19“的显示器,看起来爽多了),从终端启动gnome-display-properties或者在设置里面点击显示,GUI出来之后CPU立刻就被吃掉了80%以上,搜索了一下,是一个bug,Bug#375368,好像状态是invalid,因为最初的filer长时间没响应。 :(

最近Ubuntu 9.10 beta已经出来几天了,闲来无事,就把家里笔记本上的系统升级到9.10,尝尝鲜,结果升级之后,无线网络可以连上,有线无论如何都无法连上,而我用的电信ADSL是需要登录的,郁闷,只有退出到Windows,然后找了一下,发现果然是一个network-manage的bug,手工从终端启动pppoe-config然后配置之后,就可以了。详细情况参考这里

看来beta还是不太稳定哈,还有20天,9.10就正式release了,希望到时候少些问题,而且9.10是一个LTS版本9.10 不是 LTS, 10.04 才是,感谢cloud指正,打算把office的也升上去。

Categories: 业界 Tags:

Ubuntu9.10 is coming

October 4th, 2009 ricky.zhu 2 comments

从8.04开始用Ubuntu,历经8.10,9.04,现在 9.10马上就要来了,还有20几天,如果你已经迫不及待了,可以现在就去尝试一下Beta版本

голова болит секс

Categories: 业界 Tags:

Using vi

July 8th, 2009 ricky.zhu 2 comments

General Startup

”’To use vi:”’ vi filename
”’To exit vi and save changes:”’ :wq
”’To exit vi and save changes:”’ :x
”’To exit vi without saving changes:”’ :q!
”’To enter vi command mode:”’ [esc]

Counts

A number preceding any vi command tells vi to repeat that command that many times.

Cursor Movement

h move left (backspace)
j move down
k move up
l move right (spacebar)
[return] move to the beginning of the next line
$ last column on the current line
0 move cursor to the first column on the current line
^ move cursor to first nonblank column on the current line
w move to the beginning of the next word or punctuation mark
W move past the next space
b move to the beginning of the previous word or punctuation mark
B move to the beginning of the previous word, ignores punctuation
e end of next word or punctuation mark
E end of next word, ignoring punctuation
H move cursor to the top of the screen
M move cursor to the middle of the screen
L move cursor to the bottom of the screen

Screen Movement

G move to the last line in the file
xG move to line x
z+ move current line to top of screen
z move current line to the middle of screen
z- move current line to the bottom of screen
^F move forward one screen
^B move backward one line
^D move forward one half screen
^U move backward one half screen
^R redraw screen (does not work with VT100 type terminals)
^L redraw screen (does not work with Televideo terminals)

Inserting

r replace character under cursor with next character typed
R keep replacing character until [esc] is hit
i insert before cursor
a append after cursor
A append at end of line
O open line above cursor and enter append mode

Deleting

x delete character under cursor
dd delete line under cursor
dw delete word under cursor
db delete word before cursor

Copying Code

yy (yank)’copies’ line which may then be put by the p(put) command. Precede with a count for multiple lines.

Put Command

brings back previous deletion or yank of lines, words, or characters

P bring back before cursor
p bring back after cursor

Find Commands

? finds a word going backwards
/ finds a word going forwards
f finds a character on the line under the cursor going forward
F finds a character on the line under the cursor going backwards
t find a character on the current line going forward and stop one character before it
T find a character on the current line going backward and stop one character before it
; repeat last f, F, t, T

Miscellaneous Commands

. repeat last command
u undoes last command issued
U undoes all commands on one line
xp deletes first character and inserts after second (swap)
J join current line with the next line
^G display current line number
% if at one parenthesis, will jump to its mate
mx mark current line with character x
‘x find line marked with character x

”’NOTE:”’ Marks are internal and not written to the file.

Line Editor Mode

Any commands form the line editor ”’ex”’ can be issued upon entering line mode.

To enter: type ‘:’
To exit: press [return] or [esc]

Substitution

:#,#s/old/new/g

# line number range
old pattern to replace
new pattern to insert
g optional key for global substitution (multiple occurences of old on the same line will not be replace without this)

Reading Files

copies (reads) filename after cursor in file currently editing

:r filename

Write File

:w saves the current file without quitting

Moving

:# move to line #
:$ move to last line of file

Shell Escape

executes ‘cmd’ as a shell command.

:!’cmd’

Categories: 脚本语言 Tags: