Apple Interview Question

How would I implement the 'ls' command in Unix?

Interview Answers

Anonymous

Feb 1, 2010

I did not have sufficient knowledge in filesystems to answer that question.

Anonymous

Feb 23, 2010

I remember the way how I did it when I was in college is to first to know the current directory then you iterate each of file/directory nodes in the file system at that level and print out each of them one at time.

Anonymous

Aug 3, 2015

If this is in reference to the command line. Typing ls in terminal in the "desired" file directory, will output all files within that file. So, for example if you navigate to your "documents" folder and type "ls" you will see all files contained inside your documents folder.