Saturday, April 9, 2016

Unix: Alias

As the name suggests Alias is another/alternate name for a command or group of commands.
To know the aliases currently, just type alias at the prompt and hit enter

hadoop@ubuntu:~$ alias

alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alF'
alias ls='ls --color=auto'


The above gives the list of aliases that we currently have in the system. 
To create an alias, 
hadoop@ubuntu:~$ alias ll='ls -lrt'

hadoop@ubuntu:~$ ll
total 224
-rw-r--r--  1 hadoop hadoop  8445 Feb 21  2015 examples.desktop
drwxr-xr-x  2 hadoop hadoop  4096 Feb 21  2015 Videos
drwxr-xr-x  2 hadoop hadoop  4096 Feb 21  2015 Templates
drwxr-xr-x  2 hadoop hadoop  4096 Feb 21  2015 Public
drwxr-xr-x  2 hadoop hadoop  4096 Feb 21  2015 Music
-rw-rw-r--  1 hadoop hadoop 14904 Feb 22  2015 pig_1424592579651.log
-rw-rw-r--  1 hadoop hadoop 11738 Feb 23  2015 pig_1424676723694.log
-rwxrwxr-x  1 hadoop hadoop     6 Mar  1  2015 cls


Notice that there shouldn't be any space between the = while setting up the alias.
 













Friday, April 8, 2016

The PATH variable

PATH variable is colon delimited list of directories that UNIX uses to locate a command for execution.

To see the contents of the PATH variable we can echo the same

echo $PATH

























When we run a command say ls -lrt, UNIX would check the paths provided in the PATH variable one by one and locate the command and execute the same.
In this case ls is present in the /bin directory.

This can be found using the which command:

which ls
/bin/ls







Oracle SQL and UNIX Gems

I will be posting some of Oracle SQL and UNIX "gems" that would be useful as a quick reference/revisions of the basics of SQL and UNIX in the next few posts.

Thursday, April 7, 2016

Jungle book: Jungle Jungle Baat chali hai

The song that won the hearts of every kid and adults alike in those days.. is back in a newer version. Bringing back childhood.. and nostalgia. The kids have done  splendid job in recreating the magic.
The movie releases on 8th April in India



Sunday, January 3, 2016

grep for 3rd Jan 16

Grep is a command that is used in pattern matching in UNIX. Some of the commonly used variants of grep sre below. We will discuss in detail in the next posts.

grep -i
grep -w
grep -v
grep -n
grep -c

Saturday, January 2, 2016

Grep grep grep

Will write all about grep UNIX in the next posts. Want to make this exhaustive and informative.

Friday, January 1, 2016

Happy New Year!

Wish all a very Happy new year 2016! Hope to write as many productive posts as possible from the start of the year!