linux 常用命令小集(一)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/shangshaohui2009/article/details/88577603

1--从当前目录一直往里递归查找
find -depth -name '*.class' -exec grep -l '关键字' {} \;

2--当前目录开始递归,找所有文件
grep "关键字" -rl .  

3--当前目录开始递归,但只找jsp文件
grep "关键字" -rl `find -depth -name '*.jsp'` 

4--按200m单位分割一个文件,poslogin.log为要分割的文件,a 为分割后的文件名
split  -b  200m  poslogin.log  a

5--截取文件nohup.out的第50到55行,输入到文件a.log中
sed -n '50,55p' nohup.out > a.log

6--在当前目录中,找出包含http://www.baidu.com的文件,并替换为https://www.baidu.com
sed -ir 's#https://www.baidu.com#http://www.baidu.com#g' `grep "http://www.baidu.com" -rl `find -depth -name '*.jsp'``

7--创建软连接
ln -s /picclife/weblogic/wlserver9/user_projects/domains/domain8 domains

删除软连接
rm directnew
提示输入y

8--查看命令位置
whereis ifconfig

9--将本机文件复制到远程服务器上
#scp /home/administrator/news.txt [email protected]:/etc/

10--将远程服务器上的文件复制到本机
scp [email protected]:/picclife/hadoop-2.6.4.tar.gz /picclife

扫描二维码关注公众号,回复: 5985002 查看本文章

猜你喜欢

转载自blog.csdn.net/shangshaohui2009/article/details/88577603