A simple replacement for gnu-ls
written in C that allows for some customization.
It should work on any UNIX x86 system :)
- list files data
- colored file name based on type
- date of last edit
- size in human readable format
- support for
ls
's-a
and-A
flags
- Configurable through
config.h
- install script
Similar to suckless
software the script is contained in cofing.h
file where you can customize your color palette and extend functionality.
In order to, customize the your lss
you need to locate the main.c
file in the repository directory and open it with an editor of choice. There are 4 common customizations.
-
Change the color palette;
This can be done by editing the
COLOR_XXX
definitions:NOTE: DO NOT CHANGE THE
COLOR_RESET
VALUE -
Add more types of a category to be colored:
This can be done by including more
char *
in theXXX_ARRAY
definitions and then increasing/decreasing the defined length of the arrayXXX_ARR_LEN
. (I am aware setting array length by hand is dumb, however ***~Felt lazy, might patch later ~***): -
Add more categories
In order to add a new category you need to do 3 operations
- Define a new
COLOR_XXX
andXXX_ARR_LEN
- Initialize a new global array:
#define COLOR_FONTS #6633FF
#define FONTS_ARR_LEN 4
char * FONTS_ARRAY[] = {".ttf", '.otf', '.ps', '.woff'}
-
Finally, add the custom array in the
default
case of theswitch
statement on line224
:switch((S_IFMT & st.st_mode)){ // line 224 case S_IFDIR: print_colored(entries[i]->d_name, COLOR_DIR); break; //some switch cases default: // line 250 if (st.st_mode & S_IXUSR){ print_colored(entries[i]->d_name, COLOR_SH); } else{ // some if-else statements else if (typeChecker(entries[i]->d_name, FONTS_ARRAY, FONTS_ARR_LEN)){ print_colored(entries[i]->d_name, COLOR_FONTS); } // some other if statemetns } break;
In order to install lss
run the install.sh
script located in the repository:
$ sudo ./install.sh
Alternatively, you can compile the installation manually:
$ gcc main.c -o lss
$ sudo cp lss /usr/bin/.