Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

75%
+4 −0
Q&A Make Less use a normal view instead of hexdump view

Less does not display data files normally, but if it were some sort of Xxd. $ bash --norc $ export LESS= $ file -i /var/log/lastlog /var/log/lastlog: application/octet-stream; charset=binary $...

1 answer  ·  posted 2y ago by Quasímodo‭  ·  edited 2y ago by Quasímodo‭

Question less
#3: Post edited by user avatar Quasímodo‭ · 2021-10-14T16:59:58Z (over 2 years ago)
Show environment variables; Explain why the issue may not be reproducible for some people.
  • Less does not display data files normally, but if it were some sort of Xxd.
  • ```
  • $ bash --norc
  • $ export LESS=
  • $ file -i /var/log/lastlog
  • /var/log/lastlog: application/octet-stream; charset=binary
  • $ less -EX /var/log/lastlog
  • 00000000 a3 4c d2 60 74 74 79 32 00 00 00 00 00 00 00 00 |.L.`tty2........|
  • 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  • *
  • 000474a0 ee c7 66 61 74 74 79 31 00 00 00 00 00 00 00 00 |..fatty1........|
  • 000474b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  • *
  • 000475c0 00 00 00 00 |....|
  • 000475c4
  • ```
  • Usually that is a good choice, but some data files are better read as normal text ([for example, `.viminfo`](https://powerusers.codidact.com/posts/284577/284581#answer-284581)). **How can I switch to the normal, plain text view in Less?**
  • I have searched for "binary", "hex" and "xxd" in Less' manual but there does not seem to be a mention of it. For the moment I'm using More, but More is less...
  • Less does not display data files normally, but if it were some sort of Xxd.
  • ```
  • $ bash --norc
  • $ export LESS=
  • $ file -i /var/log/lastlog
  • /var/log/lastlog: application/octet-stream; charset=binary
  • $ less -EX /var/log/lastlog
  • 00000000 a3 4c d2 60 74 74 79 32 00 00 00 00 00 00 00 00 |.L.`tty2........|
  • 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  • *
  • 000474a0 ee c7 66 61 74 74 79 31 00 00 00 00 00 00 00 00 |..fatty1........|
  • 000474b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  • *
  • 000475c0 00 00 00 00 |....|
  • 000475c4
  • ```
  • Usually that is a good choice, but some data files are better read as normal text. **How can I switch to the normal, plain text view in Less?**
  • I have searched for "binary", "hex" and "xxd" in Less' manual but there does not seem to be a mention of it.
  • ----
  • An update just to situate Canina's correct answer.
  • ```
  • $ env | grep LESS
  • LESS=-iRj4
  • LESSOPEN=|lesspipe %s
  • ```
  • `lesspipe` is a shell script with `# Copyright 1999-2020 Gentoo Authors`, so it is no surprise that many could not reproduce what I described.
#2: Post edited by user avatar Quasímodo‭ · 2021-10-13T13:33:19Z (over 2 years ago)
The problem is reproducible in a clean environment
  • Less does not display data files normally, but if it were some sort of Xxd.
  • ```
  • $ file -i /var/log/lastlog
  • /var/log/lastlog: application/octet-stream; charset=binary
  • $ less -EX /var/log/lastlog
  • 00000000 a3 4c d2 60 74 74 79 32 00 00 00 00 00 00 00 00 |.L.`tty2........|
  • 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  • *
  • 000474a0 ee c7 66 61 74 74 79 31 00 00 00 00 00 00 00 00 |..fatty1........|
  • 000474b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  • *
  • 000475c0 00 00 00 00 |....|
  • 000475c4
  • ```
  • Usually that is a good choice, but some data files are better read as normal text ([for example, `.viminfo`](https://powerusers.codidact.com/posts/284577/284581#answer-284581)). **How can I switch to the normal, plain text view in Less?**
  • I have searched for "binary", "hex" and "xxd" in Less' manual but there does not seem to be a mention of it. For the moment I'm using More, but More is less...
  • Less does not display data files normally, but if it were some sort of Xxd.
  • ```
  • $ bash --norc
  • $ export LESS=
  • $ file -i /var/log/lastlog
  • /var/log/lastlog: application/octet-stream; charset=binary
  • $ less -EX /var/log/lastlog
  • 00000000 a3 4c d2 60 74 74 79 32 00 00 00 00 00 00 00 00 |.L.`tty2........|
  • 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  • *
  • 000474a0 ee c7 66 61 74 74 79 31 00 00 00 00 00 00 00 00 |..fatty1........|
  • 000474b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
  • *
  • 000475c0 00 00 00 00 |....|
  • 000475c4
  • ```
  • Usually that is a good choice, but some data files are better read as normal text ([for example, `.viminfo`](https://powerusers.codidact.com/posts/284577/284581#answer-284581)). **How can I switch to the normal, plain text view in Less?**
  • I have searched for "binary", "hex" and "xxd" in Less' manual but there does not seem to be a mention of it. For the moment I'm using More, but More is less...
#1: Initial revision by user avatar Quasímodo‭ · 2021-10-13T13:10:31Z (over 2 years ago)
Make Less use a normal view instead of hexdump view
Less does not display data files normally, but if it were some sort of Xxd.

```
$ file -i /var/log/lastlog
/var/log/lastlog: application/octet-stream; charset=binary
$ less -EX /var/log/lastlog
00000000  a3 4c d2 60 74 74 79 32  00 00 00 00 00 00 00 00  |.L.`tty2........|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000474a0  ee c7 66 61 74 74 79 31  00 00 00 00 00 00 00 00  |..fatty1........|
000474b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000475c0  00 00 00 00                                       |....|
000475c4
```

Usually that is a good choice, but some data files are better read as normal text ([for example, `.viminfo`](https://powerusers.codidact.com/posts/284577/284581#answer-284581)). **How can I switch to the normal, plain text view in Less?**

I have searched for "binary", "hex" and "xxd" in Less' manual but there does not seem to be a mention of it. For the moment I'm using More, but More is less...