[Ilugc] [[Need help]] Few *nix questions

  • From: scorpionking.sahil@xxxxxxxxx (sahil साहिल)
  • Date: Tue, 23 Feb 2016 00:27:50 +0530

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 the
owner
can execute, read and write, the group can execute and read and the
others
cannot do anything.
# mkdir demo && chmod 750 demo
Nothing to say

* Print all the lines from /var/log/demon.log having the string ntp
and NTP
but not NtP.
grep -E '\<ntp\>|\<NTP\>' /var/log/daemon.log

* Write a shell script to get the third element delimited by ":" from
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...>
(SUM=0; read_cb(){ set ${2//:/ }; SUM=$((SUM + $3)); }; readarray -c 1
-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.


Well, thank you for taking time from your busy schedule and writing
answers. I really appreciate that. I never thought that reading or
answering such questions will land-up me a job. But reading something
useful and related to your interest is not bad either. Puting efforts to
any opensource project is another thing and solving/reading questions
before going to any exam is another tale. One should know the difference. :)
If my questions made one annoy then I will not ask questions from now
onwards. I thought that in this group folks are quite experienced that's
why I ask questions so we all learn from those and new folks like me may
get some real insight.


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.


I know this mailing-list operates in English and I don't mind in writing
"Namaste" as salutation as this is our Indian culture and I feel proud and
prefer to say Namaste.
Those who like they will respond and those who don't they will not. I never
seek. I just asked. Rest is choice. As simple as that!

-- 

*Regards,Sahil ModGill*

Other related posts: