My Cmdl Cheatsheet

git

Specify ssh Key

When multiple ssh keys exist, use below form to specify the key to use

$ git -c core.sshCommand="ssh -i <key_file_path>" clone <git_clone_url>

Alternatively, you can configure core.sshCommand on repo level with the command below:

$ get config core.sshCommand "ssh -i <key_file_path>" 

fd

Search the current directory for all directories whose names contain the letter ’t'

$ fd -d 1 -t d '.*t.*'
DataLab
PythonLab
RustLab
  • -d 1 means the max depth is 1, which is equivalent to the current directory.
  • -t d means to only include entries of directory type.

Search against file full path

$ fd -p -i '.*pythonlab.*\.py$'
PythonLab/Scripts/lab.py

Search by file size

$ fd -l -S +800K '.*\.py$'
-rw-rw-r-- 2 chsu chsu 841K Nov  6  2025 ./AILab/Env/lib/python3.14/site-packages/debugpy/_vendored/pydevd/_pydevd_bundle/_debug_adapter/pydevd_schema.py
-rw-rw-r-- 2 chsu chsu 841K Jul  7 00:15 ./DuckDBLab/env/lib/python3.14/site-packages/debugpy/_vendored/pydevd/_pydevd_bundle/_debug_adapter/pydevd_schema.py
  • -S +/-<size> can specify a file size greater or smaller than <size>.
  • -l shows detailed information about the matching files.

Jupyter Lab

Start Jupyter Lab, listening on port 9523 and allowing traffic from all networks.

jupyter lab --ip=0.0.0.0 --port=9523

sed

Use sed with cat -A to verify if yaml files contain unexpected TABs

$ cat -A docker-compose.yml | sed -n '1,15p'
services:$
$
  drupal:$
    image: drupal:11.3.16-php8.5-apache$
    ports:$
      - 8080:80$
    depends_on:$
      - postgres$
    volumes:$
      -^Imy_cms_drupal_storage_modules:/var/www/html/modules$
      -^Imy_cms_drupal_storage_profiles:/var/www/html/profiles$
      -^Imy_cms_drupal_storage_sites:/var/www/html/sites$
      -^Imy_cms_drupal_storage_themes:/var/www/html/themes$
    networks: $
      - my_cms_network$

^I means tab character and that causes error in yaml files.

Vifm

Basic file operations

  • cw to rename (change word) the file
  • cW to rename the base name of the file
  • dd to delete/cut the file
  • t to toggle selection of the file
  • :filter <regex> to filter out/hide files from the file list
    • :filter! <regex> to keep the files according to the regex

Hide/show hidden files

  • za to toggle hiding/showing hidden files

Preview files

  • w to toggle preview of the current file

Use marks as follows

  • m to mark/label the position
  • ' to go to the marked position

Split/hide windows as follows

  • :only to only show the active window pane
  • vs to vertically split the window
  • sp to horizontally split the window

Sort

  • set sort to display the current sorting rule
  • :sort to select sorting criteria
  • set sort=-size,+name to set complex sorting rule, size descending and then name ascending

Filter

  • :filter? to display the current filter setting
  • =<regex> to keep the matching items with local filter
  • :filter <regex> to filter out (hide) the matching items with explicit permanent filter
    • :filter README to filter out README
    • :filter /readme/i as case insensitive fitler
  • zf to add the selected files and directories to implicit permanent filter
  • zO to clear current permanent filter setting
Built with Hugo
Theme Stack designed by Jimmy