This article is published as a reply to the last few articles on the thoughtbot blog.
Some time or another during the project development you may wonder: «What files does my project include?» or «Why am I a Star Wars fan anyway?». This article will focus on the first question, leaving the second to your own reflection.
Any shell you might be using comes with a lot of useful tools. The one of interest today is ls
Here's the most simple example of its usage in a Rails project
sample_project $ ls README app db lib public test vendor Rakefile config doc log script tmp
As a little more complex example, you might want to get the list of your model files:
sample_project $ ls app/models/ comment.rb post.rb
Or, it even can do crazy stuff, like list all your model files AND controller files AND helper files! Now thats some useful magic, isn't it?
sample_project $ ls app/* app/controllers: application_controller.rb comments_controller.rb posts_controller.rb app/helpers: application_helper.rb comments_helper.rb posts_helper.rb app/models: comment.rb post.rb app/views: comments layouts posts
ls can do much. much more. Go check out the manual page here, you'll be amazed.
Note to Windows users: you also have a similar command, named dir.
Unbelievable! Thank you very much! I’ll know now!
Aleksandr Koss
10 Sep 09 at 12:23
[...] robots, we have a reply to your outstanding articles: A wonderful way to list your project files. Please read it carefully, you definitely will find something useful for you! Thanks to @labria for [...]
In reply to latest articles in Thoughtbot blog | Dmytro Shteflyuk's Home
10 Sep 09 at 12:35
=)
Dieinzige
10 Sep 09 at 12:46
find app -type d | sort | awk ‘{print “\n”$1″:”; system(“ls ” $1)}’
sasha
10 Sep 09 at 12:49
[...] This post was Twitted by calavera [...]
Twitted by calavera
10 Sep 09 at 13:55
черный юмор пошел нынче в моду
mikhailov
10 Sep 09 at 14:34
поржал
da4nik
10 Sep 09 at 14:34
Hi Labria,
Point well taken. “tail” is part of any developer’s toolbox.
I never had a formal computer science education and have picked up scraps of UNIX on the job.
The latest post wasn’t about tail so much as an application of it that I’ve found helpful recently while debugging some testing issues in Rails.
It’s probably basic, but I don’t feel the need to hold back what might seem basic to many readers if it comes in handy for a few others.
I try to keep such articles short so I’m not wasting anyone’s time, and in the theme of “this has been working for me; I hope it comes in handy for someone else, too.”
Thanks for reading.
Dan Croak
10 Sep 09 at 15:25
A-A-A! моск взорван
Alexey Osipenko
10 Sep 09 at 16:47
Thanks in support of sharing such a nice thought, post is fastidious, thats why i have read it fully
mcitp training cources
23 May 13 at 14:01
continuously i used to read smaller articles or reviews that as well clear their
motive, and that is also happening with this piece of writing which I am reading at this place.
mcitp training
25 May 13 at 18:25
In fact no matter if someone doesn’t know after that its up to other visitors that they will help, so here it takes place.
Mcitp training
27 May 13 at 03:10