Tag Info

New answers tagged

0

The cat stays on the screen. Everything less disapears. Clarified by/for Volker Siegel: The output of cat stays on the screen. Everything shown by less disapears after closing.


2

That's completely different, since less may do various kinds of transformation, e.g. via $LESSOPEN.


1

It's not quite the same, since when col can do something with output from less. The important point here, less will copy input file to output if its output is not a tty. You can see in less-451 - main.c - line 222: /* * Set up terminal, etc. */ if (!is_tty) { /* * Output is not a tty. * Just copy the input ...


2

This is a companion program for less. It is used internally in some configurations (determined at compile time) to call a shell from commands where you can specify a wildcard pattern that stands for a list of file names: the “examine” (:e) command and a few others (-o, -O, -T). The weird quoting is something that less parses internally. The point of using ...


4

On Red Hat and CentOS systems, it is defined in /etc/profile.d/less.sh. On version 5, this contains # less initialization script (sh) [ -x /usr/bin/lesspipe.sh ] && export LESSOPEN="${LESSOPEN-|/usr/bin/lesspipe.sh %s}" On other systems, such as version 7, the value may be ||/usr/bin/lesspipe.sh %s; there is a slightly different interpretation ...


2

Note, the following command may or may not be valid, depending on your particular installation. From man less. | <m> shell-command <m> represents any mark letter. Pipes a section of the input file to the given shell command. The section of the file to be piped is between the first line on the current screen ...


3

You can use a regular expression: &!cat|dog|fish


0

In this case I used to re-page the whole command git submodule ... | less but we lose any potential formatting from sub-commands. Then I realized we have the same issue with "git status", so after reading the answer to "How can I turn on a pager for the output of git status?" I would suggest git config --global pager.submodule "less -FX"


2

First, cat writes to the standard output, which is not necessarily a terminal, even if cat was typed as part of a command to an interactive shell. If you really need something to write to the terminal even when the standard output is redirected, that is not so easy (you need to specify which terminal, and there might not even be one if the command is ...


1

I know this is a past tense question. Technically, since printing the contents of a file to stdout is a form of concatenation, cat is semantically appropriate. Don't forget that printf is semantically intended to format and print data. Bash provides mechanisms semantically intended to redirect input and output from files. A combination of these might ...


4

Under zsh try <file I believe it is the shortest way to print a file. But still it uses 'hidden' cat or more in case if stdout is terminal. However if you really like your cat you can play with it all the time after READNULLCMD=cat


4

The most obvious one is cat. But, also have a look at head and tail. There are also other shell utillities to print a file line by line: sed, awk, grep. But those are to alternate the file content or to search inside the file. I made a few tests to estimate which is the most effective one. I run all trough strace to see which made the least system calls. My ...


3

POSIX define cat as: NAME cat - concatenate and print files SYNOPSIS cat [-u] [file...] DESCRIPTION The cat utility shall read files in sequence and shall write their contents to the standard output in the same sequence. So I think concatenate here means read files in sequence.


8

I know cat can do this, but its main purpose is to concatenate rather than just displaying the content. The purpose of cat is exactly that, read a file and output to stdout.


2

You can if you drop the redundant cat command. tail -f ./log/system.log | tr '\\n' '\n' or putting a filter in there: tail -f ./log/system.log | grep [whatever] | tr '\\n' '\n'


1

Have you tried replacing tail -50 with tail -f ?


1

The top line of less output scrolls out on top because you print a line at the bottom, causing one line of scrolling. That's the \n in your prompt. How to avoid this, and still have two lines? You could write part of the prompt above the mormal command line, instead of using a two line prompt. In a sense, it would be one normal line, and one printed above ...



Top 50 recent answers are included