String operations (commonly used)
Equal: = (equal sign)
Not equal: != (Not equal sign)
And: -a
Or: -o
Secure Copy
scp [local-file-path]
scp myfiles*.jar user1@abc1234:/tmp/user1/
Secured Shell Commands
ssh user@host [unix-command] [unix-command-parameters]
ssh user1@abc1234 cp [local-file-path] [remote-file-path]
ssh userx@host123 "command-to-run-locally-1; command-to-run-locally-2"
Who all are logged into terminal
finger
To see list of all processes
top
List the file descriptors for a process id
lsof -p [process-id]
Get the length of the string
${#StringVariable}
Evaluate Mathematical/ General expression
Var1=`expr ${VAR-X} - $((${VAR-Y}*2)) - 5`
Secure FTP Command Sample
function getTagValue
{
_TAG=$( echo $( echo $1 | cut -d'<' -f2 ) | cut -d'>' -f1 )
_OUTPUT=$( echo $( echo $1 | cut -d'>' -f2 ) | cut -d'<' -f1 )
}
function getValueFromTag
{
# get the tag name from the text
getTagValue $1
case ${_TAG} in
Target)
_OUT1=$( echo ${_OUTPUT} | cut -d'#' -f1 )
_OUT2=$( echo ${_OUTPUT} | cut -d'#' -f2 )
echo "${_TAG} value1: ${_OUT1} and value2: ${_OUT2}"
;;
User)
echo "${_TAG} value: ${_OUTPUT}"
;;
*)
echo "ERROR: Incorrect TAG : ${_TAG} found!"
exit 2
;;
esac
}
getValueFromTag "
getValueFromTag "
No comments:
Post a Comment