Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Wednesday, September 14, 2022

Ten Commands For Day 1 With Ubuntu

1.

(base) ashish@ashishdesktop:~$ ls

anaconda3   Desktop   Documents   Downloads   Pictures  "PlayOnLinux's virtual drives"   Public   snap   Videos

2.

(base) ashish@ashishdesktop:~$ cd Desktop

(base) ashish@ashishdesktop:~/Desktop$ ls
'The Tsunami (Class 8th).odt'   ws

(base) ashish@ashishdesktop:~/Desktop$ ls -l
total 28
-rw-rw-r-- 1 ashish ashish 24290 Jul  6 21:37 'The Tsunami (Class 8th).odt'
drwxrwxr-x 6 ashish ashish  4096 Mar 15  2022  ws

(base) ashish@ashishdesktop:~/Desktop$ 
(base) ashish@ashishdesktop:~/Desktop$ 

3.

(base) ashish@ashishdesktop:~/Desktop$ mkdir moni

(base) ashish@ashishdesktop:~/Desktop$ ls -l

total 32
drwxrwxr-x 2 ashish ashish  4096 Sep 14 20:16  moni
-rw-rw-r-- 1 ashish ashish 24290 Jul  6 21:37 'The Tsunami (Class 8th).odt'
drwxrwxr-x 6 ashish ashish  4096 Mar 15  2022  ws

(base) ashish@ashishdesktop:~/Desktop$ 

(base) ashish@ashishdesktop:~/Desktop$ cd moni
(base) ashish@ashishdesktop:~/Desktop/moni$ 
(base) ashish@ashishdesktop:~/Desktop/moni$ 
(base) ashish@ashishdesktop:~/Desktop/moni$ ls -l
total 0

4.

(base) ashish@ashishdesktop:~/Desktop/moni$ touch moni.html
(base) ashish@ashishdesktop:~/Desktop/moni$ ls -l
total 0
-rw-rw-r-- 1 ashish ashish 0 Sep 14 20:21 moni.html
(base) ashish@ashishdesktop:~/Desktop/moni$ 

5.

(base) ashish@ashishdesktop:~/Desktop/moni$ gedit moni.html
(base) ashish@ashishdesktop:~/Desktop/moni$ 
(base) ashish@ashishdesktop:~/Desktop/moni$ ls -l
total 4
-rw-rw-r-- 1 ashish ashish 35 Sep 14 20:27 moni.html
(base) ashish@ashishdesktop:~/Desktop/moni$ 

6.

(base) ashish@ashishdesktop:~/Desktop/moni$ ls
moni.html
(base) ashish@ashishdesktop:~/Desktop/moni$ touch dummy.html
(base) ashish@ashishdesktop:~/Desktop/moni$ 
(base) ashish@ashishdesktop:~/Desktop/moni$ ls -l
total 4
-rw-rw-r-- 1 ashish ashish  0 Sep 14 21:58 dummy.html
-rw-rw-r-- 1 ashish ashish 35 Sep 14 20:27 moni.html
(base) ashish@ashishdesktop:~/Desktop/moni$ 
(base) ashish@ashishdesktop:~/Desktop/moni$ gedit dummy.html
(base) ashish@ashishdesktop:~/Desktop/moni$ ls -l
total 8
-rw-rw-r-- 1 ashish ashish  6 Sep 14 21:59 dummy.html
-rw-rw-r-- 1 ashish ashish 35 Sep 14 20:27 moni.html
(base) ashish@ashishdesktop:~/Desktop/moni$ 
(base) ashish@ashishdesktop:~/Desktop/moni$ rm dummy.html
(base) ashish@ashishdesktop:~/Desktop/moni$ 
(base) ashish@ashishdesktop:~/Desktop/moni$ ls -l
total 4
-rw-rw-r-- 1 ashish ashish 35 Sep 14 20:27 moni.html

7.

(base) ashish@ashishdesktop:~/Desktop/moni$ cat moni.html
<pre>
my name is moni singh.
</pre>

8.

(base) ashish@ashishdesktop:~/Desktop/moni$ pwd
/home/ashish/Desktop/moni

9.

(base) ashish@ashishdesktop:~/Desktop/moni$ echo $USER
ashish
(base) ashish@ashishdesktop:~/Desktop/moni$ echo $HOME
/home/ashish

10.

(base) ashish@ashishdesktop:~/Desktop/moni$ uname -a

Linux ashishdesktop 5.15.0-41-generic #44-Ubuntu SMP Wed Jun 22 14:20:53 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

(base) ashish@ashishdesktop:~/Desktop/moni$ uname

Linux

FAQs

Ques 1: What is Terminal? Ans 1: Terminal is a command line interface to the Ubuntu operating system. As of Oct, 2021: Terminal icon is depicted by a 'black background with letters ">_". "Terminal" is an application that is used to run command like: "ls", "cd" and "echo". manju@manju-desktop:~$ ls Desktop Documents Downloads Music Pictures Public Templates Videos manju@manju-desktop:~$ manju@manju-desktop:~$ ls -l total 32 drwxr-xr-x 2 manju manju 4096 Oct 1 23:34 Desktop drwxr-xr-x 2 manju manju 4096 Oct 1 20:56 Documents drwxr-xr-x 2 manju manju 4096 Apr 7 11:58 Downloads drwxr-xr-x 2 manju manju 4096 Apr 7 11:58 Music drwxr-xr-x 2 manju manju 4096 Apr 7 11:58 Pictures drwxr-xr-x 2 manju manju 4096 Apr 7 11:58 Public drwxr-xr-x 2 manju manju 4096 Apr 7 11:58 Templates drwxr-xr-x 2 manju manju 4096 Apr 7 11:58 Videos manju@manju-desktop:~$ cd Desktop manju@manju-desktop:~/Desktop$ ls -l total 4 -rw-rw-r-- 1 manju manju 537 Oct 1 23:34 'Beginner FAQs for Ubuntu.txt' --- Ques 2: How to browse internet? Answer 2: Use broswers: 1. Mozilla Firefox Browser. 2. Google Chrome. --- Ques 3: How to install Google Chrome. Answer: Use 'Ubuntu Software'. Step 1: Open "Ubuntu Software". Step 2: Press 'Ctrl+F' to launch 'Find and Search'. OR Step 1: Do a Google search in Firefox: "google chrome ubuntu" Step 2: On "Google Chrome Download" page, select "64 bit .deb (For Debian/Ubuntu)" radio button. Step 3: Click on "Accept and Install". ---
Tags: Technology,Linux,

