进入这个目录里/usr/local/mysql/bin执行导出sql命令mysqldump -u root -p mydataname > file.sqlroot是用户名mydataname是数据库名
回车-->输入密码-->在这个目录下就有file.sql数据库文件了
/usr/local/mysql/var一般数据库文件在这里
清病毒
chmod +x clean_block_nobak.sh
./clean_block_nobak.sh
找到indexback.php 并删除
find . -type f -name "indexback.php" -exec rm -f {} \;
使用 find 命令结合 grep 来确保只列出符合条件的文件及其修改时间"汉字是双引号-代码是单引号"
grep -rl '<script src="https://51la.icu/min.js"></script>' --include=\*.{php,js,css} . | while read file; do ls -lh --time-style=long-iso "$file"; done
在当前目录及其所有子目录中查找包含特定字符串(如“你的英雄”)的所有 .php .js .css文件,可以使用 grep 命令结合递归选项,不仅想查看文件名,还想查看每个文件中包含“你的英雄”的具体行
grep -rl "你的英雄" --include=\*.{php,js,css} . | while read file; do ls -lh --time-style=long-iso "$file"; done
查找25.2.10号当天修改的 .php 文件并排除任何名为 runtime 的目录中的文件,你可以使用 find 命令结合 -path 和 -prune 选项来实现。
find . -type d -name 'runtime' -prune -o -type f -name "*.php" -newermt "2025-02-1" ! -newermt "2025-02-15" -exec ls -l --time-style=long-iso {} +
查看今天并罗列
查找今天修改的 .php 文件并排除任何名为 runtime 的目录中的文件,你可以使用 find 命令结合 -path 和 -prune 选项来实现。
26.1.7~新版本-昨天0点到现在为止的
find . -path "*/runtime" -prune -o -type f \( -name "*.php" -o -name "*.cer" -o -name "*.ashx" -o -name "*.jsp" -o -name "*.ini" -o -name "*.txt" -o -name "*.bat" -o -name "*.js" -o -name "*.asp" -o -name "*.html" -o -name "*.htm" \) \( -newermt "yesterday 00:00" -o -newerct "yesterday 00:00" \) -printf "%TY-%Tm-%Td %TH:%TM \t %p\n" | sort上周天中午现在
find . -path "*/runtime" -prune -o -type f \( -name "*.php" -o -name "*.cer" -o -name "*.ashx" -o -name "*.jsp" -o -name "*.ini" -o -name "*.txt" -o -name "*.bat" -o -name "*.js" -o -name "*.asp" -o -name "*.html" -o -name "*.htm" \) \( -newermt "last sunday 12:00" -o -newerct "last sunday 12:00" \) -printf "%TY-%Tm-%Td %TH:%TM \t %p\n" | sort从昨天19到现在
find . -path "*/runtime" -prune -o -type f \( -name "*.php" -o -name "*.jsp" -o -name "*.ini" -o -name "*.txt" -o -name "*.bat" -o -name "*.js" -o -name "*.asp" -o -name "*.html" -o -name "*.htm" \) \( -newermt "$(date -d "yesterday 19:00" +'%Y-%m-%d %H:%M:%S')" \) -printf "%TY-%Tm-%Td %TH:%TM \t %p\n" | sort
新版本-昨天0点到现在为止的(所有格式文件)
find . -path "*/runtime" -prune -o -type f \( -newermt "yesterday 00:00" -o -newerct "yesterday 00:00" \) -print
最近两天
find . -path "*/runtime" -prune -o -type f -name "*.php" \( -mtime -2 -o -ctime -2 \) -exec ls -lh --time-style=long-iso {} +新版本-今天到现在为止的
find . -type d -name 'runtime' -prune -o -type f -regex '.*\.php$' \( -newermt "$(date +%Y-%m-%d)" -o -newerct "$(date +%Y-%m-%d)" \) ! -newermt "$(date +%Y-%m-%d -d tomorrow)" -exec ls -l --time-style=long-iso {} +
旧版本
find . -type d -name 'runtime' -prune -o -type f -regex '.*\.php$' -newermt $(date +%Y-%m-%d) ! -newermt $(date +%Y-%m-%d -d tomorrow) -exec ls -l --time-style=long-iso {} +
昨天的罗列
查找昨天修改的 .php 文件并排除任何名为 runtime 的目录中的文件,你可以使用 find 命令结合 -path 和 -prune 选项来实现
新版本-前天一整天的
find . -type d -name 'runtime' -prune -o -type f -regex '.*\.php$' \( -newermt "$(date -d '2 days ago' +%Y-%m-%d)" -o -newerct "$(date -d '2 days ago' +%Y-%m-%d)" \) ! -newermt "$(date -d yesterday +%Y-%m-%d)" -exec ls -l --time-style=long-iso {} +
新版本-昨天一整天的
find . -type d -name 'runtime' -prune -o -type f -regex '.*\.php$' \( -newermt "$(date -d yesterday +%Y-%m-%d)" -o -newerct "$(date -d yesterday +%Y-%m-%d)" \) ! -newermt "$(date +%Y-%m-%d)" -exec ls -l --time-style=long-iso {} +
旧版本的
find . -type d -name 'runtime' -prune -o -type f -regex '.*\.php$' -newermt $(date +%Y-%m-%d -d yesterday) ! -newermt $(date +%Y-%m-%d) -exec ls -l --time-style=long-iso {} +
查看所有并替换
使用命令行 centos系统中 把所有的php/js/css文件里的<script src="https://51la.icu/min.js"></script>替换为空
find . -type f \( -name "*.php" -o -name "*.js" -o -name "*.css" \) -exec sed -i 's|<script src="https://51la.icu/min.js"></script>||g' {} +
替换php里的代码
使用命令行 centos系统中 把所有的php文件里的<script src="https://51la.icu/min.js"></script>替换为空
find . -type f -name "*.php" -exec sed -i 's|<script src="https://51la.icu/min.js"></script>||g' {} +
使用命令行 centos系统中 把所有的php/js/css文件里的<script src="https://51la.icu/min.js"></script>替换为空
for ext in php js css; do
find . -type f -name "*.${ext}" -exec sed -i 's|<script src="https://51la.icu/min.js"></script>||g' {} +
done
使用命令行 centos系统中 把所有的php文件里的aaa替换为bbb
find . -type f -name "*.php" -exec sed -i 's/aaa/bbb/g' {} +
如果你想压缩当前目录下的 **所有文件**,包括以 . 开头的隐藏文件(.*),你可以使用 tar 命令。tar 可以压缩并打包文件和目录,包括隐藏文件。
tar czf archive.tar.gz ./
tar -czvf all.tar.gz .
查看temp文件
命令来查看当前目录及其子目录下是否存在 temp.php 文件
find . -name "temp.php"