Git筆記之使用git Bash的命令集


   首先,吃水不忘挖井人,感謝linux創始人林納斯托瓦茲(Linus Torvalds)2005年開發了Git版本控制系統。
   Git是一個開源的分布式版本控制系統,用以有效、高速的處理從很小到非常大的項目版本管理。它采用了分布式版本庫的方式,不必服務器端軟件支持,使源代碼的發布和交流極其方便。而且速度很快。Git 最為出色的是它的合並跟蹤(merge tracing)能力。

    Git Bash Here

     0、Dash命令格式

命令  [-options]  [參數]
 $      可選         文件      

  

  1. bash 常見命令  
pwd  (Print Working Directory)  查看當前目錄
cd   (Change Directory)  切換目錄,如 cd /etc
ls   (List)        查看當前目錄下內容,如 ls -al

  2 、命令集*分類

            ○  創建

                      ● mkdir (Make Directory) 創建目錄,如 mkdir blog

                  ● touch 創建文件,如 touch index.html

               ○  查看

                      ●  cat 查看文件全部內容,如 cat index.html (必須有后綴名)

                  ● more & less 查看文件,如 more /etc/passwd & less /etc/passwd                      

  這邊使用的是仿linux系統的,more不能用,只能用less,  【less  文件名】 linux上可用;
more直接打印出來;less直接進入Vi編輯器看文件。

              ● head 查看文件前幾行,如 head -5 index.html

                  ● tail 查看文件后幾行 –n –f,如 tail index.htmltail -f -n 5 index.html 

                  ● history 查看操作歷史

                  ● who am i 查看當前用戶  使用時中間無空格 whoami

            ○ 刪除

                  ● rm (remove) 刪除文件,如 rm index.html

                       ●  rm -rf  blog   強刪文件blog  (注:強刪時必須加文件名,不然會發生恐怖的事,勿試)    

                       ● rmdir (Remove Directory) 刪除文件夾,只能刪除空文件夾,<不常用>

      其他功能

                    ●  mv (move) 移動文件或重命名,如 mv index.html ./demo/index.html

         ●  cp (copy) 復制文件,cp index.html ./demo/index.html

                    ●  tab 自動補全,連按兩次會將所有匹配內容顯示出來

         ●  ssh 遠程登錄,如ssh root@gitlab.study.com

                     > >>   都是重定向,如echo hello world! > README.md,不同的是 >覆蓋 >>追加

   $ echo hello world!
      hello world!     //直接輸出打印出來
   $ echo hello world! > demo.txt     //會將hello world!內容重定向打印到demo.txt中
   $ echo hello Fauss! > demo.txt    //hello Fauss! 會將demo.txt中的hello world!覆蓋掉
   $ echo hello Fauss! >> demo.txt   //hello Fauss!只會追加到demo.txt中的hello world!的后面

           wget 下載,如 wget https://nodejs.org/dist/v4.4.0/node-v4.4.0.tar.gz

                    tar 解壓縮,如 tar zxvf node-v4.4.0.tar.gz

                   ● curl 網絡請求,如 curl http://www.baidu.com

                     |   管道符,將上一次處理的結果當下一次的參數

                     grep 匹配內容,一般結合管道符使用

 

注: 文章初次嘗試使用makedown寫的 index.md  格式有幾處不對齊,敬請諒解;

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM