Customizing Linux File Listing

Beginner

In this project, you will learn how to create a custom `ls` command that displays the sizes of directories in a user-friendly format. This project will help you understand how to retrieve and format file information in a Linux environment using Zsh scripting.

LinuxShell

Introduction

In this project, you will learn how to create a custom ls command that displays the sizes of directories in a user-friendly format. This project will help you understand how to retrieve and format file information in a Linux environment using Zsh scripting.

👀 Preview

$ cd /home/labex
$ sh newls.sh /home/labex
## Example
drwxr-xr-x 1 labex 6B Oct 13 10:11 Code
drwxr-xr-x 1 labex 120B Oct 13 10:11 Desktop
drwxr-xr-x 1 labex 28B Sep 23 2021 golang
drwxr-xr-x 1 labex 22B Oct 23 10:17 project

ðŸŽŊ Tasks

In this project, you will learn:

  • How to create a Zsh script to display file and directory information
  • How to format the file size for better readability
  • How to determine the appropriate date format for file modification times
  • How to output the file information in the same format as the ls -lh command

🏆 Achievements

After completing this project, you will be able to:

  • Write a Zsh script that can display the sizes of files and directories in a specified directory
  • Format the file size information for better readability
  • Determine the appropriate date format for file modification times based on the current year and the file's last modification time
  • Output the file information in a user-friendly format that matches the ls -lh command

Teacher

labby

Labby

Labby is the LabEx teacher.