less, Powerful Not-So-CLI (:-) Text Viewer and Launcher

Miscellaneous tools
Message
Author
musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

less, Powerful Not-So-CLI (:-) Text Viewer and Launcher

#1 Post by musher0 »

Edit, 19 Nov. 2015. Version 481 compiled for Puppy, here.
~~~~~~~~~~~~~~~~~
Edit, Dec. 17, 2014. Less, version 470, has been attached to message
http://murga-linux.com/puppy/viewtopic. ... ost#815558.
The new "read pdf as txt" script is in the message just above it. Enjoy! :)
~~~~~~~~~~~~~~~~~
Edit, Dec. 20, 2013. For latest compile of less version 458, please go to:
http://murga-linux.com/puppy/viewtopic. ... ost#745241
(I've deleted the version 451 that was attached to this initial post.)
Thanks.
~~~~~~~~~~~~~~~~~
Update, April 25, 2013: less-458 is out. See message at bottom of page.

Hello, all!
Here is less 4.51, dated July 2012, compiled from source. This pet includes lesspipe and numerous right-click accesses. More compact size than v. 4-44 obtained by stripping and upx'ing of executable. This one also replaces outright the "defaulttextviewer" file.

From the less viewer, if you need to edit a file, press "V" and the file will load in your text editor. You will be brought back to the less viewer upon closing your editor.

Enjoy! :)

/////////////////

Rationale:
The less included by default in Puppy is the cut-down version integrated in busybox. It does the job, barely. If you need more sophisticated viewing capacity, then you need this full version of less.

For example I've replaced Puppy's defaulttextviewer with less-4.51, with no regrets. It loads the text extremely fast, it allows you to view text -- or binary material, which leafpad, nicodedit or even geany do not load at all.

This pet also comprises (minimal) docs created by the compilation. Look for "less.hlp" under /usr/local/share/doc and view it with... less ?? :)

(You can also view the help file of less while reading any other text, simply by typing "h". After you've consulted less's help, type "q" to return to reading your initial text.)

The default text viewer has been replaced with this script:

Code: Select all

#!/bin/sh
# /usr/local/bin/defaulttextviewer
####
urxvt -fn "xft:Aerial Mono:pixelsize=13" -fg "#D8FDDB" -bg "#786849" -sr +st +tcw -bc -T "Aperçu de \"$@\"" -n "Aperçu de \"$@\"" -tr -tint black -sh 57 -bd firebrick4 -g 84x25+320+24 -cr white -b 4 -e less-444 -B -J -m -N -~ "$1"
# exec nicoedit "$@"
# or perhaps 
# exec leafpad "$@"
The above uses the transparent and xft font features of urxvt to make viewing under less "softer on the eyes". It also displays the name of the file being viewed in the title bar.

As an aside, I've got the docs in a series of 8 jpg panels for easy consultation. If there's a request, I'll make them available here also.

Have a great day!

P.S. A screenshot is included.
Attachments
viewing-a-script-with-less.jpg
(20.25 KiB) Downloaded 1473 times
Last edited by musher0 on Thu 19 Nov 2015, 08:45, edited 10 times in total.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
GustavoYz
Posts: 883
Joined: Wed 07 Jul 2010, 05:11
Location: .ar

#2 Post by GustavoYz »

Thanks, it works like a charm.
I've to tweak some things in order to make puppy less (busybox one) work with man pages, but this full less has no issues.
Thanks again.

EDIT: I've replaced the original less symlink for an equal symlink pointing to less-444, no regrets.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#3 Post by musher0 »

Hi, Gustavo.

My pleasure!

BFN.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#4 Post by musher0 »

Confused by the less commands?

Here's a little script that will launch the less help at the same time as the document you want to view with less.

You can link this script as a context command in ~/.config/rox-sourceforge.net/SendTo/text_plain, for example, or any other of the directories there with text_something.

The help text will appear black on white, and the consulted text as white on black. No fancy transparency.

Enjoy!

Code: Select all

#!/bin/ash 
# /~/my-applications/bin/less-avec-aide.sh
####
urxvt -sr -g 82x24+40+40 -e less-444 --help &
urxvt -rv -sr -g 110x28 -e less-444 -B -J -m -N -~ "$@" &
Here is a screenshot.
Attachments
less-avec-aide.jpg
(63.89 KiB) Downloaded 1312 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#5 Post by musher0 »

Hello, all.

A new version of less is available. Please see first post for download.

Enjoy!
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
GustavoYz
Posts: 883
Joined: Wed 07 Jul 2010, 05:11
Location: .ar

#6 Post by GustavoYz »


User avatar
GustavoYz
Posts: 883
Joined: Wed 07 Jul 2010, 05:11
Location: .ar

#7 Post by GustavoYz »

:arrow: You can set options into a system variable called `$LESS`, so the next time is executed, less will use those (useful when "piping").

For example, to see a script with sintax highlights, I often use pygmentize + less on this way (I use a custom bash function with this in reality):

Code: Select all

pygmentize -l perl regex.pl | less
But, if $LESS has no '-R', it won't show colors.

The workaround is easy: add on the .bashrc somthing like this:

Code: Select all

LESS=`$LESS -r`
This way you won't loose any previous options set and add support for colors on situations like above.

My $LESS variable (bashrc adds '-r -Qai'):

Code: Select all

-M -r -Qai
:arrow: Also, less alloud you to have color on man pages (some puppies have `man`).
Check this: http://pastebin.com/SbaR33Pt

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#8 Post by musher0 »

Thanks for those tips, Gustavo!
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#9 Post by musher0 »

less-458 is just out.
Enjoy!

musher0

PS. Almost forgot:
* if this is your first install of less, you can ignore this note.
* if you already have less installed, remove all previous "less"-related files (such as lesskey, lessopen) with pfind before you install this version. The executables of this version are entirely in /usr/bin, and we don't want interference from earlier versions, right ? :)
In particular remove any previous versions you may have in /usr/local/bin or /root/my-applications/bin.
Also, it's not fresh to my mind, but I believe BK has a "less" linked to busybox in /bin in some Puppies. Never remove BK stuff from a Puppy; simply rename it to "less-NO", or something like that. The new 458 full version will then have full precedence, and there will be no confusion in the system.
Thanks.
Attachments
less-458.pet
Known to work on wheezypup 3.5.2.5
(121.31 KiB) Downloaded 835 times
Last edited by musher0 on Fri 26 Apr 2013, 15:02, edited 1 time in total.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#10 Post by tallboy »

Hi musher0
I downloaded less_458 to my LupuPlus_5.2.8. As you mentioned, the existing /usr/bin/less was a link to busybox.

Less only flashed on the screen for a fraction of a second when I tried it.

Code: Select all

# less my-documents/growisofs.txt 
less: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
tallboy
True freedom is a live Puppy on a multisession CD/DVD.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#11 Post by musher0 »

Hi, tallboy.

Ah ? I compiled this version in wheezy 3.5.2.5. Strange...

But it's normal, in a way, because less needs "food", it does indeed sort of flash and close if it does not have any text to show.

Re-reading your message, I see that you did give it "food". Ok, I'll do another compile on lupu 5.28 specifically.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#12 Post by musher0 »

To test "less" :

Does the following show in a console window or just flashes?

Code: Select all

echo beebabelooba > /tmp/bebop.txt;urxvt -e less -~ /tmp/bebop.txt
# Or any other *.txt file, of course. Or
#
# urxvt -e less --help
# if this last one, type G to go to the end of the help file, and 
# small-case g to come back to top, to see if it reacts properly.
If the text shows, it works, obviously. :)

musher0
Last edited by musher0 on Fri 26 Apr 2013, 14:54, edited 1 time in total.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#13 Post by musher0 »

@tallboy and others who might be experiencing library problems with the wheezypup build of less above:

please try this one, compiled on Small Business Pup (SBP) by e_mattis, a derivative of lupu 5.28.

Tests were ok on my lupu. Reports appreciated if not on your machine.

The less-458 version and the libtinfo.so.5.7 library are presented separately. You'll need both for less-458 to work on lupu 5.28.

Enjoy.

musher0

Note. The attached libtinfo library pet was extracted from this package: http://pkgs.org/centos-6-rhel-6/centos- ... /download/.
Attachments
less-458lupu2.pet
less-458 for lupu 5.28; you'll also need the libtinfo library, below.
(121.59 KiB) Downloaded 736 times
libtinfo.so-5.7.pet
partial ncurses library needed by less on lupu 5.28 Puppies.
(45.13 KiB) Downloaded 795 times
Last edited by musher0 on Sat 27 Apr 2013, 04:10, edited 1 time in total.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#14 Post by tallboy »

Hi musher0.
The /root/my-applications/bin/ directory containing 4 scripts in the original less_458.pet package, is not present in the less_458lupu version.

Will there be any problems if I just copy the scripts into /my-applications/bin? Any hardcoding with references?

tallboy
True freedom is a live Puppy on a multisession CD/DVD.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#15 Post by musher0 »

tallboy wrote:Hi musher0.
The /root/my-applications/bin/ directory containing 4 scripts in the original less_458.pet package, is not present in the less_458lupu version.

Will there be any problems if I just copy the scripts into /my-applications/bin? Any hardcoding with references?

tallboy
Hi, tallboy.

Chucks... :(
Thanks for telling me.
No, no problem at all with your suggestion. :) Just with my focus...

So I redid the pet for lupu. See above.

BFN.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#16 Post by tallboy »

musher0 wrote:Just with my focus...
Do you actually try to convince us that you're not an industrial robot?? :lol: :lol: :lol:

tallboy
True freedom is a live Puppy on a multisession CD/DVD.

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#17 Post by tallboy »

Hi again musher0
I renamed the original /usr/bin/less to less-old, it is a link pointing to /bin/busybox.

I still get a message after running less in a urxvt window:
# less --help
less: Symbol `ospeed' has different size in shared object, consider re-linking
There is no file named ospeed, but when I search with pfind for the standalone word ospeed in text, the search give two results: /bin/busybox and /bin/stty.

Do you know what this is?

tallboy
True freedom is a live Puppy on a multisession CD/DVD.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#18 Post by musher0 »

Hi, bzzt, bzzt, Tallboy.

No idea, bzzt, bzzt. :lol:

musher0

PS. There are mentions here:
http://www.info.com/searchw?qkw=ospeed& ... &qhqn=&KW=
Related to perl or tput ? I am afraid I can be of no help.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
GustavoYz
Posts: 883
Joined: Wed 07 Jul 2010, 05:11
Location: .ar

#19 Post by GustavoYz »

Something is overwriting ncurses ospeed, so less (and probably other programs as well) raise that error.
If you have installed Mono in your system, may have that problem.
Last edited by GustavoYz on Sat 27 Apr 2013, 22:44, edited 1 time in total.

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#20 Post by tallboy »

Thank you for that info, GustavoYz
I don't find Mono in my system.

Message: Symbol `ospeed' has different size in shared object, consider re-linking

I removed the original less symlink that pointed to busybox, could that be a clue? (the same message came when I just renamed the link)

What does ospeed do?

tallboy
True freedom is a live Puppy on a multisession CD/DVD.

Post Reply