Show files in current directory using Git Bash?

2019-01-22 21:23发布

How can I check files in current directory, from git bash? Like command dir, in Windows cmd ?

I found a command git ls-files, but it's work only with git repository files. But if I navegate through drive C:\, and want to see files in current directory, how can I do that in git bash?

4条回答
冷血范
2楼-- · 2019-01-22 21:45

Git bash runs bash, so you can use bash commands, i.e:

ls -la

You can have a look at basic bash commands, to list files, delete, show content, etc, here: http://tldp.org/LDP/abs/html/basic.html

查看更多
放荡不羁爱自由
3楼-- · 2019-01-22 21:51

A simple ls should be enough.

since git bash is a regular unix bash, regular unix commands do work.


That being said, I prefer using a regular cmd session, using the git-cmd.bat script provided with msysgit.
That way, all git commands are available while the regular DOS commands do work.

查看更多
相关推荐>>
4楼-- · 2019-01-22 21:55

The git bash is basically a Unix shell, therefore you can list current files and directories with the ls command

You can also use ls -a to show hidden files and folders.

Since it is a Unix shell, you can make an alias called dir in a .bashrc file. It's handy when you are on windows, such that you don't have to remember both the Linux and the Windows command for listing directories.

查看更多
【Aperson】
5楼-- · 2019-01-22 22:00

The command you are looking for is called ls (for list). Run it as

ls -als

to see all files and directories in the current directory.

Take a look at the Bash tutorial here, which will give you an overview of the most commonly used commands.

http://www.cs.uwp.edu/staff/knautz/BashTutorial-1.0.0/bt.php?p=tutorial01

查看更多
登录 后发表回答