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  格式有几处不对齐,敬请谅解;

 

posted @ 2016-04-19 22:50  逍遥超儿  阅读(3747)  评论(0编辑  收藏  举报