基本命令
ls [目录名] 查看当前目录下的内容
pwd 查看当前所在目录
cd [目录名] 切换目录
touch [文件名] 如果文件不存在,创建目录
mkdir [目录名] 创建目录
rm [文件名] 删除指定文件
技巧
1). Tab键自动补全
2). 连续两次Tab键,给出操作提示
3). 使用上下箭头快速调出曾经使用过的命令
4). 使用clear命令或者Ctrl+l快捷键实现清屏
常用命令
(文件夹)
ll 查看当前目录文件及目录的详情
cd ./aaa 进入当前目录的下一级目录aaa
cd /root 进入根目录下的root目录
cd .. 退一级目录
(cd支持混合使用)
(文件)
cat 文件名 全部展示
more 文件名 分页展示
tail 文件名 查看尾部(可以用于查看实时更新的日志文件)
cp 复制
cp (文件或文件名)到(文件)中
mv 移动
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目录中
tar 压缩
打包 tar -cvf hello.tar ./包名
解包 tar -xvf hello.tar
压缩并打包 tar -zcvf hello.tar.gz ./包名
解压缩 tar -zxvf hello.tar.gz
vim 文件名 打开文件
find . -name "*.java" 查找当前目录及子目录以.java结尾的文件
grep 搜索内容
grep hello HelloWord.java 查找文件中hello
sh 是Linux自带的运行脚本文件的指令
(sh startup.sh或./start.up)
ps -ef 查看所有正在运行的进程
kill -9 强制杀死所有进程
| 管道命令,作用是连接两个Linux明令,把前一个命令输出的结果作为后一个命令的输入
systemctl 服务命令
systemctl start xxxx # 启动
systemctl restart xxxx # 重启
systemctl stop xxxx # 停止
systemctl status xxxx # 查看状态
systemctl disable xxx #禁止开机启动
systemctl enable xxx #开机启动
防火墙
systemctl start firewalld # 启动
systemctl restart firewalld # 重启
systemctl stop firewalld # 停止
systemctl status firewalld # 查看状态
systemctl disable firewalld #禁止开机启动
systemctl enable firewalld #开机启动



