Random tips for coreutils program or alternatives

Coreutils come from the GNU coreutils project, bringing ls, make, cat, grep etc...

Grep and ripgrep

todo: learn ripgrep and use it

Make

make has a -j argument to configure the number of parallel jobs.

make -j8 # could just be faster for long build

todo: other parallelisations techniques

Find and fd

The find utility has not necessarly the best API, a rewrite in Rust called fd makes it easier to work with file research. A few examples:

Warning: fd by default reads .gitignore to avoid uninteressting listing files, this can sometimes be an issue. In this case you can add --no-ignore

  • Get all the files with the given extension (here .md): fd -e md
  • Get all the directories: fd -t d (type directory)
  • Get all files but change the base directory: fd --base-directory build
  • Get all files with max depth of 3: fd --max-depth 3

JSON and YAML manipulation

When working with JSON or YAML, jq and yq are very handy.

Vim movements tips

  • Map the Caps Lock as the Escape key !! I find this key actually useful and this is a game changer. You'll thank me later.
  • Use Vimium Firefox extension
  • Configure your existing tools with Vim modes: Gitui, your shell, ...

ls and eza

There is a better ls with more colors called eza, you can just alias ls eza as a droppin replacement.

Random hacks

cat -A

prints M$ is line ends with CR and LF prints only $ if line ends with LF https://unix.stackexchange.com/questions/79702/how-to-test-whether-a-file-uses-crlf-or-lf-without-modifying-it

dos2unix to fix