Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

19 votes
7 answers
3646 views
pager program like less, able to repeat top N lines
Is there any way to make `less` program repeat first line (or first 2 lines) on every displayed page? Is there any other pager program which can do this? This would be a killer-app for database table browsing, think `mysql` or `psql` or `gqlplus`... See the screenshot. [![Console pager for psql outp...
Is there any way to make less program repeat first line (or first 2 lines) on every displayed page? Is there any other pager program which can do this? This would be a killer-app for database table browsing, think mysql or psql or gqlplus... See the screenshot. Console pager for psql output I want to repeat header line + horizontal ascii bar. Identically as the "Freeze Top N Rows" feature known from spreadsheet software.
filiprem (439 rep)
Dec 28, 2011, 11:26 AM • Last activity: May 16, 2025, 03:27 PM
0 votes
2 answers
2607 views
Obtaining starting adress of a page
I want to obtain the beginning of a memory page, a page that contains a function. In my case I try to achieve the page beginning of main function. Which lies in `0x400a80`, I think it is in code section of memory. I would appreciate if you can verify whether it is true or not. As far as I understood...
I want to obtain the beginning of a memory page, a page that contains a function. In my case I try to achieve the page beginning of main function. Which lies in 0x400a80, I think it is in code section of memory. I would appreciate if you can verify whether it is true or not. As far as I understood, adress 0x400a80 lies in a page. When I show memory segments of my process with pmap, it shows a segment starting with 0x400000 with size 8K, and the next portion goes with 0x601000 with size 4K. I want to obtain adress 0x400000 because it has the address of the main() function. How can I achieve starting adress of a page when I have an adress that resides in that page? Is there any built-in way to do in linux ?
Utku (1 rep)
May 5, 2020, 09:04 AM • Last activity: Apr 10, 2025, 02:09 PM
11 votes
1 answers
13534 views
Changing default (man) pager on Solaris 10
I'm working on Solaris 10, using bash. Want to change default pager from "more" to "less" (because "less is more" :). Tried to do the following: PAGER=less PS. When I do it in csh via setenv PAGER less then it works
I'm working on Solaris 10, using bash. Want to change default pager from "more" to "less" (because "less is more" :). Tried to do the following: PAGER=less PS. When I do it in csh via setenv PAGER less then it works
stevica (183 rep)
Nov 8, 2018, 09:56 AM • Last activity: Jan 8, 2025, 02:05 PM
1 votes
1 answers
431 views
In Less, how to jump horizontally between search matches on the same line?
On pressing n , Less skips all the search matches in the current line and moves to the next *line* with a match (even if the lines are wrapped). How can I make it move the cursor to all the matches in each line?
On pressing n, Less skips all the search matches in the current line and moves to the next *line* with a match (even if the lines are wrapped). How can I make it move the cursor to all the matches in each line?
Arch Stanton (355 rep)
Aug 4, 2021, 07:23 AM • Last activity: Nov 23, 2024, 11:17 AM
4 votes
1 answers
494 views
How do I stop 'more' from stopping and displaying "(END)" at the end of files in Debian 12 (bookworm)?
Since upgrading to Debian 12 (bookworm), the `more` command seems to have been changed and now comes to a stop when you reach the end of the file you are viewing and then displays "**(END)**", rather than just returning you to the command line (or prompting you to move on to the next file, if you ar...
Since upgrading to Debian 12 (bookworm), the more command seems to have been changed and now comes to a stop when you reach the end of the file you are viewing and then displays "**(END)**", rather than just returning you to the command line (or prompting you to move on to the next file, if you are trying to view multiple files), as it did before. It seems that I now need to press q to actually quit more to return to the command line - but this would then prevent me from viewing the next file(s) I had named (in the case of multiple files), and so in that case I would then need to explicitly use the "Go to next file" keyboard not-so-shortcut. As someone with many years of muscle memory of `` being the universal Do The Right Thing shortcut, this change is really very annoying! Is there a way to make more revert to the previous more sensible behaviour, or is it maybe now sadly time for me to look into using a different file pager program instead?
dave559 (451 rep)
Nov 21, 2024, 10:58 AM • Last activity: Nov 22, 2024, 09:46 AM
3 votes
2 answers
371 views
how to alias the `history` function in fish shell
I'm trying to set the fish `history` pager to be `bat -l fish` for syntax highlighting. (i.e. set the `PAGER` environment variable `bat -l fish` just for the `history` command). I tried: ```bash # 1: alias history "PAGER='bat -l fish' history" # results in "The function “history” calls itself immedi...
I'm trying to set the fish history pager to be bat -l fish for syntax highlighting. (i.e. set the PAGER environment variable bat -l fish just for the history command). I tried:
# 1:
alias history "PAGER='bat -l fish' history" 
# results in "The function “history” calls itself immediately, which would result in an infinite loop"

# 2:
alias history "PAGER='bat -l fish' \history"
# results in the same.

# 3:
alias _old_history history
alias history "PAGER='bat -l fish' _old_history"
# results in (line 1): The call stack limit has been exceeded
I'm aware that abbr works in this case, but this changes my history command, and this is not what I want.
matan h (149 rep)
Jun 13, 2024, 12:17 PM • Last activity: Jun 14, 2024, 12:38 PM
19 votes
1 answers
2194 views
Is there any way of changing most keybindings to something more familiar?
`most` pager is nice, but its default keybindings are unlike any other. As I don't want to learn a whole new set of keybindings for my pager (no matter how fancy and wonderful it is), is there any way of making `most` hotkeys feel more like `vi`, `less` and others?
most pager is nice, but its default keybindings are unlike any other. As I don't want to learn a whole new set of keybindings for my pager (no matter how fancy and wonderful it is), is there any way of making most hotkeys feel more like vi, less and others?
kirushik (471 rep)
Mar 21, 2016, 01:51 PM • Last activity: Jun 9, 2024, 02:45 PM
3 votes
2 answers
2989 views
What is the `less` command line option to page to the next file at the end of the current one?
I'm sure there used to be an option in `less` which allowed you to page onto the next file after you reached the end of the current file, so you could just keep *space*ing through a bunch of short files without having to keep `:n`ing to get to the next one. Could someone remind me what it is?
I'm sure there used to be an option in less which allowed you to page onto the next file after you reached the end of the current file, so you could just keep *space*ing through a bunch of short files without having to keep :ning to get to the next one. Could someone remind me what it is?
Mark Booth (1061 rep)
Jul 13, 2011, 02:03 PM • Last activity: May 9, 2024, 01:41 PM
4 votes
1 answers
252 views
How to prevent less --quit-if-one-screen --no-init +G from filling the screen with empty lines when the file is shorter than the screen?
I use ``` less -XFR +G ``` to page some variations of `git log`, and **all four options are important**. The thing I don't like is that it fills the screen with empty lines (marked with `~`) when the log/file is shorter than a screen. The shorter repro steps that I could find are the following: ```...
I use
less -XFR +G
to page some variations of git log, and **all four options are important**. The thing I don't like is that it fills the screen with empty lines (marked with ~) when the log/file is shorter than a screen. The shorter repro steps that I could find are the following:
echo -e 'one\ntwo\nthree' | less -F +G
I would like the command to behave just like it was not there if the file fits the page.
Enlico (2258 rep)
Apr 21, 2020, 06:45 PM • Last activity: Apr 24, 2024, 03:08 AM
8 votes
6 answers
6941 views
Viewing man pages with scroll wheel support
I'd like to use the scroll wheel (xterm mouse escape codes) to scroll through man pages, like I can in emacs with `xterm-mouse-mode`. less doesn't seem to have support for that and short of recompiling it I can't find a way to add it. Is there a different pager I could use that supports the scroll w...
I'd like to use the scroll wheel (xterm mouse escape codes) to scroll through man pages, like I can in emacs with xterm-mouse-mode. less doesn't seem to have support for that and short of recompiling it I can't find a way to add it. Is there a different pager I could use that supports the scroll wheel (or a way I could get less to do it)? I'd rather not give up bold and underline if possible. My emulator is iTerm2 on Mac OS X Yosemite, if that helps.
0942v8653 (233 rep)
Feb 13, 2015, 12:23 AM • Last activity: Apr 4, 2024, 03:51 PM
1 votes
1 answers
135 views
less option "--save-marks" does nothing when less is used as a manual pager
I use `less` version 590 (GNU regular expressions). I use export LESSFILE="/root/.lesshst_for_manpages" export MANPAGER="pager --save-marks -I" man -L en > ... but `--save-marks` appears to have no effect when setting marks in manuals (using the `m` command in the pager). When reading the same manua...
I use less version 590 (GNU regular expressions). I use export LESSFILE="/root/.lesshst_for_manpages" export MANPAGER="pager --save-marks -I" man -L en > ... but --save-marks appears to have no effect when setting marks in manuals (using the m command in the pager). When reading the same manual again, the pager does not seem to remember the previously set marks. What can I do?
Anton Wessel (121 rep)
Dec 14, 2022, 10:44 AM • Last activity: Mar 27, 2024, 09:12 PM
5 votes
3 answers
9797 views
Bash always outputs to less, how can I turn this off?
After a recent update `bash` seems to always output to `less`, which is resulting in pagination for many commands. Does anyone know how to turn `less` off? Example output for `systemctl status` [![Output of systemctl status][1]][1] [1]: https://i.sstatic.net/hqsCP.png
After a recent update bash seems to always output to less, which is resulting in pagination for many commands. Does anyone know how to turn less off? Example output for systemctl status Output of systemctl status
user180820 (91 rep)
Apr 8, 2017, 11:26 AM • Last activity: Feb 20, 2024, 12:30 PM
6 votes
4 answers
2015 views
How do I add line numbers to the man page?
How can I add line numbers to `man` pages or `info` pages in Linux? I want to use line numbers to navigate in man pages. I can write the man page in a file and then open it with Vim, but is there a better way?
How can I add line numbers to man pages or info pages in Linux? I want to use line numbers to navigate in man pages. I can write the man page in a file and then open it with Vim, but is there a better way?
mohamadi_arch (215 rep)
Jan 22, 2024, 11:16 AM • Last activity: Jan 25, 2024, 08:06 AM
2 votes
2 answers
1689 views
How do I change the PAGER variable for man if it's possible?
I'm not an expert in Linux, but I was reading an introductory book and found that `man` pages use the `PAGER` environment variable to show the content of `man` pages. I checked `printenv` and didn't find any `PAGER` variable there. However, since it's a binary, and the path to `/usr/bin` is in my pa...
I'm not an expert in Linux, but I was reading an introductory book and found that man pages use the PAGER environment variable to show the content of man pages. I checked printenv and didn't find any PAGER variable there. However, since it's a binary, and the path to /usr/bin is in my path, there is a program called pager in Linux as well, and I think it's what is the default option for $PAGER. Just out of curiosity I would like to know how to modify this PAGER variable. I tried adding one to my bashfile but that didn't work, couldn't find how pager can be changed. And whats so special about pager - I expect any program that can read from stdin, or support piping stuff, can be pager, can vim be a pager? Internally it seems the man just uses sed to send data to a defined PAGER variable because doing following works, but fails.
env PAGER=/usr/bin/nano man printf
and I get an error, like following enter image description here
Yanjan. Kaf. (129 rep)
Oct 13, 2023, 11:43 AM • Last activity: Oct 14, 2023, 05:17 AM
0 votes
3 answers
236 views
open man (or info) pages from the same position where you left off last time
I treat man pages is the primary source of documentation about installed software. I would like to use them not only as a reference, but actually read them from beginning to end. And here comes the question. When I close the man page, next time I want it to be opened at the place I left off. Is it p...
I treat man pages is the primary source of documentation about installed software. I would like to use them not only as a reference, but actually read them from beginning to end. And here comes the question. When I close the man page, next time I want it to be opened at the place I left off. Is it possible? Ideally it would work with less, which is the default system pager. But I am OK to change it to any pager that will do the trick. Standalone vim for example remembers position the file was read at last time. There might be some way to use it as a pager remembering position. Please try your idea before posting comments/answer.
Sergey Guzenkov (17 rep)
Oct 11, 2023, 05:45 PM • Last activity: Oct 13, 2023, 11:52 PM
0 votes
1 answers
106 views
mkfs.xfs completely ignoring "|more" redirect
trying to install gentoo linux and can't format the drive with xfs because when I run `mkfs.xfs /dev/sda3` it throws an error and then displays help, but the help is so big that it takes up the entire screen and I can't scroll up because Im on tty1. `mkfs.xfs /dev/sda1 |more` does nothing, it still...
trying to install gentoo linux and can't format the drive with xfs because when I run mkfs.xfs /dev/sda3 it throws an error and then displays help, but the help is so big that it takes up the entire screen and I can't scroll up because Im on tty1. mkfs.xfs /dev/sda1 |more does nothing, it still shows the enlarged help and doesn't pause. I've tried redirecting the output to a file using
cat mkfs.xfs /dev/sda1 > file.txt 2>&1
but it just outputs garbage
Zack (1 rep)
Aug 25, 2023, 11:56 PM • Last activity: Aug 26, 2023, 02:00 PM
2 votes
1 answers
428 views
Oh-my-zsh deletes output of successful command with "FAIL: 141"
My Oh-my-zsh does the following: 1. When I run the `git log --pretty --oneline` command, it shows me a long list of commits, as expected. 2. As soon as I hit q , it suddenly disappears with the below output: ``` $ git log --pretty --oneline FAIL: 141 ``` Why is this happening, and how do I fix it?
My Oh-my-zsh does the following: 1. When I run the git log --pretty --oneline command, it shows me a long list of commits, as expected. 2. As soon as I hit q, it suddenly disappears with the below output:
$ git log --pretty --oneline
    FAIL: 141
Why is this happening, and how do I fix it?
ritratt (131 rep)
Apr 24, 2023, 09:34 PM • Last activity: Apr 25, 2023, 07:58 AM
10 votes
1 answers
895 views
Issue viewing compressed file with "zless", but not with "zmore" or "gunzip -c"
On my FreeBSD 13.2 system, the `zless` utility cannot view text files compressed with `gzip` or `compress`, warning that they may be binary files and then showing garbage if I say I want to see the contents anyway. Strangely, using `zmore` or `gunzip -c` seems to work. ```shell $ zless znapzend.log....
On my FreeBSD 13.2 system, the zless utility cannot view text files compressed with gzip or compress, warning that they may be binary files and then showing garbage if I say I want to see the contents anyway. Strangely, using zmore or gunzip -c seems to work.
$ zless znapzend.log.1.gz
"znapzend.log.1.gz" may be a binary file.  See it anyway?
(Answering affirmatively sends binary data to the terminal.)
$ zless --version
less 608 (POSIX regular expressions)
Copyright (C) 1984-2022  Mark Nudelman

less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Home page: https://greenwoodsoftware.com/less 
$ zmore --version
less 608 (POSIX regular expressions)
Copyright (C) 1984-2022  Mark Nudelman

less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Home page: https://greenwoodsoftware.com/less 
What is the cause of this?
Kusalananda (354278 rep)
Apr 16, 2023, 12:29 PM • Last activity: Apr 17, 2023, 11:35 AM
0 votes
1 answers
355 views
Any 'cat' colorized tool?
I sometimes `cat` a c file or a JSON file, there is no colorful format text. Is there any command line tool that can show colorful format text as it is in ex: gedit?
I sometimes cat a c file or a JSON file, there is no colorful format text. Is there any command line tool that can show colorful format text as it is in ex: gedit?
Mark K (955 rep)
Mar 29, 2023, 06:12 AM • Last activity: Mar 29, 2023, 10:33 PM
5 votes
3 answers
267 views
Restore interactive commands after accidentally overpaging pipe input to less?
Consider a script like this: $ cat example.sh #! /usr/bin/env bash for i in {1..90} do printf '%s\n' "$i" done sleep 10 printf '91\n' sleep 10 printf 'done\n' and suppose the output is piped to less, like so: $ bash example.sh | less If I scroll down as far as line 90, I can scroll back up again, se...
Consider a script like this: $ cat example.sh #! /usr/bin/env bash for i in {1..90} do printf '%s\n' "$i" done sleep 10 printf '91\n' sleep 10 printf 'done\n' and suppose the output is piped to less, like so: $ bash example.sh | less If I scroll down as far as line 90, I can scroll back up again, search, and use any other interactive commands that less provides. However, as soon as I try to go past line 90 with e.g. j or Ctrl-N, less stops responding to interactive commands until another line of input is available. And if I try to scroll a full pageful past line 90 with e.g. spacebar, less stops responding to interactive commands until a full page of input is available or it receives EOF. This can be undesirable if I want to look at previous output and don't realize I have just gone over the available lines and must wait for more lines to appear, which could require an arbitrary amount of time. If I use Ctrl-C to send SIGINT, I can immediately get interactivity again, but then less will stop listening for more input from the pipe. The script is just an easily reproducible example, but it could be replaced by any long-running command that slowly generates lines of output, such as finding broken symbolic links: $ find $HOME -xtype l | less or world-readable permissions in my home directory: $ find $HOME -perm 777 | less or any number of other slow, resource-intensive commands that send lines to stdout. Is there any way I can tell less to stop waiting for more input and regain interactive commands without waiting for the required lines of input to be generated from the pipe?
Nathaniel M. Beaver (1398 rep)
Oct 20, 2019, 07:29 PM • Last activity: Mar 1, 2023, 02:10 PM
Showing page 1 of 20 total questions