2009年5月4日星期一
2009年4月25日星期六
Linux编程工具--(转)
Linux下编程辅助工具vim+ctags+taglist+cppcomplete+cscope+global
http://www.lpi-china.org/bbs/viewthread.php?tid=3485=====================================各个工具的主要功能:
vim:这个是Linux下功能十分强大的编辑器,就不说了。
ctags:生成tag文件的命令,这个是其它工具的基础。
taglist:需要ctags的支撑,直接在左边列出函数列表,全局参数列表。
cppcomplete:需要ctags的支撑,可以补全类型或者函数名。
cscope:比较强大,可以对函数以及部分类型定义进行跳转,其实cscope是用来替代ctags功能的。
global:貌似和cscope,taglist功能一样,据说对于大型的工程表现不错。
各个工具的安装:
1)vim,ctags,cscope,global,在系统安装时安装,或者使用yum安装。
2)下载vim的cscope插件,并放到相应目录下,如~/.vim/plugin/
2)taglist,cppcomplete是Vim的插件,从下面地址获得,然后放到vim相应目录下即可。
各个工具的使用:
1)ctags的使用
在终端运行如下命令,将生成文件tags:
ctags *.cpp
要生成cppcomplete需要的tags文件的话,需要运行下面的命令:
ctags -n -f cppcomplete.tags --fields=+ai --C++-types=+p * -L cscope.files
注意,我在最后使用了参数"-L cscope.files" 这仅仅是借用拉cscope生成的文件索引来帮助ctags去查询相关工程文件生成tags。
2)使用taglist
taglist的功能是即时生成当前文件的函数列表和全局变量列表,便于索引。
在vim中命令模式下使用:
Tlist 打开或者关闭当前文件的索引;
TlistSync 立即在打开的索引窗口中定位当前的光标所在位置属于哪个函数或者结构定义中。
3)使用cppcomplete
使用很简单,就是在你需要补全类型成员时,按F8键就可以啦。
The default key mapping to complete the code are:
Alt+l in insert mode will try to find the possible completions and display them in a popup menu. Also normal completions to the names in cppcomplete.tags.
Alt+j in insert mode will show the popup menu with the last results. Selecting one of the items will paste the text.
F8/F9 will work in a similar way as Ctrl+N, Ctrl+P in unextended vim so the script can be used without the popup menu.
F5 in insert mode will lookup the class and display it in a preview window
The key mapping are only tested under Windows and linux and they will not work on all platforms. Changing the mappings is easy.
4)使用cscope
cscope的tag生成最简单的方法是:
在你的开发工程的最上层目录执行cscope-indexer,它会遍历下面的所有目录,生成两个文件,一个是cscope.files,这个文件记录需要生成tags的文件名,可以手工修改,另一个是cscope格式的tags文件cscope.out。
完成后,就可以使用Ctrl-]跳转查找类型定义了。
5)使用global
在工程的最上层目录执行命令:
gtags
等待它完成所有需要的global自己格式的tags的生成。生成完后,可以用如下命令查询相关类型引用和关联关系:
Gtags xxxx 查找xxxx的定义
Gtags -r xxxx 查找xxxx的引用
Gtags -s xxxx 查找xxxx出现的地方
有时它无法正常分析的类型 可以试试用带-s 的参数的方式找找类型定义。
2009年4月22日星期三
2009年4月20日星期一
linux crontab--linux 命令
语法
crontab [ -e [UserName] | -l [UserName] | -r [UserName] | -v [UserName] | File ]
-e:编辑
-l:列出用户的cron
-r:删除
-v:检查用户cron状态
描述
1,/var/spool/cron/crontabs
2,/var/adm/cron/cron.allow 和 /var/adm/cron/cron.deny,allow优先权大于deny
3,* 表示允许所有值, ","表示单个值的集合, "-"表示范围
4,如果包含一个 % (百分号)在第六字段,cron 守护进程像命令调用一样处理所有的任务,并使所有的后续任务在标准输入上可用,除非转义百分号 (\%)。空行和第一个非空字符是编号标记(#)将被忽略。如果命令含有反斜杠 (\) 的参数,反斜杠前应加另一个反斜杠。
示例
- 拷贝一个名为 mycronjobs 的文件,到 /var/admn/cron/crontabs 目录下,输入以下内容:
crontab mycronjobs
- 将时间以小时的形式把每个小时写到 console 中,输入:
0 * * * * echo The hour is `date` 。 >/dev/console
- 要在每个星期一、星期三和星期五的 6:30 a.m. 运行 calendar 命令,输入:
30 6 * * 1,3,5 /usr/bin/calendar
- 要在一年的每一天的 6:30 运行 calendar 命令,输入:
30 6 * * * /usr/bin/calendar
- 要在八月的每天午夜运行一个称为 maintenance 的脚本,输入:
0 0 * 8 * /u/harry/bin/maintenance
- 为命令的标准输入定义文本,输入:
0 16 * 12 5 /usr/sbin/wall%HAPPY HOLIDAY!%Remember to turn in your time card.
在 %(百分号)之后定义 wall 命令的标准输入的文本:
HAPPY HOLIDAY! Remember to turn in your time card.
7,每两个小时 0*/2* * * date
crontab mycronjobs
0 * * * * echo The hour is `date` 。 >/dev/console
30 6 * * 1,3,5 /usr/bin/calendar
30 6 * * * /usr/bin/calendar
0 0 * 8 * /u/harry/bin/maintenance
0 16 * 12 5 /usr/sbin/wall%HAPPY HOLIDAY!%Remember to turn in your time card.
在 %(百分号)之后定义 wall 命令的标准输入的文本:
HAPPY HOLIDAY! Remember to turn in your time card.
7,每两个小时 0*/2* * * date 2009年4月8日星期三
linux ---安装记录
1,声卡安装 configure--make--make install(alsa-driver-1.0.18rc3)
2,显卡去官方网站按照提示
3,其他个软件可以去官网下载安装
4,realplayer--首选项-去掉 x code,然后把音频改为 oss格式
5,totem偏色--直接修改色差度
6,vmware--a3ny8-epfox-y8hdz-4yxnk,LR5HT-16602-T814A-4MEN2、THWW8-HRZAH-A24FA-4YTN3
linux---一些常用命令
1,ssh---
- 远程登录
ssh user@remote.machine
- 远程执行
ssh user@remote.machine 'command ...'
- 远程复制
scp user@remote.machine:/remote/path /local/path
scp /local/path user@remote.machine:/remote/path
- X forward
ssh -X user@remote.machine
2,aptitude,基本可以和apt-get 呼唤,不过更“好”一些
--aptitude search XXX | grep XXX
--aptitude install XXX
3,svn
-svn co[out/in] http://XXXXXXXXXXXXXXXXX /locale/XXXXXXXX
4,dpkg Debian安装(i),查找(l),卸载(r)
5,apt
---apt-cache search 命令可以按关键字查找软件包,通常用于查询的关键字会使用软件包的名字或软件包的一部分.
----apt-cache show命令显示指定软件包的详细信息.例如:apt-cache show vim
-----apt-cache depends来查询包依赖关系.例如:apt-cache depends vim
----apt-get remove 可以蛮好的解决软件包卸载过程中的包依赖关系问题,依赖于被卸载软件包的其他软件包将被一同卸载.
---apt-get clean命令安全有效的清理/var/cache/apt/archives/目录中的文件.
- 远程登录
ssh user@remote.machine
- 远程执行
ssh user@remote.machine 'command ...'
- 远程复制
scp user@remote.machine:/remote/path /local/path
scp /local/path user@remote.machine:/remote/path
- X forward
ssh -X user@remote.machine
2,aptitude,基本可以和apt-get 呼唤,不过更“好”一些
--aptitude search XXX | grep XXX
--aptitude install XXX
3,svn
-svn co[out/in] http://XXXXXXXXXXXXXXXXX /locale/XXXXXXXX
4,dpkg Debian安装(i),查找(l),卸载(r)
5,apt
---apt-cache search 命令可以按关键字查找软件包,通常用于查询的关键字会使用软件包的名字或软件包的一部分.
----apt-cache show命令显示指定软件包的详细信息.例如:apt-cache show vim
-----apt-cache depends来查询包依赖关系.例如:apt-cache depends vim
----apt-get remove 可以蛮好的解决软件包卸载过程中的包依赖关系问题,依赖于被卸载软件包的其他软件包将被一同卸载.
---apt-get clean命令安全有效的清理/var/cache/apt/archives/目录中的文件.
订阅:
博文 (Atom)