Home  >  Article  >  Operation and Maintenance  >  The latest summary of commonly used Linux commands!

The latest summary of commonly used Linux commands!

藏色散人
藏色散人forward
2022-10-28 17:10:021300browse

This article summarizes and introduces the common commands of Linux. Friends in need can collect them~

Common Linux commands

#链接远程服务器
ssh root@47.xxx.xxx.46

#从服务器上下载文件到本地
scp root@47.xxx.xxx.46:/www/wwwroot/xxxx.zip /Users/xxxx/work/

#上传

scp xxx.log root@192.168.0.1:/tmp/ 


#启动服务
php artisan serve --port=80

docker Common commands

#删除所有的镜像
docker rmi -f $(docker images -aq)
#删除所有的容器
docker rm -f $(docker ps -aq)

#拉取镜像
docker pull 2233466866/lnmp
#启动容器
docker run -dit \
-p 80:80 \
-p 443:443 \
-p 3306:3306 \
-p 9000:9000 \
-v /Users/missapp/work/project/docker/www:/www \
-v /Users/missapp/work/project/docker/mysql:/data/mysql \
--privileged=true \
--name=lnmp \
2233466866/lnmp
#查看容器
docker images
# 进入容器,容器名称与上一步保持一致
docker exec -it lnmp /bin/bash

Linux Common Commands

#tail 从文件尾部开始读
tail -f test.php 
#从文件头部读
head 
#读取整个文件
cat     
#分页读
more 
#可控分页
less     
#搜索关键字
grep  
grep "111"  test.php         
grep  -n  "111"  test.php  
grep  -n  "111"  test.php |wc -l             
ps -ef |grep ssh
netstat -anpl |grep 'http'
netstat -apn|grep 8077
#查找文件
find      
#统计个数
wc
lsof -i:80

php -i |grep ini

netstat -lptn
ss -ntlp

#查看占用端口
netstat -tunlp

#查看ip
ifconfig
ip addr

#绝对定位找到你的php.ini
php -i|grep php.ini


history 查看运行的命令记录
ping xxx.com
telnet 192.168.0.1 80

#重启服务
systemctl restart nginx
systemctl restart php-fpm.service

#更改目录权限
chmod -R 777 ./xxxx
#更改所属组
chown -R www:www ./xxx
#服务器负载
du -sh ./*
服务器硬件资源信息
内存:free -m 
硬盘:df -h
负载:w/top
#解压
tar -zcvf 压缩文件名 .tar.gz 被压缩文件名
tar -zxvf 压缩文件名.tar.gz
tar     -tf  xxx.tar 解压文件
tar    -tvf xxx.tar    解压文件并展示信息
zip -r  xx.zip ./xxx 压缩 unzip xx.zip 解压
#修改防火墙配置文件    
vi /etc/sysconfig/iptables
#重启防火墙使配置生效
service iptables restart

Recommended learning: "Linux Video Tutorial"

The above is the detailed content of The latest summary of commonly used Linux commands!. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:learnku.com. If there is any infringement, please contact admin@php.cn delete