linux基础

cd.. 返回上级目录

cd/ 返回根目录

cd d: 进入d盘

cd test 进入当前目录的test文件夹

./shutdown.sh 使用Tomcat关闭命令

ps -ef|grep java 查看Tomcat是否已关闭

进入到tomcat的bin目录下,再执行./version.sh 查看版本

cd /opt/tomcat/bin 进去bin目录

cd ../ 返回上一级

cd / 返回根目录

ls 列出文件

ll 列出文件

ll -a 列出隐藏文件

ll -rts 按时间排列列出文件,最新的在最下面

sz catalina.log 下载文件到本地

rz catalina.log 上传文件到服务器

mv a b a重命名为b

mkdir lib 创建lib目录

[root@mysql ~]# ifconfig -a             // 查看所有网卡的信息(包括down状态的网卡
[root@mysql ~]# ifconfig 0          // 查看指定网卡的信息
[root@mysql ~]# ifconfig eth0 up        // 启用指定的网卡,等同于:ifup eth0
[root@mysql ~]# ifconfig eth0 down      // 关闭指定的网卡,等同于:ifdown eth0
vi /etc/sysconfig/network-scripts/ifcfg-eth0            配置IP
ethtool -p eth0                             使网卡port上的led不断的闪

chmod +x cleaninstall.sh 开放脚本权限

chown root.root nginx.conf nginx.conf的文件所有者:root,组所有者:root

chmod -R 777 /opt/dahuaHA/ 赋777权限

file命令 查看文件类型

cat 由第一行开始显示文件内容

tail -f 用于显示指定文件末尾内容

tail -n 1000 evo-isms.log 用于显示指定文件末尾1000行内容

tail -f /log/evo-runs/evo-runs.log | grep GlobalListener

touch [file name] 创建空文件

kill -9 进程号 关闭进程

vi 进入vi编辑器 shift+g 跳到文件最下方

/ download.giz 在vim界面搜索 n键下一个

ctrl+u 顶部

ctrl+d 底部

: q! (不保存退出)

:wq!(保存退出)

top 类似于Windows的任务管理器

netstat -anotulp |grep 9000 |grep -v 127.0.0.1 查看有哪些是客户端的IP

netstat -anotulp |grep 3306 查看端口 3306使用情况

netstat -anp|grep 117952 查看进程117952 相关的所有端口

lsof -i:8080 查看8080端口是否占用

pidof evo-eims 查看进程号

tar -zcvf test.tar.gz *.tx *.tx文件打包并压缩为 test.tar.gz

tar -zcvf test.tar conf conf文件夹打包并压缩为 test.tar

tar -zxvf test.tar.gz 将 test.tar.gz 解压到当前目录

tar -zxvf test.tar.gz -C /home 将 test.tar.gz 解压到指定目录

unzip LicTool.zip 解压zip包到当前目录

unzip -d /temp test.zip 解压zip包到指定目录

unzip CardSolution.war -d CardSolution 解压war包到指定文件夹

rm -rf ... 删除

killall -9 nginx 重启nginx时,需先杀死nginx进程

  • ln -snf /opt/a.txt /opt/b.txt

目标文件/opt/b.txt 连接到了 源文件/opt/a.txt

  • 删除软连接

    保险方式unlink /opt/a_ln.txt

tcpdump -i any -s0 -w all.pcap

tcpdump -i any port 9400 -s0 -w PES.pcap 对特定端口抓包

tcpdump -i any -s0 -w zhuatu_shebei2.pcap host 10.35.105.241 and port 37776 对设备抓包

-i any  监听所有的网络接口
-s0     表示包不截断,抓完整的数据包  
-w   直接将包写入文件中,并不分析和打印出来

iptables -A INPUT -p tcp --dport 8000 -j ACCEPT 打开端口号

iptables -A INPUT -p tcp --dport 8000 -j DROP 关闭端口号

service iptables save 保存端口设置

/sbin/iptables -L -n

iptables -nvL 查看所有防火墙

wireshark
ip.src == 192.168.0.1
ip.dst == 192.168.0.1
http.request.uri contains ""

cp -r eims eims_bak 递归复制

cp -r /mnt/dss/index ./ 递归复制到当前目录

pam_tally2 --reset 后面账号锁定了,找其他正常登录的,执行下以上

grep -rn 'abc*' 根据文件内容查找

find / -name 'abc*' 根据文件名查找

env | grep LD_LIBRARY_PATH 或者echo "$LD_LIBRARY_PATH" =》动态库查找路径

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib 添加动态库查找路径

ldd -r xxx.so 命令查看so动态链接状态和错误信息

echo '/lib' >ld_lib_path-x86_64.conf
ldconfig

df -h 查看服务器磁盘空间使用情况

free -h 查看服务器内存使用情况

top

top -bn1 | grep evo-eims | awk '{print $6}' 查看服务占用内存情况

jps -l 查看java相关的pid及程序所在包名

jmap -histo 94282|head -n20 分析相关进程的堆内存

iotop

iostat -x 1 10 查看io情况,看util

lscpu

注意编写的sh脚本里面不要有CR换行符

tree ** -N 树型展示目录

date -s 06/29/22 设置日期
date -s 16:25:00 设置时间

admin切换root用户:su - root

!ps 最近的一个ps

arping -c 1 -w 1 -I eth0 10.56.23.153 检测ip占用冲突(需要在非本身ip服务器上执行)

mysql -h127.0.0.1 -umysql -pO7luOjDM

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容