在linux下开发常用命令..

来源:互联网 发布:斗地主机器人算法 编辑:程序博客网 时间:2024/05/21 16:58

这个可能不是大家常用的命令。但是这个是自己这几天常在用的命令。

首先是找些国内的源:(将下面的一段复制粘贴到你的source.list中,你也可使用创建一个新文件然后再去覆盖的方法。注意这里要在命令前使用sudo )

#
# deb cdrom:[Xubuntu 8.04 _Hardy Heron_ - Release i386 (20080422.1)]/ hardy main multiverse restricted universe
# deb cdrom:[Xubuntu 8.04 _Hardy Heron_ - Release i386 (20080422.1)]/ hardy main multiverse restricted universe
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.

# deb http://cn.archive.ubuntu.com/ubuntu/ hardy main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ hardy main restricted

## Major bug fix updates produced after the final release of the
## distribution.
# deb http://cn.archive.ubuntu.com/ubuntu/ hardy-updates main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ hardy-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
# deb http://cn.archive.ubuntu.com/ubuntu/ hardy universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ hardy universe
# deb http://cn.archive.ubuntu.com/ubuntu/ hardy-updates universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ hardy-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
# deb http://cn.archive.ubuntu.com/ubuntu/ hardy multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ hardy multiverse
# deb http://cn.archive.ubuntu.com/ubuntu/ hardy-updates multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ hardy-updates multiverse

## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://cn.archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository. This software is not part of Ubuntu, but is
## offered by Canonical and the respective vendors as a service to Ubuntu
## users.
# deb http://archive.canonical.com/ubuntu hardy partner
# deb-src http://archive.canonical.com/ubuntu hardy partner

# Line commented out by installer because it failed to verify:
# deb http://security.ubuntu.com/ubuntu hardy-security main restricted
# Line commented out by installer because it failed to verify:
# deb-src http://security.ubuntu.com/ubuntu hardy-security main restricted
# Line commented out by installer because it failed to verify:
# deb http://security.ubuntu.com/ubuntu hardy-security universe
# Line commented out by installer because it failed to verify:
# deb-src http://security.ubuntu.com/ubuntu hardy-security universe
# Line commented out by installer because it failed to verify:
# deb http://security.ubuntu.com/ubuntu hardy-security multiverse
# Line commented out by installer because it failed to verify:
# deb-src http://security.ubuntu.com/ubuntu hardy-security multiverse

# deb http://medibuntu.sos-sts.com/repo/ hardy free non-free
# deb-src http://medibuntu.sos-sts.com/repo/ hardy free non-free

deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiverse
deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiverse
deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted universe multiverse
deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted universe multiverse
deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted universe multiverse
deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted universe multiverse
deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted universe multiverse
deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted universe multiverse
deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-proposed main multiverse restricted universe
deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiverse

deb http://debian.ustc.edu.cn/ubuntu/ hardy main restricted universe multiverse
deb http://debian.ustc.edu.cn/ubuntu/ hardy-backports main restricted universe multiverse
deb http://debian.ustc.edu.cn/ubuntu/ hardy-proposed main restricted universe multiverse
deb http://debian.ustc.edu.cn/ubuntu/ hardy-security main restricted universe multiverse
deb http://debian.ustc.edu.cn/ubuntu/ hardy-updates main restricted universe multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ hardy main restricted universe multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ hardy-backports main restricted universe multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ hardy-proposed main restricted universe multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ hardy-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ hardy multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ hardy-updates main restricted universe multiverse


替换掉etc/apt/source.list, 然后使用 sudo apt-get update

然后下个subversion,使用sudo apt-get apt-get install subversion

首先从网上用svn checkout svn://URL [where to store]

不过因为网络的原因,很有可能它会说没有这个URL

其实你也可以用移动硬盘直接把别人checkout之后的代码copy过来。同样含有svn信息。

然后如果代码有更新,到你的代码的顶级目录下使用:svn update.如果这里说你的client太old,那么就下个最新的svn.

下面是改代码阶段。

你改动了很多代码..你如果记得所有代码的位置,可以删除后再使用 svn update. 但是这个方法很笨。

你也可以使用svn revert [foldername or filename]

如果你svn update之后,发现突然编译失败了.那么可能有个小孩把错误的代码commit到了svn数据库中。

你可以使用svn log | more 命令还看看你想恢复到那个版本。

然后呢,再使用svn up -r 22323 比如这里版本为r22323那么svn就会回退到那个r22323版本

如果你想打一个patch包或diff包。使用 svn diff [path] > [filename]

path 是你想diff的目录,filename是最后生成的patch包名字.

如果你想快速的找一个代码文件在什么位置,使用

find [folder] -name 'filename' 这里的filename可以使用正则表达。

如果你不知道哪个变量或者函数在什么位置,或者那些文件使用了这个变量,那么使用

grep -i 'varialbe' filename

或者

grep -i 'variable' ./*  (这里说查找当前文件夹下的所有文件)