Saturday, June 6, 2026

 Bash Shell

Bash is used to run commands and write scripts on Unix/Linux systems. Bash is the default shell on most Linux and macOS systems. Bash added features from other shells, such as the Korn shell (ksh) and C shell (csh),

[root@localhost ~]# echo $SHELL

/bin/bash

[root@localhost ~]# cat /etc/shells       --available shells

/bin/sh                                     --à cannot find many function, command

/bin/bash

/usr/bin/sh

/usr/bin/bash

[root@localhost ~]# echo "Hello World"                    àin terminal

Hello World

[root@localhost ~]# vi shell1.sh

[root@localhost ~]# ls -l

-rw-r--r--  1 root root      32 Jun  6 13:05 shell1.sh

[root@localhost ~]# bash shell1.sh

Hello World

[root@localhost ~]# env

 [root@localhost ~]# echo $PWD

/root

[root@localhost ~]# echo $PATH

/usr/share/Modules/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

[root@localhost ~]# echo $SHELL

/bin/bash

[root@localhost ~]# su – santosh                   -----à To switch to other user

santosh@localhost ~]$ echo $USER

santosh

env----------------------------------> env---user wise will change, only last for session only

[santosh@localhost ~]$ env                            

 [santosh@localhost ~]$ $PATH

-bash: /home/santosh/.local/bin:/home/santosh/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin: No such file or directory

[santosh@localhost ~]$ export NAME=centos                         here, NAME=variabler, centos=value

[santosh@localhost ~]$ env | grep NAME

HOSTNAME=localhost.localdomain

NAME=centos

LOGNAME=santosh

[santosh@localhost ~]$ var2=NEPAL

[santosh@localhost ~]$ env | grep NEPAL

[santosh@localhost ~]$ echo $var2

NEPAL

[santosh@localhost ~]$ exit            logout from user

logout

[root@localhost ~]# echo $NAME

           -----------Nothing will show

[root@localhost ~]# su - santosh

[santosh@localhost ~]$ echo $var2

 

[santosh@localhost ~]$ echo $NAME         ---doesn't show any things ......only for session

[santosh@localhost ~]$ export NAME=san

[santosh@localhost ~]$ echo $NAME

san

[santosh@localhost ~]$ export NAME=karma

[santosh@localhost ~]$ echo $NAME

karma

[santosh@localhost ~]$ unset NAME                             Ã  To remove

[santosh@localhost ~]$ echo $NAME

 [santosh@localhost ~]$ vi exercise2.sh

[santosh@localhost ~]$  ./exercise2.sh

-bash: ./exercise2.sh: Permission denied

[santosh@localhost ~]$ chmod +x exercise2.sh                 -à To make executable file

[santosh@localhost ~]$  ./exercise2.sh

My Name is San

[santosh@localhost ~]$ cd /tmp/

[santosh@localhost tmp]$ ./exercise2.sh

-bash: ./exercise2.sh: No such file or directory   à file must run where is made

[santosh@localhost tmp]$ cd

[santosh@localhost ~]$ ls

Desktop    Downloads     Music     Public     Videos

Documents  exercise2.sh  Pictures  Templates

[santosh@localhost ~]$ mkdir -p .local/bin

[santosh@localhost ~]$ mv exercise2.sh .local/bin

[santosh@localhost ~]$ echo $PATH

/home/santosh/.local/bin:/home/santosh/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin

[santosh@localhost ~]$ cd /tmp/                  ---->run from anywhere, it works

[santosh@localhost tmp]$ exercise2.sh

My Name is San

[santosh@localhost tmp]$ cd /var/log
[santosh@localhost log]$ exercise2.sh
My Name is San

[santosh@localhost log]$ cd

[santosh@localhost ~]$ cat .local/bin/exercise2.sh

#!/bin/bash

NAME=San

echo "My Name is $NAME"

[santosh@localhost ~]$ mkdir $HOME/.local/bin                         here, $HOME=variable  or use [santosh@localhost ~]$ mkdir -p ~/.local/bin  where, ~/ any user home directory

mkdir: cannot create directory ‘/home/santosh/.local/bin’: File exists

[santosh@localhost ~]$ mkdir -p $HOME/.local/bin

