You are not logged in.

#1 2011-11-02 14:43:32

tasty_minerals
Member
Registered: 2011-03-30
Posts: 191

my little "ls" alternative

Hello everyone,
I've started learning BASH recently, so I decided to make a script that will suit my needs.
I didn't like how "ls" worked for me and made a small script for myself to play with.

First of all, why?
Well, there is nothing wrong with "ls", nor do I want to replace it, no. Just that I like colors.
By default "ls" is, well ls) It doesn't sort anything, nor does it color the output without being aliased somewhere. So I decided to write something simple first, but somehow it became a real script afterwards.
lls outputs current list of files and directories in nice colors, it also provides additional info on each file. It does use special tags for describing permissions (see --help).
Anyway, here is it, I hope somebody will find it useful, I do)


screencut:
http://imageshack.us/f/338/201111012341041096x487s.png/

script:
http://code.google.com/p/lls/downloads/list

Last edited by tasty_minerals (2011-11-02 20:43:14)


lenovo thinkpad EDGE 13'

Offline

#2 2011-11-02 18:35:27

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: my little "ls" alternative

Looks very cool. What is the "open" in the output?
Also this error,

lls: line 297: break: only meaningful in a `for', `while', or `until' loop

aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#3 2011-11-02 19:23:02

tasty_minerals
Member
Registered: 2011-03-30
Posts: 191

Re: my little "ls" alternative

these are special tags I use for permissions;

TAGS:
DIR open -- means that user can search into this directory.
DIR closed -- means that user can't search into this directory.
FILE open -- means that this file is writable and readable.
FILE closed -- means that this file is not writable and readable.
FILE open X -- means that this file is writable, readable and executable.
FILE closed X -- means that this file is executable only.
FILE seen X -- means that this file is readable and executable, but not writable.
FILE edit X -- means that this file is writable and executable, but not readable.
FILE edit only -- means that this file is writable only.
FILE seen only -- means that this file is readable only.
FILE zombie -- means that this file is not writable, readable or executable.

thank you for "break" tip, my mistake, I shall correct it.


lenovo thinkpad EDGE 13'

Offline

#4 2011-11-02 21:24:00

oboedad55
Member
From: Baku
Registered: 2011-04-05
Posts: 392

Re: my little "ls" alternative

OK, I'm a moron. How do I use this?


Registered Linux user #436067

Offline

#5 2011-11-03 07:54:52

TuxLyn
Member
From: United States
Registered: 2011-10-26
Posts: 283

Re: my little "ls" alternative

@oboedad55, Simply copy lls script to your /bin/ directory and chmod +x /bin/lls

Then to use it simply run lls -h for available commands.


@tasty_minerals, when I use dark background and green text in my terminal I can hardly see any of your lls commands because they are in dark colors. It would be good idea to have default colors match terminal colors.

Last edited by TuxLyn (2011-11-03 08:01:20)


::: Using Arch Linux Since October 25, 2011 :::
::: Tutorials: http://distrogeeks.com/ :::

Offline

#6 2011-11-03 09:21:09

tasty_minerals
Member
Registered: 2011-03-30
Posts: 191

Re: my little "ls" alternative

TuxLyn wrote:

@oboedad55, Simply copy lls script to your /bin/ directory and chmod +x /bin/lls

Then to use it simply run lls -h for available commands.


@tasty_minerals, when I use dark background and green text in my terminal I can hardly see any of your lls commands because they are in dark colors. It would be good idea to have default colors match terminal colors.

yes, forgot that I myself use grey background.
you can download a copy for totally black backgrounds here:
http://code.google.com/p/lls/downloads/ … akechanges

It would be actually a good idea, to make user customize the colors for his own use.
That brings me to a ".llsrc" config file for the script.


lenovo thinkpad EDGE 13'

Offline

#7 2011-11-03 09:26:02

tasty_minerals
Member
Registered: 2011-03-30
Posts: 191

Re: my little "ls" alternative

oboedad55 wrote:

OK, I'm a moron. How do I use this?

after you download the file from here:
http://code.google.com/p/lls/downloads/ … akechanges

open up your terminal, cd to the download directory, and type:

sudo cp lls_white /usr/local/sbin/lls

then just use "lls" in your terminal.


lenovo thinkpad EDGE 13'

Offline

#8 2011-11-03 14:49:57

tasty_minerals
Member
Registered: 2011-03-30
Posts: 191

Re: my little "ls" alternative

I've added custom colors support for lls.
Now you can easily change the colors yourself!

Download .tar archive here http://code.google.com/p/lls/downloads/list
Just put the ".llsrc" file into yout $HOME dir and /root/ for "su" user, and play with the colors.

Last edited by tasty_minerals (2011-11-04 11:23:30)


lenovo thinkpad EDGE 13'

Offline

#9 2011-11-03 16:10:51

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: my little "ls" alternative

