Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@zlin888
Last active July 2, 2019 17:06
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 zlin888/43a713b8eee631e33c46bef7e3a8c4c3 to your computer and use it in GitHub Desktop.
Save zlin888/43a713b8eee631e33c46bef7e3a8c4c3 to your computer and use it in GitHub Desktop.
ubuntu cheatsheet

Ubuntu Cheatsheet

  • check disk space: df -H

  • transfer file from server to local: scp your_username@remotehost.edu:foobar.txt /local/dir

  • local to server: rsync -avz -e 'ssh' foobar.txt your_username@remotehost.edu:somewhere

  • find file and remove: find . -maxdepth 1 -regex './[a-z0-9]*' | xargs rm -rf
    find the folder find . -type f
    -maxdepth 1 means non-recursive
    xargs is the command that "converts" its standard input into arguments of another program, or, as they more accurately put it on the man page\

  • count word, line: wc -l -w [file]

  • output the head or tail: head/tail -n [number-of-line] [file]

  • execute a command in the bg: [command] &
    also hide the stdout: [command] > /dev/null &

https://askubuntu.com/a/562915

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment