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
- 第一章 Linux
- 1. Linux安装和网络配置
- 2. Linux基本命令
- 3. Xshell和winscp
- 4. VIM编辑器
- 5. 安装软件
- 5.1 安装JDK
- 5.2 安装TOMCAT
- 5.3 安装MySql
- 5.4 安装Nginx
- 5.5 部署工程
- 第二章 Nginx
- 1. 安装Nginx
- 2. 配置Nginx
- 2.1 配置静态服务器
- 2.2 配置反向代理
- 2.3 配置负载均衡
- 2.4 配置动静分离
- 2.5 跨域访问
- 第三章 Redis
- 1. 安装Redis
- 2. JAVA操作Redis
- 3. Redis事务
- 4. Redis持久化
- 5. 主从复制和集群
- 6. Redis实现Session共享
- 第四章 MySQL主从复制
- 4.1 MyCat安装
- 4.2 MySQL主从复制
- 4.3MySQL读写分离
- 第五章 ActiveMQ
- 5.1 Queue
- 5.2 Topic
- 第六章 FastDFS图片服务器
- 第七章