1)重置Root密码
重启系统,看到启动倒计时的画面,敲回车 按‘a’进入[to modify the kernel arguments before booting在启动前修改内核参数 ] 进入之后输入‘single’,然后回车 跳转成功后就可以用passwd指令修改root的密码
2)写备份数据库Shell脚本
3)配置网络
4)配置XShell或者CRT连接
查看进程 第一列 root 用户名 第二列 2192 pid进程号 最后一列 ssh运行的命令
[root@hadoop-01 ~]# ps -ef | grep ssh
root 2192 1 0 05:21 ? 00:00:00 /usr/sbin/sshd
root 2922 2904 0 05:25 pts/0 00:00:00 grep ssh
查看端口号 端口号为22
[root@hadoop-01 ~]# netstat -nlp | grep 2192
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2192/sshd
tcp 0 0 :::22 :::* LISTEN 2192/sshd
知道端口号查进程【例如重启tomcat】
history | grep ssh
netstat -nlp | grep 22
ps -ef | grep 2192
5)指令目录搜索
find /name “name” 全局搜索 locate Java 搜索Java有关的内容 which Java 搜索Java有关的内容
6)查看命令帮助
man tail 查看tail指令用法 tail --help 查看tail指令用法
7)打印或者追加指令
echo “xxxx” 打印xxxx echo “xxxx” > test.log 覆盖内容为xxxx echo “xxxx” >> 追加xxxx
8)tail指令
监控log日志文件 退出 ctrl+z
tail -F test.log
一)零碎知识点
wget 下载软件
wget+网址
yum 下载httpd,不提示y/n
yum -y install httpd
--卸载httd,不要提示用-y
yum -y remove httpd
rpm
--查询http包
rpm -qa | grep http
--卸载http包,后面写全路径,不验证包依赖项(--nodeps),-e(专用(卸载))
rpm -e --nodeps httpd-2.2.15-69.el6.centos.x86_64
tar 压缩 解压 解压中xzvf解释 extract files from an archive filter the archive through gzip verbosely list files processed use archive file or device ARCHIVE
--压缩test.log
tar -czf test.tar.gz test.log
--解压 v打印解压后的文件名
tar -xzvf test.tar.gz
mv 移动 cp test01.log test02.log
--移动文件test.log到文件夹Lee01
mv test.log Lee01
--修改文件名
mv test.log test.log.beifen
查看磁盘空间 查看内存
df -h
free -m
top
查看机器负载load average
查看哪个进程的CPU memory占的比例比较高
--查看到高的进程,看是否要杀死
ps -ef | grep pid
啊