Skip to content

Instantly share code, notes, and snippets.

@Donmclean
Last active December 16, 2017 21:33
Show Gist options
  • Save Donmclean/d0fa6e333d4c7e4c8201 to your computer and use it in GitHub Desktop.
Save Donmclean/d0fa6e333d4c7e4c8201 to your computer and use it in GitHub Desktop.
SHELL COMMANDS TO REMEMBER!!!! (BASH)
#SHELL COMMANDS TO REMEMBER!!!! (BASH)
# Find content in files
grep --color -irn CONTENT_STRING PATH //https://www.computerhope.com/unix/ugrep.htm
# Find file on drive
find PATH -name FILENAME
# -i ignore case
# -n add line number to output
# -c shows number of times the searched item appears in file
# -v does and inverse search returning the opposite of what is being searched for
# replace (www-data) with whatever you want the new ownership to be.
# also you can replace the (*) with whatever file name/names you want to change.
# eg: sudo chown -R www-data: help.txt
# eg: sudo chown -R root: help.txt
sudo chown -R www-data: *
#Execute a bash script with the "./" prefix
$ chmod u+x my_shell_script.sh
#Then execute
$ ./my_shell_script.sh
#shell script logical
#uses 'command' to verify installation of a command
if ! [ -x "$(command -v someclicommand)" ]; then
# exec false case. i.e: (someclicommand is not installed)
else
# exec true case. i.e: (someclicommand is installed)
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment