From e34dbcb9d624fd17e99ac897a0186611d70247f8 Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Sat, 17 Feb 2018 11:44:34 +0530 Subject: [PATCH] Added scripts --- README.md | 2 +- scripts/mkr.sh | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 scripts/mkr.sh diff --git a/README.md b/README.md index 6a34f3b..4871ab8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# mkrhere/wiki +# MKRhere/wiki A private repo for common problems. diff --git a/scripts/mkr.sh b/scripts/mkr.sh new file mode 100644 index 0000000..e27cc67 --- /dev/null +++ b/scripts/mkr.sh @@ -0,0 +1,61 @@ +# Simpler apt commands + +alias update="sudo apt-get update" +alias i="sudo apt-get install -y" +alias purge="sudo apt purge -y" +alias ar="sudo apt autoremove -y" +alias autoremove="sudo apt autoremove -y" # Alias of ar + +## To install without -y + +alias install="sudo apt-get install" + +# Directory management + +## Makes a new directory and enters it +mk () { + mkdir "$1" + cd "$_" +} + +## Use with caution: Removes current working directory and changes to one up level +## If an argument is passed, simply deletes that file or folder from current working directory + +rmd () { + CWD="$(dirname $(realpath $0))" + if [ "$1" ]; then + rm -rf "$1" + else + cd .. + rm -rf "$CWD" + fi +} + +# Git commands + +## push "Commit Message" origin master +## if only commit message is present, pushes to default upstream + +push () { + git add . + git commit -m "$1" + if [ "$2" ]; then + git push -u "$2" "$3" + else + git push + fi +} + +# Systemctl commands + +status () { + sudo systemctl status "$1" +} + +start () { + sudo systemctl start "$1" +} + +stop () { + sudo systemctl stop "$1" +} \ No newline at end of file