16 Linux tools

  • which
  • whatis
  • apropos
  • type

16.1 Git

  • clean (the best way is to delete and re-clone)
git reset --hard     # revert all modified files
git clean -fd        # remove all untracked files and folders
  • untrack files
git rm --cached path/to/file
git update-index --assume-unchanged path/to/file
  • config (~/.gitconfig)
git config --global user.name "ZhuoerDong"
  • print alias
$git help co
'co' is aliased to 'checkout'
  • orphan branch (keep an empty branch to checkout from if you frequently use this)
git checkout --orphan foobar
git rm --cached *  # I suggest VSCode's `Ustage All Changes`            
echo haha > readme.md && git add readme.md && git commint -m 'initial'
git push --set-upstream origin foobar

16.2 Vim

  • insert output of a command

Press ‘:’ in command mode would switch to command-line mode, then you can use !command to execute the command you want, such as !ls.

However, if you don’t press ‘:’, but directly press !*command 20 instead, the output of the command will be inserted into the current document and replace the current line.

  • paste as is
set paste
  • copy to clipboard (may need install vim-gui-common)
set clipboard=unnamedplus

  1. * means any normal key, for example, if you type !als, the command to execute will be ls↩︎