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
- 啊