Skip to content

Maintenance search commands #17107

@Managor

Description

@Managor

I'll list here some search commands for the repository to find common mistakes that contributors make. Feel free to post your own. Not everything here returns a direct mistake, but they reduce the list enough that it's feasible to go through it manually. The acceptable outputs are outputs that has been verified to be intended and not an error.

Option placeholders

grep -r -- "{{\[.*\]}[^}]" No output
grep -r -- "[^{]{\[.*\]}}" No output
grep -r "\]\]" acceptable output
grep -r "\[\[" acceptable output
grep -rE "{{\[[a-z]\|--[a-z]+\]}}" No output
grep -rE "{{\[-[a-z]\|[a-z]+\]}}" acceptable output
grep -r "{{-[a-zA-Z]|-" acceptable output
grep -r "{{-[a-zA-Z][a-zA-Z]|-" No output
grep -r "{{\[[^|]*\]}}" acceptable output

Brackets

grep -r {{{ acceptable output
grep -r }}} acceptable output
find . -type f -print0 | xargs -0 awk '{ o=gsub(/{/,"&"); c=gsub(/}/,"&"); if(o!=c) print FILENAME ": " $0 }' acceptable output
find . -type f -print0 | xargs -0 awk '{ o=gsub(/\[/,"&"); c=gsub(/\]/,"&"); if(o!=c) print FILENAME ": " $0 }' acceptable output
find . -type f -print0 | xargs -0 awk '{ o=gsub(/\(/,"&"); c=gsub(/\)/,"&"); if(o!=c) print FILENAME ": " $0 }' acceptable output
find . -type f -print0 | xargs -0 awk '{ q=gsub(/"/,"&"); if(q % 2 != 0) print FILENAME ": " $0 }' No output
grep -r "{{[^}]*{{" No output
grep -r "}}[^{]*}}" acceptable output

Man pages

grep -r manned.org/man/ acceptable output
grep -r ubuntu.com/manpages No output
grep -r linux.die acceptable output
grep -r linux.org/docs No output
grep -r linuxcommandlibrary No output
grep -r /html_node/ | grep -v coreutils | grep -v emacs No output
grep -r "\.[a-z]*[/]*>" | grep -v "\.[x]*htm[l]*[/]*>" | grep -v "\.php[/]*>" | grep -v "\.md[/]*>" | grep -v "\.adoc[/]*>" | grep -v "\.pdf[/]*>" | grep -v "\.txt[/]*>"

Wrong wording

grep -ri help | grep -v "Display help:" | grep -v -- --help | grep -v -- help]
grep -ri version | grep -v "Display version:" | grep -v -- --version
grep -ri config | grep -vi configuration | grep -v "More information"
grep -ri info | grep -vi information | grep -v informative
grep -ri stats | grep -vi statistics
grep -ri "See also" | grep -v "> See also:" acceptable output

Duplicate files

find . -type f -printf "%f\n" | sort | uniq -c | sort

Command line

grep -ri "command line"
grep -ri command-line
grep -r CLI
grep -ri terminal

Github and gitlab useless parts

grep -r ?ref_type=heads No output
grep -r ?tab=readme-ov-file No output

Wrong filepath or url format

grep -r filename
grep -r http://target No output
grep -r "foo\."
grep -r "bar\."
grep -r path/to | grep -v "{{path/to"
grep -r "directory/}}" No output

More information versioning

grep -r "More information:" | grep "[0-9]\.[0-9]"
grep -r "More information:" | grep "v[0-9]"
grep -r "More information:" | grep "/[0-9]/"
grep -r "> More information:" | grep -E "/[0-9]+/"

Device format

grep -r /dev/sd[a-z]
grep -r eth[0-9]
grep -r wlan[0-9]
grep -r /dev/tty

Lone short options

grep -r " -[a-zA-Z][^a-zA-Z]"
grep -r " -[a-zA-Z][a-zA-Z][^a-zA-Z]"

Small letter after colon

grep -r ": [a-z]"

Imperative mood

grep -r Generates No output
grep -r Runs
grep -r Resolves
grep -r Lists
grep -r Displays No output
grep -r Gets No output
grep -r Uses
grep -r Restarts No output
grep -r Opens
grep -r Executes
grep -r Creates
grep -r Initializes

Character mistakes

grep -r … No output
grep -r " " acceptable output
grep -r — No output
grep -r =
grep -r ’ No output

Wrong case

grep -rE "{{[a-zA-Z]+(-[a-z]+)+}}" # kebab-case
grep -rE "{{[a-z]+([A-Z][a-z]+)+}}" # camelCase
grep -rE "{{[A-Z][a-z]+([A-Z][a-z]+)+}}" # PascalCase
grep -rE "{{[A-Z]?[a-z]+([A-Z][a-z]+)+}}" # PascalCase + camelCase (previous 2 combined)

Page title doesn't match the filename

grep -r -m 1 '#' | sed "s/-/ /g" | sed "s/ \+/ /g" | grep -vEi '/(.+)\.md:.*\1' acceptable output

Command does not match filename

grep -r '`' | grep 'md:`' | sed "s/-/ /g" | grep -vEi '/([a-zA-Z0-9+_ \.\^,!~%\[]+)\.md:`.*\1' | grep -v tldr | grep -v "<" | grep -v "pacman" | grep -vEi ' ([a-zA-Z0-9+_ \.]+)\.md:`.*\1\]}}'

Page title does not match command

find . -type f | while read -r file
do
  l1=$(grep -m 1 "#" $file | cut -d ' ' -f 2-)
  grep '^`' $file | while read -r l2
  do
    short=$(echo $l1 | rev | cut -d ' ' -f 1 | rev)
    echo $l2 | grep -vF -- "$l1" | grep -v tldr | grep -v "<" | grep -v pacman | grep -vFi -- "$short]}}" | awk -v file="$file" -v title="$l1" 'NR==1 { printf "%-40s %s %s\n", file ":", "#" title ":", $0 }'
  done
done

Title contains uppercase letters

grep -r -m 1 "#" | grep [A-Z]

Test if command is a symlink and the page should be an alias

find . -type f | xargs -n1 basename | cut -d . -f 1 | xargs -I _ bash -c "if [ -L /bin/_ ]; then echo _ is a symlink; fi"

Typos

grep -ir initialise No output

Placeholders in descriptions

grep -r "^-" | grep {{ No output

Mnemonics

grep -r "^-" | grep -E "\[[a-zA-Z]+\]"

Optionality in commands

grep -rv "^-" | grep "\`" | grep "\[" | grep -v "{{\["

Use of archaic foobar

grep -r foo

Usage of ls in pipelines

grep -r "ls[ ]*.* |"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions