Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make dir command in windows output like ls command on linux?

dir is the command in windows to list what files are there in the current position, like the ls command in linux. However, their default information to display is different. Here is one of the example output of windows dir:

2016-06-30  03:47 PM    <DIR>          .
2016-06-30  03:47 PM    <DIR>          ..
2015-06-04  03:49 PM            12,292 .DS_Store
2016-06-10  05:10 PM                11 .gitattributes
2016-06-30  03:47 PM               318 .gitignore
2015-09-25  10:09 AM                 0 .gitmodules
2016-08-03  11:25 AM    <DIR>          app
2015-08-10  05:07 PM             2,502 artisan
2016-06-30  03:47 PM    <DIR>          bootstrap
2016-06-30  03:47 PM             1,361 composer.json
2016-03-17  06:00 PM            82,167 composer.lock
2015-08-10  05:07 PM               147 CONTRIBUTING.md
2016-06-30  03:47 PM             1,310 error.log
2015-08-10  05:07 PM               583 phpunit.xml
2016-09-05  05:37 PM    <DIR>          public
2015-08-10  05:07 PM             1,816 readme.md
2016-06-30  03:47 PM        13,993,746 requests.log
2015-08-10  05:07 PM               538 server.php
2016-06-30  04:55 PM    <DIR>          vendor
              13 File(s)     14,096,791 bytes
               6 Dir(s)  778,356,928,512 bytes free

It does the job, but it uses one line for one file and is showing information that I don't need. Usually I just want a quick reminder on what is inside the folder and are not interested in when file was changed. In linux, the output for ls will be like

app         artisan bootstrap  composer.json compser.lock CONTRIBUTING.md error.log 
phpunit.xml public  readme.xml public        readme.md    requests.log    server.php 
vendor 

It is much more compact and takes fewer lines. For me, it is easier to read and as it takes less lines, the previous command are kept in the screen too. Window's dir command is like keep using ls -l in linux.

So, the question, is there a way to change the default settings of dir command in windows to make it behaves like ls in linux? Or if it is not possible to make it default, at least an option to be type every time?

like image 288
cytsunny Avatar asked Dec 14 '22 03:12

cytsunny


1 Answers

After some detail reading on the documentation on dir command, the answer is dir /W or dir /D. The only difference is just the way they order files. dir /D is column first and dir /W is row first.

Reference: http://www.computerhope.com/dirhlp.htm

like image 136
cytsunny Avatar answered Apr 29 '23 07:04

cytsunny