Linux grep/sed/awk 命令

grep grep -c 'img' index.php # 查看index.php文件中包含img的有多少行 cat var.php | grep -o 'img' # 查看文件中匹配到的部分,如果有两个匹配,就显示两个img cat var.php | grep 'img'

Linux 文件内容查看

cat命令 cat nginx.conf # 查看nginx.conf文件内容,全部显示 cat nginx.conf fcgi.conf # 查看多个文件内容 cat -n index.php #查看文件内容并从 1 开始添加序号 less 分屏显示文件内容 less

Linux 文件/目录操作

file:查看文件类型 file filename touch :新建空文件 touch filename.php cp:复制文件或目录 cp index.php /var/www/ # 复制文件到目录下 cp -a index.php /var/www/ # 复制文件到目录下,并且保留文件的属性、权限