export $PATH
echo $PATH
export PATH="/opt/ibm/db2/V11.5/bin:$PATH"
ssh 不用密码
ssh-keygen -t rsa
一路回车
scp -P 22 C:\Users\ljj/.ssh/id_rsa.pub root@crimson.chat:/root/.ssh/authorized_keys
•
/etc/resolve.conf 是设置DNS服务器的IP地址及DNS域名,还包含了主机的域名搜索顺序。
CentOS 是一个Linux的发行版本,是目前企业中用来做应用服务器系统的主要版本
命令
•
expand 把空白字符换成一个空格
cd -
ll
ls -a
find /root -name ‘test*’
mv 目录名称 新目录名称
cp -r from to
rm -rf ... -f 参数表示不用确认
touch
cat more less tail
pwd
|
>
2>
>>
chmod
\cp -fv -T directory directory 目录覆盖 f覆盖 v显示过程 T目录当成文件 \是取消cp的别名,因为别名自动加 -i参数会导致 个个确认
rsync -r --delete dir1 dir2 文件夹同步
•
所有 war包 解压
ll |grep war|awk '{print $9}' |xargs -I $ basename $ '.war'|xargs -I $ unzip $.war -d $
•
添加 环境变量
export PATH=/usr/local/mongodb/bin:$PATH
•
实时看 日志
tail -f /home/tomcat8080-/logs/catalina.out
•
端口 占用
netstat -natp
•
查找 编辑 文件
find -name jdbc.p*|head -6|tail -1|xargs vim
stty sane
进程
(1)查看进程
命令:ps -ef
示例:查看当前系统中运行的进程
(1)查看进程可占用率
命令:ps -aux
示例:查看当前系统中运行的进程
(2)杀死进程
命令:kill -9 进程的pid
网络
ipconfig (win同)
防火墙
•
需配置redis端口6379在linux防火墙中开发
/sbin/iptables -I INPUT -p tcp --dport 6379 -j ACCEPT
/etc/rc.d/init.d/iptables save
远程连接工具
SSH Secure 命令行
fileZilla 可以拖拽文件
Xshell
putty
以root的身份执行上一条命令
sudo !!
指令历史
history
输出最常用的十条指令
history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10
去重输出历史命令
history|grep -v ll|grep -v ls|grep -v cd.*|grep -v pwd|grep -v tree.*|awk '{for(i=2;i<NF;++i)printf$i" ";printf"\n"}'|grep -v ^$|sort|uniq|nl
history|grep -v ll|grep -v ls|grep -v cd.*|grep -v history.*|grep -v pwd|grep -v tree.*|awk '{for(i=2;i<NF;++i)printf$i" ";printf"\n"}'|grep -v ^$|sort|uniq|nl
在vim模式下查看文件不同
vimdiff file1 file2
评论区