GQL provides a python 3.6+ script, called gql-cli which allows you to execute GraphQL queries directly from the terminal.
This script supports http(s) or websockets protocols.
$ echo 'query { continent(code:"AF") { name } }' | gql-cli https://countries.trevorblades.com
{"continent": {"name": "Africa"}}
$ echo 'query { continent(code:"AF") { name } }' | gql-cli wss://countries.trevorblades.com/graphql
{"continent": {"name": "Africa"}}
$ echo 'query getContinent($code:ID!) { continent(code:$code) { name } }' | gql-cli https://countries.trevorblades.com --variables code:AF
{"continent": {"name": "Africa"}}
Insert your query in the terminal, then press Ctrl-D to execute it.
$ gql-cli wss://countries.trevorblades.com/graphql --variables code:AF
Put the query in a file:
$ echo 'query {
continent(code:"AF") {
name
}
}' > query.gql
Then execute query from the file:
$ cat query.gql | gql-cli wss://countries.trevorblades.com/graphql
{"continent": {"name": "Africa"}}
$ gql-cli https://countries.trevorblades.com/graphql --print-schema > schema.graphql