Wednesday, April 28, 2021

How to find the web server location of html, php files on a remote machine?

 I had to make modifications on a remote machine.But i did not know the location where web server files html or php are located.

ssh username@remotehost
password: #####

bash$cat /etc/httpd/conf/httpd.conf | grep DocumentRoot

# DocumentRoot: The directory out of which you will serve your
DocumentRoot "/var/www/html"

cd /var/www/html

There I was in the directory to proceed further,

Tuesday, April 27, 2021

What do the version numbers mean in NPM modules ^ ~

 

A package with the sequence 4.17.4 is interpreted as Major release, Minor Release and patch.

^4.17.4 - keep major version update minor version

~4.17.4 - keep minor version update patch

4.17.4 - exact version

* - latest version

How to find root directory of NPM modules?

 npm root -g

Monday, April 26, 2021

What is XHR?

 XHR stands for XmlHttpRequest object.

This is the traditional way of accessing data asynchronously.

HTML file has a button that we will use to trigger the event.

!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<!--<meta http-equiv="X-UA-Compatible" content-->
<meta name="keyword" content="AJAX">
<meta name="description=" content="AJAX example">
<!-- <script type="javascript" async="" src="js/ajax.js"></script> -->
<title>AJAX Example</title>
</head>
<body>
<div class="container">
<button id="button">Get Data</button>
<br><br>
<div id="output"></div>
</div>
<script src="js/ajax.js"></script>
</body>
</html>



<script src="js/ajax.js"></script>

Saturday, April 24, 2021

Where are the macOS commands located? What are /usr/bin /usr/local/bin directories used for?

We have all heard of /usr/bin /usr/local/bin and so on. Do we know how and why they are organized?Let's get started

/bin - user utilities - cd ls cat bash cp pwd - all these are here. Did you know? 

/sbin - s for system program and administration

ping mount reboot shutdown ifconfig - ring a bell?

/usr/bin - non-system programs - 

awk base64 curl emacs find grep ssh php vim perl php python rake rails sed

/usr/sbin - system daemons(background processes) & system utilities only

chown chmod cron httpd sendmail sshd apachectl - sytem utilities that are user specific

/usr/local/bin - The programs installed over the base operating systems due to a dmg file installation or using a package manager might land up here.

Example: Lets say you install mysql it would be installed in /usr/local/mysql/bin. Similarly php would be installed in /usr/local/php

Summary:
/bin and /sbin - commands provided by OS - /bin - consumers /sbin - system administrators
/usr/bin - utilities used by developers
/usr/sbin - utilities used by OS administrators
/usr/local/bin - compilers/executables softwares installed - php and mysql
/usr/local/sbin - administrative commands for softwares installed - Apache restart, mysql server start re-start

We all use cd, ls and many such commands in the macOS Terminal day in and day out. I am better than yesterday after I learnt this today. I know where to search my executables.

Credits & Thanks to :https://medium.com/@jalendport/what-exactly-is-your-shell-path-2f076f02deb4