Monday, May 22, 2023

Error : -bash: ifconfig: command not found

 Error :  -bash: ifconfig: command not found  


Login as root user :


[root@0.0.0.0]#

[root@0.0.0.0]#

[root@0.0.0.0]#

[root@0.0.0.0]# ifconfig

-bash: ifconfig: command not found

[root@0.0.0.0]#

[root@0.0.0.0]#

[root@0.0.0.0]#


Install net-tools package using yum command 


[root@0.0.0.0]# yum install net-tools

Updating Subscription Management repositories.

Unable to read consumer identity


This system is not registered with an entitlement server. You can use subscription-manager to register.


Last metadata expiration check: 0:01:33 ago on Mon 22 May 2023 04:36:53 PM UTC.

Dependencies resolved.

==============================================================================================================================

 Package                Architecture        Version                                Repository                            Size

==============================================================================================================================

Installing:

 net-tools              x86_64              2.0-0.52.20160912git.el8               rhel-8-baseos-rhui-rpms              322 k


Transaction Summary

==============================================================================================================================

Install  1 Package


Total download size: 322 k

Installed size: 942 k

Is this ok [y/N]: y

Downloading Packages:

net-tools-2.0-0.52.20160912git.el8.x86_64.rpm                                                 9.4 MB/s | 322 kB     00:00

------------------------------------------------------------------------------------------------------------------------------

Total                                                                                         6.1 MB/s | 322 kB     00:00

Running transaction check

Transaction check succeeded.

Running transaction test

Transaction test succeeded.

Running transaction

  Preparing        :                                                                                                      1/1

  Installing       : net-tools-2.0-0.52.20160912git.el8.x86_64                                                            1/1

  Running scriptlet: net-tools-2.0-0.52.20160912git.el8.x86_64                                                            1/1

  Verifying        : net-tools-2.0-0.52.20160912git.el8.x86_64                                                            1/1

Installed products updated.


Installed:

  net-tools-2.0-0.52.20160912git.el8.x86_64


Complete!

[root@0.0.0.0]#

[root@0.0.0.0]#