Wednesday, February 23, 2022

No voice in Firefox on Ubuntu 2022-Feb-23

Logs From Firefox Console:

>>> window.speechSynthesis.getVoices()

Array []
length: 0
<prototype>: Array []
Tags: Technology,JavaScript,Web Development,Linux,

Tuesday, February 1, 2022

Debugging SSH Setup for two RHEL systems


ISSUE: SLAVE1 IS NOT ABLE TO CONNECT WITH SLAVE2 VIA SSH WITHOUT PASSWORD PROMPT.

IP AND HOSTNAME MAPPING:
  10.74.19.50 ​   MASTER
  10.138.22.103  SLAVE1
  10.85.62.107   SLAVE2

COMMANDS FOR DOING SSH SETUP:

  1) sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT
  2) sudo reboot
  3) ssh-keygen -t rsa -f ~/.ssh/id_rsa -P ""
  4) ssh-copy-id -i ~/.ssh/id_rsa.pub projadmin@SLAVE2
  5) ssh-copy-id -i ~/.ssh/id_rsa.pub admin@SLAVE1
  6) ssh-copy-id -i ~/.ssh/id_rsa.pub admin@MASTER

~~  ~~  ~~

Command "ssh-copy-id" is used to copy your SSH public key to remote server for password less authentication.

