1.目录操作命令
- ll -a
- ls -a
- mv /usr/local/newTest / (移动)
- mv /usr/local/newTest /usr/local/oldTest (改名)
- cp -r /usr/local/newTest /
- rm -r /usr/local/newTest
- mkdir /usr/local/newTest
- find /usr/local/tomcat -name ‘l*’
2.文件的操作命令
- 文件 .txt(增删改查)
- touch /usr/local/a.txt
- cat /usr/local/a.txt (cat最后一屏内容)
- more /usr/local/a.txt (显示百分比,回车下一行,空格下一页)
- less /usr/local/a.txt (键盘上下键,向上向下翻页)
- tail -10 /usr/local/a.txt (文件后十行,ctrl+c结束)
- tail -f catalina.2019-09-22.log (对文件进行动态监控,ctrl+c退出)
- vim /usr/local/a.txt (修改)
- rm -rf a.txt (删除文件)
3.压缩文件操作命令
- .tar.gz(打包.tar,压缩.gz)
- tar -zcvf /usr/local/test/* (打包并压缩test下所有文件到本文件夹中)
- tar -xvf xxx.tar.gz -C /usr/local (C代表指定解压的位置)
4.其它命令
- pwd 显示当前位置
- grep a /usr/local/a.txt (搜索/usr/local/a.txt里a高亮显示)
- 管道命令(|)
- ps -ef | grep system 查看当前系统中所有进程中包括system字符串的进程
- 查看当前系统中运行的进程(ps -ef)
- 杀死进程(kill -9) 进程的pid
- ifconfig(显示当前系统的网卡信息)
- ping(查看与某台机器的连接情况)
- netstat -an (查看当前系统的端口使用)
5.Linux权限命令
-
d:代表目录
-
-:代表文件
-
|:代表链接
-
r:代表权限是可读,也可以用4表示
-
w:代表权限是可写,2
-
x:代表权限是可执行,1
-
属主(user) | 属组(group) | 其他用户
r w x | r w x | r w x
4 2 1 | 4 2 1 | 4 2 1 -
修改文件/目录的权限的命令:chmod
-
chmod u=rwx,g=rw,o=r aaa.txt 或 chmod 764 aaa.txt
6.Linux软件安装
-
rpm与软件相关的命令 相当于window下的软件助手管理软件
-
rpm -qa | grep java 查看当前Linux系统是否安装java
-
rpm -e --nodeps 要卸载的软件 卸载软件
-
启动mysql:service mysql start
-
将mysql加到系统服务器:chkconfig --add mysql
-
自动启动:chkconfig mysql on
-
修改mysql的密码:set password=password(‘root’);
-
开启mysql的远程登录:grant all privileges on . to ‘root’ @’%’ identified by ‘root’;
flush privileges;