diff --git a/README.md b/README.md index 39a353d..a5cc1f5 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket. For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186). -_1621 TILs and counting..._ +_1622 TILs and counting..._ See some of the other learning resources I work on: - [Ruby Operator Lookup](https://www.visualmode.dev/ruby-operators) @@ -116,6 +116,7 @@ If you've learned something here, support my efforts writing daily TILs by - [Find And Follow Server Logs](aws/find-and-follow-server-logs.md) - [Sign Up User With Email And Password](aws/sign-up-user-with-email-and-password.md) - [SSH Into An ECS Container](aws/ssh-into-an-ecs-container.md) +- [Turn Off Output Pager For A Command](aws/turn-off-output-pager-for-a-command.md) - [Use Specific AWS Profile With CLI](aws/use-specific-aws-profile-with-cli.md) ### Brew diff --git a/aws/turn-off-output-pager-for-a-command.md b/aws/turn-off-output-pager-for-a-command.md new file mode 100644 index 0000000..312be21 --- /dev/null +++ b/aws/turn-off-output-pager-for-a-command.md @@ -0,0 +1,38 @@ +# Turn Off Output Pager For A Command + +It is not uncommon for an AWS CLI command to return a ton of output. When that +happens, it is nice that the results end up in pager program (like `less`) +where you can search and review them, copy a value of interest, and then exit. +The pager prevents that wall of output from cluttering your terminal history. + +However, sometimes I am running a command that I know is going to return a +small result. I'd rather have the results go to stdout where I can see them in +the terminal history rather than to an ephemeral pager. + +For that situation I can tack on the `--no-cli-pager` flag. + +```bash +$ aws rds describe-db-instances \ + --query 'DBInstances[*].EngineVersion' \ + --output json \ + --no-cli-pager + +[ + "13.15", + "16.8" +] +``` + +Here I've asked the AWS CLI to tell me the engine versions of all my RDS +Postgres databases. Because I know the results are only going to include a +couple results for my couple of DBs, I'd like to skip the pager — +`--no-cli-pager`. + +Though I think it is better to do this on a case by case basis, it is also +possible to turn off the pager via the CLI configuration file. + +```bash +$ aws configure set cli_pager "" +``` + +[source](https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-pagination.html#cli-usage-pagination-clientside)