How can I view gzipped files in less without having to type zless?

Clash Royale CLAN TAG#URR8PPP
up vote
25
down vote
favorite
I am using Ubuntu, and I would like to be able to type less compressed_text_file.gz and page the contents of the text file in uncompressed form. Is there a way to do this?
less compression
add a comment |Â
up vote
25
down vote
favorite
I am using Ubuntu, and I would like to be able to type less compressed_text_file.gz and page the contents of the text file in uncompressed form. Is there a way to do this?
less compression
add a comment |Â
up vote
25
down vote
favorite
up vote
25
down vote
favorite
I am using Ubuntu, and I would like to be able to type less compressed_text_file.gz and page the contents of the text file in uncompressed form. Is there a way to do this?
less compression
I am using Ubuntu, and I would like to be able to type less compressed_text_file.gz and page the contents of the text file in uncompressed form. Is there a way to do this?
less compression
less compression
edited Apr 30 '11 at 18:34
Gilles
516k12210271556
516k12210271556
asked Apr 30 '11 at 18:20
Ryan Thompson
3,46332222
3,46332222
add a comment |Â
add a comment |Â
4 Answers
4
active
oldest
votes
up vote
27
down vote
accepted
You can configure the key bindings and set many settings for less in a file called ~/.lesskey. Once you've created the file, run the lesskey command; it generates a file called ~/.less which less reads when it starts.
The setting you want is LESSOPEN. It's an input formatter for less. The less package comes with a sample formatter in /bin/lesspipe; it decompresses gzipped files, shows content listings for many multi-file archive formats, and converts several formatted texts formats to plain text. In your ~/.lesskey:
#env
LESSOPEN=|/bin/lesspipe %s
add a comment |Â
up vote
28
down vote
Use zcat, then pipe it to less.
$ zcat $FILE | less
1
I would prefer iflessjust worked on compressed files.
â Ryan Thompson
May 6 '11 at 18:37
2
Unlike the accepted answer this one is a clean and unix-way solution. Thanks!
â Pavel Vlasov
Dec 8 '14 at 11:43
This is as simple as it gets, win. One thing to bear in mind is that if you open a large file with less, it opens in a useable way, straight away. With this approach, it will open but you won't be able to do much (if anything) until the compression has finished running it all through the pipe. So if you're planning on opening it repeatedly, it's better to decompress it first. Otherwise, do this and check your emails or something :)
â Max Williams
Jul 4 at 7:31
add a comment |Â
up vote
1
down vote
I'm using IBM and when using zcat, it will complains that it can't find the file ending with .Z.
On IBM one can use gzcat:
$ gzcat log_file.gz | less
What do you mean by "using IBM"? Do you mean AIX?
â Duncan X Simpson
Sep 29 at 18:11
add a comment |Â
up vote
0
down vote
Viet's answer is also necessary on Solaris 5
$ gzcat log_file.gz | less
New contributor
John is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
27
down vote
accepted
You can configure the key bindings and set many settings for less in a file called ~/.lesskey. Once you've created the file, run the lesskey command; it generates a file called ~/.less which less reads when it starts.
The setting you want is LESSOPEN. It's an input formatter for less. The less package comes with a sample formatter in /bin/lesspipe; it decompresses gzipped files, shows content listings for many multi-file archive formats, and converts several formatted texts formats to plain text. In your ~/.lesskey:
#env
LESSOPEN=|/bin/lesspipe %s
add a comment |Â
up vote
27
down vote
accepted
You can configure the key bindings and set many settings for less in a file called ~/.lesskey. Once you've created the file, run the lesskey command; it generates a file called ~/.less which less reads when it starts.
The setting you want is LESSOPEN. It's an input formatter for less. The less package comes with a sample formatter in /bin/lesspipe; it decompresses gzipped files, shows content listings for many multi-file archive formats, and converts several formatted texts formats to plain text. In your ~/.lesskey:
#env
LESSOPEN=|/bin/lesspipe %s
add a comment |Â
up vote
27
down vote
accepted
up vote
27
down vote
accepted
You can configure the key bindings and set many settings for less in a file called ~/.lesskey. Once you've created the file, run the lesskey command; it generates a file called ~/.less which less reads when it starts.
The setting you want is LESSOPEN. It's an input formatter for less. The less package comes with a sample formatter in /bin/lesspipe; it decompresses gzipped files, shows content listings for many multi-file archive formats, and converts several formatted texts formats to plain text. In your ~/.lesskey:
#env
LESSOPEN=|/bin/lesspipe %s
You can configure the key bindings and set many settings for less in a file called ~/.lesskey. Once you've created the file, run the lesskey command; it generates a file called ~/.less which less reads when it starts.
The setting you want is LESSOPEN. It's an input formatter for less. The less package comes with a sample formatter in /bin/lesspipe; it decompresses gzipped files, shows content listings for many multi-file archive formats, and converts several formatted texts formats to plain text. In your ~/.lesskey:
#env
LESSOPEN=|/bin/lesspipe %s
answered Apr 30 '11 at 18:34
Gilles
516k12210271556
516k12210271556
add a comment |Â
add a comment |Â
up vote
28
down vote
Use zcat, then pipe it to less.
$ zcat $FILE | less
1
I would prefer iflessjust worked on compressed files.
â Ryan Thompson
May 6 '11 at 18:37
2
Unlike the accepted answer this one is a clean and unix-way solution. Thanks!
â Pavel Vlasov
Dec 8 '14 at 11:43
This is as simple as it gets, win. One thing to bear in mind is that if you open a large file with less, it opens in a useable way, straight away. With this approach, it will open but you won't be able to do much (if anything) until the compression has finished running it all through the pipe. So if you're planning on opening it repeatedly, it's better to decompress it first. Otherwise, do this and check your emails or something :)
â Max Williams
Jul 4 at 7:31
add a comment |Â
up vote
28
down vote
Use zcat, then pipe it to less.
$ zcat $FILE | less
1
I would prefer iflessjust worked on compressed files.
â Ryan Thompson
May 6 '11 at 18:37
2
Unlike the accepted answer this one is a clean and unix-way solution. Thanks!
â Pavel Vlasov
Dec 8 '14 at 11:43
This is as simple as it gets, win. One thing to bear in mind is that if you open a large file with less, it opens in a useable way, straight away. With this approach, it will open but you won't be able to do much (if anything) until the compression has finished running it all through the pipe. So if you're planning on opening it repeatedly, it's better to decompress it first. Otherwise, do this and check your emails or something :)
â Max Williams
Jul 4 at 7:31
add a comment |Â
up vote
28
down vote
up vote
28
down vote
Use zcat, then pipe it to less.
$ zcat $FILE | less
Use zcat, then pipe it to less.
$ zcat $FILE | less
edited May 6 '11 at 7:42
Michael Mrozekâ¦
59.3k27187208
59.3k27187208
answered May 6 '11 at 7:09
Alex
28122
28122
1
I would prefer iflessjust worked on compressed files.
â Ryan Thompson
May 6 '11 at 18:37
2
Unlike the accepted answer this one is a clean and unix-way solution. Thanks!
â Pavel Vlasov
Dec 8 '14 at 11:43
This is as simple as it gets, win. One thing to bear in mind is that if you open a large file with less, it opens in a useable way, straight away. With this approach, it will open but you won't be able to do much (if anything) until the compression has finished running it all through the pipe. So if you're planning on opening it repeatedly, it's better to decompress it first. Otherwise, do this and check your emails or something :)
â Max Williams
Jul 4 at 7:31
add a comment |Â
1
I would prefer iflessjust worked on compressed files.
â Ryan Thompson
May 6 '11 at 18:37
2
Unlike the accepted answer this one is a clean and unix-way solution. Thanks!
â Pavel Vlasov
Dec 8 '14 at 11:43
This is as simple as it gets, win. One thing to bear in mind is that if you open a large file with less, it opens in a useable way, straight away. With this approach, it will open but you won't be able to do much (if anything) until the compression has finished running it all through the pipe. So if you're planning on opening it repeatedly, it's better to decompress it first. Otherwise, do this and check your emails or something :)
â Max Williams
Jul 4 at 7:31
1
1
I would prefer if
less just worked on compressed files.â Ryan Thompson
May 6 '11 at 18:37
I would prefer if
less just worked on compressed files.â Ryan Thompson
May 6 '11 at 18:37
2
2
Unlike the accepted answer this one is a clean and unix-way solution. Thanks!
â Pavel Vlasov
Dec 8 '14 at 11:43
Unlike the accepted answer this one is a clean and unix-way solution. Thanks!
â Pavel Vlasov
Dec 8 '14 at 11:43
This is as simple as it gets, win. One thing to bear in mind is that if you open a large file with less, it opens in a useable way, straight away. With this approach, it will open but you won't be able to do much (if anything) until the compression has finished running it all through the pipe. So if you're planning on opening it repeatedly, it's better to decompress it first. Otherwise, do this and check your emails or something :)
â Max Williams
Jul 4 at 7:31
This is as simple as it gets, win. One thing to bear in mind is that if you open a large file with less, it opens in a useable way, straight away. With this approach, it will open but you won't be able to do much (if anything) until the compression has finished running it all through the pipe. So if you're planning on opening it repeatedly, it's better to decompress it first. Otherwise, do this and check your emails or something :)
â Max Williams
Jul 4 at 7:31
add a comment |Â
up vote
1
down vote
I'm using IBM and when using zcat, it will complains that it can't find the file ending with .Z.
On IBM one can use gzcat:
$ gzcat log_file.gz | less
What do you mean by "using IBM"? Do you mean AIX?
â Duncan X Simpson
Sep 29 at 18:11
add a comment |Â
up vote
1
down vote
I'm using IBM and when using zcat, it will complains that it can't find the file ending with .Z.
On IBM one can use gzcat:
$ gzcat log_file.gz | less
What do you mean by "using IBM"? Do you mean AIX?
â Duncan X Simpson
Sep 29 at 18:11
add a comment |Â
up vote
1
down vote
up vote
1
down vote
I'm using IBM and when using zcat, it will complains that it can't find the file ending with .Z.
On IBM one can use gzcat:
$ gzcat log_file.gz | less
I'm using IBM and when using zcat, it will complains that it can't find the file ending with .Z.
On IBM one can use gzcat:
$ gzcat log_file.gz | less
answered Dec 14 '17 at 13:30
Viet
1214
1214
What do you mean by "using IBM"? Do you mean AIX?
â Duncan X Simpson
Sep 29 at 18:11
add a comment |Â
What do you mean by "using IBM"? Do you mean AIX?
â Duncan X Simpson
Sep 29 at 18:11
What do you mean by "using IBM"? Do you mean AIX?
â Duncan X Simpson
Sep 29 at 18:11
What do you mean by "using IBM"? Do you mean AIX?
â Duncan X Simpson
Sep 29 at 18:11
add a comment |Â
up vote
0
down vote
Viet's answer is also necessary on Solaris 5
$ gzcat log_file.gz | less
New contributor
John is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
0
down vote
Viet's answer is also necessary on Solaris 5
$ gzcat log_file.gz | less
New contributor
John is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Viet's answer is also necessary on Solaris 5
$ gzcat log_file.gz | less
New contributor
John is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Viet's answer is also necessary on Solaris 5
$ gzcat log_file.gz | less
New contributor
John is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
John is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered 8 mins ago
John
11
11
New contributor
John is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
John is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
John is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f12383%2fhow-can-i-view-gzipped-files-in-less-without-having-to-type-zless%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password