q
Quit a program or utility
TLDR
Query a CSV file by specifying the delimiter as ','
Query a TSV file
Query file with header row
Read data from stdin; '-' in the query represents the data from stdin
Join two files (aliased as f1 and f2 in the example) on column c1, a common column
Format output using an output delimiter with an output header line (Note: Command will output column names based on the input file header or the column aliases overridden in the query)
SYNOPSIS
q [command...]
q -n num
q -m message
PARAMETERS
command...
The command(s) to be queued for later execution. If no command is given, it reads from standard input.
-n num
Specifies the maximum number of concurrent `qrunner` processes to allow (number of processes to run in parallel).
-m message
Adds a message to the queue. This is generally used for debugging or informational purposes. The message is written to standard output.
DESCRIPTION
The `q` command in Linux is a simple utility designed to queue commands for later execution. It allows you to submit tasks to a queue, and a background process (often referred to as a `qrunner`) will execute those tasks sequentially.
This is useful for deferring resource-intensive tasks, scheduling jobs, or managing processes that don't need immediate attention. It can improve system responsiveness and prevent overloading the system with simultaneous tasks.
It reads commands from standard input and executes them via `/bin/sh`. The commands added to the queue are executed in the order they're added, providing a simple form of task scheduling.
CAVEATS
The `q` command is quite basic. It lacks advanced features like dependency management, error handling, and complex scheduling. It also requires an active `qrunner` process to actually execute the queued commands. Without a qrunner the commands won't execute.
QRUNNER
The `qrunner` program is responsible for actually executing the commands placed in the queue by `q`. It typically runs as a background process, continuously checking the queue and executing any pending commands.
You will usually need to start it explicitly to get the queue to execute.
EXAMPLE USAGE
To queue a command:
echo 'ls -l' | q
To queue multiple commands from a file:
q < commands.txt
HISTORY
The `q` command has been around in the Unix world for a considerable amount of time, providing a simple way to queue commands. Its design reflects older approaches to task scheduling, predating more sophisticated tools like `systemd` timers.
While specific historical details regarding its original development are scarce, its core functionality has remained consistent: deferring task execution.