Debian Codegraph @

upstream/debian-unstable/man1/lesspipe.1

raw
1 .TH LESSOPEN 1
2 .\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection
3 .\" other parms are allowed: see man(7), man(1)
4 .SH NAME
5 lessfile, lesspipe \- "input preprocessor" for less.
6 .SH SYNOPSIS
7 .B lessfile, lesspipe
8 .SH "DESCRIPTION"
9 This manual page documents briefly the
10 .IR lessfile ,
11 and
12 .I lesspipe
13 commands.
14 This manual page was written for the Debian GNU/Linux distribution
15 because the input preprocessor scripts are provided by Debian GNU/Linux and
16 are not part of the original program.
17 .PP
18 .I lessfile
19 and
20 .I lesspipe
21 are programs that can be used to modify the way the contents of a file are
22 displayed in
23 .I less.
24 What this means is that
25 .I less
26 can automatically open
27 up tar files, uncompress gzipped files, and even display something reasonable
28 for graphics files.
29 .PP
30 .I lesspipe
31 will toss the contents/info on STDOUT and
32 .I less
33 will read them
34 as they come across. This means that you do not have to wait for the
35 decoding to finish before less shows you the file. This also means that
36 you will get a 'byte N' instead of an N% as your file position. You can
37 seek to the end and back to get the N% but that means you have to wait
38 for the pipe to finish.
39 .PP
40 .I lessfile
41 will toss the contents/info on a file which
42 .I less
43 will then
44 read. After you are done,
45 .I lessfile
46 will then delete the file. This means that the process has to finish before
47 you see it, but you get nice percentages (N%) up front.
48 .
49 .SH USAGE
50 Just put one of the following two commands in your login script (e.g.
51 ~/.bash_profile):
52 .PP
53 eval "$(lessfile)"
54 .PP
55 or
56 .PP
57 eval "$(lesspipe)"
58 .SH FILE TYPE RECOGNITION
59 File types are recognized by their extensions.
60 This is a list of currently supported extensions
61 (grouped by the programs that handle them):
62
63 .DS
64 *.a
65 *.arj
66 *.tar.bz2
67 *.bz
68 *.bz2
69 *.deb, *.udeb, *.ddeb
70 *.doc
71 *.egg
72 *.gif, *.jpeg, *.jpg, *.pcd, *.png, *.tga, *.tiff, *.tif
73 *.iso, *.raw, *.bin
74 *.lha, *.lzh
75 *.tar.lz, *.tlz
76 *.lz
77 *.7z
78 *.pdf
79 *.rar, *.r[0-9][0-9]
80 *.rpm
81 *.tar.gz, *.tgz, *.tar.z, *.tar.dz
82 *.gz, *.z, *.dz
83 *.tar
84 *.tar.xz, *.xz
85 *.whl
86 *.jar, *.war, *.xpi, *.zip
87 *.zoo
88 *.tar.zst, *.tzst
89 *.zst
90 .DE
91 .SH USER DEFINED FILTERS
92 It is possible to extend and overwrite the default
93 .I lesspipe
94 and
95 .I lessfile
96 input processor if you have specialized requirements. Create an executable
97 program with the name
98 .I .lessfilter
99 and put it into your home directory. This can be a shell script or a binary
100 program.
101
102 .PP
103 It is important that this program returns the correct exit code: return 0 if
104 your filter handles the input, return 1 if the standard
105 .I lesspipe/lessfile
106 filter should handle the input.
107
108 .PP
109 Here is an example script:
110
111 .DS
112 #!/bin/sh
113
114 case "$1" in
115 *.extension)
116 extension-handler "$1"
117 ;;
118 *)
119 # We don't handle this format.
120 exit 1
121 esac
122
123 # No further processing by lesspipe necessary
124 exit 0
125 .DE
126
127 .SH FILES
128 .TP
129 .I ~/.lessfilter
130 Executable file that can do user defined processing. See section USER DEFINED
131 FILTERS for more information.
132 .SH BUGS
133 .PP
134 Sometimes, less does not display the contents file you want to view but output
135 that is produced by your login scripts (~/.bashrc or ~/.bash_profile). This
136 happens because less uses your current shell to run the lesspipe filter. Bash
137 first looks for the variable $BASH_ENV in the environment expands its value
138 and uses the expanded value as the name of a file to read and execute. If
139 this file produces any output less will display this. A way to solve this
140 problem is to put the following lines on the top of your login script that
141 produces output:
142
143 .DS
144 if [ -z "$PS1" ]; then
145 exit
146 fi
147 .DE
148
149 This tests whether the prompt variable $PS1 is set and if it isn't (which is
150 the case for non-interactive shells) it will exit the script.
151 .SH "SEE ALSO"
152 less(1)
153 .SH AUTHOR
154 This manual page was written by Thomas Schoepf <[email protected]>,
155 for the Debian GNU/Linux system (but may be used by others). Most of the
156 text was copied from a description written by Darren Stalder <[email protected]>.