Linux工作常用命令
   点滴记录   3 评论   1781 浏览

Linux工作常用命令

   点滴记录   3 评论   1781 浏览

查看端口占用

Win
netstat -aon|findstr "80"
tasklist|findstr "80"
Linux
lsof -i:80
netstat -nlp|grep :80

后台运行(重启无效)

nohup java -jar -Xmx200m JavaRun.jar &

监控TCP/IP网络

netstat -tunlp

无条件终止进程

Win
taskkill /f /pid 1234
Linux
kill -9 pid

查看文件最后50行

cat nohup.out | tail -n 50

centos7怎么永久关闭防火墙

systemctl status firewalld
systemctl stop firewalld
systemctl disable firewalld

Linux生成pem免密

ssh-keygen -t rsa -b 2048 -v
#回车到结束
 
ls ~/.ssh/
mv ~/.ssh/id_rsa ~/.ssh/id_rsa.pem
chmod 700 ~/.ssh/
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
nano /etc/ssh/sshd_config
 
=====================
AuthorizedKeysFile .ssh/authorized_keys
#添加下面这两行
RSAAuthentication yes
PubkeyAuthentication yes
========================== 

service sshd restart

下载到本地/root/.ssh/id_rsa.pem
sz /root/.ssh/id_rsa.pem

CentOS安装JDK

JDK华为镜像下载
https://repo.huaweicloud.com/java/jdk
https://repo.huaweicloud.com/java/jdk/8u201-b09/jdk-8u201-linux-x64.tar.gz
=========================

mkdir /usr/local/java/
tar -zxvf jdk-8u201-linux-x64.tar.gz -C /usr/local/java/
nano /etc/profile
末尾添加

export JAVA_HOME=/usr/local/java/jdk1.8.0_201
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

source /etc/profile
应用

添加软链接
ln -s /usr/local/java/jdk1.8.0_201/bin/java /usr/bin/java

java -version

本文由 RawChen 发表, 最后编辑时间为:2023-01-30 21:45
如果你觉得我的文章不错,不妨鼓励我继续写作。

发表评论
选择表情
  1. 谷歌yo

    文章不错,支持一下

       Windows 10   Chrome 86
  2. 祝你平安,仅测试用

       Windows 10   Chrome 101
  3. 之前记录过,不过用了宝塔就不用那么麻烦了。

       Windows 10   Chrome 106
Top