Skip to content

Instantly share code, notes, and snippets.

@dannguyen
Last active July 25, 2019 17:16
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 dannguyen/ad80b9d03f755822d3cc03174bcbef74 to your computer and use it in GitHub Desktop.
Save dannguyen/ad80b9d03f755822d3cc03174bcbef74 to your computer and use it in GitHub Desktop.
bashfoo.yaml : Dan nguyen's personally curated list of bash/command-line commands that are useful but that he keeps forgetting
"""
bashfoo.yaml
https://gist.github.com/dannguyen/ad80b9d03f755822d3cc03174bcbef74
Dan Nguyen's personally curated list of bash/command-line commands and snippets
that are useful but yet he keeps forgetting
"""
# gist: https://gist.github.com/dannguyen/ad80b9d03f755822d3cc03174bcbef74
#
# template
#
#
# slug_for_command:
# date: YYYY-MM-DD
# article:
# title: related article title
# url: https://example.com
#
# code: |
# find . -name "foo*"
# output: |
#
# sample output
# from utils stdout/stedrr
#
############################################################################################################
pkill_on_pattern:
date: 2019-07-25
article:
url: https://stackoverflow.com/questions/8987037/how-to-kill-all-processes-with-a-given-partial-name
title: How to kill all processes with a given partial name?
code: |
pkill -fil ipython
output: |
kill -15 90396
kill -15 90523
pgrep_process_info:
date: 2019-07-25
article:
url: https://serverfault.com/questions/77162/how-to-get-pgrep-to-display-full-process-info
title: How to get pgrep to display full process info
code: |
# MacOS
pgrep -fil 'rails'
# Linux
pgrep -af 'rails'
output: |
47502 rails master RBENV_VERSION=2.5.1 TERMINAL_FONT=Monaco
47517 rails worker[0] RBENV_VERSION=2.5.1 TERMINAL_FONT=Monaco
extract_tar_verbosely:
date: 2019-07-18
article:
title: The tar command explained
url: https://www.howtoforge.com/tutorial/linux-tar-command/
code: |
tar xzfv ARCHIVE.TAR.GZ
find_file_by_name:
article:
title: 'How can I recursively find all files in current and subfolders based on wildcard matching?'
url: https://stackoverflow.com/questions/5905054/how-can-i-recursively-find-all-files-in-current-and-subfolders-based-on-wildcard
code: |
find . -name "foo*"
find_directory_by_name_recursively:
article:
title: How can I recursively search for directory names with a particular string where the string is only part of the directory name
url: https://askubuntu.com/questions/153144/how-can-i-recursively-search-for-directory-names-with-a-particular-string-where
code: |
find START_DIR -type d -name "PATTERN"
find_and_exec_something_on_file:
article:
title: How to run find -exec?
url: https://unix.stackexchange.com/questions/12902/how-to-run-find-exec
code: |
find ./PATTERN -exec FOO BAR {} \;
find PlainText/*.md -exec wc -l {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment