nushell / nushell.github.io

Nushell's main website, blog, book, and more
https://www.nushell.sh/book/
MIT License
183 stars 426 forks source link

Most frequently used Nushell commands chapter #899

Open maxim-uvarov opened 1 year ago

maxim-uvarov commented 1 year ago

UPD: for those who are interested result are published here: https://github.com/maxim-uvarov/nu-commands-frequency-stats/blob/main/aggregated_stats/aggregated-freq-stats20230911.csv

Work on the script is in progress


Guys, I think it would be cool to add a chapter to the book about the most frequently used Nushell commands to help newcomers prioritize their learning efforts.

To gather statistics from several nushell users, I wrote this script.

After running this script, it will produce two files: a CSV with the commands and their frequency that were used in your history for more than 10 times and a YAML-formatted txt file with some additional information (as github doesn't allow to upload files with YAML extension into the comments).

Please feel free to alter that data by either increasing the frequency threshold included in the CSV report commands or by not attaching the YAML.txt file if you believe it could somehow harm your privacy.

If you would like to contribute your data, please run the script and upload your files in this thread so we could aggregate the data from them.

The script will ask you if you want to include stats only about built-in commands or all the commands that you used. It is up to you how much information you want to share.

maxim-uvarov commented 1 year ago

My data: frequent-commands-sqlite3.csv frequent-commands-sys-info-yaml.txt

pingiun commented 1 year ago

My data: frequent-commands-sqlite3.csv frequent-commands-sys-info-yaml.txt

fdncred commented 1 year ago

Have fun frequent-commands-sqlite3.csv frequent-commands-sys-info-yaml.txt

kubouch commented 1 year ago

Good luck frequent-commands-sys-info-yaml.txt frequent-commands-txt.csv

(for some reason it doesn't read my sqlite history file, only the old text one)

sholderbach commented 1 year ago

I am really skewing the results with debugging work... And help

frequent-commands-txt.csv frequent-commands-sys-info-yaml.txt

maxim-uvarov commented 1 year ago

Everybody, thank you for sharing! This stat is a very useful thing.

I downloaded your data into a folder, added your nickname, and archived the folder.(historty-nushell.zip)

Ran this script:

glob *.csv | reverse | each {|i| open $i | upsert from {|b| $i | str replace ".csv" "" | split row "-" | last}} | flatten | group-by name | items {|k v| {command: $k} | merge ($v | select command_type | get 0) | merge ($v | select from count | transpose -i -d -r)} | fill non-exist

Where `fill non-exist:

def fill non-exist [ tbl?: any --value: nothing ] {
    let tbl = ($in | default $tbl)
    let cols = ($tbl | each {|i| $i | columns} | flatten | uniq | reduce --fold {} {|i acc| $acc | merge {$i : $value}})

    $tbl | each {|i| $cols | merge $i}
}

Got a cool table (nushell_commands_freq_resluts0.csv)

Later, I will normalise this table, add histogram-like bars and maybe color coding. Also, I will enhance the initial script to incorporate your results there, to provide some benchmarks for those who will run it. And to name files.

Also, I'm thinking of creating a repository for results that anybody can contribute to by making a pull request with their data. Or leaving everything like now - to accept data in this thread.

┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━┓
┃                command                ┃ command_type ┃ kubouch ┃ fbncred ┃ sholderbach ┃ pingiun ┃ uvarov ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━╋━━━━━━━━━╋━━━━━━━━━╋━━━━━━━━━━━━━╋━━━━━━━━━╋━━━━━━━━┫
┃ ls                                    ┃ builtin      ┃     791 ┃    1525 ┃         162 ┃      67 ┃   1510 ┃
┃ cd                                    ┃ builtin      ┃     675 ┃     661 ┃          80 ┃      98 ┃    535 ┃
┃ p                                     ┃ builtin      ┃     538 ┃      58 ┃             ┃         ┃    472 ┃
┃ get                                   ┃ builtin      ┃     535 ┃     792 ┃          64 ┃      15 ┃   2007 ┃
┃ config                                ┃ builtin      ┃     480 ┃     273 ┃          16 ┃      41 ┃    373 ┃
┃ profile                               ┃ builtin      ┃     468 ┃      18 ┃             ┃      39 ┃     29 ┃
┃ overlay                               ┃ keyword      ┃     440 ┃         ┃             ┃         ┃        ┃
┃ open                                  ┃ builtin      ┃     349 ┃     677 ┃          70 ┃      15 ┃   1780 ┃
┃ each                                  ┃ builtin      ┃     300 ┃     364 ┃          46 ┃         ┃    835 ┃
┃ n                                     ┃ builtin      ┃     258 ┃     271 ┃          45 ┃         ┃    394 ┃
┃ where                                 ┃ builtin      ┃     223 ┃     498 ┃          66 ┃         ┃    726 ┃
┃ all                                   ┃ builtin      ┃     220 ┃      51 ┃          36 ┃         ┃    105 ┃
┃ help                                  ┃ builtin      ┃     205 ┃     818 ┃         219 ┃      88 ┃    653 ┃
┃ encode                                ┃ builtin      ┃     182 ┃      12 ┃             ┃         ┃        ┃
┃ let                                   ┃ keyword      ┃     177 ┃     584 ┃          35 ┃      24 ┃   1120 ┃
┃ source                                ┃ keyword      ┃     159 ┃     501 ┃             ┃      16 ┃    700 ┃
┃ lines                                 ┃ builtin      ┃     148 ┃     246 ┃          37 ┃         ┃    255 ┃
┃ extern                                ┃ keyword      ┃     147 ┃         ┃             ┃      23 ┃        ┃
┃ last                                  ┃ builtin      ┃     142 ┃     120 ┃             ┃         ┃    184 ┃
┃ path                                  ┃ builtin      ┃     135 ┃     213 ┃             ┃      25 ┃    251 ┃
┃ use                                   ┃ keyword      ┃     123 ┃      41 ┃             ┃      14 ┃     45 ┃
┃ if                                    ┃ builtin      ┃     116 ┃     176 ┃          36 ┃         ┃    177 ┃
┃ let-env                               ┃ builtin      ┃     110 ┃     164 ┃             ┃      17 ┃     44 ┃
┃ rm                                    ┃ builtin      ┃     109 ┃     124 ┃          11 ┃      39 ┃    130 ┃
┃ find                                  ┃ builtin      ┃     106 ┃     132 ┃          10 ┃      12 ┃     60 ┃
┃ table                                 ┃ builtin      ┃     105 ┃     351 ┃          29 ┃         ┃     99 ┃
┃ str collect                           ┃ builtin      ┃     104 ┃      34 ┃             ┃         ┃     20 ┃
┃ skip                                  ┃ builtin      ┃     102 ┃      80 ┃             ┃         ┃    204 ┃
┃ module                                ┃ keyword      ┃     101 ┃         ┃             ┃         ┃     12 ┃
┃ update                                ┃ builtin      ┃      99 ┃     173 ┃          11 ┃         ┃     49 ┃
┃ group-by                              ┃ builtin      ┃      91 ┃      88 ┃             ┃         ┃     86 ┃
┃ def                                   ┃ keyword      ┃      91 ┃     244 ┃          30 ┃      11 ┃    183 ┃
┃ drop                                  ┃ builtin      ┃      86 ┃         ┃             ┃         ┃     38 ┃
┃ from xml                              ┃ builtin      ┃      81 ┃         ┃             ┃         ┃        ┃
┃ length                                ┃ builtin      ┃      77 ┃     125 ┃          12 ┃         ┃    555 ┃
┃ flatten                               ┃ builtin      ┃      72 ┃     145 ┃          25 ┃         ┃    305 ┃
┃ default                               ┃ builtin      ┃      65 ┃      70 ┃             ┃         ┃     71 ┃
┃ collect                               ┃ builtin      ┃      62 ┃      13 ┃             ┃         ┃        ┃
┃ echo                                  ┃ builtin      ┃      56 ┃     186 ┃          51 ┃      42 ┃    193 ┃
┃ math avg                              ┃ builtin      ┃      55 ┃         ┃             ┃         ┃        ┃
┃ export                                ┃ keyword      ┃      54 ┃         ┃             ┃         ┃        ┃
┃ mv                                    ┃ builtin      ┃      53 ┃      33 ┃             ┃         ┃     46 ┃
┃ merge                                 ┃ builtin      ┃      51 ┃     214 ┃             ┃         ┃    109 ┃
┃ debug                                 ┃ builtin      ┃      50 ┃     240 ┃             ┃      17 ┃     28 ┃
┃ sort-by                               ┃ builtin      ┃      49 ┃     145 ┃          12 ┃         ┃    420 ┃
┃ size                                  ┃ builtin      ┃      48 ┃     104 ┃             ┃         ┃    185 ┃
┃ fmt                                   ┃ builtin      ┃      45 ┃      15 ┃             ┃      10 ┃        ┃
┃ enter                                 ┃ builtin      ┃      44 ┃         ┃             ┃         ┃        ┃
┃ mut                                   ┃ keyword      ┃      43 ┃      40 ┃             ┃         ┃     40 ┃
┃ into decimal                          ┃ builtin      ┃      41 ┃      11 ┃             ┃         ┃        ┃
┃ cp                                    ┃ builtin      ┃      40 ┃      26 ┃             ┃         ┃     55 ┃
┃ mkdir                                 ┃ builtin      ┃      40 ┃      34 ┃          27 ┃         ┃     59 ┃
┃ to                                    ┃ builtin      ┃      40 ┃      28 ┃             ┃         ┃    221 ┃
┃ histogram                             ┃ builtin      ┃      39 ┃      13 ┃             ┃         ┃        ┃
┃ append                                ┃ builtin      ┃      39 ┃      59 ┃             ┃         ┃    219 ┃
┃ overlay list                          ┃ builtin      ┃      38 ┃         ┃             ┃         ┃     29 ┃
┃ const                                 ┃ keyword      ┃      36 ┃         ┃             ┃         ┃        ┃
┃ version                               ┃ builtin      ┃      36 ┃      76 ┃          14 ┃      28 ┃     39 ┃
┃ overlay use                           ┃ keyword      ┃      36 ┃         ┃             ┃         ┃    426 ┃
┃ describe                              ┃ builtin      ┃      36 ┃     128 ┃          36 ┃         ┃    147 ┃
┃ alias                                 ┃ keyword      ┃      36 ┃      53 ┃             ┃         ┃     19 ┃
┃ save                                  ┃ builtin      ┃      34 ┃      71 ┃          18 ┃         ┃    310 ┃
┃ which                                 ┃ builtin      ┃      30 ┃      96 ┃             ┃      32 ┃    133 ┃
┃ view                                  ┃ builtin      ┃      29 ┃      19 ┃             ┃         ┃     19 ┃
┃ do                                    ┃ builtin      ┃      28 ┃     120 ┃          24 ┃      27 ┃    134 ┃
┃ transpose                             ┃ builtin      ┃      26 ┃     211 ┃          28 ┃      11 ┃    238 ┃
┃ path join                             ┃ builtin      ┃      26 ┃      20 ┃          12 ┃         ┃        ┃
┃ math abs                              ┃ builtin      ┃      26 ┃         ┃             ┃         ┃        ┃
┃ export def                            ┃ keyword      ┃      26 ┃         ┃             ┃         ┃     37 ┃
┃ insert                                ┃ builtin      ┃      26 ┃         ┃             ┃         ┃     64 ┃
┃ into                                  ┃ builtin      ┃      26 ┃      84 ┃          42 ┃         ┃        ┃
┃ reject                                ┃ builtin      ┃      25 ┃      56 ┃             ┃         ┃    124 ┃
┃ nu-highlight                          ┃ builtin      ┃      25 ┃      10 ┃             ┃         ┃        ┃
┃ math sum                              ┃ builtin      ┃      25 ┃      16 ┃             ┃         ┃     37 ┃
┃ char                                  ┃ builtin      ┃      23 ┃     123 ┃             ┃      13 ┃     20 ┃
┃ dfr group-by                          ┃ builtin      ┃      22 ┃         ┃             ┃         ┃     28 ┃
┃ g                                     ┃ builtin      ┃      22 ┃         ┃             ┃         ┃     26 ┃
┃ parse                                 ┃ builtin      ┃      22 ┃     104 ┃             ┃         ┃    340 ┃
┃ du                                    ┃ builtin      ┃      20 ┃      13 ┃          18 ┃         ┃        ┃
┃ dfr as                                ┃ builtin      ┃      20 ┃         ┃             ┃         ┃     42 ┃
┃ into int                              ┃ builtin      ┃      20 ┃     114 ┃             ┃         ┃    175 ┃
┃ config nu                             ┃ builtin      ┃      19 ┃         ┃          18 ┃         ┃    179 ┃
┃ dfr agg                               ┃ builtin      ┃      19 ┃         ┃             ┃         ┃     25 ┃
┃ history                               ┃ builtin      ┃      19 ┃     190 ┃          14 ┃         ┃    241 ┃
┃ columns                               ┃ builtin      ┃      19 ┃      61 ┃             ┃         ┃    191 ┃
┃ str trim                              ┃ builtin      ┃      18 ┃     113 ┃             ┃         ┃     32 ┃
┃ for                                   ┃ keyword      ┃      18 ┃      65 ┃          26 ┃         ┃     34 ┃
┃ error make                            ┃ builtin      ┃      17 ┃      18 ┃          13 ┃         ┃        ┃
┃ overlay hide                          ┃ keyword      ┃      17 ┃         ┃             ┃         ┃     39 ┃
┃ to md                                 ┃ builtin      ┃      17 ┃      13 ┃             ┃         ┃     19 ┃
┃ from                                  ┃ builtin      ┃      17 ┃      42 ┃          10 ┃         ┃    483 ┃
┃ path parse                            ┃ builtin      ┃      16 ┃      30 ┃          14 ┃         ┃     32 ┃
┃ print                                 ┃ builtin      ┃      15 ┃     170 ┃          16 ┃      16 ┃    205 ┃
┃ overlay new                           ┃ keyword      ┃      15 ┃         ┃             ┃         ┃        ┃
┃ help commands                         ┃ builtin      ┃      15 ┃     133 ┃             ┃         ┃     37 ┃
┃ split row                             ┃ builtin      ┃      15 ┃      80 ┃             ┃      12 ┃    171 ┃
┃ dfr sort-by                           ┃ builtin      ┃      14 ┃         ┃             ┃         ┃    116 ┃
┃ hide                                  ┃ keyword      ┃      14 ┃      15 ┃             ┃         ┃        ┃
┃ zip                                   ┃ builtin      ┃      13 ┃      33 ┃             ┃         ┃     49 ┃
┃ select                                ┃ builtin      ┃      13 ┃     241 ┃             ┃         ┃    565 ┃
┃ path expand                           ┃ builtin      ┃      13 ┃      36 ┃             ┃         ┃     20 ┃
┃ exit                                  ┃ builtin      ┃      12 ┃         ┃             ┃         ┃        ┃
┃ register                              ┃ keyword      ┃      12 ┃     141 ┃             ┃         ┃     17 ┃
┃ first                                 ┃ builtin      ┃      12 ┃     178 ┃          18 ┃         ┃    841 ┃
┃ config env                            ┃ builtin      ┃      11 ┃         ┃             ┃         ┃     24 ┃
┃ path relative-to                      ┃ builtin      ┃      11 ┃         ┃             ┃         ┃        ┃
┃ filter                                ┃ builtin      ┃      11 ┃      20 ┃             ┃         ┃        ┃
┃ env                                   ┃ custom       ┃         ┃     501 ┃             ┃         ┃        ┃
┃ z                                     ┃ alias        ┃         ┃     332 ┃             ┃         ┃     90 ┃
┃ ansi                                  ┃ builtin      ┃         ┃     211 ┃          12 ┃         ┃    131 ┃
┃ git fetch                             ┃ external     ┃         ┃     206 ┃             ┃         ┃        ┃
┃ git push                              ┃ external     ┃         ┃     174 ┃             ┃         ┃        ┃
┃ into datetime                         ┃ builtin      ┃         ┃     155 ┃             ┃         ┃     77 ┃
┃ upsert                                ┃ builtin      ┃         ┃     153 ┃             ┃         ┃    711 ┃
┃ str replace                           ┃ builtin      ┃         ┃     142 ┃             ┃         ┃    288 ┃
┃ into binary                           ┃ builtin      ┃         ┃     124 ┃             ┃         ┃     30 ┃
┃ split column                          ┃ builtin      ┃         ┃     116 ┃             ┃         ┃     31 ┃
┃ http get                              ┃ builtin      ┃         ┃     112 ┃             ┃      19 ┃     35 ┃
┃ explore                               ┃ builtin      ┃         ┃     111 ┃          18 ┃         ┃     57 ┃
┃ query web                             ┃ plugin       ┃         ┃     105 ┃             ┃         ┃        ┃
┃ from json                             ┃ builtin      ┃         ┃     102 ┃          57 ┃         ┃    440 ┃
┃ lsg                                   ┃ custom       ┃         ┃      99 ┃             ┃         ┃        ┃
┃ git status                            ┃ external     ┃         ┃      85 ┃             ┃         ┃        ┃
┃ ps                                    ┃ builtin      ┃         ┃      84 ┃          22 ┃      28 ┃     11 ┃
┃ cargo install-update                  ┃ external     ┃         ┃      81 ┃             ┃         ┃        ┃
┃ git log                               ┃ external     ┃         ┃      80 ┃             ┃         ┃        ┃
┃ date format                           ┃ builtin      ┃         ┃      78 ┃             ┃         ┃     43 ┃
┃ pwd                                   ┃ custom       ┃         ┃      75 ┃             ┃         ┃        ┃
┃ format                                ┃ builtin      ┃         ┃      74 ┃          20 ┃         ┃     50 ┃
┃ show                                  ┃ custom       ┃         ┃      71 ┃             ┃         ┃        ┃
┃ cargo install                         ┃ external     ┃         ┃      69 ┃             ┃         ┃        ┃
┃ bytes at                              ┃ builtin      ┃         ┃      68 ┃             ┃         ┃        ┃
┃ sys                                   ┃ builtin      ┃         ┃      67 ┃          21 ┃         ┃     21 ┃
┃ nuver                                 ┃ custom       ┃         ┃      67 ┃             ┃         ┃        ┃
┃ str length                            ┃ builtin      ┃         ┃      64 ┃             ┃         ┃     50 ┃
┃ str join                              ┃ builtin      ┃         ┃      64 ┃          24 ┃         ┃     85 ┃
┃ complete                              ┃ builtin      ┃         ┃      64 ┃             ┃      20 ┃    109 ┃
┃ url                                   ┃ builtin      ┃         ┃      64 ┃          46 ┃         ┃        ┃
┃ to json                               ┃ builtin      ┃         ┃      63 ┃             ┃         ┃     24 ┃
┃ date now                              ┃ builtin      ┃         ┃      62 ┃          10 ┃         ┃    107 ┃
┃ reduce                                ┃ builtin      ┃         ┃      62 ┃             ┃         ┃    111 ┃
┃ take                                  ┃ builtin      ┃         ┃      61 ┃             ┃         ┃        ┃
┃ glob                                  ┃ builtin      ┃         ┃      58 ┃             ┃         ┃     97 ┃
┃ rename                                ┃ builtin      ┃         ┃      57 ┃             ┃         ┃    113 ┃
┃ to text                               ┃ builtin      ┃         ┃      57 ┃          37 ┃         ┃     34 ┃
┃ into record                           ┃ builtin      ┃         ┃      56 ┃             ┃         ┃     51 ┃
┃ git branch                            ┃ external     ┃         ┃      55 ┃             ┃         ┃        ┃
┃ into duration                         ┃ builtin      ┃         ┃      55 ┃             ┃         ┃        ┃
┃ ansi strip                            ┃ builtin      ┃         ┃      53 ┃             ┃         ┃        ┃
┃ wrap                                  ┃ builtin      ┃         ┃      52 ┃             ┃         ┃    104 ┃
┃ keybindings                           ┃ builtin      ┃         ┃      51 ┃             ┃         ┃     40 ┃
┃ term size                             ┃ builtin      ┃         ┃      49 ┃             ┃         ┃     14 ┃
┃ split chars                           ┃ builtin      ┃         ┃      46 ┃             ┃         ┃     26 ┃
┃ detect columns                        ┃ builtin      ┃         ┃      45 ┃             ┃         ┃        ┃
┃ column                                ┃ custom       ┃         ┃      44 ┃             ┃         ┃        ┃
┃ from ssv                              ┃ builtin      ┃         ┃      43 ┃             ┃         ┃        ┃
┃ input                                 ┃ builtin      ┃         ┃      43 ┃             ┃         ┃     17 ┃
┃ git pull                              ┃ external     ┃         ┃      43 ┃             ┃         ┃        ┃
┃ reverse                               ┃ builtin      ┃         ┃      43 ┃          31 ┃         ┃    169 ┃
┃ decode                                ┃ builtin      ┃         ┃      43 ┃             ┃         ┃        ┃
┃ is-empty                              ┃ builtin      ┃         ┃      41 ┃          13 ┃         ┃     23 ┃
┃ hide_prompt                           ┃ custom       ┃         ┃      40 ┃             ┃         ┃        ┃
┃ uniq                                  ┃ builtin      ┃         ┃      40 ┃          19 ┃         ┃    181 ┃
┃ cal                                   ┃ builtin      ┃         ┃      39 ┃             ┃         ┃        ┃
┃ date                                  ┃ builtin      ┃         ┃      39 ┃             ┃         ┃        ┃
┃ regex                                 ┃ plugin       ┃         ┃      38 ┃             ┃         ┃        ┃
┃ while                                 ┃ builtin      ┃         ┃      37 ┃             ┃         ┃        ┃
┃ seq                                   ┃ builtin      ┃         ┃      36 ┃             ┃         ┃     12 ┃
┃ get_weather                           ┃ custom       ┃         ┃      35 ┃             ┃         ┃        ┃
┃ sleep                                 ┃ builtin      ┃         ┃      35 ┃             ┃         ┃        ┃
┃ stars                                 ┃ custom       ┃         ┃      35 ┃             ┃         ┃        ┃
┃ inspect                               ┃ builtin      ┃         ┃      32 ┃             ┃         ┃     40 ┃
┃ schema                                ┃ builtin      ┃         ┃      31 ┃             ┃         ┃        ┃
┃ into string                           ┃ builtin      ┃         ┃      30 ┃             ┃         ┃     76 ┃
┃ window                                ┃ builtin      ┃         ┃      29 ┃             ┃         ┃     55 ┃
┃ gstat                                 ┃ plugin       ┃         ┃      27 ┃             ┃         ┃        ┃
┃ nudown                                ┃ custom       ┃         ┃      26 ┃             ┃         ┃        ┃
┃ grid                                  ┃ builtin      ┃         ┃      26 ┃             ┃         ┃        ┃
┃ group                                 ┃ builtin      ┃         ┃      26 ┃             ┃         ┃        ┃
┃ decode base64                         ┃ builtin      ┃         ┃      25 ┃             ┃         ┃        ┃
┃ http                                  ┃ builtin      ┃         ┃      25 ┃             ┃         ┃        ┃
┃ from csv                              ┃ builtin      ┃         ┃      24 ┃             ┃         ┃     35 ┃
┃ pnet                                  ┃ plugin       ┃         ┃      24 ┃             ┃         ┃        ┃
┃ any                                   ┃ builtin      ┃         ┃      24 ┃          47 ┃         ┃     10 ┃
┃ seq date                              ┃ builtin      ┃         ┃      24 ┃             ┃         ┃     32 ┃
┃ to nuon                               ┃ builtin      ┃         ┃      23 ┃          21 ┃         ┃     16 ┃
┃ prepend                               ┃ builtin      ┃         ┃      23 ┃             ┃      13 ┃        ┃
┃ try                                   ┃ builtin      ┃         ┃      23 ┃          17 ┃      13 ┃     44 ┃
┃ start                                 ┃ builtin      ┃         ┃      22 ┃             ┃         ┃     75 ┃
┃ enumerate                             ┃ builtin      ┃         ┃      22 ┃             ┃         ┃     42 ┃
┃ clear                                 ┃ builtin      ┃         ┃      22 ┃             ┃         ┃     52 ┃
┃ to csv                                ┃ builtin      ┃         ┃      21 ┃             ┃         ┃     22 ┃
┃ spwd                                  ┃ custom       ┃         ┃      21 ┃             ┃         ┃        ┃
┃ query                                 ┃ plugin       ┃         ┃      21 ┃             ┃         ┃        ┃
┃ values                                ┃ builtin      ┃         ┃      20 ┃             ┃         ┃     68 ┃
┃ compact                               ┃ builtin      ┃         ┃      20 ┃             ┃         ┃        ┃
┃ metadata                              ┃ builtin      ┃         ┃      20 ┃          15 ┃         ┃        ┃
┃ to tsv                                ┃ builtin      ┃         ┃      19 ┃             ┃         ┃        ┃
┃ fill                                  ┃ builtin      ┃         ┃      19 ┃          39 ┃         ┃     54 ┃
┃ math ceil                             ┃ builtin      ┃         ┃      19 ┃             ┃         ┃        ┃
┃ help operators                        ┃ builtin      ┃         ┃      19 ┃             ┃         ┃        ┃
┃ keybindings listen                    ┃ builtin      ┃         ┃      18 ┃             ┃         ┃        ┃
┃ bytes length                          ┃ builtin      ┃         ┃      18 ┃             ┃         ┃        ┃
┃ nuvermd                               ┃ custom       ┃         ┃      17 ┃             ┃         ┃        ┃
┃ range                                 ┃ builtin      ┃         ┃      17 ┃             ┃         ┃     21 ┃
┃ path exists                           ┃ builtin      ┃         ┃      17 ┃             ┃         ┃     11 ┃
┃ timeit                                ┃ builtin      ┃         ┃      17 ┃             ┃         ┃     81 ┃
┃ break                                 ┃ builtin      ┃         ┃      17 ┃             ┃         ┃        ┃
┃ query xml                             ┃ plugin       ┃         ┃      17 ┃             ┃         ┃        ┃
┃ bytes                                 ┃ builtin      ┃         ┃      17 ┃             ┃         ┃        ┃
┃ hist                                  ┃ plugin       ┃         ┃      16 ┃             ┃         ┃        ┃
┃ str substring                         ┃ builtin      ┃         ┃      16 ┃          16 ┃         ┃    105 ┃
┃ plot                                  ┃ plugin       ┃         ┃      16 ┃             ┃         ┃        ┃
┃ view files                            ┃ builtin      ┃         ┃      15 ┃             ┃         ┃        ┃
┃ split words                           ┃ builtin      ┃         ┃      15 ┃             ┃         ┃        ┃
┃ git remote                            ┃ external     ┃         ┃      15 ┃             ┃         ┃        ┃
┃ join                                  ┃ builtin      ┃         ┃      15 ┃             ┃         ┃     14 ┃
┃ bytes index-of                        ┃ builtin      ┃         ┃      14 ┃             ┃         ┃        ┃
┃ def-env                               ┃ keyword      ┃         ┃      13 ┃             ┃         ┃        ┃
┃ dfr into-df                           ┃ builtin      ┃         ┃      13 ┃             ┃         ┃    207 ┃
┃ cargo clean                           ┃ external     ┃         ┃      13 ┃             ┃         ┃        ┃
┃ get_cargo_downloads                   ┃ custom       ┃         ┃      13 ┃             ┃         ┃        ┃
┃ headers                               ┃ builtin      ┃         ┃      13 ┃             ┃         ┃     21 ┃
┃ path dirname                          ┃ builtin      ┃         ┃      12 ┃             ┃         ┃        ┃
┃ hc                                    ┃ custom       ┃         ┃      12 ┃             ┃         ┃     66 ┃
┃ keybindings list                      ┃ builtin      ┃         ┃      12 ┃             ┃         ┃        ┃
┃ keybindings default                   ┃ builtin      ┃         ┃      11 ┃             ┃         ┃        ┃
┃ std help                              ┃ custom       ┃         ┃      11 ┃             ┃         ┃        ┃
┃ cargo run                             ┃ external     ┃         ┃      10 ┃             ┃         ┃        ┃
┃ into filesize                         ┃ builtin      ┃         ┃      10 ┃             ┃         ┃        ┃
┃ cargo list                            ┃ custom       ┃         ┃      10 ┃             ┃         ┃        ┃
┃ return                                ┃ keyword      ┃         ┃      10 ┃             ┃         ┃     13 ┃
┃ loop                                  ┃ builtin      ┃         ┃      10 ┃             ┃         ┃        ┃
┃ items                                 ┃ builtin      ┃         ┃      10 ┃             ┃         ┃        ┃
┃ help aliases                          ┃ builtin      ┃         ┃      10 ┃             ┃         ┃        ┃
┃ commandline                           ┃ builtin      ┃         ┃         ┃          46 ┃         ┃     17 ┃
┃ from tsv                              ┃ builtin      ┃         ┃         ┃          43 ┃         ┃     31 ┃
┃ from nuon                             ┃ builtin      ┃         ┃         ┃          24 ┃         ┃        ┃
┃ each while                            ┃ builtin      ┃         ┃         ┃          17 ┃         ┃     15 ┃
┃ math eval                             ┃ builtin      ┃         ┃         ┃          16 ┃         ┃        ┃
┃ decode hex                            ┃ builtin      ┃         ┃         ┃          11 ┃         ┃        ┃
┃ str starts-with                       ┃ builtin      ┃         ┃         ┃          11 ┃         ┃     30 ┃
┃ tutor                                 ┃ builtin      ┃         ┃         ┃          10 ┃         ┃     15 ┃
┃ run-external                          ┃ builtin      ┃         ┃         ┃             ┃      23 ┃        ┃
┃ ignore                                ┃ builtin      ┃         ┃         ┃             ┃      15 ┃     29 ┃
┃ exec                                  ┃ builtin      ┃         ┃         ┃             ┃      11 ┃     18 ┃
┃ cy                                    ┃ custom       ┃         ┃         ┃             ┃         ┃   1740 ┃
┃ f                                     ┃ custom       ┃         ┃         ┃             ┃         ┃    442 ┃
┃ md                                    ┃ custom       ┃         ┃         ┃             ┃         ┃    331 ┃
┃ par-each                              ┃ builtin      ┃         ┃         ┃             ┃         ┃    263 ┃
┃ job status                            ┃ custom       ┃         ┃         ┃             ┃         ┃    241 ┃
┃ cy ber                                ┃ custom       ┃         ┃         ┃             ┃         ┃    208 ┃
┃ br                                    ┃ custom       ┃         ┃         ┃             ┃         ┃    145 ┃
┃ job clean                             ┃ custom       ┃         ┃         ┃             ┃         ┃    133 ┃
┃ dfr filter-with                       ┃ builtin      ┃         ┃         ┃             ┃         ┃    120 ┃
┃ cy passport get                       ┃ custom       ┃         ┃         ┃             ┃         ┃    115 ┃
┃ dfr col                               ┃ builtin      ┃         ┃         ┃             ┃         ┃    109 ┃
┃ cy pin text                           ┃ custom       ┃         ┃         ┃             ┃         ┃    107 ┃
┃ cy tmp view                           ┃ custom       ┃         ┃         ┃             ┃         ┃    104 ┃
┃ cyber query rank search               ┃ external     ┃         ┃         ┃             ┃         ┃     94 ┃
┃ cyber query bank balances             ┃ external     ┃         ┃         ┃             ┃         ┃     93 ┃
┃ dfr into-lazy                         ┃ builtin      ┃         ┃         ┃             ┃         ┃     81 ┃
┃ cyber query rank karma                ┃ external     ┃         ┃         ┃             ┃         ┃     80 ┃
┃ dfr get                               ┃ builtin      ┃         ┃         ┃             ┃         ┃     78 ┃
┃ dfr open                              ┃ builtin      ┃         ┃         ┃             ┃         ┃     78 ┃
┃ cy cid download async                 ┃ custom       ┃         ┃         ┃             ┃         ┃     77 ┃
┃ dfr rename                            ┃ builtin      ┃         ┃         ┃             ┃         ┃     76 ┃
┃ cy tmp send tx                        ┃ custom       ┃         ┃         ┃             ┃         ┃     75 ┃
┃ json path                             ┃ plugin       ┃         ┃         ┃             ┃         ┃     70 ┃
┃ dfr with-column                       ┃ builtin      ┃         ┃         ┃             ┃         ┃     69 ┃
┃ cyber tx authz exec                   ┃ external     ┃         ┃         ┃             ┃         ┃     63 ┃
┃ dfr select                            ┃ builtin      ┃         ┃         ┃             ┃         ┃     62 ┃
┃ dfr collect                           ┃ builtin      ┃         ┃         ┃             ┃         ┃     56 ┃
┃ hash                                  ┃ builtin      ┃         ┃         ┃             ┃         ┃     53 ┃
┃ cy search                             ┃ custom       ┃         ┃         ┃             ┃         ┃     50 ┃
┃ gp                                    ┃ custom       ┃         ┃         ┃             ┃         ┃     48 ┃
┃ dfr drop                              ┃ builtin      ┃         ┃         ┃             ┃         ┃     48 ┃
┃ cyber keys list                       ┃ external     ┃         ┃         ┃             ┃         ┃     47 ┃
┃ cy tmp replace                        ┃ custom       ┃         ┃         ┃             ┃         ┃     44 ┃
┃ hist-save                             ┃ custom       ┃         ┃         ┃             ┃         ┃     44 ┃
┃ cyber query wasm contract-state smart ┃ external     ┃         ┃         ┃             ┃         ┃     43 ┃
┃ cy config activate                    ┃ custom       ┃         ┃         ┃             ┃         ┃     42 ┃
┃ dfr join                              ┃ builtin      ┃         ┃         ┃             ┃         ┃     42 ┃
┃ path basename                         ┃ builtin      ┃         ┃         ┃             ┃         ┃     41 ┃
┃ backup                                ┃ custom       ┃         ┃         ┃             ┃         ┃     41 ┃
┃ dfr value-counts                      ┃ builtin      ┃         ┃         ┃             ┃         ┃     38 ┃
┃ is-cid                                ┃ custom       ┃         ┃         ┃             ┃         ┃     38 ┃
┃ cyber query txs                       ┃ external     ┃         ┃         ┃             ┃         ┃     38 ┃
┃ cy config view                        ┃ custom       ┃         ┃         ┃             ┃         ┃     38 ┃
┃ cr                                    ┃ alias        ┃         ┃         ┃             ┃         ┃     38 ┃
┃ hs                                    ┃ custom       ┃         ┃         ┃             ┃         ┃     37 ┃
┃ str contains                          ┃ builtin      ┃         ┃         ┃             ┃         ┃     36 ┃
┃ dfr append                            ┃ builtin      ┃         ┃         ┃             ┃         ┃     35 ┃
┃ random                                ┃ builtin      ┃         ┃         ┃             ┃         ┃     35 ┃
┃ cy queue check                        ┃ custom       ┃         ┃         ┃             ┃         ┃     34 ┃
┃ job log                               ┃ custom       ┃         ┃         ┃             ┃         ┃     34 ┃
┃ dfr unique                            ┃ builtin      ┃         ┃         ┃             ┃         ┃     33 ┃
┃ cy link texts                         ┃ custom       ┃         ┃         ┃             ┃         ┃     33 ┃
┃ from yaml                             ┃ builtin      ┃         ┃         ┃             ┃         ┃     32 ┃
┃ explain                               ┃ builtin      ┃         ┃         ┃             ┃         ┃     29 ┃
┃ view source                           ┃ builtin      ┃         ┃         ┃             ┃         ┃     29 ┃
┃ dfr filter                            ┃ builtin      ┃         ┃         ┃             ┃         ┃     28 ┃
┃ cy help                               ┃ custom       ┃         ┃         ┃             ┃         ┃     27 ┃
┃ cy passport set                       ┃ custom       ┃         ┃         ┃             ┃         ┃     27 ┃
┃ cyber query bandwidth neuron          ┃ external     ┃         ┃         ┃             ┃         ┃     26 ┃
┃ math floor                            ┃ builtin      ┃         ┃         ┃             ┃         ┃     25 ┃
┃ cy tweet                              ┃ custom       ┃         ┃         ┃             ┃         ┃     24 ┃
┃ fill non-exist                        ┃ custom       ┃         ┃         ┃             ┃         ┃     24 ┃
┃ cy balances                           ┃ custom       ┃         ┃         ┃             ┃         ┃     24 ┃
┃ move                                  ┃ builtin      ┃         ┃         ┃             ┃         ┃     24 ┃
┃ cyber status                          ┃ external     ┃         ┃         ┃             ┃         ┃     24 ┃
┃ cy config new                         ┃ custom       ┃         ┃         ┃             ┃         ┃     22 ┃
┃ cyber _keys table                     ┃ custom       ┃         ┃         ┃             ┃         ┃     21 ┃
┃ conda activate                        ┃ custom       ┃         ┃         ┃             ┃         ┃     20 ┃
┃ py-graph-update                       ┃ custom       ┃         ┃         ┃             ┃         ┃     20 ┃
┃ if-empty                              ┃ custom       ┃         ┃         ┃             ┃         ┃     20 ┃
┃ cyber tx sign                         ┃ external     ┃         ┃         ┃             ┃         ┃     20 ┃
┃ dfr shape                             ┃ builtin      ┃         ┃         ┃             ┃         ┃     19 ┃
┃ cyber query liquidity pools           ┃ external     ┃         ┃         ┃             ┃         ┃     19 ┃
┃ dfr count                             ┃ builtin      ┃         ┃         ┃             ┃         ┃     18 ┃
┃ cy tmp clear                          ┃ custom       ┃         ┃         ┃             ┃         ┃     18 ┃
┃ cyber tx graph cyberlink              ┃ external     ┃         ┃         ┃             ┃         ┃     18 ┃
┃ cy graph download snapshoot           ┃ custom       ┃         ┃         ┃             ┃         ┃     17 ┃
┃ cy pin files                          ┃ custom       ┃         ┃         ┃             ┃         ┃     17 ┃
┃ ast                                   ┃ builtin      ┃         ┃         ┃             ┃         ┃     17 ┃
┃ cyber query tx                        ┃ external     ┃         ┃         ┃             ┃         ┃     17 ┃
┃ pu-add                                ┃ custom       ┃         ┃         ┃             ┃         ┃     16 ┃
┃ ansi gradient                         ┃ builtin      ┃         ┃         ┃             ┃         ┃     16 ┃
┃ history-stats2                        ┃ custom       ┃         ┃         ┃             ┃         ┃     16 ┃
┃ dfr set                               ┃ builtin      ┃         ┃         ┃             ┃         ┃     15 ┃
┃ broot                                 ┃ external     ┃         ┃         ┃             ┃         ┃     15 ┃
┃ cyber query rank backlinks            ┃ external     ┃         ┃         ┃             ┃         ┃     15 ┃
┃ job spawn                             ┃ custom       ┃         ┃         ┃             ┃         ┃     14 ┃
┃ cy cache clear                        ┃ custom       ┃         ┃         ┃             ┃         ┃     14 ┃
┃ cyber query rank negentropy           ┃ external     ┃         ┃         ┃             ┃         ┃     13 ┃
┃ cy watch search folder                ┃ custom       ┃         ┃         ┃             ┃         ┃     13 ┃
┃ cyber tx bank send                    ┃ external     ┃         ┃         ┃             ┃         ┃     13 ┃
┃ cyber query rank is-exist             ┃ external     ┃         ┃         ┃             ┃         ┃     13 ┃
┃ cyber keys add                        ┃ external     ┃         ┃         ┃             ┃         ┃     13 ┃
┃ is-neuron                             ┃ custom       ┃         ┃         ┃             ┃         ┃     12 ┃
┃ cyber tx liquidity swap               ┃ external     ┃         ┃         ┃             ┃         ┃     12 ┃
┃ cyber query block                     ┃ external     ┃         ┃         ┃             ┃         ┃     12 ┃
┃ cy tmp link from                      ┃ custom       ┃         ┃         ┃             ┃         ┃     12 ┃
┃ touch                                 ┃ builtin      ┃         ┃         ┃             ┃         ┃     12 ┃
┃ cyber query account                   ┃ external     ┃         ┃         ┃             ┃         ┃     12 ┃
┃ cyber tx grid edit-route              ┃ external     ┃         ┃         ┃             ┃         ┃     11 ┃
┃ wa                                    ┃ custom       ┃         ┃         ┃             ┃         ┃     11 ┃
┃ history session                       ┃ builtin      ┃         ┃         ┃             ┃         ┃     11 ┃
┃ dfr not                               ┃ builtin      ┃         ┃         ┃             ┃         ┃     11 ┃
┃ cyber query rank top                  ┃ external     ┃         ┃         ┃             ┃         ┃     11 ┃
┃ dfr concat-str                        ┃ builtin      ┃         ┃         ┃             ┃         ┃     10 ┃
┃ dfr fill-null                         ┃ builtin      ┃         ┃         ┃             ┃         ┃     10 ┃
┃ to yaml                               ┃ builtin      ┃         ┃         ┃             ┃         ┃     10 ┃
┃ cybernode_upload_file                 ┃ custom       ┃         ┃         ┃             ┃         ┃     10 ┃
┃ dfr reverse                           ┃ builtin      ┃         ┃         ┃             ┃         ┃     10 ┃
┃ math round                            ┃ builtin      ┃         ┃         ┃             ┃         ┃     10 ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━╋━━━━━━━━━╋━━━━━━━━━╋━━━━━━━━━━━━━╋━━━━━━━━━╋━━━━━━━━┫
┃                command                ┃ command_type ┃ kubouch ┃ fbncred ┃ sholderbach ┃ pingiun ┃ uvarov ┃
CBenoit commented 1 year ago

Nice initiative! Here are mine: frequent-commands-txt.csv frequent-commands-sys-info-yaml.txt

ShinyZero0 commented 1 year ago

nu-commands-frequency-sqlite3+shinyzero0.csv nu-commands-frequency-sqlite3+shinyzero0.txt

zjp-CN commented 1 year ago

nu-commands-frequency-txt+zjp.csv

nicokosi commented 1 year ago

nu-commands-frequency-txt+nicokosi.csv nu-commands-frequency-txt+nicokosi.txt

horasal commented 1 year ago

nu-commands-frequency-txt+horasal.csv nu-commands-frequency-txt+horasal.txt

cptpiepmatz commented 1 year ago

nu-commands-frequency-txt+cptpiepmatz.txt nu-commands-frequency-txt+cptpiepmatz.csv

dazfuller commented 1 year ago

nu-commands-frequency-txt+dazfuller.csv nu-commands-frequency-txt+dazfuller.txt

maxim-uvarov commented 1 year ago

Here is an updated summary of results: nushell_commands_freq_resluts1.csv

You can get this summary by collecting all the files together, and executing the command:

glob *.csv | reverse | each {|i| open $i | upsert from {|b| $i | str replace ".csv" "" | split row "-" | last}} | flatten | group-by name | items {|k v| {command: $k} | merge ($v | select command_type | get 0) | merge ($v | select from count | transpose -i -d -r)} | fill non-exist

where fill non-exist

def fill non-exist [ tbl?: any --value: nothing ] {
    let tbl = ($in | default $tbl)
    let cols = ($tbl | each {|i| $i | columns} | flatten | uniq | reduce --fold {} {|i acc| $acc | merge {$i : $value}})

    $tbl | each {|i| $cols | merge $i}
}
chtenb commented 1 year ago

nu-commands-frequency-txt+chtenb.csv nu-commands-frequency-txt+chtenb.txt

maxim-uvarov commented 1 year ago

I'm working on making sense of these stats.

I wrote a script (history-frequency-stats2.nu), to aggregate properly named files.

Collected all the results into yaml file nu_commands_freq_aggregated.yaml.

Those who are interested can find both files in the Archive.zip attached.

I'm going to modify initial script that collect stats to:

  1. Use nu --ast functionality to extract commands information
  2. To output single properly named YAML file (with all the data nested in it).
fdncred commented 1 year ago

@maxim-uvarov I looked at your zip and the yaml file was binary. Not sure that's what you intended.

oops, nevermind. i was looking in the __macosx folder. my mistake.

I'd really like to just have all this data aggregated into one list as well. also, you spelled my name wrong.

maxim-uvarov commented 1 year ago

It's strange. On my computer vs code and sublime open this file with no problem.

I stripped ansi codes (which were used with histograms), and saved the same file as json.

nu_commands_freq_aggregated.json.txt

Hopefully I'll finish my ideas soon and present them here. Thank you for checking, @fdncred

ErichDonGubler commented 1 year ago

Here's mine; I think a lot of the command frequency is influenced by my heavy usage of ajeetdsouza/zoxide. Maybe it's worth figuring out how to distinguish commands run in a hook from manually entered invocations?

maxim-uvarov commented 1 year ago

I spent last few days wrangling data in nushell. It was fun.

You can find some results in the repository: https://github.com/maxim-uvarov/nu-commands-frequency-stats

I would love to polish and document scripts, but I have to play with other data.

I Hope to get back to this project soon.

maxim-uvarov commented 1 year ago

@fdncred I corrected your name 🙏 You can check out the aggregated results: aggregated-freq-stats.csv

maxim-uvarov commented 1 year ago

Maybe it's worth figuring out how to distinguish commands run in a hook from manually entered invocations?

@ErichDonGubler I'm not sure that I understand the doubt.

After aggregating stats - all the builtin commands have their categories.

So the custom commands and aliases like z or br (which is very interesting topic for me!), could be treated separtely.

maxim-uvarov commented 1 year ago

I updated the scripts:

Now, after running the script, a user can benchmark their usage with aggregated stats. There are two examples of main commands in the README: https://github.com/maxim-uvarov/nu-commands-frequency-stats

I'm going to write documentation on the script and create a video on how to use its results with explore or my beloved vd. But I probably won't have time for this soon, so I'm sharing a work in progress.

@fdncred, if you happen to have a minute to check my research, I would be very grateful.

fdncred commented 1 year ago

@maxim-uvarov Sorry, I'm not sure what this means.

❯ open ~/Downloads/aggregated-freq-stats.csv
╭─#─┬──────command──────┬───────category───────┬users_count┬freq_norm_avg┬users_sparkline┬freq_norm_max┬freq_norm_min┬freq_norm_median╮
│0  │ls                 │filesystem            │         12│         0.84│▆██▁█▄▄██▆█▆▇  │            1│         0.46│            0.96│
│1  │cd                 │filesystem            │         12│         0.63│▃▁▄█▇██▃▇▄▄█▁  │            1│         0.04│            0.66│
│2  │overlay            │core                  │          1│         0.56│▁▁▁▁█▁▁▁▁▁▁▁▁  │         0.56│         0.56│            0.56│
│3  │help               │core                  │         12│         0.41│▃▂▅▁▃▂▂▁▃█▁▇█  │            1│         0.03│            0.29│
│4  │open               │filesystem            │         13│         0.38│█▄▄▁▄▃▆▂▂▃▃▂▇  │         0.89│         0.02│            0.32│
│5  │get                │filters               │         13│         0.36│█▄▅▁▆▃▁▁▂▃▂▂█  │            1│         0.02│            0.27│
│6  │encode             │strings               │          3│         0.24│▁▁▁▁▄▁▁▁▁▁█▁▁  │         0.50│         0.01│            0.23│
│7  │run-external       │system                │          1│         0.23│▁▁▁▁▁▁▁▁▁▁▁█▁  │         0.23│         0.23│            0.23│
│8  │upsert             │filters               │          2│         0.23│█▁▃▁▁▁▁▁▁▁▁▁▁  │         0.35│         0.10│            0.23│
│9  │config             │env                   │         13│         0.22│▃▄▃▂█▁▂▂▆▂▁▆▅  │         0.61│         0.01│            0.18│

How can I tell the most popular commands?

maxim-uvarov commented 1 year ago

@fdncred, thank you.

I have updated the script and its results are now published in the new CSV file: aggregated-freq-stats20230911.csv.

The new CSV includes the freq_overall column, which is an absolute measure of command usage among all users. Additionally, there is an importance column, which is a composite normalized metric that takes into account the number of users of the command and the average normalized frequency.

Furthermore, I have tested the script, and it now works on both Windows and Mac. In case someone is interested in running it.

fdncred commented 1 year ago

Thanks for working on this @maxim-uvarov! This is a little easier to understand.

maxim-uvarov commented 10 months ago

So, there is a Git repo https://github.com/Nushell101/nu-stats/ with aggregated current results.

If anyone is interested in updating their results, please execute the following script:

use nu-stats.nu [nu-hist-stats]; let $res = nu-hist-stats; $res

This script will create a new file WriteYourNick.csv in the stats_submissions folder. You can then make a pull request or upload this file here.

You can find the current results with command frequency here: https://github.com/Nushell101/nu-stats/blob/main/script_results/aggregated-submissions.csv

I still intend to write a book chapter that will utilize this data, but it may take another 9 months... 🙏