check history along with dates for queries in Postgres I am running PostgreSQL on my Linux terminal and If we do select pg_backend_pid(); it gives pid for specific session.
Below gives us only the last query executed
select pid,
       usename as username,
       datname as database_name,
       query,
       application_name,
       backend_start,
       state,
       state_change
from pg_stat_activity
where pid = 'your-pid';

but looks like this \s gives us all the history of query but not with dates. can we get dates along with them
and if we do save output to a filename where does it gets stored on Linux server?
\s filename

Kindly suggest if there are more specific way, actually I am looking for the queries executed on particular date.
PostgreSQL doesn't remember the times when queries are run.
If you need that information, set log_statement = 'all' and include %m in log_line_prefix. Then the queries and their time are written to the log file.