本篇体验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. eclipse里面设置JVM参数的问题

    在run----run configuration---Agruments里面设置JVM的参数:  -Xms256m   -Xmx1024m 肯定还有别的方式设置,今天就先写这一种方法.待续...

  2. Ubuntu 12.04(32位)安装Oracle 11g(32位)

    安装过程(主要过程就直接copy别人的教程了)及问题: 1.将系统更新到最新: sudo apt-get updatesudo apt-get dist-upgrade 2. 如果使用的Ubuntu不 ...

  3. 信心题--FUOJ2226(莫队算法)

    http://acm.fzu.edu.cn/problem.php?pid=2226 信心题,还说是信心题,题目给的真好.但是一点都不像信心题. 又是一个新的算法,莫队算法 莫队算法是一个用数组就可以 ...

  4. cach

    为程序使用内存缓存(MemoryCache) oscache Guava cache 一种解决方法是配一个listener,在里面启动定时器. 简单缓存可以封装LinkedHashMap,因为它是有顺 ...

  5. 初识Android && 搭建Android开发环境

    搭建Android开发环境需要的工具: JDK(Java Development Kit) Eclipse Android Sdk(Software Development Kit) ADT (And ...

  6. dom4j 学习总结

    Dom4j is an easy to use, open source library for working with XML, XPath and XSLT on the Java platfo ...

  7. 关于QT安装的一些心得(QT551, VS2013)项目开发配置,以及项目结构分析

    推荐QT开发的配置如下: 我的硬件配饰中等,所以推荐一下配置: QT551版本,目前QT最新版8.0,为了稳定选择551版本 VS2013IDE, 因为VS2010与VS2013的编译器相同,但是VS ...

  8. testng.xml顺序执行多个case配置

    testng.xml顺序执行多个case配置 项目结构如图:

  9. 作业,备份,存储过程,sqlserver print 语句,输出字符串

    declare @filename nvarchar(100) set @filename='H:/backOrder/'+ convert(varchar(50),getdate(),112)+ l ...

  10. Hadoop-1.2.1 安装步骤小结(ubuntu)

    1.安装ubuntu系统 如果不使用云服务器,可以使用虚拟机WmWare安装,具体安装步骤这里就不讲了,ubuntu系统下载地址:http://www.ubuntu.com/download/desk ...