[santosh@localhost ~]$ echo $HOME

/home/santosh

[santosh@localhost ~]$ vi exercise2.sh

[santosh@localhost ~]$ chmod +x exercise2.sh

[santosh@localhost ~]$ ./exercise2.sh

Hello testing

[santosh@localhost ~]$ cd /tmp/

[santosh@localhost tmp]$ ls

[santosh@localhost tmp]$ ./exercise2.sh

-bash: ./exercise2.sh: No such file or directory

[santosh@localhost tmp]$ $HOME/exercise2.sh    àTo execute, give full path

Hello testing

 

OR,

[santosh@localhost tmp]$ cd

[santosh@localhost ~]$ mkdir bin

[santosh@localhost ~]$ mv exercise2.sh  /bin/

mv: cannot move 'exercise2.sh' to '/bin/exercise2.sh': Permission denied

[santosh@localhost ~]$ sudo mv exercise2.sh  /bin/

[sudo] password for santosh:

[santosh@localhost ~]$ cd /bin/

[santosh@localhost bin]$ ls

 

[santosh@localhost bin]$ cd /tmp/

[santosh@localhost tmp]$ exercise2.sh

My Name is San                             here output is My Name is San not Hello tesing because of precedienty of ./local/bin

 

[santosh@localhost tmp]$ cat ~/.local/bin/exercise2.sh

#!/bin/bash

NAME=San

echo "My Name is $NAME"

[santosh@localhost tmp]$ cat ~/bin/exericise2.sh

cat: /home/santosh/bin/exericise2.sh: No such file or directory

[santosh@localhost tmp]$ echo $PATH

/home/santosh/.local/bin:/home/santosh/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin       --àshows on my name is because of precedencity /.local/bin

 [santosh@localhost tmp]$ cd /bin/

[santosh@localhost bin]$ mv exercise2.sh exercise3.sh

mv: cannot move 'exercise2.sh' to 'exercise3.sh': Permission denied

[santosh@localhost bin]$ sudo mv exercise2.sh exercise3.sh

[sudo] password for santosh:

[santosh@localhost bin]$ cd /tmp/

[santosh@localhost tmp]$ ls

[santosh@localhost tmp]$ exercise3.sh

Hello testing

[root@localhost ~]# cd /bin

[root@localhost bin]# ls

[root@localhost bin]# vim exercise4.sh

root@localhost bin]# chmod +x exercise4.sh

[root@localhost bin]# vim exercise4.sh

[root@localhost bin]# exercise4.sh

value1 my first variable

Enter your name

san

Your name is san

:Testing

[root@localhost ~]# cd /

[root@localhost /]# cd bin

[root@localhost bin]# vi exercise5.sh

[root@localhost bin]# chmod +x exercise5.sh

[root@localhost bin]# ./exercise5.sh ram and hari        -->parameter passed

You have passed ram and hari

[root@localhost bin]# man chpasswd                         --for password

 [root@localhost bin]# vi user.sh

 [root@localhost bin]# chmod +x user.sh

 [root@localhost bin]# ./user.sh karma Chelsea

chpasswd: line 1: user 'karma' does not exist

chpasswd: error detected, changes ignored

Username is karma and password is chelsea

 Solution:

[root@localhost bin]# vi user.sh

[root@localhost bin]# chmod +x user.sh

[root@localhost bin]# ./user.sh karma chelsea

Username is karma and password is Chelsea

Note: if from user the add sudo

 To check username and password

[root@localhost bin]# cat /etc/passwd

[root@localhost bin]# id karma

uid=1001(karma) gid=1001(karma) groups=1001(karma)

 [root@localhost bin]# vi user.sh                              -à$# check number if parameter

[root@localhost bin]# ./user.sh  k kk

2 is number of parameter

Username is k and password is kk

Practice: ssh enable or not

service running or not,  if not running, run it , if it is already running,message it as its running

Add 50 user and password 

install nginx

install mysql

install postgress

Database backup and restore 

[root@localhost ~]# cd /

[root@localhost /]# ls

bin   etc   lib    mnt             opt   run     shell1.sh  tmp

boot  home  lib64  nginxscript     proc  sbin    srv        usr

dev   HOME  media  nginxscript.sh  root  script  sys        var

