Questions tagged [less-unix]

It's a UNIX command to display a file.

Example: less file will display the file file.

See discussion in Meta for the history on why is used for this instead of , which is broadly used for CSS.

139 questions
2
votes
1 answer

Python shell script open less with +F option

I have the following Python script, all seems to work how I want it to, except for the following: less opens with the option -F, this will follow the file like Tail would. to inspect (move through) the file the user has to ctrl + c to send an…
2
votes
4 answers

Powershell, paginating output from foreach

Seems like this should be simple, but powershell is winning another battle with me. Simply wanting to output the name of all the services running on a system, and their executable path, and pipe that into something I can use to search through it…
2
votes
1 answer

How does terminal programs add scrolling to the screen?

How does the programs less, more, or vi add a scrolling section on the terminal screen without clearing the screen and how does it disappear afterwards? Is there any way to run less for a specific amount of time if I was running it from a script or…
user3442743
2
votes
1 answer

linux less command search invisible character

I want search one invisible character(control character, such as 0x05) using less command in Linux. I find the character is displayed as ^E in less. I can not search it by directly using the characters "^E" . Neither ctrl+vctrl+e in VI or just…
bluearrow
  • 856
  • 2
  • 11
  • 26
2
votes
1 answer

Tailing less with a custom LESSOPEN colorize script

I've written the following script to pick out keywords from a log file and highlight terms: #!/bin/bash case "$1" in *.log) sed -e "s/\(.*\[Error\ \].*\)/\x1B[31m&\x1b[0m/" "$1" \ | sed -e "s/\(.*\[Warn\ \ \].*\)/\x1B[33m&\x1b[0m/"…
Graeme
  • 4,514
  • 5
  • 43
  • 71
1
vote
1 answer

pipe "less" content out, when "less" get content from stdin

In "ipython", we use some_obj?? to get documentation, which uses "less" to show the docs. How can we get the document out of "less", into a text editor? The content is fed from stdin, so pressing "v" gives the error: "can not edit standard input"
Andrew_1510
  • 12,258
  • 9
  • 51
  • 52
1
vote
1 answer

Mercurial (TortoiseHG) command-line on Windows does not respond to pager environment variables (and fails to use a pager at all)

When I run commands such as hg log, I expect to see the output in a pager. I have configured my repository .hg\hgrc to use less: ... [pager] pager = C:\path\to\bin\less.exe ... I have confirmed that less is correctly installed, as I am able to run…
Dancing Bear
  • 55
  • 1
  • 8
1
vote
1 answer

How to offset the line numbering from within `less` (i.e., specify starting number)?

Given the following ... $ less -N file.txt 1 first line 2 second line 3 third line 4 fourth line file.txt (END) ... I'd like to do something like this: $ less -N --STARTING-NUMBER=0 file.txt 0 first line 1 second…
1
vote
0 answers

Communication between child and parent process through pipe in unix c

The program first creates a pipe, and then creates a child process of the current process through fork(). Then each process closes the file descriptors that are not needed for the read and write pipes. The child process executes the ls -a command…
ayaz
  • 11
  • 1
1
vote
1 answer

how to filter special characters and blank lines in unix

I want to display lines containing blank lines and special characters (?#!%#). i used grep command for special characters but its not working for blank line. grep -n '[]?#!*%[]' file if someone can please try this one? Thank you
1
vote
1 answer

Segfault when reading from a file descriptor created by popen() in c

I'm debugging less utility. It creates a file descriptor by calling popen(). fd = popen(scmd, "r"); scmd is: (gdb) p scmd $3 = 0x555555591f00 "/bin/bash -c lessecho\\ -p0x22\\ -d0x22\\ -e\\\\\\\\\\ -n0x3b\\ -n0x20\\ -n0x2a\\ -n0x3f\\ -n0x9\\…
潇洒张
  • 273
  • 2
  • 9
1
vote
0 answers

Delayed paging using `less`

I have a scripts which generates huge amount of data and dump it to stdout. Using less it is easy to scroll through it: ./myscript | less If myscript is running and providing data continuously, the latest less can update the view automatically (if…
Tibor Takács
  • 3,535
  • 1
  • 20
  • 23
1
vote
1 answer

Read pdf on terminal output 2 columns to one

I like to read pdf with less command lately. less file.pdf Would like to read a pdf book which is two columns format. There should be a command to output in one column, right? Note: For each page changes with ^L Something like pipe with awk? Would…
Cristo
  • 700
  • 1
  • 8
  • 20
1
vote
1 answer

Bash test effective (paginated) lines of file before displaying

I just created a script to display the contents of a file, either with cat or with less based on the number of effective (post-line-wrap) number of lines in the file. To be clear, what I have works well, I'm just curious if anyone has something…
memtha
  • 797
  • 5
  • 24
1
vote
1 answer

How to clear the screen after exiting less, man and vim

When I exit from the man page, less and vim the screen doesn't clear. I don't mean the clear command rather I want to see the previous screen that I entered before the man or less. There is a less -X (--no-init) command that doesn't clear the screen…
Kavian
  • 107
  • 7