Kshitiz Sharma
Kshitiz Sharma

Reputation: 18627

How to disable pagination for AWS CLI help output?

I want to display some help text, and search it with grep.

aws ec2 help | grep instance

AWS CLI uses more to paginate the help.

To disable it I've already tried:

aws --no-cli-pager ec2 help | grep instance

export AWS_PAGER=''; aws ec2 help | grep instance

and changing cli_pager in config file:

[default]
cli_pager=

It still uses the pager.

I'm using AWS CLIv2 Windows version on Cygwin.

How does one disable it?

Upvotes: 4

Views: 2100

Answers (2)

djsadinoff
djsadinoff

Reputation: 5612

There is in fact no well-supported way to do this for the special case of the help output. The help output is treated specially by the v2 aws-cli and ignores the configured cli_pager gadgetry.

The workaround is simply to remove the tty and pipe to cat:

aws help |cat 

see: https://github.com/aws/aws-cli/issues/4972

Upvotes: 4

Dennis Traub
Dennis Traub

Reputation: 51664

There are two ways to disable pagination in the AWS CLI.

1: Using the cli_pager option in the config file:

[default]
cli_pager=

2: Using the AWS_PAGER environment variable:

$ export AWS_PAGER=""

Please note: They only work if you’re using the AWS CLI version 2. They aren’t available if you run AWS CLI version 1. For information on how to install version 2, see Installing, updating, and uninstalling the AWS CLI version 2.

Upvotes: 5

Related Questions