Linux 工作中 常用命令

1、Xftp无法使用时

rz sz指令可以实现linux和windows之间的文件传输,但要求在windows客户端要安装Xshell或SecureCRT远程连接工具。rz指令和sz指令是一对上传与下载的指令。它们的软件包名为lrzsz。
linux安装命令如下
redHat、centos、Fedora系统 yum install lrzsz -y
ubuntu系统 dpkg -i lrzsz -y
上传命令格式:rz 回车后会弹出windows窗口,然后选择文件。默认下载到当前目录

在这里插入图片描述
当文件解析出错时,
可以采用rz -b,上传压缩包.zip,.7z
可以采用rz -e,上传jar包,war包
在这里插入图片描述

2、模糊查询删除文件

find . -name “.DS_Store” -print -delete
在这里插入图片描述

3、vim 编辑文件


[root@app01 nginx]# vim conf/
cert/                    fastcgi_params           koi-win                  nginx_202112151601.conf  .nginx.conf.swp          uwsgi_params             
fastcgi.conf             fastcgi_params.default   mime.types               nginx.conf               scgi_params              uwsgi_params.default     
fastcgi.conf.default     koi-utf                  mime.types.default       nginx.conf.default       scgi_params.default      win-utf                  
[root@app01 nginx]# vim conf/nginx.conf

4、ll 查看该路径下的目录

[root@app01 nginx]# ll
总用量 36
drwx------  2 nobody root 4096 6月  24 11:44 client_body_temp
drwxr-xr-x  3 root   root 4096 6月  27 17:48 conf
drwx------  2 nobody root 4096 8月   4 2021 fastcgi_temp
drwxr-xr-x  2 root   root 4096 8月   3 2021 html
drwxr-xr-x  2 root   root 4096 5月  25 14:07 logs
drwx------ 12 nobody root 4096 8月   4 2021 proxy_temp
drwxr-xr-x  2 root   root 4096 8月   3 2021 sbin
drwx------  2 nobody root 4096 8月   4 2021 scgi_temp
drwx------  2 nobody root 4096 8月   4 2021 uwsgi_temp

5、cd …/切换到项目根目录

在这里插入图片描述

6、删除文件

rm 文件名(功能:删除文件);

rm * (功能:删除该路径下的所有文件);

rm -f 文件名 (功能:删除文件,不再询问是否删除);

7、tomcat中启动、停止服务

进入项目根目录

front-end-autoconfig为服务名

bin/front-end-autoconfig start

bin/front-end-autoconfig stop

8、查看项目日志

进入项目lib文件夹后

cd …/conf/

cd …/logs/

tail -200f front-end-autoconfig-localhost.log

[root@app2 lib]# cd ../conf/
您在 /var/spool/mail/root 中有邮件
[root@app2 conf]# ll
总用量 20
-rw-r--r--  1 root root 9675 4月  25 2021 application.properties
-rw-r--r--. 1 root root 4244 10月 31 2019 application.properties20200707
[root@app2 conf]# cd ../conf
[root@app2 conf]# ll
总用量 20
-rw-r--r--  1 root root 9675 4月  25 2021 application.properties
-rw-r--r--. 1 root root 4244 10月 31 2019 application.properties20200707
[root@app2 conf]# cd ../logs/
[root@app2 logs]# ll
总用量 83848
-rw-r--r--  1 root root  5205818 7月  11 14:22 front-end-autoconfig-localhost.log
-rw-r--r--  1 root root 10511434 7月  11 13:20 front-end-autoconfig-localhost.log.1
-rw-r--r--  1 root root 10541043 7月  11 11:55 front-end-autoconfig-localhost.log.2
-rw-r--r--  1 root root 10495368 7月  10 22:43 front-end-autoconfig-localhost.log.3
-rw-r--r--  1 root root 10487576 7月  10 14:40 front-end-autoconfig-localhost.log.4
-rw-r--r--  1 root root 10495227 7月  10 06:56 front-end-autoconfig-localhost.log.5
-rw-r--r--  1 root root 10490410 7月   9 16:59 front-end-autoconfig-localhost.log.6
-rw-r--r--  1 root root 10487995 7月   9 09:33 front-end-autoconfig-localhost.log.7
-rw-r--r--. 1 root root  7023444 10月 15 2019 front-end-autoconfig-primo.log
[root@app2 logs]# tail -200f front-end-autoconfig-localhost.log

9、部署项目时,先将原jar包做好备份

使用mv 修改原jar包的名称
在这里插入图片描述

10、服务器时间

查看服务器时间 data
Internet时间同步

11、sz文件下载

sz 文件名
在这里插入图片描述

12、unzip 解压zip压缩包至当前目录

在这里插入图片描述

13、查看程序所有进程和端口号

ps -ef | grep 程序名称
在这里插入图片描述

13、杀死进程

kill -9 PID
在这里插入图片描述

14、查看某用户的所有进程

top -u [用户名]

15、查看进程所属用户

ps u PID

16、根据进程号查询正在运行的程序的port(端口号)

netstat -anop | grep pid

17、根据PID查询进程名称

ll /proc/PID
这样就可以定位到该运行程序的路径
🐖 注意PID替换成自己查询到的PID代号

18、SCP传输文件到其他服务器

scp 文件名 root@服务器IP地址:/目录
执行命令后,输入对应IP的root权限密码
在这里插入图片描述

19、SSH进入其他服务器

SSH root@服务器IP地址
执行命令后,输入对应IP的root权限密码

20、查看所有占用端口

netstat -tunl
在这里插入图片描述

21、查看磁盘空间使用情况

df -h
在这里插入图片描述

22、查看磁盘空间使用情况

sudo -i 切换root账号权限
su hldev 切换到指定账号权限
在这里插入图片描述

  • 5
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

柚几哥哥

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值