本篇体验Git Bash在Windows操作系统上的用法。

什么是Bash?

是一个Shell环境,Bourne Again Shell的缩写。

安装git for windows

→ http://git-for-windows.github.io/
→ Download,选择一个合适的版本
→ 安装
→ 安装完后有Git Bash, Git CMD, 和 Git GUI这个三个应用程序
→ 运行Git Bash,检查当前版本
git version
→ 退出
exit

安装Notepad++

→ notepad-plus-plus.org
→ download,选择合适的版本
→ 安装

在Bash中打开Notepad++

→ 找到notepad++的应用程序文件
一般在C:\Program Files(x86)\Notepad++中,把C:\Program Files(x86)\Notepad++赋值
→ 右键"我的电脑",点击"高级系统设置", 点击"环境变量", 双击Path,把;C:\Program Files(x86)\Notepad++加到最后,点击"确定"
→ 运行Git Bash
→ notepad++
这样,在Bash中就打开notepadd++了。

显示查看当前目录

→ 运行Git Bash
→ 查看当前目录
pwd
显示/c/Users/Darren,其中/c/相当于C:\,
→ 列出当前文件夹下的所有文件
ls

ls -l

更换当前目录

→ 运行Git Bash
→ 导航到其它目录
cd Videos/
→ 退回到上一级
cd ..
→ 导航到My Documents目录
cd My\ Documents/
→ 退回三级
cd ../../../
→ 回到主目录
cd ~
→ 导航到一个绝对位置上的目录
cd /c/Windows/System32/

查看命令出处

→ 查看ls命令的出处
whick ls
显示/bin/ls

显示打印

→ 显示打印环境变量
echo $PATH

查看文件内容

→ 查看一个文件内容
cat test.txt
→ 查看一个文件内容并编辑
less test.txt

创建、重命名、移动、删除文件

→ 创建一个空文件
touch demo.txt
→ 重命名一个文件
mv demo.txt demo-1.txt
→ 删除已知文件
rm demo-1.txt

创建、删除目录

→ 创建目录
mkdir projects
→ 删除目录
rmdir projects
→ 创建多级目录
mkdir projects/client-a/awesome-web-project/
→ 删除多级目录
rm -rf projects/

清空和退出

→ 清空内容
clear
→ 退出控制台
exit

控制台打印信息输出到文件

→ 打印信息输出追加到创建文件
echo "hi" >> demo.txt
→ 打印信息输入重写已知文件
echo "hello" > demo.txt

执行Bash脚本

→ 查看bash安装在哪里
which bash
显示:/bin/bash
→ 使用notepad++创建打开一个文件
notepad++ example.sh
→ 输入命令

#!/bin/bash

echo "hi, everyone"

使用Git Bash for Windows的更多相关文章

  1. How to add more to Git Bash on Windows

    How to add more to Git Bash on Windows Download the lastest wget binary for windows from https://ete ...

  2. Git - git bash 在 windows 下创建软连接

    1. 概述 使用 git bash 在 windows 下创建软连接 或者叫 快捷方式 感谢 Tony 老师的帮助 Tony 的技术笔记 Windows 使用 ln -s 创建软链接 2. 问题 需求 ...

  3. When cloning on with git bash on Windows, getting Fatal: UriFormatException encountered

    I am using git bash $ git --version git version .windows. on Windows 7. When I clone a repo, I see: ...

  4. Git Bash for Windows add ssh key时报Could not open a connection to your authentication agent.

    $ ssh-add id_rsa_bitbucketCould not open a connection to your authentication agent. 运行: $ ssh-agent ...

  5. shell,bash,git bash,xshell,ssh

    一:shell是linux/unix系统的外壳,也可以理解为命令行接口,就是你输入并执行命令行的地方.bash(born again shell)是shell的一种,最常用的shell之一.你在你的l ...

  6. Git Bash的妙用 - 使用Linux命令

    如何在Windows中使用Linux命令? 网上有很多说是安装CygwinPortable 在cmd 窗口下是用linux 命令,但是还有一些缺陷. 其实对于程序员来说有一个非常简单有效的方法,那就是 ...

  7. git 入门教程之 git bash 竟然不支持 tree 命令

    开门见山 git bash 是 Windows 用户安装 git 时默认安装的命令行工具,不仅界面漂亮功能也不错,大多数情况下可以替代 Windows 原生的 cmd 命令行. 然而,git bash ...

  8. git bash中提示 bash:node: command not found

    昨天小伙伴私信,git bash以及windows 的cmd命令行下均无法运行node npm. 究其原因是环境变量的问题.解决步骤: 1>在"此电脑"中右击,选择" ...

  9. Git:为Git Bash.exe设置默认起始目录的两种方式(start in、~/.bashrc)

    在协作开发的过程中,我们经常要进行一些项目的上传拉取操作. 在无数次不厌其烦的打开关闭 Git Bash 后,我实在忍受不了作为一个程序员还要每次都要进行如下的小白操作了 cd /d/my-proje ...

随机推荐

  1. 关于php中正则匹配包括换行符在内的任意字符的问题总结

    要使用正则匹配任意字符的话,通常有以下几种方法,这里我分别对每一种方法在使用的过程中做一个总结: 第一种方式:[.\n]*? 示例 ? PHP preg_match_all('/<div cla ...

  2. ns3模拟无线Ad hoc 网络通信

    Ad hoc网络 Ad hoc网是一种多跳的.无中心的.自组织无线网络,又称为多跳网(Multi-hop Network).无基础设施网(Infrastructureless Network)或自组织 ...

  3. [Ng]Angular应用点概览

      1. 使用模块化写法. var app = angular.module('myApp', []); app.controller('TextController', function($scop ...

  4. aceAdmin fuelux tree 从后台获取数据,并设置节点ID等属性

    如题,从后台封装数据,有两种方式渲染节点的数据: 1.全部节点加载 2.根据父节点加载子节点 首先,先介绍下第一种渲染方式: 后台返回数据格式(所有的附加属性,都可放在additionalParame ...

  5. freeCodeCamp:Find the Longest Word in a String

    找到提供的句子中最长的单词,并计算它的长度. 函数的返回值应该是一个数字. /* 先把字符串 str 转为数组 myarr 将数组myarr中的每个元素长度转换成一个新的数组newarr 将这个数组按 ...

  6. [Chapter 3 Process]Practice 3.12 Including the initial parent process, how many processes are created by the program shown in Figure 3.32?

    3.12 Including the initial parent process, how many processes are created by the program shown in Fi ...

  7. 【转】python fabric实现远程操作和部署

    fabric title是开发,但是同时要干开发测试还有运维的活……为毛 task*3 不是 salary * 3 (o(╯□╰)o) 近期接手越来越多的东西,发布和运维的工作相当机械,加上频率还蛮高 ...

  8. centos6.5中 nginx-1.6.3 编译安装

    参考来源:http://nginx.org/en/docs/configure.html nginx-1.6.3 编译安装:1) ./configure --help 查看编译选项 2) 需要安装一下 ...

  9. noip2014-day2-t2

    题意:在有向图G 中,每条边的长度均为1 ,现给定起点和终点,请你在图中找一条从起点到终点的路径,该路径满足以下条件: 1 .路径上的所有点的出边所指向的点都直接或间接与终点连通. 2 .在满足条件1 ...

  10. tesseract api C++使用例子

    转自:https://code.google.com/p/tesseract-ocr/wiki/APIExample APIExample API examples Updated Aug 12, 2 ...