linux(Ubuntu)經常使用命令整理 -- 基礎篇 -- 持續更新

有些命令很經常使用,可是一段時間不用就會忘,把本身天天用到的整理下來,具體參數用到的時候再寫。html


  1. 查看一個命令的使用幫助:manjava

    查看ps命令的使用幫助:man ps(按q退出)mysql


  2. 查看所有歷史命令:historylinux

    查看包含「ssh」的全部命令歷史:history | grep sshnginx


  3. 安裝/卸載程序git

    (1)使用apt-get安裝程序:sudo apt-get installsql

    安裝freemind:sudo apt-get install freemind數據庫

    (2)手動下載安裝包安裝:apache

    下載:直接網頁搜索安裝包下載  或者 使用命令: wget [option]... [URL]... ubuntu

    下載skype:wget http://download.skype.com/linux/skype-ubuntu-precise_4.3.0.37-1_i386.deb

    安裝skype: sudo dpkg -i skype-ubuntu-precise_4.3.0.37-1_i386.deb

    (3)卸載:sudo apt-get remove

    卸載amule:sudo apt-get remove amule 而後 sudo apt-get autoremove 


  4. 查看圖片: display

    查看圖片123.jpg: display 123.jpg


  5. 查看文件內容: cat / tail

    查看tomcat日誌(顯示整個文件內容):cat catalina.out

    顯示tomcat日誌最後50行輸出: tail -n50 catalina.out

    跟蹤顯示tomcat日誌輸出:tailf catalina.out


  6. 查看進程: ps 

    查看名字爲java的所有進程信息: ps -aux | grep java

    強制殺死進程: kill -9 <pid> 


  7. 切換root用戶:su

    退出root用戶:exit

    當前用戶使用root權限執行命令: sudo 要執行的命令

    使用root權限執行上一條命令: sudo !!


  8. vim編輯器:vim test.txt

    命令模式下:

    i 進入插入模式

    cc 改變整行,即將整行內容清掉

    :.d   刪除當前行

    :m,nd 刪除第m行到第n行

    :w 保存

    :q 退出vim

    :q!強制退出

    插入模式下:

    esc鍵 退出插入模式

    命令模式下,按‘/’,而後輸入要查找的字符,Enter。?和/的區別是,一個向前(下)找,一個向後(上)。
    另外,‘*’能夠查找當前光標下的word(徹底符合),‘g*’則部分符合,以#代替*表示向後(上)找。


  9. git經常使用(查看幫助:git --help):

    在當前目錄建立新代碼倉庫:git init

    從既有代碼倉建立:git clone git://code.scdn.net/myproject.git

    查看工做目錄下文件改動狀態: git status

    添加全部新建文件:git add -A

    帶提交信息提交全部本地改動:git commit -am "提交信息"

    從Origin獲取最後一次改動:git pull

    將本地改動推送到Origin:git push

    …… …… …… ……


  10. mysql鏈接數據庫:

    mysql -h192.168.0.100 -uzhouqz -p

    輸入密碼

  11. 鏈接遠程服務器:ssh

    ssh username@remoteip -p端口號

    輸入遠程服務器登陸密碼

  12. 遠程複製文件:scp

    複製當前路徑下全部文件到遠程服務器upload下:

    scp *.* username@remoteip:/usr/local/apache-tomcat-7.0.27/upload

    輸入遠程服務器登陸密碼


  13. 截圖:shutter(需本身安裝shutter:sudo apt-get install shutter)

  14. 查看當前所在目錄:pwd

  15. 搜索安裝程序路徑:whereis

    搜索nginx安裝路徑: whereis  niginx

  16. 清空終端:clear

  17. 從終端以圖形界面方式打開指定文件夾:gnome-open /var/upload/




參考:

原文連接:

http://my.oschina.net/JustLoveIT/blog/473301

各類查找查看命令:

http://www.kuqin.com/linux/20091009/70532.html

從終端以圖形界面方式打開指定文件夾:

http://jingyan.baidu.com/article/3c343ff7149f890d37796308.html

相關文章
相關標籤/搜索