<commit_before>= Unix/Linux Commands 


[#gnu-parallel]
== GNU Parallel

Split input into parts having no more than 5 lines each, but run j=2 jobs in parallel, and keep input order

  seq 100 | parallel --keep-order --pipe -N 5 -j 2  'wc -lw && sleep 2 '
    
    
    
Show progress

  seq 100 | parallel --progress --keep-order --pipe -N 5 -j 2  'wc -lw && sleep 2 '



== Clear Terminal

We all use `clear` or `CTRL+L` but it's not really a "clear" termianl

    printf "\033c"   #<ESC>c
    reset            # another way
    
Info https://stackoverflow.com/q/5367068/1506477 


[#inverse-select]
== Invert / Exclude files
Info : https://www.tecmint.com/delete-all-files-in-directory-except-one-few-file-extensions/ 

[source,bash]
----
shopt -s extglob  # enable
ls !(conf.yml)    # list all except conf.yml
rm -r !(conf.yml)   # rm all  except conf.yml
rm -v !("filename1"|"filename2")  # multiple exclusions
----<commit_msg>Update unix.adoc<commit_after>= Unix/Linux Commands 


[#gnu-parallel]
== GNU Parallel

Split input into parts having no more than 5 lines each, but run j=2 jobs in parallel, and keep input order

  seq 100 | parallel --keep-order --pipe -N 5 -j 2  'wc -lw && sleep 2 '
    
    
    
Show progress

  seq 100 | parallel --progress --keep-order --pipe -N 5 -j 2  'wc -lw && sleep 2 '



== Clear Terminal

We all use `clear` or `CTRL+L` but it's not really a "clear" termianl

    printf "\033c"   #<ESC>c
    reset            # another way
    
Info https://stackoverflow.com/q/5367068/1506477 


[#inverse-select]
== Invert / Exclude files

Info : https://www.tecmint.com/delete-all-files-in-directory-except-one-few-file-extensions/ 

[source,bash]
----
shopt -s extglob  # enable
ls !(conf.yml)    # list all except conf.yml
rm -r !(conf.yml)   # rm all  except conf.yml
rm -v !("filename1"|"filename2")  # multiple exclusions
----

[#bashexit]
== Bash Exit On Error

[source,bash]
----
set -euxo pipefail
----

`-e` exits on error, `-u` errors on undefined variables, and `-o pipefail` exits on command pipe failures.

1. https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
1. https://stackoverflow.com/a/2871034/1506477 

{'fraction_non_alphanumeric': 0.13701149425287357, 'fraction_numerical': 0.03770114942528736, 'mean_word_length': 2.7517241379310344, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5061222', 'n_tokens_mistral': 856, 'n_tokens_neox': 753, 'n_words': 247}