当前位置:首页 > linux > 正文内容

超强、超实用的linux命令

root10个月前 (08-01)linux312

1、常用linux命令

# 查看网络状态
netstat

# 查看ip网卡流量
iftop
 例如:iftop -i eth0 -B -F xxx.xxx.xxx.xxx/32

#图形资源监控器,类top
htop

# 默认系统资源监控器
top

# 系统监视工具,查看打开文件的进程,端口等
lsof -i

#后台启动,定向日志文件
nohup command >X.file 2 >&1 &


# 比nohup更人性化的后台执行
screen

# 实时打印文件追加内容
tail -f
 例如:tail -f 100 xxx.log

# 查找文件中的关键词,递归
grep -rn "关键词" ./

# 查找文件名,支持通配符
find -name 

# 远程复制文件,支持递归
scp

# 创建一个简单的HTTP服务,用于测试防火墙类,非常有用
python -m SimpleHTTPServer 端口号

# 访问http
curl

# http下载
wget

# 查看自己公网IP
curl http://httpbin.org/ip

# 系统查看、启挺程序
systemctl status SERVER_NAME
systemctl stop SERVER_NAME
systemctl start SERVER_NAME

# linux系统设置定时任务
crontab -e 

# 查看磁盘情况
df -h

查看目录大小
du -sh *

# 查看目录下文件占用排行
du --max-depth=1 -h

#显示系统资源限制信息
ulimit

# 释放内存
echo 3 > /proc/sys/vm/drop_caches
0是系统默认,表示不释放内存
1释放页缓存
2释放dentries和inodes
3释放所有缓存

#关闭swap空间
swapon -s    #查看swap的盘符 例如盘符是:/dev/dm-1
swapoff  /dev/dm-1

# 快捷的上传下载命令
rz  # 上传
sz  # 下载

# 系统时间更新
ntpdate edu.ntp.org.cn

# 查看相关进程的信息
ps aux |grep xxx
查看进程、端口文件打开数
lsof |grep PID
lsof -i :8080

查看进程流量
nethogs

测试端口是否开通
telnet ip port


扫描二维码推送至手机访问。

版权声明:本文由一叶知秋发布,如需转载请注明出处。

本文链接:https://zhiqiu.top/?id=240

分享给朋友:

相关文章

helm的更新部署命令

helm list -n test 查看test 空间下有那些helm安装的程序helm uninstall -n test mysql卸载mysqlhelm  -n test install mysql  ....

linux添加用户,修改用户密码,设置文件/文件夹的归属用户和用户组 、 hostname

添加用户useradd  username  修改用户密码passwd username修改文件用户和用户组chown -R username:group  /project/修改归属用户chown&...

python安装的时候出现python setup.py egg_info Check the logs for full command output

python安装的时候出现python setup.py egg_info Check the logs for full command output

解决yum install python2-develpip install --upgrade setuptools...

ssh自动添加hostkey到know_hosts

有时后端daemon或者脚本在执行ssh连接时,会遇到以下提示:The authenticity of host 'git.sws.com (10.42.1.88)' can't be establishe...

一行 Python 实现并行化 -- 日常多线程操作的新思路

一行 Python 实现并行化 -- 日常多线程操作的新思路

Python 在程序并行化方面多少有些声名狼藉。撇开技术上的问题,例如线程的实现和 GIL1,我觉得错误的教学指导才是主要问题。常见的经典 Python 多线程、多进程教程多显得偏“重”。而且往往隔靴搔痒,没有深入探讨日常工作中最有用的内容...

linux 更换apt的源

sudo sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list将archive.ubunt...