Skip to content

Instantly share code, notes, and snippets.

@justinmklam
Last active April 18, 2019 17:23
Show Gist options
  • Save justinmklam/3522741033a1ac61c3fc50b31884137d to your computer and use it in GitHub Desktop.
Save justinmklam/3522741033a1ac61c3fc50b31884137d to your computer and use it in GitHub Desktop.
Useful snippets in bash.
# Find text in files in current directory
# -i - ignore text case
# -r - recursively search files in subdirectories.
# -n is line number, and
# -l - show file names instead of file contents portions.
grep -irn "search string" .
# Update system time from google (used to be able to do `sudo ntpdate time.nist.gov`, but ntpdate is considered deprecated as of 16.04
# Caveat: Might be 8-50 ms behind
sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d" " -f5-8)Z"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment