Skip to content

Handy terminal commands

  • Allow website through vpn or link IP to a dns name:
    sudo pico /etc/hosts (add ip address and public name)
  • List hidden files: ls -a
  • Important file: ~/.zsrhc
  • Add path variable:export PATH=$PATH:pathname
  • Is virtualisation enabled on computer (VMX in return value means yes): sysctl -a | grep -o VMX
  • Treat insecure origin as secureopen -a /Applications/Google\ Chrome.app’ –args –unsafely-treat-insecure-origin-as-secure=”http://localhost:3000″‘
  • Treat insecure origin as secure in Chrome browser urlchrome://flags/#unsafely-treat-insecure-origin-as-secure
  • Remove node modules:

    find . | grep /node_modules$ | grep -v /node_modules/ | xargs rm -fR

GIT

    • Show adapted files: git diff –cached –name-only
    • Show adapted file: git diff master package.json
    • Revert a commit:

      git show HEAD > patch git revert HEAD git apply patch

      Undo a commit to unstaged changes:

      git reset HEAD~

    • To rebase:

      Git rebase -I HEAD~4 > 4 commits rebasen Git rebase – I commitnr Vim > I > change pick by s > esc >wq

    • to make case sensitive files be checked in: git config core.ignorecase false

DOCKER

  • Show all docker images:docker ps -a
  • Start image: docker start filename

JS

  • Create a new js package: yarn init
  • Yarn commands: Yarn commands
  • Yarn why: due to which project/package is a package installed. When having duplicate packages, check yarn.lock to see where the duplicate comes from and add it to resolutions in package.json (only works in the top level in case of a workspace) or upgrade.
  • Yarn upgrade: does not update package.json. use yarn upgrade package@^ 
  • Yarn outdated: check which packages are outdated

Published inToolsUncategorized

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *