Skip to content

Commit 2d09107

Browse files
committed
Add Clear The Screen In psql as a postgres til
1 parent aa1eb0f commit 2d09107

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ variety of languages and technologies. These are things that don't really
77
warrant a full blog post. These are mostly things I learn by pairing with
88
smart people at [Hashrocket](http://hashrocket.com/).
99

10-
_378 TILs and counting..._
10+
_379 TILs and counting..._
1111

1212
---
1313

@@ -163,6 +163,7 @@ _378 TILs and counting..._
163163
- [Aggregate A Column Into An Array](postgres/aggregate-a-column-into-an-array.md)
164164
- [Auto Expanded Display](postgres/auto-expanded-display.md)
165165
- [Checking The Type Of A Value](postgres/checking-the-type-of-a-value.md)
166+
- [Clear The Screen In psql](postgres/clear-the-screen-in-psql.md)
166167
- [Compute Hashes With pgcrypto](postgres/compute-hashes-with-pgcrypto.md)
167168
- [Configure The Timezone](postgres/configure-the-timezone.md)
168169
- [Constructing A Range Of Dates](postgres/constructing-a-range-of-dates.md)

postgres/clear-the-screen-in-psql.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Clear The Screen In psql
2+
3+
The `psql` interactive terminal does not have a built-in way of clearing the
4+
screen. What I usually do if I really need the screen cleared is quit, run
5+
`clear` from the shell, and then open a new `psql` session. This is
6+
unnecessary though. Instead, we can use the `\!` command to execute a shell
7+
command, in this case, the `clear` command.
8+
9+
```
10+
> \! clear
11+
```
12+
13+
This clears the screen in one step and keeps our current session running.
14+
15+
See the [psql
16+
docs](http://www.postgresql.org/docs/current/static/app-psql.html) for more
17+
details.

0 commit comments

Comments
 (0)