MESSAGE YOU GET WHEN SSH KEYS ARE ALREADY PRESENT ON THE REMOTE SYSTEM:

  (base) [projadmin@SLAVE2 ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub admin@SLAVE1
    /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/projadmin/.ssh/id_rsa.pub"
    /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
    
    /usr/bin/ssh-copy-id: WARNING: All keys were skipped because they already exist on the remote system.
                    (if you think this is a mistake, you may want to use -f option)

~~  ~~  ~~

MESSAGE YOU GET WHEN SSH KEYS ARE COPIED ON THE REMOTE SYSTEM:

  (base) [admin@SLAVE1 ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub projadmin@SLAVE2
    /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/admin/.ssh/id_rsa.pub"
    /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
    /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
    IT IS AN OFFENSE TO CONTINUE WITHOUT PROPER AUTHORIZATION.
    projadmin@SLAVE2's password:
    
    Number of key(s) added: 1
    
    Now try logging into the machine, with:   "ssh 'projadmin@SLAVE2'"
    and check to make sure that only the key(s) you wanted were added.

LOGIN ATTEMPT 1:
  (base) [admin@SLAVE1 ~]$ ssh 'projadmin@SLAVE2'
    The authenticity of host 'slave2 (10.85.62.107)' can't be established.
    ECDSA key fingerprint is SHA256:+BqTUw27qVUgqcYRErYL8nksgX4XX9cimu/sgk2IkRs.
    ECDSA key fingerprint is MD5:27:41:cd:39:f2:97:a9:29:6b:e8:8b:f3:e6:aa:cd:8e.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added 'slave2' (ECDSA) to the list of known hosts.
    IT IS AN OFFENSE TO CONTINUE WITHOUT PROPER AUTHORIZATION.
    projadmin@slave2's password:
    Last login: Fri May  1 11:56:39 2020 from SLAVE1
    W A R N I N G
    THIS IS A PRIVATE COMPUTING SYSTEM FOR USE ONLY BY AUTHORIZED USERS.
  (base) [projadmin@SLAVE2 ~]$

LOGIN ATTEMPT 2:
  
  (base) [admin@SLAVE1 ~]$ ssh 'projadmin@SLAVE2'
    IT IS AN OFFENSE TO CONTINUE WITHOUT PROPER AUTHORIZATION.
    projadmin@slave2's password:
    Last login: Fri May  1 12:01:02 2020 from SLAVE1
    W A R N I N G
    THIS IS A PRIVATE COMPUTING SYSTEM FOR USE ONLY BY AUTHORIZED USERS.
	
  (base) [projadmin@SLAVE2 ~]$

~~  ~~  ~~

SSH PUBLIC KEYS ARE STORED IN REMOTE SERVER'S FILE "~/.ssh/authorized_keys". NEXT, WE DISPLAY THAT:

  (base) [projadmin@SLAVE2 ~]$ cat ~/.ssh/authorized_keys
    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAaG5d2wcXeVGQkTtiHr5EQD5nYPugU1upCAnsei8vuZ1LpoUdrCiFq0jkvnQCOa... admin@MASTER
    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDckTRtXhW3JlQ/dgR3cEn70MGUNU29DT438ItypXh+BRnGTSuFayGLLb7XfgR4Fg... projadmin@SLAVE2
    ssh-rsa	AAAAB3NzaC1yc2EAAAADAQABAAABAQCb/WDdGt0abaEI9aTljhgtRYtzrjjAJu3+GK3wbmjFMTvvlb5729l4kcUwg3IeAv... admin@SLAVE1

NEXT, WE CHECK OUR PUBLIC KEY OF SLAVE1:
  (base) [admin@SLAVE1 ~]$ cat ~/.ssh/id_rsa.pub
    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCb/WDdGt0abaEI9aTljhgtRYtzrjjAJu3+GK3wbmjFMTvvlb5729l4kcUwg3IeAv... admin@SLAVE1

~~  ~~  ~~

NEXT, WE CHECK SSH CONFIG ON SLAVE2:
  (base) [admin@SLAVE1 ~]$ cat ~/.ssh/config
    cat: /home/admin/.ssh/config: No such file or directory
  (base) [admin@SLAVE1 ~]$

  (base) [projadmin@SLAVE2 ~]$ ssh-agent
    SSH_AUTH_SOCK=/tmp/ssh-1ULxPy4vidVX/agent.5929; export SSH_AUTH_SOCK;
    SSH_AGENT_PID=5930; export SSH_AGENT_PID;
    echo Agent pid 5930;

NEXT, WE CHECK SSH CONFIG ON SLAVE2:
  (base) [projadmin@SLAVE2 .ssh]$ ls
    authorized_keys  id_rsa  id_rsa.pub  known_hosts
  
  (base) [projadmin@SLAVE2 .ssh]$ cat known_hosts
    SLAVE1,10.138.22.103 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTIt...rObCVOxrV5XaKARNHQA=
	slave1 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTIt...rbCVOxrV5XaKARNHQA=
    SLAVE2,10.85.62.107 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoY...Xg6hmPnlGbfIiVmVPNdU=
	slave2 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbm...ArObCVOxrV5XaKARNHQA=
    10.74.19.50 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYT...rObCVOxrV5XaKARNHQA=
    MASTER ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTIt...ArObCVOxrV5XaKARNHQA=
    master ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTI...hmPnlGbfIiVmVPNdU=
    localhost ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoY...mPnlGbfIiVmVPNdU=
      
CREATING 'CONFIG' FILE SINCE IT DOES NOT EXIST:
  (base) [projadmin@SLAVE2 .ssh]$ touch config
  (base) [projadmin@SLAVE2 .ssh]$ ls
    authorized_keys  config  id_rsa  id_rsa.pub  known_hosts
  (base) [projadmin@SLAVE2 .ssh]$ vi config
  (base) [projadmin@SLAVE2 .ssh]$ cat config
    Host *
      UseKeychain yes
      AddKeysToAgent yes
      IdentityFile ~/.ssh/id_rsa

  (base) [projadmin@SLAVE2 ~]$ ssh-add -A
    Could not open a connection to your authentication agent.
  (base) [projadmin@SLAVE2 ~]$

~~  ~~  ~~

  (base) [projadmin@SLAVE2 ~]$ eval `ssh-agent -s`
    Agent pid 5182

  (base) [projadmin@SLAVE2 ~]$ ssh-add -K ~/.ssh/id_rsa
    unknown option -- K
    usage: ssh-add [options] [file ...]
    Options:
      -l          List fingerprints of all identities.
      -E hash     Specify hash algorithm used for fingerprints.
      -L          List public key parameters of all identities.
      -k          Load only keys and not certificates.
      -c          Require confirmation to sign using identities
      -t life     Set lifetime (in seconds) when adding identities.
      -d          Delete identity.
      -D          Delete all identities.
      -x          Lock agent.
      -X          Unlock agent.
      -s pkcs11   Add keys from PKCS#11 provider.
      -e pkcs11   Remove keys provided by PKCS#11 provider. 
	  
  (base) [projadmin@SLAVE2 ~]$ ssh-add -k ~/.ssh/id_rsa
    Identity added: /home/projadmin/.ssh/id_rsa (/home/projadmin/.ssh/id_rsa)
    (base) [projadmin@SLAVE2 ~]$

  (base) [projadmin@SLAVE2 .ssh]$ eval `ssh-agent -s`
    Agent pid 5611
  (base) [projadmin@SLAVE2 .ssh]$ ssh-add ~/.ssh/id_rsa
    Identity added: /home/projadmin/.ssh/id_rsa (/home/projadmin/.ssh/id_rsa)
    
~~  ~~  ~~

LAST RESORT:

  Deleting the everything in the directory: projadmin@SLAVE2:/home/projadmin/.ssh
  Copying public key only again from slave1: (base) [admin@SLAVE1 ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub projadmin@SLAVE2
  The issue still exists. Not able to SSH slave2 from slave1 without password prompt.

~~  ~~  ~~

STATUS: ISSUE UNRESOLVED

References:

1. SSH Setup: Remote machine still asking for password (Stackoverflow)
2. Copying SSH key to remote server

Tags: Technology,Linux,SSH

SSH Setup on Two Ubuntu Machines


USER: MANJU

1. manju@manju-desktop:~/Desktop$ sudo nano /etc/hostname [sudo] password for manju: manju@manju-desktop:~/Desktop$ cat /etc/hostname manju

2.

manju@manju:~/Desktop$ hostname manju manju@manju:~/Desktop$ sudo nano /etc/hosts [sudo] password for manju: manju@manju:~/Desktop$ cat /etc/hosts 192.168.1.103 manju 192.168.1.101 ashish manju@manju:~/Desktop$ sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT manju@manju:~/Desktop$ ssh-keygen -t rsa -f ~/.ssh/id_rsa -P "" Generating public/private rsa key pair. Created directory '/home/manju/.ssh'. Your identification has been saved in /home/manju/.ssh/id_rsa Your public key has been saved in /home/manju/.ssh/id_rsa.pub The key fingerprint is: SHA256:87t+....JyZl5NvSEYYvM manju@manju The key's randomart image is: +---[RSA 3072]----+ ... | ..+ | | .++ | +----[SHA256]-----+ manju@manju:~/Desktop$ ssh-copy-id -i ~/.ssh/id_rsa.pub ashish@ashish /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/manju/.ssh/id_rsa.pub" /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: ERROR: ssh: connect to host ashish port 22: No route to host 3. manju@manju:~$ sudo apt-get install openssh-server manju@manju:~$ sudo reboot

4.

manju@manju:~$ ping 192.168.1.104 PING 192.168.1.104 (192.168.1.104) 56(84) bytes of data. 64 bytes from 192.168.1.104: icmp_seq=1 ttl=64 time=87.5 ms 64 bytes from 192.168.1.104: icmp_seq=2 ttl=64 time=3.47 ms ^C --- 192.168.1.104 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1002ms rtt min/avg/max/mdev = 3.466/45.488/87.510/42.022 ms manju@manju:~$ sudo nano /etc/hosts [sudo] password for manju: manju@manju:~$ ssh-copy-id -i ~/.ssh/id_rsa.pub ashish@ashish /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/manju/.ssh/id_rsa.pub" The authenticity of host 'ashish (192.168.1.104)' can't be established. ECDSA key fingerprint is SHA256:gSl4hdqrq8...WVRO0. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys ashish@ashish's password: Number of key(s) added: 1 Now try logging into the machine, with: "ssh 'ashish@ashish'" and check to make sure that only the key(s) you wanted were added. manju@manju:~$

USER: ASHISH

1. ashish@ashish-Vostro-1014:~/Desktop$ cat /etc/hosts 127.0.0.1 localhost 127.0.1.1 ashish-Vostro-1014 # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters 2. ashish@ashish:~/Desktop$ cat /etc/hostname ashish ashish@ashish:~/Desktop$ hostname ashish ashish@ashish:~/Desktop$ ashish@ashish:~/Desktop$ ifconfig enp9s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 ether 14:fe:b5:a2:4f:ec txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 203 bytes 17205 (17.2 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 203 bytes 17205 (17.2 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 wlp12s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.101 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 2401:4900:47fc:ff81:4d50:2f1b:8e0d:4ab3 prefixlen 64 scopeid 0x0<global> inet6 2401:4900:47fc:ff81:69fb:546c:eed4:ba63 prefixlen 64 scopeid 0x0<global> inet6 fe80::6e0:63ce:56e8:94bc prefixlen 64 scopeid 0x20<link> ether ec:55:f9:13:78:d3 txqueuelen 1000 (Ethernet) RX packets 93 bytes 19289 (19.2 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 182 bytes 29336 (29.3 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 3. ashish@ashish:~/Desktop$ sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT [sudo] password for ashish: ashish@ashish:~/Desktop$ ssh-keygen -t rsa -f ~/.ssh/id_rsa -P "" Generating public/private rsa key pair. /home/ashish/.ssh/id_rsa already exists. Overwrite (y/n)? y Your identification has been saved in /home/ashish/.ssh/id_rsa Your public key has been saved in /home/ashish/.ssh/id_rsa.pub The key fingerprint is: SHA256:WNJqmuUwAR/PGRaM...c68dg ashish@ashish The key's randomart image is: +---[RSA 3072]----+ ... | +.+=. | | o.o+.E | |oo.o**. | +----[SHA256]-----+ 4. ashish@ashish:~$ cat /etc/hosts 192.168.1.101 ashish 192.168.1.103 manju ashish@ashish:~$ ashish@ashish:~$ sudo reboot 5. ashish@ashish:~$ sudo apt-get install openssh-server 6. ashish@ashish:~$ ssh-copy-id -i ~/.ssh/id_rsa.pub manju@manju /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/ashish/.ssh/id_rsa.pub" The authenticity of host 'manju (192.168.1.103)' can't be established. ECDSA key fingerprint is SHA256:4lS4BWY6l7I0A2pQ6RiSB6PMskHiy1oNVPozB/6jkIc. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys manju@manju's password: Number of key(s) added: 1 Now try logging into the machine, with: "ssh 'manju@manju'" and check to make sure that only the key(s) you wanted were added. 7. ashish@ashish:~$ ssh manju@manju Welcome to Ubuntu 21.04 (GNU/Linux 5.11.0-49-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage 65 updates can be applied immediately. To see these additional updates run: apt list --upgradable Your Ubuntu release is not supported anymore. For upgrade information, please visit: http://www.ubuntu.com/releaseendoflife New release '21.10' available. Run 'do-release-upgrade' to upgrade to it.
Tags: Technology,Linux,

Connect Windows Machine and Ubuntu Machine Over Airtel Hotspot


1:
2:
Logs: (base) C:\Users\Ashish Jain>ping 192.168.1.102 Pinging 192.168.1.102 with 32 bytes of data: Reply from 192.168.1.102: bytes=32 time=6ms TTL=64 Reply from 192.168.1.102: bytes=32 time=7ms TTL=64 Reply from 192.168.1.102: bytes=32 time=6ms TTL=64 Reply from 192.168.1.102: bytes=32 time=7ms TTL=64 Ping statistics for 192.168.1.102: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 6ms, Maximum = 7ms, Average = 6ms

3:

4:

5:

manju@manju-desktop:~/Desktop$ ping 192.168.1.103 PING 192.168.1.103 (192.168.1.103) 56(84) bytes of data. 64 bytes from 192.168.1.103: icmp_seq=110 ttl=128 time=3.71 ms 64 bytes from 192.168.1.103: icmp_seq=111 ttl=128 time=5.60 ms 64 bytes from 192.168.1.103: icmp_seq=112 ttl=128 time=5.98 ms 64 bytes from 192.168.1.103: icmp_seq=113 ttl=128 time=3.79 ms 64 bytes from 192.168.1.103: icmp_seq=114 ttl=128 time=4.48 ms 64 bytes from 192.168.1.103: icmp_seq=115 ttl=128 time=8.06 ms 64 bytes from 192.168.1.103: icmp_seq=116 ttl=128 time=10.5 ms 64 bytes from 192.168.1.103: icmp_seq=117 ttl=128 time=164 ms 64 bytes from 192.168.1.103: icmp_seq=118 ttl=128 time=5.08 ms 64 bytes from 192.168.1.103: icmp_seq=119 ttl=128 time=217 ms 64 bytes from 192.168.1.103: icmp_seq=120 ttl=128 time=30.9 ms 64 bytes from 192.168.1.103: icmp_seq=121 ttl=128 time=5.03 ms 64 bytes from 192.168.1.103: icmp_seq=122 ttl=128 time=217 ms 64 bytes from 192.168.1.103: icmp_seq=123 ttl=128 time=4.62 ms 64 bytes from 192.168.1.103: icmp_seq=124 ttl=128 time=11.9 ms 64 bytes from 192.168.1.103: icmp_seq=125 ttl=128 time=6.16 ms 64 bytes from 192.168.1.103: icmp_seq=126 ttl=128 time=5.97 ms 64 bytes from 192.168.1.103: icmp_seq=127 ttl=128 time=6.92 ms 64 bytes from 192.168.1.103: icmp_seq=128 ttl=128 time=9.06 ms 64 bytes from 192.168.1.103: icmp_seq=129 ttl=128 time=8.81 ms 64 bytes from 192.168.1.103: icmp_seq=130 ttl=128 time=165 ms 64 bytes from 192.168.1.103: icmp_seq=131 ttl=128 time=6.27 ms ^C --- 192.168.1.103 ping statistics --- 131 packets transmitted, 22 received, 83.2061% packet loss, time 132459ms rtt min/avg/max/mdev = 3.708/41.218/217.431/71.696 ms
Tags: Technology,Linux,

Friday, November 26, 2021

Make Virtual Machines Talk to Each Other in VirtualBox



My VirtualBox version:
So finally you have a Ubuntu-master machine running and an Ubuntu-slave machine running and both of them in VirtualBox. But they are not talking to each other. By default if you do not set-up a separate NAT network, they will both be NAT'ed. But they will be NAT'ed in isolated environment. For instance, I have got Ubuntu-master in one window. If I do an "ifconfig" and this is in VirtualBox. I see my IP address as 10.0.2.15. In the other Window, I have Ubuntu-slave and I see my ip address using "ifconfig" and it is 10.0.2.15. They both have the same address but they cannot talk to each other. 10.0.2.15 is the default address that virtual box assigns to any machine that is set up for NAT. If we want these two machines to talk to each other and be NAT'ed, we have to set up a separate new NAT network. Let's go to VirtualBox. Let's verify what we are discussing. Both of our VMs (two Ubuntu VMs) are set-up for NAT (which is default). Open VirtualBox Manager. Click on "Tools".
Click on "Prefrences".
Click on "Network".
Click on "Plus" sign to create new NAT network. They call it "NATNetwork".
Click on the gear icon to change the name to "TopGunNetwork" or "MyNATNetwork".
Address Space --> Network CIDR: 192.168.100.0/24 We certainly want to support the DHCP.
Next step is to add both Ubuntu-master and Ubuntu-slave to this new network. And they should be automatically assigned a new IP address in the 192.168.100.X space. I start with Ubuntu-master, I go to "Settings" of Kali.
I go to "Network". It says "Attached to:" -- "NAT" here. We are going to change its "Name" from the dropdown to "NAT Network" that was created by us a minute back.
Do the same thing for Ubuntu-slave machine.
Now, try doing "ifconfig" on Ubuntu-master: you get 192.168.100.4
master@master-VirtualBox:~$ ifconfig enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.100.4 netmask 255.255.255.0 broadcast 192.168.100.255 inet6 fe80::9c46:b732:6918:fb34 prefixlen 64 scopeid 0x20<link> ether 08:00:27:ab:ba:4d txqueuelen 1000 (Ethernet) RX packets 28322 bytes 21509883 (21.5 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 21151 bytes 3096104 (3.0 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 16547 bytes 1408605 (1.4 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 16547 bytes 1408605 (1.4 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 Ubuntu-slave becomes: 192.168.100.5
And trying pinging the machines from each other. You can also try and ping "google.com" and see that your internet access is also still there.

Sunday, October 31, 2021

Pentaho and PostgreSQL Installation on Ubuntu (2021 Oct)



URL to download Pentaho Community Edition: https://sourceforge.net/projects/pentaho/
    
Unzip the downloaded .zip file using the command: $ unzip xyx.zip When you would try to run 'spoon.sh' for the first time, you might see this WARNING: (base) ashish@ashish-VirtualBox:~/Downloads/pdi-ce-9.2.0.0-290/data-integration$ source spoon.sh   ####################################################################### WARNING: no libwebkitgtk-1.0 detected, some features will be unavailable Consider installing the package with apt-get or yum. e.g. 'sudo apt-get install libwebkitgtk-1.0-0' ####################################################################### Gtk-Message: 13:35:00.303: Failed to load module "canberra-gtk-module" 13:35:05,128 INFO [KarafBoot] Checking to see if org.pentaho.clean.karaf.cache is enabled 13:35:05,510 INFO [KarafInstance] ******************************************************************************* *** Karaf Instance Number: 1 at /home/ashish/Downloads/pdi-ce-9.2.0.0-290/d *** *** ata-integration/./system/karaf/caches/spoon/data-1 *** *** Karaf Port:8802 *** *** OSGI Service Port:9051 ----- ----- -----

ERROR IN INSTALLATION OF: libwebkitgtk

System Info: (base) ashish@ashish-VirtualBox:~$ uname -a Linux ashish-VirtualBox 5.11.0-38-generic #42~20.04.1-Ubuntu SMP Tue Sep 28 20:41:07 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux (base) ashish@ashish-VirtualBox:~/Downloads/pdi-ce-9.2.0.0-290/data-integration$ sudo apt-get install libwebkitgtk-1.0-0 Reading package lists... Done Building dependency tree Reading state information... Done Package libwebkitgtk-1.0-0 is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'libwebkitgtk-1.0-0' has no installation candidate Ref: https://stackoverflow.com/questions/62301866/how-to-install-the-libwebkitgtk-package-on-ubuntu-20-04-lts Following the steps here fixed the issue for me: 1. Open terminal and write this: $ sudo nano /etc/apt/sources.list 2. Add this entry to the file and save: deb http://cz.archive.ubuntu.com/ubuntu bionic main universe 3. $ sudo apt-get update 4.1. $ sudo apt-get install libwebkitgtk-1.0-0 ----> if you are using Vega and jdk of 64 bits 4.2 $ sudo apt-get install libwebkitgtk-1.0-0:i386 ----> if you are using Vega and jdk of 32 bits ----- ----- -----

POSTGRESQL

PostgreSQL Installation Script: install_postgresql.sh sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - sudo apt-get update sudo apt-get -y install postgresql

Continuing Installation and Solving Issues

(base) ashish@ashish-VirtualBox:/$ cd ~ (base) ashish@ashish-VirtualBox:~$ bash (base) ashish@ashish-VirtualBox:~$ psql psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: role "ashish" does not exist (base) ashish@ashish-VirtualBox:~$ psql -U ashish psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: role "ashish" does not exist (base) ashish@ashish-VirtualBox:~$ echo $USER ashish (base) ashish@ashish-VirtualBox:~$ psql -U postgres psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: Peer authentication failed for user "postgres" (base) ashish@ashish-VirtualBox:~$ (base) ashish@ashish-VirtualBox:~$ sudo service postgresql restart (base) ashish@ashish-VirtualBox:~$ psql -U postgres Password for user postgres: psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: password authentication failed for user "postgres" (base) ashish@ashish-VirtualBox:~$ sudo -i -u postgres postgres@ashish-VirtualBox:~$ psql Password for user postgres: psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: password authentication failed for user "postgres" postgres@ashish-VirtualBox:~$ ----- ----- ----- STACKOVERFLOW: The problem is your pg_hba.conf file*. This line: local all postgres peer Should be: local all postgres md5 * The location of this file isn't very consistent. The command locate pg_hba.conf should help; here's some examples: /etc/postgresql/*/main/pg_hba.conf and /var/lib/pgsql/data/pg_hba.conf. After altering this file, don't forget to restart your PostgreSQL server. If you're on Linux, that would be sudo service postgresql restart. These are brief descriptions of both options according to the official PostgreSQL docs on authentication methods. ----- ----- -----

ERROR

postgres@ashish-VirtualBox:~$ exit logout (base) ashish@ashish-VirtualBox:~$ sudo nano /etc/postgresql/14/main/pg_hba.conf (base) ashish@ashish-VirtualBox:~$ sudo -i -u postgres postgres@ashish-VirtualBox:~$ psql -U postgres Password for user postgres: psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: password authentication failed for user "postgres" postgres@ashish-VirtualBox:~$ ----- ----- ----- Solution You need just set METHOD to trust. (base) ashish@ashish-VirtualBox:~$ sudo nano /etc/postgresql/14/main/pg_hba.conf #TYPE DATABASE USER ADDRESS METHOD local all all trust And reload postgres server. $ service postgresql-9.5 reload ----- ----- -----

Snapshot of my own file

# Database administrative login by Unix domain socket local all all trust # TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only #local all all peer local all all trust # IPv4 local connections: host all all 127.0.0.1/32 scram-sha-256 # IPv6 local connections: host all all ::1/128 scram-sha-256 ----- ----- -----

TESTING POSTGRESQL COMMANDS:

(base) ashish@ashish-VirtualBox:~$ sudo -i -u postgres postgres@ashish-VirtualBox:~$ psql psql (14.0 (Ubuntu 14.0-1.pgdg20.04+1)) Type "help" for help. postgres-# \du List of roles Role name | Attributes | Member of -----------+------------------------------------------------------------+----------- postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {} postgres-# \password postgres Enter new password: Enter it again: postgres-# (base) ashish@ashish-VirtualBox:~$ psql -U postgres Password for user postgres: psql (14.0 (Ubuntu 14.0-1.pgdg20.04+1)) SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off) Type "help" for help. postgres=# postgres=# postgres=# SELECT current_date; current_date -------------- 2021-10-29 (1 row) postgres=# postgres-# quit Use \q to quit. postgres-# \q postgres@ashish-VirtualBox:~$ postgres@ashish-VirtualBox:~$ exit logout (base) ashish@ashish-VirtualBox:~$ ----- ----- -----

Sunday, March 28, 2021

ls - command to list computer files in Unix



In computing, ls is a command to list computer files in Unix and Unix-like operating systems. ls is specified by POSIX and the Single UNIX Specification. When invoked without any arguments, ls lists the files in the current working directory. The command is also available in the EFI shell. In other environments, such as DOS, OS/2, and Microsoft Windows, similar functionality is provided by the dir command. The numerical computing environments MATLAB and GNU Octave include an ls function with similar functionality.

The Portable Operating System Interface (POSIX) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems. POSIX defines the application programming interface (API), along with command line shells and utility interfaces, for software compatibility with variants of Unix and other operating systems.

The Single UNIX Specification (SUS) is the collective name of a family of standards for computer operating systems, compliance with which is required to qualify for using the "UNIX" trademark. The core specifications of the SUS are developed and maintained by the Austin Group, which is a joint working group of IEEE, ISO JTC 1 SC22 and The Open Group. If an operating system is submitted to The Open Group for certification, and passes conformance tests, then it is deemed to be compliant with a UNIX standard such as UNIX 98 or UNIX 03. Very few BSD and Linux-based operating systems are submitted for compliance with the Single UNIX Specification, although system developers generally aim for compliance with POSIX standards, which form the core of the Single UNIX Specification. 

Without options, ls displays files in a bare format. This bare format however makes it difficult to establish the type, permissions, and size of the files. The most common options to reveal this information or change the list of files are:

-l 
long format, displaying Unix file types, permissions, number of hard links, owner, group, size, last-modified date and filename

-f 
do not sort. Useful for directories containing large numbers of files.

-F 
appends a character revealing the nature of a file, for example, * for an executable, or / for a directory. Regular files have no suffix.

-a 
lists all files in the given directory, including those whose names start with "." (which are hidden files in Unix). By default, these files are excluded from the list.

-R 
recursively lists subdirectories. The command ls -R / would therefore list all files.

-d 
shows information about a symbolic link or directory, rather than about the link's target or listing the contents of a directory.

-t 
sort the list of files by modification time.

-h 
print sizes in human readable format. (e.g., 1K, 234M, 2G, etc.) This option is not part of the POSIX standard, although implemented in several systems, e.g., GNU coreutils in 1997, FreeBSD 4.5 in 2002, and Solaris 9 in 2002.

-1 (the numeric digit one) 
force output to be one entry per line.

Demo

$ pwd
home/ashish/Desktop/ls_test

$ ls
file1.txt  file2.txt  ls_test_inner

$ ls -l
total 12
-rw-rw-r-- 1 ashish ashish    2 Mar 28 20:09 file1.txt
-rw-rw-r-- 1 ashish ashish    2 Mar 28 20:09 file2.txt
drwxrwxr-x 2 ashish ashish 4096 Mar 28 20:10 ls_test_inner

$ ls -a
.  ..  file1.txt  file2.txt  ls_test_inner

$ ls -r
ls_test_inner  file2.txt  file1.txt

$ ls -t
ls_test_inner  file2.txt  file1.txt

$ echo " " > file0.txt

$ ls -r
ls_test_inner  file2.txt  file1.txt  file0.txt

$ ls -t
file0.txt  ls_test_inner  file2.txt  file1.txt

$ ls -R
.:
file0.txt  file1.txt  file2.txt  ls_test_inner

./ls_test_inner:
file3.txt

$ ls -h
file0.txt  file1.txt  file2.txt  ls_test_inner

$ ls -lh
total 16K
-rw-rw-r-- 1 ashish ashish    2 Mar 28 20:31 file0.txt
-rw-rw-r-- 1 ashish ashish    2 Mar 28 20:09 file1.txt
-rw-rw-r-- 1 ashish ashish    2 Mar 28 20:09 file2.txt
drwxrwxr-x 2 ashish ashish 4.0K Mar 28 20:10 ls_test_inner

$ ls -F
file0.txt  file1.txt  file2.txt  ls_test_inner/

$ echo " " > file3.sh

$ ls -F
file0.txt  file1.txt  file2.txt  file3.sh  ls_test_inner/

$ chmod 777 file3.sh

$ ls -F
file0.txt  file1.txt  file2.txt  file3.sh*  ls_test_inner/

$ 

So remember: FlarthR (pronounced Flarther)
Tags: Technology,Linux,

Monday, February 22, 2021

Creating new text file from terminal on Windows and Ubuntu



Creating new text file on Ubuntu from terminal

The Linux tee command is a way to write the standard output to a file. Or, to quote from the man page documentation, tee - read from standard input and write to standard output and files This is a little different from redirecting output to a file. In this case, the output is still send to standard out, but an additional copy is sent to create your text file. There are some good examples of how this can be useful, shown in the info documentation for tee. To view the info page, open a terminal window and enter info coreutils 'tee invocation' To understand the basic usage of the tee command, go to a terminal window and navigate to a directory that contains a small number of files. You can then use the ls and tee commands to create a text file that contains a listing of the files in that directory. ls | tee listing.txt You can also append a file using the -a switch. This will insert the output lines at the bottom of a pre-existing file. ls | tee -a listing.txt An example of when tee comes in handy is when you want to create a simple text file as root from your user account. I used it to create the fully qualified domain name file for my Apache configuration. You would think you could use: sudo echo "ServerName localhost" > /etc/apache2/conf.d/fqdn But that doesn't work because the sudo only affects the echo command and not the output redirection. Instead, you can use tee like this. echo "ServerName localhost" | sudo tee /etc/apache2/conf.d/fqdn That command succeeds in creating the fqdn file with the desired content. Some other commands to create text files on Ubuntu: Following line creates an "HTML" page. $ echo " " >> mypage.html Following command creates a 0 size text file: $ touch mypage.html

Creating new text file on Windows from CMD

1. type NUL > EmptyFile.txt 2. echo. 2>EmptyFile.txt This command creates an empty file as there is no error produced here that would go into the file. The command "echo." outputs an empty line in the CMD. 3. copy nul file.txt > nul 4. REM. > empty.file 5. fsutil file createnew file.cmd 0 # to create a file on a mapped drive 6. aaaa > empty_file This will output something like: 'aaaa' is not recognized as an internal or external command, operable program or batch file. But it does create an empty file. In the same spirit and the shortest one is: 7. .>out.txt It does give an error: '.' is not recognized as an internal or external command But this error is on stderr. And > only redirects stdout, where nothing have been produced. Hence the creation of an empty file. The error message can be disregarded here. Or redirected to NUL: 8. .>out.txt 2>NUL 9. echo.>filename (echo "" would actually put "" in the file! And echo without the '.' would put "Command ECHO activated" in the file...) Note: the resulting file is not empty but includes a return line sequence: 2 bytes. 10. Batch solution for a real empty file: <nul (set/p z=) >filename dir filename 11/09/2009 19:45 0 filename 1 file(s) 0 bytes The "<nul" pipes a nul response to the set/p command, which will cause the variable used to remain unchanged. As usual with set/p, the string to the right of the equal sign is displayed as a prompt with no CRLF. Since here the "string to the right of the equal sign" is empty... the result is an empty file. The difference with cd. > filename (does produce a 0-byte-length file) is that this "bit of redirection" (the <nul... trick) can be used to echo lines without any CR: <nul (set/p z=hello) >out.txt <nul (set/p z= world!) >>out.txt dir out.txt The dir command should indicate the file size as 11 bytes: "helloworld!".
% http://tuxtweaks.com/2010/06/command-line-basics-create-text-files-with-tee/ % https://stackoverflow.com/questions/1702762/how-to-create-an-empty-file-at-the-command-line-in-windows Tags: Linux, Windows CMD, Technology

Tuesday, February 9, 2021

Starting with GIMP (Image Editor) on Ubuntu



1. Checking GIMP installation

(base) ~/Desktop$ gimp

Command 'gimp' not found, but can be installed with:

sudo snap install gimp  # version 2.10.22, or
sudo apt  install gimp  # version 2.10.18-1

See 'snap info gimp' for additional versions.

2. Installing GIMP from terminal

(base) ~/Desktop$ sudo snap install gimp

[sudo] password for administrator: 
gimp 2.10.22 from Snapcrafters installed

3. Next, we launch the GIMP from terminal 

(base) ~/Desktop$ gimp
[error] cannot open locale definition file `en': No such file or directory
gimp_check_updates_callback: loading of https://www.gimp.org/gimp_versions.json failed: Operation not supported
...
...
...

4. Saving your work in GIMP

To save your work from GIMP as image, you need to use the "Export" option in the "File" option in horizontal tab at the top.
If you try to save you work using "Save" instead of "Export", it tries to save it as an "XCF" file. XCF, short for eXperimental Computing Facility, is the native image format of the GIMP image-editing program.

Keyboard shortcut for Export is: Ctrl + E

Keyboard shortcut for 'Export As' is: Ctrl + Shift + E

5. Taking screenshot in Ubuntu

Ubuntu provides a "Screenshot" utility that works better than the Keyboard "Print Screen" key.
"Print Screen" key saves the image in the "Pictures" directory and not in clipboard.
While "Screenshot" utility allows you to have it on the clipboard and paste it in GIMP editor.

6. Cropping an image The way to crop an image is by using the "Crop" tool:
You select the "Crop" tool. Select the area in the image that you want to retain. Press enter to crop the selection. 7. Blacking out a region in an image
This is a trivial activity in MS Paint. Comes intuitively from Paint UI that you select a region, delete it and fill it using Bucket Fill. To black out a region in the image in GIMP: You would have to use one of the "Selection" tools from: Top Horizontal Bar With 'Tools' Menu. So the flow is: Tools -> Selection Tools -> Rectangle Select There are multiple "Select" options present such as "Rectangle", "Ellipse", "Free", "Foreground", "Fuzzy", etc. We choose "Rectangle Select" and then use the "Bucket Fill Tool" to black out the region.
Dated: 10 Feb 2021

Monday, November 2, 2020

Working with log files in Bash shell


1: To stream a log file $ tail -f 2020-11-02_1604333192.log It will print anything that is being appended to the log file. 2: Print last 10 lines of the log file. $ tail -10 2020-11-02_1604333192.log 3: Stream a log file but also apply a string based filter to print only "ERROR" or "INFO" logs. $ tail -f 2020-11-02_1604333192.log | grep INFO $ tail -f 2020-11-02_1604333192.log | grep ERROR 4: Print the entire log file as per its present state. $ cat 2020-11-02_1604333192.log 5: Print the log file as per its present state but also filter it to show only 'ERROR' logs. $ cat 2020-11-02_1604333192.log | grep ERROR 6: Print the number of lines in the log file. $ wc -l 2020-11-02_1604333192.log 1130 2020-11-02_1604333192.log 7: Print the number of lines representing 'ERROR' (or 'INFO') logs. $ cat 2020-11-02_1604333192.log | grep ERROR | wc -l 87 $ cat 2020-11-02_1604333192.log | grep INFO | wc -l 1086 $ grep ERROR 2020-11-02_1604333192.log | wc -l 87 8: If you want to track how many lines have been added in the log file every one second or two seconds, use the following 'Python 3' code in the Python shell (or CLI). Note: 'time.sleep(1)' puts Python into sleep for one second. Ashish Jain@LAPTOP MINGW64 /e/ws/logs $ python Python 3.7.1 (default, Dec 10 2018, 22:54:23) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32 >>> import time >>> import os >>> while True: ... time.sleep(1) ... os.system('wc -l 2020-11-21_1605972090.log') ... 982 2020-11-21_1605972090.log 0 984 2020-11-21_1605972090.log 0 989 2020-11-21_1605972090.log 0 And so on...