Simple implementation of ls command

Written by    16:59 June 11, 2015 

Just an assignment from my Linux programming course.

I have only done a small part of work of the ls command, after all, it’s a program with 400+ lines, if you want to study full source codes of ls command(in which there are 4000+ lines codes), you can get it from here.

Honestly, this program is so much different from the Linux source codes, because I have used STL, which has hardly appeared in the Linux source codes but very helpful to simple codes.

The functions I have finished:

Without any option: ls_general

With option -l: use a long listing format: ls_l

With option -a: do not ignore dotfiles: ls_a

With option -R: show subdirectories: ls_R

With option -f: show files without sorting: ls_f

Show files with using default symbols: ls_default

Besides, this program can also display files beautifully in vertical order, just like the ls command.

 

Category : study

Tags :