Skip to content
Learn with RV – Tech Blog
Learn with RV – Tech Blog

#testautomation #qa #programming #linux #devops

  • Home
  • Who am I?
  • 1-on-1 Mentoring
  • Test Automation Incubator
  • 24 Testimonials
  • YouTube
  • LinkedIn
  • Contact
Learn with RV – Tech Blog

#testautomation #qa #programming #linux #devops

repeat-cli-command-logo
March 12, 2025July 15, 2026

How to repeat any CLI Command for X times using NPM repeat-cli-command

In this article I will show you an awesome NPM tool that I created called repeat-cli-command. It is open source and I invite you to contribute to it. This tool allows you to repeat any CLI command effortlessly for an X number of times. 

Whether you are running tests, debugging, or just want to loop a command, this tool has you covered.

Let’s dive in!

Installation

First, install it globally (-g) or at project level (-D) with npm.

npm install -g repeat-cli-command

Usage

Let's say we want to repeat a simple command like printing "Hello" to the terminal, for 5 times. We just run

 

npx repeat-cli-command "echo 'Hello' " --times=5

Now, let’s say you’re working with PactumJS for API testing (or any other testing framework) and want to rerun the tests for 10 times.

npx repeat-cli-command 'npx mocha api_tests --timeout=10000' --times=10

What if you have some web e2e automated tests with TestCafe? No problem!

npx repeat-cli-command 'npx testcafe chrome:headless web_tests' --times=2

Simple, isn’t it?

This is how you can use repeat-cli-command to boost productivity! It works with any CLI command and can become handy for testing, debugging, and much more.

Enjoyed this article?
I share more practical automation tips on YouTube and LinkedIn.

Need structured guidance instead of learning alone?
I offer 1-on-1 mentoring – learn more → HERE

Or email me at iamqarv [at] gmail [dot] com

Post Views: 410

Related

Share this article:
Linux Tools

Post navigation

Previous post
Next post

Recent Posts

  • Integrating OpenCode with the Grafana k6 MCP Server
  • Customizing docker ps Output with –format
  • Using npm –prefix to Run Scripts from a Nested package.json
  • Unit Testing in JavaScript: Getting started with Vitest
  • Fail Fast in Playwright with maxFailures

Recent Comments

  1. Paul on Web Accessibility: A step-by-step guide to Testing with pa11y
  2. Automated Tests for website Accessibility with Axe and TestCafe - Learn with RV - Tech Blog on How to generate E2E TestCafe Framework in seconds
  3. RV on Exploring Faker.js: A Powerful Tool for Generating Realistic Random Test Data
  4. Adrian Maciuc on Exploring Faker.js: A Powerful Tool for Generating Realistic Random Test Data
  5. Nick on Cypress vs Playwright vs Testcafe – which framework is faster?

Archives

  • October 2026
  • September 2026
  • July 2026
  • June 2026
  • May 2026
  • April 2026
  • March 2026
  • February 2026
  • November 2025
  • October 2025
  • September 2025
  • August 2025
  • July 2025
  • June 2025
  • March 2025
  • February 2025
  • January 2025
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • July 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023

Categories

  • AI
  • k6
  • Linux
  • Programming
  • QA
  • Tools
  • Uncategorized
©2026 Learn with RV – Tech Blog | WordPress Theme by SuperbThemes