Can you make an AUR package? Thanks.


aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#10 2011-11-03 19:11:42

Stalafin
Member
From: Berlin, Germany
Registered: 2007-10-26
Posts: 617

Re: my little "ls" alternative

There is a tool called ls++ btw. smile

Offline

#11 2011-11-03 20:10:59

tasty_minerals
Member
Registered: 2011-03-30
Posts: 191

Re: my little "ls" alternative

Stalafin wrote:

There is a tool called ls++ btw. smile

yes. thanks. I didn't know about this app. Even if I did, I would try to make "ls" substitute myself ^^
Its cool to have alternatives after all.


lenovo thinkpad EDGE 13'

Offline

#12 2011-11-04 04:43:59

TuxLyn
Member
From: United States
Registered: 2011-10-26
Posts: 283

Re: my little "ls" alternative

@tasty_minerals, thaks for improvement buddy. Will grab new copy.


::: Using Arch Linux Since October 25, 2011 :::
::: Tutorials: http://distrogeeks.com/ :::

Offline

#13 2011-11-04 22:04:01

tasty_minerals
Member
Registered: 2011-03-30
Posts: 191

Re: my little "ls" alternative

fsckd wrote:

Can you make an AUR package? Thanks.

Done, AUR package is available here
http://aur.archlinux.org/packages.php?ID=53735
I've updated the script, so you don't have to mess with ~/.llsrc yourself, it is created automatically from now on.

Last edited by tasty_minerals (2011-11-04 22:06:37)


lenovo thinkpad EDGE 13'

Offline

#14 2011-11-20 20:43:29

tasty_minerals
Member
Registered: 2011-03-30
Posts: 191

Re: my little "ls" alternative

Updated to v.0.9
lls -tree draws pretty trees now ;P
and the results sorted alphabetically, seems right this way.

Last edited by tasty_minerals (2011-11-25 15:27:53)


lenovo thinkpad EDGE 13'

Offline

#15 2011-11-25 15:26:31

tasty_minerals
Member
Registered: 2011-03-30
Posts: 191

Re: my little "ls" alternative

Updated the final version 1.0 of the script:
You can filter the files by type now (video, audio, doc, archives). For example if you want only archives to be shown: "lls -c" will do it (see -help)
If your archive do not have an extension its no problem, the script will filter and show it even with the wrong extension:)
(I guess its quite handy instead of running some complex "find" pipes.)
And the "-tree" option, not very useful, I guess), but still can help you to see the basic dir structure.
So this is the final version and I don't plan to add anything else, if you find bugs tell me please.
Have fun!
AUR: https://aur.archlinux.org/packages.php?ID=53735
source: http://code.google.com/p/lls/downloads/list

Last edited by tasty_minerals (2011-11-25 15:28:07)


lenovo thinkpad EDGE 13'

Offline

#16 2011-11-26 10:41:49

Awebb
Member
Registered: 2010-05-06
Posts: 6,688

Re: my little "ls" alternative

At first I thought this was a waste of time, but I actually like the result.

I have three remarks about the interface:
1. The options can't be cascaded like "-te", one must type "-t -e". I think about implementing it myself and send it to you, if I find the time tonight.
2. I can't type -tree, without going back and deleting the additional dash that happens when you type --tree :-D
3. I don't find your tags very intuitive, What's wrong with octal permissions :-P

Offline

#17 2011-11-28 08:55:24

tasty_minerals
Member
Registered: 2011-03-30
Posts: 191

Re: my little "ls" alternative

Well, it maybe a waste of time for the end user, but it was done while learning Bash and for the sake of learning it:) So don't take it too seriously, just that I spend quite some time while playing with it, I decided to share.
I like it more than before (and actually use it more often) now when I can filter archives and video files, cause ls by default is horrible.
Using "getopt(s)" could make it better, sure. I just don't have time to read the man now.
The "newbie" tag mode was made for fun mostly. You can try the other set of tags by changing the mode in ".llsrc" to "su". There you will have default "DRWX" tags.

ps; I do type --tree quite often myself smile))

Last edited by tasty_minerals (2011-11-28 08:56:12)


lenovo thinkpad EDGE 13'

Offline

#18 2011-12-07 01:58:29

TheShadowFog
Member
Registered: 2011-11-24
Posts: 21
Website

Re: my little "ls" alternative

This is really nice! Thanks!

Offline

#19 2011-12-07 10:20:27

Awebb
Member
Registered: 2010-05-06
Posts: 6,688

Re: my little "ls" alternative

tasty_minerals wrote:

Well, it maybe a waste of time for the end user, but it was done while learning Bash and for the sake of learning it:) So don't take it too seriously, just that I spend quite some time while playing with it, I decided to share.

That's what I meant. First I thought: "Boohooo reinventing the wheel, yehaaaw." Now I rather think: "Cool. I'll use it."

Offline

Board footer

Powered by FluxBB