Linux必須熟練掌握的

1)重置Root密碼

  1. 重啓系統,看到啓動倒計時的畫面,敲回車
  2. 按‘a’進入[to modify the kernel arguments before booting在啓動前修改內核參數]
  3. 進入之後輸入‘single’,然後回車
  4. 跳轉成功後就可以用passwd指令修改root的密碼

2)寫備份數據庫Shell腳本

3)配置網絡

4)配置XShell或者CRT連接

  1. 查看進程
    第一列 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
  1. 查看端口號
    端口號爲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  
  1. 知道端口號查進程【例如重啓tomcat】
history | grep ssh
netstat -nlp | grep 22
ps -ef | grep 2192

5)指令目錄搜索

  1. find /name “name” 全局搜索
  2. locate Java 搜索Java有關的內容
  3. which Java 搜索Java有關的內容

6)查看命令幫助

  1. man tail 查看tail指令用法
  2. tail --help 查看tail指令用法

7)打印或者追加指令

  1. echo “xxxx” 打印xxxx
  2. echo “xxxx” > test.log 覆蓋內容爲xxxx
  3. echo “xxxx” >> 追加xxxx

8)tail指令

  1. 監控log日誌文件
    退出 ctrl+z
tail -F test.log

一)零碎知識點

  1. wget 下載軟件
wget+網址
  1. yum
    下載httpd,不提示y/n
yum -y install httpd
--卸載httd,不要提示用-y
yum -y remove httpd
  1. rpm
--查詢http包
rpm -qa | grep http
--卸載http包,後面寫全路徑,不驗證包依賴項(--nodeps),-e(專用(卸載))
rpm -e --nodeps httpd-2.2.15-69.el6.centos.x86_64
  1. 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
  1. mv 移動
    cp test01.log test02.log
--移動文件test.log到文件夾Lee01
mv test.log Lee01
--修改文件名
mv test.log test.log.beifen
  1. 查看磁盤空間 查看內存
df -h
free -m
  1. top
查看機器負載load average
查看哪個進程的CPU memory佔的比例比較高
--查看到高的進程,看是否要殺死
ps -ef | grep pid
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章