-
Open finder at place from terminal
open .
-
Command to change the destination folder to save your screenshots in mac
defaults write com.apple.screencapture location ~/Pictures/Screenshots killall SystemUIServer
-
stop_android_filetransfer_popup.sh
- Stop the auto popup of Android FileTransfer Window when you plug in your device -
Get DSA public key of system
#More info at : https://help.github.com/articles/generating-ssh-keys/ cat ~/.ssh/id_dsa.pub
-
Disable Google Chrome’s Two-Finger Swipe Navigation
defaults write com.google.Chrome.plist AppleEnableSwipeNavigateWithScrolls -bool FALSE
-
Make your mac os talk
say "This Mac runs OS X, not OS ex"
-
Make your mac os read(verbally) a text file
say -f /path/to/file.txt
-
Get External IP
curl ipecho.net/plain; echo
-
Get network ip
ipconfig getifaddr en0
-
Test network connectivity
ping -c 10 www.google.com
How to setup these aliases
- Copy-Paste these alias inside your
.bashrc
or.zshrc
- Save.
- Goto terminal and execute
source ~/.bashrc
orsource ~/.zshrc
. - Done, now simply call the alias to execute the command as defined.
# ------------------ Shell ---------------- #
# Get default/current shell name
function currentShell(){
local CURRENT_SHELL_NAME=$SHELL;
if [[ "$CURRENT_SHELL_NAME" == "-"* ]]; then
# Returned name is of type: -bash
# Sanitize the result by removing "-"
CURRENT_SHELL_NAME=$(echo $CURRENT_SHELL_NAME | cut -d '-' -f 2);
fi
if [[ "$CURRENT_SHELL_NAME" == "/usr/bin/"* ]]; then
# Returned name is of type: /usr/bin/bash
# Sanitize the result by removing "/usr/bin/"
CURRENT_SHELL_NAME=$(echo $CURRENT_SHELL_NAME | awk -F'/' '{print $4}');
fi
if [[ "$CURRENT_SHELL_NAME" == "/bin/"* ]]; then
# Returned name is of type: /bin/bash
# Sanitize the result by removing "/bin/"
CURRENT_SHELL_NAME=$(echo $CURRENT_SHELL_NAME | awk -F'/' '{print $3}');
fi
echo $CURRENT_SHELL_NAME;
}
# Reset/Reload your current/default shell
alias resetTerminal="exec $(currentShell)"
# Open the default shell's rc file for defining configuration
alias shellConfig="code ~/.$(currentShell)rc"
Copyright 2016 Nishant Srivastava
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.