🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
1. basic linux command ls -> list ls / pwd: check current folder su: switch user about the command line: for root user: it starts with # for ordinary user: it starts with $ ifconfig: check ip address make sure you set network as bridge, so that your linux server can work as a indepenent server, and it can connect to other servers. 在centos最小化安装的情况下,没有ifconfig命令,需要yum install net-tools (ubuntu: sudo apt install net-tools) cd absolute path: cd / -> go to root folder cd /home cd .. -> go to parent folder cd ~ -> go to current user working folder relative path: bin/xx ../bin/xx mkdir/rmdir -> make a directory/remove a directory touch -> create a file cp -> copy file cp test/sample.cnf test2 cp -r test/subtest test2 to copy directory, add -r option mv 1. rename a file: mv sample.cnf sample2.cnf 2. move the file to diffirent location: mv sample2.cnf /home rm 1. remove a file: rm xxx 2. remove a directory: rm -r xxx 3. remove without asking -f rm -f xxx rm -rf xxx cat 1. cat xx.cnf 2. cat test1.cnf test2.cnf > test3.cnf tar in linux, package is different with zip to package all the files in /home into a tar file(new.tar) ``` tar -cf new.tar /home ``` to unpackage the tar file ``` tar -xf new.tar ``` zip/unzip two types of zip format,gz and biz2 ``` zip: tar -cvzf soft.tar.gz /home/hxy upzip: tar -xvzf abc.tar.gz tar -xvzf abc.tar.gz -C /home zip: tar -cvjf soft.tar.biz2 /home/hxy unzip: tar -xvjf abc.tar.biz2 tar -xvjf abc.tar.biz2 -C /home ``` ps/kill to check process ps -aux to kill process kill pid kill -9 pid (-9 stands for to kill by force) 查找端口占用的pid, 根据pid杀死进程。 netstat -lnp|grep 8080 ![](https://box.kancloud.cn/583a7a8e934a66b18ca615cd966ca5c4_698x48.png) 显示结果: 最后的一栏是 PID/Program Name