Skip to main content

Posts

Showing posts with the label unix

Add Environment variables and aliases to Bash on Mac OSX

Refrences: 1. http://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html 2. http://www.cyberciti.biz/faq/bash-shell-change-the-color-of-my-shell-prompt-under-linux-or-unix/ Add following in ~/.profile (or ~/.bash_profile, or ~/.bashrc, or /etc/profile if you have access): export JAVA_VERSION=1.8 export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home export PATH=$PATH:$JAVA_HOME/bin alias ll='ls -al' # This alias recursively destroys all .DS_Store files in the folder I am currently in alias killDS='find . -name *.DS_Store -type f -delete' # This alias reloads this file alias reload_profile='. ~/.profile' # Mac get stuck very often and are extremely slow and unstable on shutdowns. This forces a shutdown. alias poweroff='sudo /sbin/shutdown -h now' # To ignore space changes while doing git diff alias gitdf='git diff --ignore-space-change' # Show Git branch in prompt parse_git_branch() { git bra...

nohup and redirection of standard input/output/error

NOHUP and Redirection of standard input/output/error Examples JMX_PORT=1234 nohup command </dev/null >logs/nohup.out 2>&1 & # Sets a variable only for command, redirects standard input from null (disables input), then redirects standard output to logs/nohup.out & finally redirects standard error to standard output JMX_PORT=1234; nohup command </dev/null >logs/nohup.out 2>&1 & # Sets the variable for current shell, redirects standard input from null (disables input), then redirects standard output to logs/nohup.out & finally redirects standard error to standard output nohup command >/dev/null 2>&1 & # First redirects standard output to null & then redirects standard error to standard output nohup command &> /dev/null & # Same as above, but only in BASH nohup command </dev/null >/dev/null 2>&1 & # Redirects standard input from null (disables input), then redirects standard output to null ...