Examples
A set of simple recs examples to get you up and running. These are meant as a learning tool for folks new to recs. For a humorous introduction, see the Story.
How many processes is each user on my system running?
recs fromps \
| recs collate --key uid -a count \
| recs sort --key count=n \
| recs totableBroken down:
recs fromps— Get records of all the processes currently running.recs collate --key uid -a count— Grouping by theuidfield, count how many records fall into each group (stored in thecountfield by default).recs sort --key count=n— Sort the resulting records by thecountfield numerically (rather than lexically).recs totable— Print the output in a nicely formatted plain text table.
How many processes for each user at each priority level?
recs fromps \
| recs collate --key uid,priority -a count \
| recs toptable --x priority --y uid --v countBroken down:
recs fromps— Get records of all the processes currently running.recs collate --key uid,priority -a count— Grouping by theuidand thepriorityfield, count how many records fall into each group.recs toptable --x priority --y uid -v count— Create a 2-dimensional table (a pivot table): across the top put the priority values, down the side put the uid, in each cell put the value of the count field for that priority/uid combination.
Prep a report on number of modules logging to Xorg.log
What Xorg modules put information in my Xorg.log at startup, and what log level are they logged at? I need this in CSV format for importing into a spreadsheet program.
recs frommultire \
--re 'type,module=\((\S*)\) ([^:]+):' /var/log/Xorg.0.log \
| recs collate --key type,module -a ct \
| recs sort --key ct=n \
| recs tocsv --headerBroken down:
recs frommultire --re 'type,module=\((\S*)\) ([^:]+):' /var/log/Xorg.0.log— Parse out thetypeandmodulefrom the Xorg log file. That regex captures non-whitespace inside a literal()pair, then captures text after a space up to the first:(colon).recs collate --key type,module -a ct— Collate records into groups of type-modules, and count how many in each group across all records.recs sort --key ct=n— Sort by the count, numerically.recs tocsv --header— Output a table in spreadsheet format (no ASCII art), delimited by commas.
See Also
- See Getting Started for an overview of the system
- See Story for a humorous introduction to RecordStream
- See Cookbook for more advanced recipes
