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
0
votes
3 answers

How to scroll text output in Java?

Say I have a terminal with 30 lines of height. And say I have a loop that outputs 100 lines of output for(int i=0; i<100; i++){ System.out.println(i); } Is there a way I can output the first 30 lines, show text that says "Press enter to continue…
maček
  • 76,434
  • 37
  • 167
  • 198
0
votes
0 answers

How to fetch the date of the file from the folder in UNIX Shell Script?

I am beginner to Shell Script. Just want to know how to fetch date of the file from the properties in the UNIX Shell Script? When I put 'ls -lrt' , could fetch the date where as for last six months we could see only date and time but year is not…
karthickraja
  • 214
  • 1
  • 7
0
votes
0 answers

How to remap backspace in less?

According to lesskey \b signifies backspace, and \kx signifies delete. I have tried both: ~/.lesskey #command \kx back-screen \b back-screen on Kitty and Apple Terminal, and neither seems to work. ❯ less --version less 608 (PCRE2 regular…
Dominik Teiml
  • 505
  • 1
  • 4
  • 12
0
votes
1 answer

How does a program like less handle both piped stdin and keyboard input?

If I run, for example, ifconfig | less, the less program manages to at the same time: Capture output of ifconfig through the standard input where the output of ifconfig is piped React to user's keyboard input and be interactive I never gave this…
Max Yankov
  • 12,551
  • 12
  • 67
  • 135
0
votes
2 answers

Is there a way to reproduce 'less' screen behavior in bash?

I try to make a simple bash script that runs multiple tools, like dehader, cppcheck and a bunch of custom tools, and for readability, it cleans the terminal between each tool, and wait for the user to press the enter key before running the next…
Kyrela
  • 142
  • 1
  • 11
0
votes
0 answers

Git core pager less : leaving text in the console

So if I'm using Git mostly in the console and less as my core.pager, how can I make it so that whatever comes out stays in the console, with new prompt lines simply appended ? That way I can easily copy/paste outputs of less for future commands. In…
Charles
  • 988
  • 1
  • 11
  • 28
0
votes
1 answer

Less(1) with multiline color attributes

I have a tool to produce multiline colored attributes for VT100 and the like, including Xterm, rxvt, libvte (gnome-terminal, mate-terminal, terminator, etc...). When piping to less(1) (pager), the color attribute is lost at end of line, is that…
Phi
  • 735
  • 7
  • 22
0
votes
1 answer

Commandline subtitution on ksh is not being assigned to varibale

var2=$(echo "{$1}" | grep 'Objects that are still invalid after the validation:' | cut -d : -f2 | sed 's/ //g') echo $var2 the above commandline substitution is not working ksh, the variable is blank each time, have tried below command…
pradeep panda
  • 65
  • 1
  • 10
0
votes
1 answer

how to check whether a string starts with xx and ends with yy in shellscript?

In the below example I want to find whether the sentence starts with 'ap' and ends with 'e'. example: a="apple" if [[ "$a" == ^"ap"+$ ]] This is not giving proper output.
0
votes
1 answer

Unix less-like terminal scrolling in Java

By default, if lots of text is outputted, the terminal scrolls down to the very last line and then the user has to scroll all the way up to read from the top. I want a Java-like way to implement the scrolling offered in the Unix "less" program. I…
Mohit Deshpande
  • 53,877
  • 76
  • 193
  • 251
0
votes
0 answers

How do I stop tailing with less but don't break pipe

Say I invoke some-stream() { while true; do openssl rand -hex 8; done } some-stream | less +F And hit Ctrl-C then less will stop tailing, but if I hit F to resume tailing then no more output will be generated. Presumably because the pipe was…
fredefox
  • 681
  • 3
  • 11
0
votes
1 answer

How do I reach end of file in less terminal without ...skipping

If I have tree output in terminal with less with this function function tre() { tree -aC -I '.git|node_modules|bower_components' --dirsfirst "$@" | less -FRNX; } , it will scroll 1 line by pressing key each time. I need a shorcut or command to…
boleeluchshiy
  • 121
  • 1
  • 1
  • 9
0
votes
0 answers

Can't see updates using `less +F` to a file being written by Python

I have a Python code that does some computation and writes the data in C.csv file. The computation is huge and takes time. So while my program is running, I want to check if data is being written or not using: $ less +F C.csv What I notice is that…
Shubham
  • 2,847
  • 4
  • 24
  • 37
0
votes
2 answers

How to pipe help results to less by default?

I use "--help" or "-h" a lot. By default it uses cat to open help file. How can i set it to use less by default. I want the result of "command --help |less" to be the same as "command --help"
0
votes
0 answers

Using Bash Less and Grep together

I have been trying to follow and filter an log file using less +F +G /var/log/messages | grep -v -f ignoredwords.txt | grep -f words.txt but it seems the file is not continoulsy read and the operation stops once the whole file is read i have…
Saadi381
  • 55
  • 1
  • 2
  • 9