Tagged: bash

0

awk one liners

HANDY ONE-LINE SCRIPTS FOR AWK 30 April 2008 Compiled by Eric Pement – eric [at] pement.org version 0.27 Latest version of this file (in English) is usually at: http://www.pement.org/awk/awk1line.txt This file will also be available in other languages: Chinese -...

0

awk one liners (old)

————————————————————————- HANDY ONE-LINERS FOR AWK (Unix stream editor) Apr. 17, 2001 compiled by Eric Pement <[email protected]> version 0.1 Latest version of this file is usually at: http://www.student.northpark.edu/pemente/awk/awk1line.txt USAGE: Unix: awk ‘/pattern/ {print “$1”}’ # standard Unix shells DOS/Win: awk ‘/pattern/...

0

Bash alias and functions for hadoop users

Functions Beeline Usage: Beeline username [queuename] export beeline_jdbc=”jdbc:hive2://servername.fqdn:10000″ Beeline(){ if [ -z “$beeline_jdbc” ]; then echo “Error: beeline_jdbc var not available” fi if [ -z “$1” ]; then echo -e “No user specified.\nUsage: Beeline <user> [<queue>]” return 1 fi queue=”default”...

0

less +F instead of tail -f

less packs more power than “more” or “tail” commands tail -f like functionality Usage: $ less +F file.log If only $ less file.log is invoked pressing F will switch back to mode similar to tail -f Enable row number -NR inside less enables...

0

Setting up tmux without root access

At times we want access to tmux and we are just stuck due to admin restrictions or root access. There are three important parts to setting up tmux, It is dependent on libevent Compiling and installing on non-system folders require customized...

0

iTerm shell integration

Important – iTerm shell integration Shell integration should be installed on all remote hosts Connections to non standard ssh port (other than 22) can be setup in ~/.ssh/config. Format below Host www.adhocshare.tk HostName 192.168.80.200 Port 10527   Iterm2 bash prompt...

0

Run a script as root

Source: http://www.cyberciti.biz/tips/shell-root-user-check-script.html Sometime it is necessary to find out if a shell script is being run as root user or not. When user account created a user ID is assigned to each user. BASH shell stores the user ID in $UID...

0

Super charge bash with these bash_profile tips

Some tips and tricks to super charge bash Tip #01: Up down arrow auto complete ~/.inputrc #File: ~/.inputrc ## arrow up “\e[A”:history-search-backward ## arrow down “\e[B”:history-search-forward   Tip #2: Auto complete hostnames in ssh, scp. More details here. $ brew install...

0

Fetching Hive schema definitions using Webhcat

Following shell script will get the schema information from Hive using WebHCat server.   #!/bin/sh # fetch_webhcat.sh, v0.1, 2016-04-00, [email protected] # Pre-requisites: jq, curl, python (json.tool) _WEBHCAT_SERVER=”server:50111″ _USER_NAME=”JohnDoe” while [[ $# > 1 ]] do key=”$1″ case $key in -u|–user)...

0

Processing shell program arguments

Method 1: Without using getopts while [[ $# > 1 ]] do key=”$1″ case $key in -u|–user) _USER=”$2″ shift # past argument ;; -s|–server) _SERVER=”$2″ shift # past argument ;; *) # unknown option printf “Usage: %s: [-s <server> -u...