[root@localhost /]# cd bin

[root@localhost bin]# vi if.sh

[root@localhost bin]# chmod +x if.sh

[root@localhost bin]# ./if.sh

Enter the name

ram

You are successful

[root@localhost /]# cd bin

[root@localhost bin]# vi else.sh

[root@localhost bin]# chmod +x else.sh

[root@localhost bin]# ./else.sh

Enter the name

ram

You are successful

[[root@localhost bin]# ./else.sh

Enter the name

jeevan

 You are not done yet

[root@localhost bin]# name=hari

[root@localhost bin]# if [ $name == "hari" ]; then echo "You are successful"; fi

You are successful

 [root@localhost ~]# cd /

[root@localhost /]# cd bin

[root@localhost bin]# vi for.sh

 

[root@localhost bin]# chmod +x for.sh

[root@localhost bin]# ./for.sh

hello world 1

hello world 2

hello world 3

hello world 4

hello world 5

 

 

 

 

 

 

 

 

 


 

 

 

 


 

 


 

 

 

 


 

 

 

 

Friday, May 29, 2026

DevOps ....dewakoding-project-management

 

Requirements

  • PHP > 8.2+
  • Laravel 12
  • Composer
  • Node.js & npm
  •  
  • [root@localhost ~]# dnf update

    Updating Subscription Management repositories.

    Last metadata expiration check: 0:00:33 ago on Thu 28 May 2026 07:24:34 PM +0545.

    Dependencies resolved.

    Nothing to do.

    Complete!

     
  •  

    DevOps

     1) Installation of Nginx in Redhat Enterprise Linux 8.10

    Installation of nginx in red hat linux 8.10

    [root@192 ~]# dnf -y update

    Updating Subscription Management repositories.

    Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)                                      3.3 MB/s |  85 MB     00:25

    Red Hat Enterprise Linux 8 for x86_64 - Bas 61% [==========================                 ] 2.7 MB/s |  84 MB     00:20 ETA

    [root@192 ~]# dnf -y install nginx

    [root@192 ~]# dnf search nginx

    [root@192 ~]# systemctl list-unit

    list-unit-files  list-units

    [root@192 ~]# systemctl list-unit-files | grep nginx

    nginx.service                              disabled

    [root@192 ~]# systemctl list-units | grep nginx

    [root@192 ~]# systemctl enable nginx

    Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /usr/lib/systemd/system/nginx.service.

    [root@192 ~]# systemctl start nginx

    [root@192 ~]# systemctl list-units | grep nginx

    nginx.service                                                                                    loaded active running   The nginx HTTP and reverse proxy server

    [root@192 ~]# firewall-cmd --list-all

    [root@192 ~]# firewall-cmd --add-service=http --permanent

    Success

    [root@192 ~]# firewall-cmd --reload

    success

    [root@192 ~]# firewall-cmd --list-all

     

    [root@192 ~]# getenforce

    Enforcing

    [root@192 ~]# setenforce 0

    [root@192 ~]# getenforce

    Permissive

    [root@192 ~]# mkdir -p /var/www/html/testweb

    [root@192 ~]# cd /var/www/html/testweb/

    [root@192 testweb]# ls

    [root@192 testweb]# cd ~

    [root@192 ~]# vi /etc/nginx/conf.d/web.conf

    server {

    listen 80;

    server_name mywebsite.com.np;

    root /var/www/html/testweb;

    index index.html;

    }

     

    For this file  reference is 

    [root@192 ~]# cat /etc/nginx/nginx.conf

    [root@192 ~]# firefox mywebsite.com.np

    Safe Browsing server returned a 400 during update:request url = https://safebrowsing.googleapis.com/v4/threatListUpdates:fetch?$ct=application/x-protobuf&key=AIzaSyBPGXa4AYD4FC3HJK7LnIKxm4fDusVuuco&$httpMethod=POST, payload = ChUKE25hdmNsaWVudC1hdXRvLWZmb3gaCggFEAIiAiACKAEaCggBEAIiAiACKAEaCggDEAIiAiACKAEaCggHEAIiAiACKAEaCggJEAIiAiACKAE=

    [root@192 ~]# vi /etc/hosts

    192.168.184.133  mywebsite.com.np

    [root@192 ~]# systemctl reload nginx

    [root@192 ~]# firefox mywebsite.com.np

    Safe Browsing server returned a 400 during update:request url = https://safebrowsing.googleapis.com/v4/threatListUpdates:fetch?$ct=application/x-protobuf&key=AIzaSyBPGXa4AYD4FC3HJK7LnIKxm4fDusVuuco&$httpMethod=POST, payload = ChUKE25hdmNsaWVudC1hdXRvLWZmb3gaCggFEAIiAiACKAEaCggBEAIiAiACKAEaCggDEAIiAiACKAEaCggHEAIiAiACKAEaCggJEAIiAiACKAE

    403 Forbidden means Nginx is running but can't access your website files. This is a permissions issue.

    [root@192 ~]# cat /var/log/nginx/error.log

    The error is clear — no index file found in your web directory.

    [root@192 ~]# nginx -t

    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

    nginx: configuration file /etc/nginx/nginx.conf test is successful

    [root@192 ~]# ping mywebsite.com.np

    PING mywebsite.com.np (192.168.184.133) 56(84) bytes of data.

    64 bytes from mywebsite.com.np (192.168.184.133): icmp_seq=1 ttl=64 time=0.093 ms

    64 bytes from mywebsite.com.np (192.168.184.133): icmp_seq=2 ttl=64 time=0.086 ms

    64 bytes from mywebsite.com.np (192.168.184.133): icmp_seq=3 ttl=64 time=0.123 ms

    ^C

    --- mywebsite.com.np ping statistics ---

    3 packets transmitted, 3 received, 0% packet loss, time 2085ms

    rtt min/avg/max/mdev = 0.086/0.100/0.123/0.019 ms

    [root@192 ~]# vi /etc/nginx/conf.d/web.conf

    [root@192 ~]# curl mywebsite.com.np

    <html>

    <head><title>403 Forbidden</title></head>

    <body bgcolor="white">

    <center><h1>403 Forbidden</h1></center>

    <hr><center>nginx/1.14.1</center>

    </body>

    </html>

    Solution make index .html file

    root@192 html]# cd testweb/

    [root@192 testweb]# vi index.html

    <html>

    <body>

        <h1>Hello, World!</h1>

    </body>

    </html>

     

    [root@192 testweb]# firewall-cmd --reload

    success

    [root@192 testweb]# systemctl reload nginx

    [root@192 testweb]# firefox mywebsite.com.np

    To append used >>

    [root@192 testweb]# echo "website" >> index.html

    [root@192 testweb]# firefox http://mywebsite.com.np

    dnf -y install unzip

    Updating Subscription Management repositories.

    Last metadata expiration check: 0:58:44 ago on Sat 04 Jul 2026 06:51:54 AM EDT.

    Package unzip-6.0-48.el8_10.x86_64 is already installed.

    Dependencies resolved.

    Nothing to do.

    Complete!

    Dnf install unzip

    [root@192 ~]# cd /root/

    [root@192 ~]# ls

    anaconda-ks.cfg  Downloads  initial-setup-ks.cfg

    [root@192 ~]# cd Downloads/

    [root@192 Downloads]# ls

    templatemo_574_mexant.zip

    [root@192 Downloads]#  unzip -j templatemo_574_mexant.zip -d /var/www/html/testweb/                                           Archive:  templatemo_574_mexant.zip

      inflating: /var/www/html/testweb/about-us.html

      inflating: /var/www/html/testweb/animate.css

      inflating: /var/www/html/testweb/flex-slider.css

     

    [root@192 Downloads]# systemctl reload nginx

    [root@192 Downloads]# systemctl restart nginx

    [root@192 Downloads]# firewall-cmd --reload

    success

    [root@192 Downloads]# firefox http://mywebsite.com.np

     

     

    Problem: css not working

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    2) SSL  in Redhat Enterprise Linux 8.10

     

     

     

     

    Thursday, April 23, 2026

    Camera

     Your camera is reporting that it is blocked or turnedoff by a switch or button

    Slide the slider near to the web cam and test the webcam https://webcamtests.com/ 

    Video Converter

     Download Youtube  video into Desktop

    4K Video Downloader

    https://videoconverter.wondershare.net/