How to Determine if a Bash Variable is Empty
If you need to check if a bash
variable is empty, or unset, then you can use the following code:
if [ -z "${VAR}" ];
The above code will check …
Read Article →131 articles about cli development, tools, and best practices
If you need to check if a bash
variable is empty, or unset, then you can use the following code:
if [ -z "${VAR}" ];
The above code will check …
Read Article →If you use the du
command to list all the file sizes on Linux:
du
# or
du -h # Human readable
Then you would have noticed that they are not ordered by …
Read Article →If you need to resize an EBS volume in AWS, you can do so using bash
.
bash
fileCreate a bash file called resize.sh
:
#!/bin/bash …
Read Article →
AWS CodeCommit is a git
code repository service by Amazon Web Services.
You will want to clone your repository and setup your remotes using credential …
Sometimes you will need to manually approve a SageMaker model package from the AWS CLI.
aws sagemaker …
Read Article →
If you need to recursively delete all files in an AWS S3 bucket, then you can do the following:
aws s3 rm --recursive s3://your-bucket-name/foo/bar/ …
Read Article →
If you need to get the CPU Frequency in Linux, then you can run the following command:
watch -n.1 "grep \"^[c]pu MHz\" /proc/cpuinfo"
Read Article →
If you get the Instance Profile already exists
error when running your Terraform apply
, then it is either because an instance profile with that name …
If you are using aws configure sso
to populate your ~/.aws/credentials
file and you get the following error when you try and reauthorize, then you can …
If you need to match a string in a file, then grep
is your friend.
grep
Let’s take a file called somefile.txt
this
is
a
test …
Read Article →
If you want to invoke an AWS Lambda from your CLI, then the best option is to have the AWS CLI installed.
Getting started with the AWS CLI – AWS …!-->
Read Article →Sometimes you might want to exit a command if a variable is not set in Bash.
You can do this as follows:
if [ -z "$VARIABLE_NAME" ]; then echo …
Read Article →