Skip to content

Commit 945b48f

Browse files
committed
Add Skip Paging If Output Fits On Screen With Less as a unix til
1 parent 9ef4a0f commit 945b48f

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

Diff for: README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
1010

1111
For a steady stream of TILs, [sign up for my newsletter](https://tinyletter.com/jbranchaud).
1212

13-
_1034 TILs and counting..._
13+
_1035 TILs and counting..._
1414

1515
---
1616

@@ -1011,6 +1011,7 @@ _1034 TILs and counting..._
10111011
- [Show A File Preview When Searching With FZF](unix/show-a-file-preview-when-searching-with-fzf.md)
10121012
- [Show Disk Usage For The Current Directory](unix/show-disk-usage-for-the-current-directory.md)
10131013
- [Show The Size Of Everything In A Directory](unix/show-the-size-of-everything-in-a-directory.md)
1014+
- [Skip Paging If Output Fits On Screen With Less](unix/skip-paging-if-output-fits-on-screen-with-less.md)
10141015
- [SSH Escape Sequences](unix/ssh-escape-sequences.md)
10151016
- [SSH With Port Forwarding](unix/ssh-with-port-forwarding.md)
10161017
- [Specify The Language For A File With Bat](unix/specify-the-language-for-a-file-with-bat.md)
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Skip Paging If Output Fits On Screen With Less
2+
3+
The `less` command can be used to display a file or the output of a command. It
4+
is sometimes referred to as a pager because it paginates text that won't fit
5+
onto a single screen.
6+
7+
```bash
8+
$ ls | less
9+
```
10+
11+
This will list the files for the current directory with `less`.
12+
13+
By default it will even display a small amount of text output within the pager.
14+
If you want `less` to output text that fits onto a single screen directly to
15+
the terminal, you can pass the `-F` and `-X` flags.
16+
17+
```bash
18+
$ ls | less -FX
19+
```
20+
21+
The `-F` flag tells `less` to exit if the output fits onto a single screen. The
22+
`-X` tells `less` to skip screen clearing.
23+
24+
This is handy if you want the output of a command to show up in your shell
25+
history.
26+
27+
See `man less` for more details.

0 commit comments

Comments
 (0)