1.查看文件中某行的内容
通过sed打印指定行号的内容 sed -n ‘xp’ 文件名
通过sed打印某个范围内的内容 sed -n ‘x,yp’ 文件名
注意:p是固定符号,x,y指的是行号
2.查看占用端口的进程号
netstat -tunlp | grep 8080
Linux下查看端口号所使用的进程号:
使用lsof命令: lsof –i:端口号
3.根据进程查看占用端口
ps –ef|grep 进程名
4. 如何在/home目录下找出120天之前被修改过的文件?
find /home -mtime +120
如何在/var目录下找出90天之内未被访问过的文件?
find /var /! -atime -90