Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
Windows Tipps & SecurityGrafikkarte vor Überhitzung schützen: So geht’s(25.09.2026 um 08:00 Uhr)
••••••••••
Windows Tipps & SecurityGrafikkarte vor Überhitzung schützen: So geht’s(25.09.2026 um 08:00 Uhr)
••••••••••
Intelligence View
⚡ tsecurity.de Intelligence

How to use Postgresql psql shell command line

connection psql -h localhost -p 5432 -U myuser -d mydatabase psql -h localhost -p 5432 -U myuser -d mydatabase -c 'SELECT * FROM public.mytable or you use sql shell \c mydatabase to list the table information : \d mytable SELECT * FROM…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

  • connection

    psql -h localhost -p 5432 -U myuser -d mydatabase

    psql -h localhost -p 5432 -U myuser -d mydatabase -c 'SELECT * FROM public.mytable

    or you use sql shell

    \c mydatabase


  • to list the table information :

    \d mytable


  • SELECT * FROM public.mytable; \gx




Please do not forget ; at the end of your query



\bind [PARAM]... set query parameters

\copyright show PostgreSQL usage and distribution terms

\crosstabview [COLUMNS] execute query and display result in crosstab

\errverbose show most recent error message at maximum verbosity

\g [(OPTIONS)] [FILE] execute query (and send result to file or |pipe);

\g with no arguments is equivalent to a semicolon

\gdesc describe result of query, without executing it

\gexec execute query, then execute each value in its result

\gset [PREFIX] execute query and store result in psql variables

\gx [(OPTIONS)] [FILE] as \g, but forces expanded output mode

\q quit psql

\watch [[i=]SEC] [c=N] execute query every SEC seconds, up to N times



Help

\? [commands] show help on backslash commands

\? options show help on psql command-line options

\? variables show help on special variables

\h [NAME] help on syntax of SQL commands, * for all commands



Query Buffer

\e [FILE] [LINE] edit the query buffer (or file) with external editor

\ef [FUNCNAME [LINE]] edit function definition with external editor

\ev [VIEWNAME [LINE]] edit view definition with external editor

\p show the contents of the query buffer

\r reset (clear) the query buffer

\s [FILE] display history or save it to file

\w FILE write query buffer to file



Input/Output

\copy ... perform SQL COPY with data stream to the client host

\echo [-n] [STRING] write string to standard output (-n for no newline)

\i FILE execute commands from file

\ir FILE as \i, but relative to location of current script

\o [FILE] send all query results to file or |pipe

\qecho [-n] [STRING] write string to \o output stream (-n for no newline)

\warn [-n] [STRING] write string to standard error (-n for no newline)



Conditional

\if EXPR begin conditional block

\elif EXPR alternative within current conditional block

\else final alternative within current conditional block

\endif end conditional block



\dy[+] [PATTERN] list event triggers

\l[+] [PATTERN] list databases

\sf[+] FUNCNAME show a function's definition

\sv[+] VIEWNAME show a view's definition

\z[S] [PATTERN] same as \dp



Large Objects

\lo_export LOBOID FILE write large object to file

\lo_import FILE [COMMENT]

read large object from file

\lo_list[+] list large objects

\lo_unlink LOBOID delete a large object



Formatting

\a toggle between unaligned and aligned output mode

\C [STRING] set table title, or unset if none

\f [STRING] show or set field separator for unaligned query output

\H toggle HTML output mode (currently off)

\pset [NAME [VALUE]] set table output option

(border|columns|csv_fieldsep|expanded|fieldsep|

fieldsep_zero|footer|format|linestyle|null|

numericlocale|pager|pager_min_lines|recordsep|

recordsep_zero|tableattr|title|tuples_only|

unicode_border_linestyle|unicode_column_linestyle|

unicode_header_linestyle|xheader_width)

\t [on|off] show only rows (currently off)

\T [STRING] set HTML


tag attributes, or unset if none

\x [on|off|auto] toggle expanded output (currently off)

Connection

\c[onnect] {[DBNAME|- USER|- HOST|- PORT|-] | conninfo}

connect to new database (currently "tasks")

\conninfo display information about current connection

\encoding [ENCODING] show or set client encoding

\password [USERNAME] securely change the password for a user



Operating System

\cd [DIR] change the current working directory

\getenv PSQLVAR ENVVAR fetch environment variable

\setenv NAME [VALUE] set or unset environment variable

\timing [on|off] toggle timing of commands (currently off)

! [COMMAND] execute command in shell or start interactive shell



Variables

\prompt [TEXT] NAME prompt user to set internal variable

\set [NAME [VALUE]] set internal variable, or list all if no parameters

\unset NAME unset (delete) internal variable




1. Sofort-Triage & Abwehrmaßnahmen

SOC Incident Playbook: Remote Code Execution (RCE) Defense
Syntax validiert (0 Fehler)
title: Detect Exploitation - How to use Postgresql psql shell command line
id: 3e2c0408-1293-441f-b336-af4d7c2c527a
status: experimental
description: Automatisch generierte SIEM-Erkennungsregel basierend auf CTI Intelligence
references:
  - https://tsecurity.de/
author: iShareStuff CTI Automated Detection Engine
date: 2026-09-26
logsource:
  category: network_connection
  product: any
detection:
  selection:
      CommandLine|contains:
        - 'exploit'
  condition: selection
falsepositives:
  - Legitime administrative Zugriffe oder Penetrationstests
level: high
tags:
  - attack.initial_access
Syntax validiert (0 Fehler)
rule CTI_Threat_Indicator {
    meta:
        author = "iShareStuff CTI Automated Detection Engine"
        date = "2026-09-26"
        description = "YARA Signature for "
    strings:
        $str = "How to use Postgresql psql she" ascii wide
    condition:
        any of them
}
Syntax validiert (0 Fehler)
index=security sourcetype IN ("cisco:asa", "pan:traffic", "zeek_conn", "suricata", "WinEventLog:Security")
("How to use Postgresql psql shell command")
| stats count earliest(_time) as first_seen latest(_time) as last_seen by src_ip, dest_ip, dest_host, signature
| eval first_seen=strftime(first_seen, "%Y-%m-%d %H:%M:%S"), last_seen=strftime(last_seen, "%Y-%m-%d %H:%M:%S")
| sort - count
Syntax validiert (0 Fehler)
message: "*How to use Postgresql psql shell command*"
Syntax validiert (0 Fehler)
CommonSecurityLog
| where Message has "How to use Postgresql psql shell command"
| summarize EventCount = count(), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated) by SourceIP, DestinationIP, DestinationPort, Activity
| extend DetectionRule = "iShareStuff-CTI-Compiled"
| sort by EventCount desc

2. Cyber Threat Intelligence & Forensik

🎯
MITRE ATT&CK Matrix Navigator 14 Taktiken
Reconnaissance
-
Resource Development
-
Initial Access
Execution
Persistence
-
Privilege Escalation
Defense Evasion
Credential Access
-
Discovery
-
Lateral Movement
-
Collection
-
Command and Control
Exfiltration
-
Impact
tsecurity.de Cognitive Threat RAG
Fokus-Vektor:

Kognitive Analyse für identifizierte Bedrohung: Erhöhte Bedrohungslage im Bereich How to use Postgresql psql shell command.... Basierend auf 368k Vektor-Korrelationen werden sofortige Isolationsmaßnahmen für betroffene Endpunkte empfohlen.

🛡️ Angriffsfläche & Exposure

Netzwerk/Remote-Zugriff ohne Vorauthentifizierung möglich.

⚡ Empfohlene Sofortmaßnahmen
  • 1. Perimeter-Inspektion: Relevante Portfreigaben und exponierte Endpunkte unverzüglich scannen.
  • 2. Patch-Applikation: Hersteller-Hotfix einspielen oder betroffene Daemons in isolierte DMZ-Segmente überführen.
  • 3. Telemetrie & EDR-Alerts: Prozessaufrufe und Child-Processes auf anomale Shell-Spawns überwachen.
🔗 Semantisch verwandte Zero-Days MariaDB 11.7 VEC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten How to use Postgresql psql shell command line

Thematisch verwandte Begriffe: Postgresql, psql, shell, command · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-88003 | InvoicePlane is a self-hosted open source application for managing invoi…
Advisory →
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag