The latest summary of commonly used Linux commands!

藏色散人
Release: 2022-10-28 20:00:46
forward
1283 people have browsed it

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
Copy after login

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
Copy after login

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
Copy after login
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
Copy after login
#服务器负载
du -sh ./*
服务器硬件资源信息
内存:free -m 
硬盘:df -h
负载:w/top
Copy after login
#解压
tar -zcvf 压缩文件名 .tar.gz 被压缩文件名
tar -zxvf 压缩文件名.tar.gz
tar     -tf  xxx.tar 解压文件
tar    -tvf xxx.tar    解压文件并展示信息
zip -r  xx.zip ./xxx 压缩 unzip xx.zip 解压
Copy after login
#修改防火墙配置文件    
vi /etc/sysconfig/iptables
#重启防火墙使配置生效
service iptables restart
Copy after login

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!

Related labels:
source:learnku.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!