[root@0.0.0.0]# ifconfig

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 9001

        inet 172.21.31.211  netmask 255.255.240.0  broadcast 172.31.31.255

        inet6 f80::6:3ccf:fe7d:1a13  prefixlen 64  scopeid 0x20<link>

        ether 0a:76:33:7d:1a:13  txqueuelen 1000  (Ethernet)

        RX packets 86484  bytes 127950677 (122.0 MiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 11182  bytes 1084233 (1.0 MiB)

        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 509  bytes 77514 (75.6 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 509  bytes 77514 (75.6 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


[root@0.0.0.0]#

[root@0.0.0.0]#


How to download file using wget and curl command in linux ?

Download file using wget and curl command in linux 




[root@0.0.0.0 ~]# rpm -qa | grep -i wget

wget-1.19.5-11.el8.x86_64

[root@0.0.0.0 ~]#


Using wget commnad :


[root@0.0.0.0 ~]#

[root@0.0.0.0 ~]# wget https://the.earth.li/~sgtatham/putty/latest/putty-0.78.tar.gz

--2023-05-22 15:44:09--  https://the.earth.li/~sgtatham/putty/latest/putty-0.78.tar.gz

Resolving the.earth.li (the.earth.li)... 93.93.131.124, 2a00:1098:86:4d:c0ff:ee:15:900d

Connecting to the.earth.li (the.earth.li)|93.93.131.124|:443... connected.

HTTP request sent, awaiting response... 302 Found

Location: https://the.earth.li/~sgtatham/putty/0.78/putty-0.78.tar.gz [following]

--2023-05-22 15:44:10--  https://the.earth.li/~sgtatham/putty/0.78/putty-0.78.tar.gz

Reusing existing connection to the.earth.li:443.

HTTP request sent, awaiting response... 200 OK

Length: 2811628 (2.7M) [application/x-gzip]

Saving to: ‘putty-0.78.tar.gz’


putty-0.78.tar.gz               100%[=====================================================>]   2.68M  4.71MB/s    in 0.6s


2023-05-22 15:44:10 (4.71 MB/s) - ‘putty-0.78.tar.gz’ saved [2811628/2811628]


[root@0.0.0.0 ~]#



Using curl command :


[root@0.0.0.0 tmp]# curl -O https://the.earth.li/~sgtatham/putty/latest/putty-0.78.tar.gz

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

100   306  100   306    0     0   1066      0 --:--:-- --:--:-- --:--:--  1066

[root@0.0.0.0 tmp]#

[root@0.0.0.0 tmp]#


Friday, May 19, 2023

How to check User Shell details ?

 Check User Shell details  :



[root@0.0.0.0]# cat /etc/passwd

root:x:0:0:root:/root:/bin/bash


[root@0.0.0.0]# echo $0

-bash

[root@0.0.0.0]#


How to check available shell in Linux OS ?

 Check available shell in Linux OS : 


[root@0.0.0.0]# cat /etc/shells

/bin/sh

/bin/bash

/usr/bin/sh

/usr/bin/bash

/bin/ksh

/bin/rksh

/usr/bin/ksh

/usr/bin/rksh

[root@0.0.0.0]#

How to know Linux OS is 64 bit or 32 bit ?

 How to know Linux OS is 64 bit or 32 bit  ?


First Method :

[root@0.0.0.0]#

[root@0.0.0.0]# which arch

/usr/bin/arch

[root@0.0.0.0]#

[root@0.0.0.0]#

[root@0.0.0.0]#

[root@0.0.0.0]# arch

x86_64

[root@0.0.0.0]#

[root@0.0.0.0]#

[root@0.0.0.0]#



Second Method :


[root@0.0.0.0]# uname -a

Linux ip-172-31-19-40.ec2.internal 4.18.0-425.19.2.el8_7.x86_64 #1 SMP Fri Mar 17 01:52:38 EDT 2023 x86_64 x86_64 x86_64 GNU/Linux

[root@0.0.0.0]#


This is 64 bit Operating System because of output is x86_64

Thursday, May 18, 2023

How to get metadata details for AWS EC2 instance using curl command

 Get metadata details for AWS EC2 instance using curl command 


[root@]# curl http://169.254.169.254/2018-09-24/meta-data

ami-id

ami-launch-index

ami-manifest-path

block-device-mapping/

events/

hibernation/

hostname

identity-credentials/

instance-action

instance-id

instance-type

local-hostname

local-ipv4

mac

metrics/

network/

placement/

profile

public-hostname

public-ipv4

public-keys/

reservation-id

security-groups

services



Example: 

[root@]# curl http://169.254.169.254/2018-09-24/meta-data/security-groups

kpitdb-demo-db-sg

Adding Users to Sudoers in Linux

 

Adding Users to Sudoers in Linux



Login as root user : visudo and check wheel (group) details should be there 

## Sudoers allows particular users to run various commands as
## the root user, without needing the root password.
##
## Examples are provided at the bottom of the file for collections
## of related commands, which can then be delegated out to particular
## users or groups.
##
## This file must be edited with the 'visudo' command.


## Allows people in group wheel to run all commands
%wheel  ALL=(ALL)       ALL

## Same thing without a password
# %wheel        ALL=(ALL)       NOPASSWD: ALL



Login as root user to add user (atharv) in wheel group (sudoers)

[root@0.0.0.0~]# usermod -aG wheel atharv

[root@0.0.0.0~]#

[root@0.0.0.0~]#

[root@0.0.0.0~]#

[root@0.0.0.0~]#

[root@0.0.0.0~]# id atharv

uid=1002(atharv) gid=1002(dba) groups=1002(dba),10(wheel)

[root@0.0.0.0~]#


Login as atharv user 


[atharv@0.0.0.0 ~]$ su - atharv

Password:

Last login: Thu May 18 11:50:13 UTC 2023 on pts/1

[atharv@0.0.0.0 ~]$

[atharv@0.0.0.0 ~]$

[atharv@0.0.0.0 ~]$ sudo fdisk -l

Disk /dev/xvda: 60 GiB, 64424509440 bytes, 125829120 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disklabel type: gpt

Disk identifier: 2E431796-24CD-41A3-A4CB-7987FFF67072


Device     Start       End   Sectors Size Type

/dev/xvda1  2048      4095      2048   1M BIOS boot

/dev/xvda2  4096 125829086 125824991  60G Linux filesystem

[atharv@0.0.0.0 ~]$

[atharv@0.0.0.0 ~]$

[atharv@0.0.0.0 ~]$ sudo ls -la /root

total 260816

dr-xr-x---.  9 root root      4096 May 18 11:12  .

dr-xr-xr-x. 21 root root      4096 Jan 13 14:03  ..

-rw-------.  1 root root      6953 May  4  2021  anaconda-ks.cfg

drwx------   4 root root        27 Apr 14 10:20  .ansible

drwxr-xr-x   3 root root        22 Apr 14 10:14  ansible

-rw-r--r--   1 root root  77218345 Jan  9 18:30 'AutoDL?BundleId=247937_0ae14417abb444ebb02b9815e2103550'

-rw-r--r--   1 root root    137320 Feb 18 13:07  aws_replication_agent_installer.log

-rw-r--r--   1 root root     25289 Feb  6 10:25  aws-replication-installer-init.py

-rw-------.  1 root root     17257 May 18 11:12  .bash_history

-rw-r--r--.  1 root root        18 Aug 12  2018  .bash_logout

-rw-r--r--.  1 root root       176 Aug 12  2018  .bash_profile

-rw-r--r--.  1 root root       176 Aug 12  2018  .bashrc

drwx------   3 root root        20 Sep 21  2022  .config

drwxr-xr-x   6 root root        95 Sep 21  2022  .cpan

drwxr-xr-x   3 root root        55 Sep 21  2022  .cpanm

-rw-r--r--.  1 root root       100 Aug 12  2018  .cshrc

-rw-r--r--   1 root root 189609546 Dec  7 23:14  jdk-19_linux-x64_bin.rpm

drwxr-xr-x   3 root root       105 Feb 18 13:01  mgn18022023

-rw-------.  1 root root         0 May 16 17:02  original-ks.cfg

-rw-------   1 root root      3167 Nov  8  2022  .psql_history

drwx------.  2 root root        48 Apr 14 10:25  .ssh

-rw-r--r--.  1 root root       129 Aug 12  2018  .tcshrc

-rw-r--r--   1 root root       111 May 18 10:44  test.txt

-rw-------   1 root root      1047 May 18 08:41  .viminfo

-rw-------   1 root root       518 May 18 05:50  .Xauthority

[atharv@0.0.0.0 ~]$

[atharv@0.0.0.0 ~]$

[atharv@0.0.0.0 ~]$

[atharv@0.0.0.0 ~]$

[atharv@0.0.0.0 ~]$

canva popular keywords

Business & Work Keyword Template Style / Use Case Presentation Business decks, pitches, school slides Report Annual reports, whitepapers...