Skip to content

A recreation of the Unix ls command, built from scratch in C as part of the WeThinkCode curriculum.

Notifications You must be signed in to change notification settings

devwithmike/ft_ls

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ft_ls

A recreation of the Unix ls command, built from scratch in C as part of the WeThinkCode curriculum.

About

This project implements a functional version of the standard Unix ls command, supporting multiple flags and options for listing directory contents in various formats. It demonstrates fundamental C programming concepts including file I/O, memory management, data structures, and system calls.

Getting Started

Prerequisites

  • GCC compiler
  • Make
  • Unix-like environment (Linux, macOS, etc.)

Installation

Clone the repository and navigate to the project directory:

git clone https://github.com/MikeFMeyer/ft_ls
cd ft_ls/

Building

make

This will compile the project and create the ft_ls executable.

Usage

./ft_ls [OPTIONS] [file ...]

Options

Flag Description Bonus
-A Show all files (including hidden), but exclude . and ..
-G Add color output to file listings
-R Recursively list contents of directories
-a Show all files, including . and ..
-f Show files unsorted
-l Use long listing format
-n Display UID and GID as numbers in long format
-p Append / indicator to directories
-r Reverse sort order
-t Sort by modification time instead of name

Examples

# List current directory with colors
./ft_ls -G

# List all files in long format, sorted by time
./ft_ls -lt

# Recursively list with colors
./ft_ls -GR

# List with directory indicators
./ft_ls -p

Project Structure

  • srcs/ - Source files
  • libft/ - Custom C library implementation
  • includes/ - Header files
  • Makefile - Build configuration

About

A recreation of the Unix ls command, built from scratch in C as part of the WeThinkCode curriculum.

Topics

Resources

Stars

Watchers

Forks