linux命令
  ehrZuhofWJiC 2024年08月09日 51 0

1,ps aux | grep "tomcat"			查找运行的进程

2,find / -name java*				全部查找(java*)文件

3,cat -n name-file | grep "java"		查找文件(java)所在行

4,cat -n name-file | tail -n +92 | head -n 20		查看文件92行前后20行

5 :set nu 显示行号

6,:行号  跳转到指定行号

7,tail -n 20 filename	显示后20行数据

8,sudo -u bsafe bash	切换basfe帐户

9,cat textJson_20190216.log | awk -F '\t' '{print $NF}' > result.log	去除文件中字符"\t"
	方法二:#awk -F "\t" '{print $2}' ./textJson_20190215.log >result.log

10,cat file1 file2 | sort | uniq > fileAll	取出文件的并集(去重)

11,远程复制拷贝
$scp local_file remote_username@remote_ip:remote_folder
$scp local_file remote_username@remote_ip:remote_file
$scp local_file remote_ip:remote_folder
$scp local_file remote_ip:remote_file
scp root@127.0.0.1:/opt/soft/nginx-0.5.38.tar.gz /opt/soft/

12,字符串切割
awk '{FS=":"}{print $1"\t" $3}' /etc/passwd,使用FS=””,指定分割符,第一行已经读完,用冒号分割已经来不及了,默认的用空格分割,后面的用冒号分割,在FS之前强制加个BEGIN
***********awk -F '\t' '{print $3}'**********

13,删除指定行	sed -i '1d' <file>

14,删除包含特定字符的行	sed -e '/xxx/d' a1.txt > a2.txt

15,文件授权(递归授权所有文件)	chown -R testname <filename>

16,压缩	压缩方式: 
     tar -zcvf archive_name.tar.gz filename
     解压缩方式: 
     tar -zxvf archive_name.tar.gz 
	压缩解压(zip)
	 zip -r 123.zip 123.txt
	 unzip 123.zip -d ./
	 
17,nohup
	nohup /usr/local/node/bin/node /www/im/chat.js >> /usr/local/node/output.log 2>&1 &
	
18,hadoop执行指令
	hadoop jar /usr/bin/hadoop/software/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.2.4.jar wordcount /home/testWord /home/output/2

19,替换文件制定字符
	sed -i "s/tf_ab/tf_qw/g" result.txt
	
20,git命令
    git status
	git add .
	git commit -m "一些信息"
	git push 仓库地址
	###分支
	git checkout -b 分支名 #新建分支
	git branch -a 
	git checkout 分支名
	
21,rsync -av  ../log/textJson_$min".log" --port=9215 root@127.0.0.1::web_news_database
【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2024年08月09日 0

暂无评论

推荐阅读
  ehrZuhofWJiC   2024年08月09日   48   0   0 linuxshell运维
  ehrZuhofWJiC   2024年08月09日   44   0   0 linux服务器
  ehrZuhofWJiC   2024年08月09日   52   0   0 linux服务器
ehrZuhofWJiC