On Tue, Feb 23, 2016 at 12:02 AM, MohanR <mohan43u at gmail.com> wrote:
On Mon, 2016-02-22 at 13:08 +0530, sahil ????? wrote:
* Identify which IP address and port the Apache daemon listens on.sudo ss -4tlnp | grep 'httpd' | awk '{print $4}'
* Find all IP addresses between your server and www.google.com(dest="www.google.com"; ip=$(host "${dest}" | head -1 | awk '{print
$NF}'); for count in {1..30}; do hop=$(ping -t "${count}" -c 1 "${ip}"
| sed -n 's/^.*[fF]rom \([0-9.]*\).*$/\1/gp'); echo "${hop}"; [ "${ip}"
= "${hop}" ] && break; done)
* Create an empty directory and change the permissions so that theNothing to say
owner
can execute, read and write, the group can execute and read and the
others
cannot do anything.
# mkdir demo && chmod 750 demo
* Print all the lines from /var/log/demon.log having the string ntpgrep -E '\<ntp\>|\<NTP\>' /var/log/daemon.log
and NTP
but not NtP.
* Write a shell script to get the third element delimited by ":" from(SUM=0; read_cb(){ set ${2//:/ }; SUM=$((SUM + $3)); }; readarray -c 1
a
file (passing the file name as an argument to the script) and the
format of
the file is same as of /etc/passwd file and then add up all the
numbers. Do
not use <awk, sed, cut...>
-C read_cb; echo "${SUM}") < /etc/passwd
If you think reading questions like this will improve your knowledge on
*nix, then I'm sorry. If you think answering these kind of questions
can get you a job, then I'm really sorry. start contributing to a
opensource project, that will fetch you a good job.
Side-Note: I think this mailing-list operates in a specific language
called "English", so "Nameste" is not appropriate here. By saying this,
you are loosing responses from some real hardcore techies who may not
like your way of salutation.