慎用rm
./ :当前目录 ----------> rm -rf ./* :删除当前目录下所有
.. :上级目录----------> cd ../ :进入上级目录
cat:显示文件内容
less + 文件名:查看文件内容
mkdir + 文件夹名:创建文件夹 [ mkdir -p /home/ap/pic -p:父路径 ]
touch xxx:创建文件(xxx.sh、xxx.txt)
pwd:显示当前所在绝对路径
mv test1.txt test2.txt:将文件名test1.txt修改为test2.txt
cd xx:打开xx文件夹
./ xxx.sh:执行脚本 sh xxx.sh:执行脚本 sh ./ xxx.sh:执行脚本
cp -rf /var/lib/mysql /data/mysqlData/ :将数据移动到 data/mysqlData
cp /etc/my.cnf /etc/my.cnf.bak :重命名
tail -f xxx.log:刷新查看最新日志
grep band file 在file文件中找寻band字符串
chmod:修改权限---------->chown -R username:username /home/ap/root [ 将root目录下所有文件改为username所有 ]
chown:修改属性---------->chmod -R 755 /home/ap/root [ 将root目录下所有文件权限改为755 ]
根据进程名kill进程:ps -ef | grep procedure_name | grep -v grep | awk '{print $2}' | xargs kill -9
编辑文件:
vim /etc/my.cnf:编辑文件
a/i:切换到编辑模式
:1,$s/old/new/g:第一行到最后一行全局替换【1,$----->$为行数,从某行到某行范围内替换】
:%s/old/new/g:全局替换
:g/^$/d:删除空行
ll命令
首行字母“-”开头:是文件
首行字母“d”开头:是目录
首行字母“l”开头:是软连接文件
压缩包
tar -xvf xxx.tar -C /home/ap/jenkins:解压文件到指定目录/home/ap/jenkins
tar -cvf jenkins.tar jenkins 将jenkins文件压缩为jenkins.tar
zip test.zip test.txt :压缩test.txt为test.zip
unzip test.zip/ test.war:解压zip包或者war包