1.端口号、进程相关
netstat -tunlp 查看已经启动的服务
netstat -nultp 查看当前环境下已经使用了的端口信息
netstat -tunlp | grep mysql 查看mysql的服务信息
ps -ef | grep tomcat 显示系统中的进程信息并且含有tomcat字样
kill -9 pid 彻底杀死线程
netstat -anp | grep 80 查看80端口号是否被占用
2. 服务相关:
systemctl status mysqld 查看mysql服务状态
systemctl start mysqld 启动mysql服务
systemctl stop mysqld 停止mysql服务
service mysql stop 关闭服务
service mysql start 启动服务
3. 解压相关
tar -zxvf hello.tar.gz -C /usr/local 将hello.tar.gz文件进行解压,并将解压后的文件放在/usr/local目录
tar -zcvf hello.tar.gz hello 将hello文件夹打包并压缩,打包后的文件名hello.tar.gz
4.防火墙相关
systemctl stop firewalld 暂时关闭防火墙
systemctl disable firewalld 永久关闭防火墙(禁用开机自启)
systemctl start firewalld 暂时开启防火墙
systemctl enable firewalld 永久开启防火墙(启用开机自启)
firewall-cmd --zone=public --add-port=8080/tcp --permanent开放指定端口
firewall-cmd --zone=public --remove-port=8080/tcp --permanent关闭指定端口
firewall-cmd --reload 立即生效(重新加载)
firewall-cmd --zone=public --list-ports 查看开放端口
5.刷新相关
source /etc/profile 刷新配置文件
6. 卸载相关
rpm -qa 查询当前系统中安装的所有软件
rpm -qa | grep mysql 查询当前系统中安装的名称带mysql的软件
rpm -qa | grep mariadb 查询当前系统中安装的名称带mariadb的软件
软件卸载:
rpm -e --nodeps 软件名称
7. nginx相关
nginx 启动nginx
nginx -v 查看nginx版本
nginx -t 检测配置文件的
nginx -s stop 停止
nginx -s reload 重启
8.GIT 远程仓库相关
git clone (网址) 从远程仓库克隆项目,网址为仓库的ip地址
如果你上传的不是一个新建的仓库,就会报以下冲突!!!(push rejected)
依次输出如下命令:git pull
git pull origin master
git pull origin master --allow-unrelated-histories
9.拷贝移动命令
cp hello.txt itcast/ 将hello.txt复制到itcast目录中
cp hello.txt ./hi.txt 将hello.txt复制到当前目录,并改名为hi.txt
cp -r itcast/ ./itheima/ 将itcast目录和目录下所有文件复制到itheima目录下
cp -r itcast/* ./itheima/ 将itcast目录下所有文件复制到itheima目录下
mv hello.txt hi.txt 将hello.txt改名为hi.txt
mv hi.txt itheima/ 将文件hi.txt移动到itheima目录中
mv hi.txt itheima/hello.txt 将hi.txt移动到itheima目录中,并改名为hello.txt
mv itcast/ itheima/ 如果itheima目录不存在,将itcast目录改名为itheima
mv itcast/ itheima/ 如果itheima目录存在,将itcast目录移动到itheima目录中
10.vim相关
命令模式: gg | 定位到文本内容的第一行
G | 定位到文本内容的最后一行
底行模式: :wq 保存并退出
:q! 不保存退出
:set nu 显示行号
:set nonu 取消行号显示
:n 定位到第n行, 如 :10 就是定位到第10行