Useful CLI commands
2 minute read

These are just reminders/documentation for me because I don’t want to remember them. It is not a guide for anything, it just has commands and tricks I use when reinstalling OS or fixing someone’s computer. Please don’t copy/paste commands without knowing what they do.

  • GNU/Linux

    • Remap right alt key with context menu button (I miss the context button on my ThinkPad)

      // add this to your startup script to make it permanent
      xmodmap -e "keycode  108 = Menu"
    • awk

      awk '/regex/'
      awk '!/regex/'
      awk 'BEGIN{a=5; b=2.5; print a+b}'
      awk '{sub(/:/, "-")} 1' // substitution
      awk '{gsub(/:/, "-")} 1'
    • Rename files in bulk using regex

      for f in *.ttf; do mv "$f" "$(echo "$f" | sed s/findthis/replacewiththis/)"; done
    • Make VS Code remember Github credentials; Easier if you are working with multiple accounts for work and personal.

      git config credential.helper store

    • Print exit code of previous-run program

      echo $?

  • Android

    fastboot devices
    fastboot oem unlock
    fastboot flash recovery twrp.img
    fastboot reboot
  • Windows

    • PATH manipulation

      env | grep PATH
      echo $PATH
      export PATH=<previous-paths>:<new-path>
    • List network devices

      arp -a
    • Virtual Box issue on Windows 10 If you are not able to get Virtual Box in Windows, try running the following (as admin)

      dism.exe /Online /Disable-Feature:Microsoft-Hyper-V
      bcdedit /set hypervisorlaunchtype off
        Also make sure to remove the following from Windows Program and Features:
        * Hyper-V
        * Virtualizing Platform
  • nodejs

    • Installing NPM

      curl -L | sudo sh
    • Clear node modules cache and install dependencies

      rm node_modules -r
      npm cache clean --force
      npm cache verify
      npm install
  • common CLI

    • youtube-dl - best audio

      youtube-dl -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0
    • termux - setting up, etc

      • settings file ~/.termux/

      • add extra touch keyboard buttons

        extra-keys = [ \
            ['ESC','|','/','HOME','UP','END','PGUP','DEL'], \
            ['TAB','CTRL','ALT','LEFT','DOWN','RIGHT','PGDN','BKSP'] \
      • reload settings