If you have already installed android sdk and configured path skip step 1 and go to step 2 directly.
Step1:
Download SDK for linux. Extract to home folder in linux
Then configure your sdk path in .bashrc file
To configure Type
gedit .bashrc at terminal
Opens an text editor, type the folowing and save
export ANDROID_HOME="$HOME/adt/sdk"
export JAVA_HOME="/usr/bin/java"
export PATH=${PATH}:~/adt/sdk/tools
export PATH=${PATH}:~/adt/sdk/platform-tools
Step2:
Then type uiautomatorviewer at your terminal to start uiautomatorviewer and get details of elements you want to inspect.