linux 常用命令

###DOS### 
cd /d d:\    //强制跳转到d:\


####vi#####

:set ic //忽略大小写
:set nu //显示行号
:1,$d  //delete all content in vi
:1,$y //copy all content in vi 
:x //相当于:wq
ggVGy //:1 the text
d$ or D //delete from cursor to the end of current line
dG //delete from cursor to end of file
:%s/abc/123/ 将所有的abc成123
:1,3 /s/abc/123/  将1-3行的abc替换成123


 
cvs diff -uN > /home/username/diff.txt
diff -qr folder1 folder2 //only list the diff file name
sed -i 's/^-INC\( \{1,\}\S\{1,\}\).*/       COPY\1\./' test   //在sed中使用正则 1 就是之前查找到的结果
sed -i 's/\(Bundle-Version: \).*/\1'$VERSION'/g' ${WORKSPACE}/META-INF/MANIFEST.MF  //在sed中使用变量
 
 
 ###CVS Command###
 export CVSROOT=:pserver:username@bjsrc.cn.oracle.com:/repos
 cvs commit -m "check-in comment" filename  //checkin file
 
 //remove a file from CVS
 rm filename
 cvs remove filename
 
 //add a file in CVS
 copy the file to the place
 cvs add filename
 cvs commit filename
 
 //remove a directory recursively
 cvs remove -Rf folder
 cvs commit -m "comments" folder
 
 //diff two version of a file
 cvs diff -y -r1 -r2 filename
 
 //check status of a file in CVS
 cvs status filename
 cvs log filename
 cvs rlog module/filename
 
 //check out file to a module with a specified tag MY_TAG2 to a directory ./tag2_folder/
 cvs co -r MY_TAG2 -d tag2_folder modulename
 
 //add directory recursively
 copy the folder to the place
 cd newfolder
 cvs import abc/efg/newfolder inital abdnewfoler


 ###linux command###
 cksum filename
 hostname //get the server name
 echo "$USER" //get current user name-help
 which perl //get the perl installed path
 who am i //get current user name
 id username //查看user 权限
 dos2unix run_kk.sh  //format from dos to unix


 wc [-option] filename 
-c  //count the bytes of the file
-l  //count line number
-w  //count characters




 //kill all run_kk.sh process
 kill -9 `ps -ef |grep "./run_kk.sh" | awk -F " " '{print $2}'`
 kill -9  `pgrep -f run_kk`
 
 //zip and unzip xxx.jar
jar xvf xx.jar
zip -r xxx.jar *
unzip file.zip -d /directory_name  
tar czvf xxx.tgz ./test/  //打包
tar xzvf xxx.tgz          //解包
tar -xf xxx.tgz -C /test/  //解包到指定目录
tar tzf xxx.tgz //不用解包,查看.tgz文件的内容


ulimit
参  数:
  -a  显示目前资源限制的设定。 
  -c <core文件上限>  设定core文件的最大值,单位为区块。 
  -d <数据节区大小>  程序数据节区的最大值,单位为KB。 
  -f <文件大小>  shell所能建立的最大文件,单位为区块。 
  -H  设定资源的硬性限制,也就是管理员所设下的限制。 
  -m <内存大小>  指定可使用内存的上限,单位为KB。 
  -n <文件数目>  指定同一时间最多可开启的文件数。 
  -p <缓冲区大小>  指定管道缓冲区的大小,单位512字节。 
  -s <堆叠大小>  指定堆叠的上限,单位为KB。 
  -S  设定资源的弹性限制。 
  -t <CPU时间>  指定CPU使用时间的上限,单位为秒。 
  -u <程序数目>  用户最多可开启的程序数目。 
  -v <虚拟内存大小>  指定可使用的虚拟内存上限,单位为KB。


 
uname [option]
-a或–all     详细输出所有信息,依次为内核名称,主机名,内核版本号,内核版本,硬件名,处理器类型,硬件平台类型,操作系统名称
-m或–machine   显示主机的硬件(CPU)名    
-n或-nodename 显示主机在网络节点上的名称或主机名称
-r或–release       显示linux操作系统内核版本号
-s或–sysname    显示linux内核名称
-v                      显示显示操作系统是第几个 version 版本
-p                      显示处理器类型或unknown
-i                       显示硬件平台类型或unknown
-o                      显示操作系统名
–help               获得帮助信息
–version        显示uname版本信息


e.g uname -m //显示是64位还是32位
  
//scp file
scp abc.zip user@sina.cn.oracle.com:/home/user/folder1/


//add user to a group
useradd -g groupname username
gpasswd -a username groupname


cp -fr /folder/  


//display .data file in linux
hexdump -C UNLOAD.DATA


###find command###
find . -type f|xargs cksum|sort >../aix_stage_cksum.txt
find . -name "*.cbl" |xargs grep -n "\-INC "  //查找多个文件需要用“”
find /home/username/ -name "*.cbl" -exec ls -al {} \;
find /home/username/ -name "*.cbl" |xargs ls -al


####echo command###
echo -n "no auto new line" //不自动换行
echo "12.1.1.91-RP" | grep -E -o "^[0-9]+\.[0-9]+\.[0-9]+\.[^.]+$"  //查找是否是合法的version number




###VNC command###
connect to a server use putty
input "vncserver" to open a new window
use vncreviewer connect to the new window
vncconfig -nowin & //linux和windows之间复制粘贴
窗口键+p //全屏切换
tab+Alt //切换桌面
shift+Ctrl+T //open a new tab 


#######EMACS########
重新编译所有文件
cd /home/username/
emacs-23.1 -l .emacs
(make-system "home/username/system.lisp") //当workspace改变的时候,需要修改这个文件
(compile-and-load-file "/home/username/kk_test/make.re")
(ru::cat)
命令 快捷键 功能
forward-word M-f 向前移动一个单词。
isearch-forword C-s 递增搜索
undo C-/ 撤销最后一次操作,如果多次执行则取消以前的操作。
keyboard-quit C-g 取消当前的命令。
find-file C-x C-f 在一个新的缓冲区里访问某个文件(用户给定文件名)。
save-buffer C-x C-s 将缓冲区的内容保存到文件。
save-some-buffers C-x s 保存所有的缓冲区
save-with-newname C-x C-w 将缓冲区的内容另存为一个新的文件。
save-buffers-kill-emacs C-x C-c 提示是否保存文件,然后退出Emacs。
set-mark-command C-[空格]注 设定标记,用于剪切或复制。
kill-region C-w 剪切标记到当前光标所在处的文本。
kill-ring-save M-w 复制标记到当前光标所在处的文本。
yank C-y 从Emacs的剪贴板中粘贴文本。
kill-buffer C-x k 关闭当前buffer。


search 后 C+s 查找下一个
C+Alt+y 执行上一个命令
C+x+1 只保留一个窗口
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值