linux常用命令

查看

dmesg | grep -n -A3 -B2 'eth'     #例子1 查网卡信息

ulimit -a 查看服务器配置信息

ulimit -c unlimited

wc -l   行数

搜索

grep -n 'the' test.txt  //从刚刚的文件当中取得 the 这个特定字串
grep -vn 'the' test.txt //当该行没有 'the' 这个字串时才显示在萤幕上
grep -in 'the' test.txt //想要取得不论大小写的 the 
grep -n 't[ae]st' test.txt // 搜寻 test 或 taste 这两个单字时
grep -n '[^g]oo' test.txt // oo前面不可以是g
grep -n '[^a-z]oo' test.txt // oo前面不可以是小写字母
grep -n '^the' test.txt // the在行首
grep -n '^[^a-z]' test.txt // 不是以小写字母为行首的行
grep -n '\.$' test.txt // 以.结尾的行,\相当于转义字符
grep -n '^$' test.txt // 空行
grep -i "hello" *.cpp

运行程序

chmod +x IndexSyncServerV2.0 加权限

./name d 后台运行

killall -9 name 强杀程序

top

top -d 1 -p 7614,7678    看这两个进程的资源利用情况   
shift+m

ps -lu hfx 查看hfx用户的进程
jobs ps 看所有正在工作的进程

传输

scp 文件名 用户名@ip:路径

system("rm -rf /home/data/* ");//系统调用shell命令

find . -name "*.h" | xargs grep -H "ST_StkWeight"                   查文件

grep 20120816113000 calcmfdde2.sys.2012-08-16.log | wc –l          查个数

%s/替换目标/替换源

wc -l `find /home/hfx/soframe/moneyflowdde2/ -name "*.cpp"`|tail -n查找文件行数

ls

ll

man a funname

压缩

gzip xxx压缩

zcat xxx.gz读取

gzip d xxx.gz解压

tar cvf xxx.tar xxx打包

tar zcvf xxx.tar.gz xxx打包压缩

tar xvf xxx.tar 解包

tar zxvf xxx.tar.gz 解压解包

zip r xxx.zip xxx压缩

uzip xxx.zip 解压

下载

rz上传

sz xxx下载

脚本

变量定义i=1

只读变量readonly i

输出echo $i

定义数组iarr[0]=1;iarr[1]=2

数组访问echo ${arr[*]}

删除变量unset i;

导出变量到环境export i;//其他sh进程也可以使用之

shell变量:

RANDOM随机数

其他

diff -Naur passwd.old passwd.new > passwd.patch
cat passwd.patch
nc ip port

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值