Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michael-milette/37b6495393299a495f1a7f616ce6de5a to your computer and use it in GitHub Desktop.
Save michael-milette/37b6495393299a495f1a7f616ce6de5a to your computer and use it in GitHub Desktop.

Git

  • See git cheatsheet.

Copy/Sync Files and Directories

  • rsync -a --delete --compress --omit-dir-times --omit-link-times --no-g --no-perms [user@server:]source [user@server:]target
  • scp -Crqp [user@server:]source [user@server:]target

Terminal

  • ssh username@server
  • tmux (Ctrl+b ":set -g status off" to disable status bar with clock)
  • screen

Compression

  • zip
  • unzip
  • tar

System resources

  • top
  • htop
  • df
  • du

Directories and Files

  • ls
  • cd
  • cd ~
  • pushd
  • popd
  • shopt -s dotglob
  • mkdir
  • rmdir
  • rm -rf
  • mv
  • (shopt -s dotglob; mv ~/source/* ~/target)

Finding stuff

  • find . -iname *.md
  • command | grep "text-to-find"
  • grep "text-to-find" filename
  • grep -Ril "text-to-find-here" directoryPath

Editing files

  • sed
  • nano
  • vi
  • touch

File and folder access/permissions

  • sudo
  • sudo -u username command
  • chomod
  • chown

Groups

  • groups username
  • usermod -a -G [www-data/or/apache] username

System identification

  • hostname -I
  • whoami

Shell Command History

  • history

MySQL

  • mysql -u username -p databaseName
  • mysql -u username -p databaseName < exportdb.sql
  • mysqldump -u username -p databaseName > exportdb.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment