linux常用命令

1.  netstat -nat|grep -i “80″|wc -l
2. find / -name  “*.txt”   通配符要加引号
3.  ps –ef|grep ‘’
4.  top:
     top   //每隔5秒显式所有进程的资源占用情况
     top -d //每隔2秒显式所有进程的资源占用情况
     top -c  //每隔5秒显式进程的资源占用情况,并显示进程的命令行参数(默认只有进程名)
     top -p 12345 -p 6789//每隔5秒显示pid是12345和pid是6789的两个进程的资源占用情况
     top -d 2 -c -p 123456 //每隔2秒显示pid是12345的进程的资源使用情况,并显式该进程启动的命令行参数
 
5.  tail -f -n 1000 filename
6. rm -rf foldername
7. netstat -apn   //  netstat -ntlp     、、
    (windows)  netstat -ano
8. vi  编辑 命令
    command       删除一行  dd      插入一行 o
    input
    :q!    :wq
9. jps -mvl      //看进程相关的信息
10. jinfo  pid   // 查看jvm参数
11. ./nginx -t //check
     ./nginx -s reload   //重启 nginx
12. jstack pid(tomcat进程id)   //查看相关线程
13. mysql -h 172.16.16.45 -P 3306 -u root -p123
14.  scp *.jar uname@172.16.211.*:/tmp
15. ssh -p2222 uname@172.16.211.*
 
git 相关命令
1. git log  //查找相关的提交记录
2. git remote add origen路径 git路径
3. git remote -v  //可提交的 服务器列表
4. git diff  filename //文件路径
5. git commit -a -m "fix description"
6. git add filename
7. git commit -a
8. echo  test char> README.md

9. git branch //获取分支列表  
10.  git pull origin master 从服务器拉取最新代码 
11. git push origin  branchname:branchname  git push origin master
12.  git co 1.3  切换分支
 13.   git clone ( http|ssh://***********************.git )
   删除本地分支   git branch -d xxxxx
   创建本地分支   git branch test
   查看远程分支   git branch -a
   切换分支 git checkout  name...
//通过命令行创建一个新的版本库
   touch README.md
    git init
    git add README.md
    git commit -m "first commit"
    git remote add origin ssh://admin@192.168.1.30:29418/ymfront.git
    git push -u origin master

redis目录下执行:
redis-server  redis.windows.conf 
密码设置:
redis.windows.conf 下 打开
requirepass ***
linux 安装jdk8
1. 下载 jdk

  2. 解压到/usr/lib/jvm/jdk1.8.0_144

 
3. /etc/profile 最后加入 如下三行
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_144
export CLASSPATH=${JAVA_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

4. 使文件生效 source /etc/profile
5. java -version确认 
cat主要有三大功能:
1.一次显示整个文件。$ cat filename
2.从键盘创建一个文件。$ cat > filename  
   只能创建新文件,不能编辑已有文件.
3.将几个文件合并为一个文件: $cat file1 file2 > file
参数:
-n 或 --number 由 1 开始对所有输出的行数编号
-b 或 --number-nonblank 和 -n 相似,只不过对于空白行不编号
-s 或 --squeeze-blank 当遇到有连续两行以上的空白行,就代换为一行的空白行
-v 或 --show-nonprinting
例:
把 textfile1 的档案内容加上行号后输入 textfile2 这个档案里
cat -n textfile1 > textfile2

把 textfile1 和 textfile2 的档案内容加上行号(空白行不加)之后将内容附加到 textfile3 里。
cat -b textfile1 textfile2 >> textfile3
 
test.txt文件扔进垃圾箱,赋空值test.txt
cat /dev/null > /etc/test.txt 




原文地址:https://www.cnblogs.com/xifenglou/p/5601112.html