This article mainly introduces the common commands of Linux and how to use them. In daily operations, I believe many people have doubts about the common commands of Linux and how to use them. The easy-to-use method of operation, I hope it will help you to answer your doubts about the commonly used commands in Linux and how to use them! Next, please follow the editor to learn together!
Linux common commands
#Link remote server
ssh [email protected]
#Download the file from the server to the local
scp [email protected]:/www/wwwroot/xxxx.zip /Users/xxxx/work/
#upload
scp xxx.log [email protected]:/tmp/
#start service
php artisan serve --port=80
docker common commands
#Delete all images
docker rmi -f $(docker images -aq)
#delete all containers
docker rm -f $(docker ps -aq)
#Pull image
docker pull 2233466866/lnmp
# start the container
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
#View container
docker images
# Enter the container, the container name is consistent with the previous step
docker exec -it lnmp /bin/bash
Linux common commands
#tail read from the end of the file
tail -f test.php
# read from the beginning of the file
head
# read the entire file
cat
#page read
more
#Controllable pagination
less
#search for the keyword
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 files
find
#Statistics
wc
lsof -i:80
php -i |grep ini
netstat -lptn
ss -ntlp
#View occupied ports
netstat -tunlp
#View ip
ifconfig
ip addr
# Absolute positioning to find your php.ini
php -i | grep php.ini
history View running command records
ping xxx.com
telnet 192.168.0.1 80
# restart service
systemctl restart nginx
systemctl restart php-fpm.service
#Change directory permissions
chmod -R 777 ./xxxx
# change the group
chown -R www:www ./xxx
#Server load du -sh ./* Server hardware resource information Memory: free -m Hard disk: df -h Load: w/top
#Decompression
tar -zcvf compressed file name .tar.gz compressed file name
tar -zxvf compressed file name.tar.gz
tar -tf xxx.tar unzip the file
tar -tvf xxx.tar unzip the file and display information
zip -r xx.zip ./xxx compression unzip xx.zip decompression
#Modify firewall configuration file
vi /etc/sysconfig/iptables
#Restart the firewall to make the configuration take effect
service iptables restart
Copyright Description:No reproduction without permission。
Knowledge sharing community for developers。
Let more developers benefit from it。
Help developers share knowledge through the Internet。
Follow us