版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_30531261/article/details/80964537
linux下的操作
记录一点linux下的小知识点
1查看内网ip
ifconfig
输出结果:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.1.1.121 netmask 255.255.255.0 broadcast 10.1.1.255
ether 00:16:3e:32:9c:3d txqueuelen 1000 (Ethernet)
RX packets 5093684047 bytes 1335281608408 (1.2 TiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4279646034 bytes 2493190966473 (2.2 TiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1 (Local Loopback)
RX packets 1131113280 bytes 79753900575 (74.2 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1131113280 bytes 79753900575 (74.2 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
其中,inet
后面的ip就是内网ip。
2测试tomcat的端口号
想知道怎么访问项目的路径,就要知道ip的tomcat的端口号,用ps -ef | grep tomcat
查看进程号,进而用netstat
指令去查看tomcat端口号,可是这招我还是不会,发现有三个端口对应tomcat,没搞懂。
最后是通过访问url的方式,但是该服务器是内网服务器,该怎么办???其实可以像在windows上使用浏览器访问localhost:8080一样。在linux上可以使用curl
指令去访问你的项目,像这样:curl http://127.0.0.1:8080/projectName/
,如果能返回index.jsp
的代码,就说明tomcat监听的是8080端口。我知道虽然这样做很傻,可也是一个办法。
另外,如果带参数,要这样写:curl -d "a=b&c=d" http://127.0.0.1/projectName/index.php?/xxxxxx/function