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

Tuesday, March 25, 2025

Linux Commands

Commands to check packages installed/available in system
#Below code show avaliable package glibc-devel* 
dnf list available glibc-devel-* 

#Below code show installed package glibc-devel* installed on server
dnf list installed glibc 

#To check rpm details of the package installed in system. Here we check all packages related to gcc
rpm -qi gcc-*

Below linux command will create ssh keys in 4096 format


ssh-keygen -t -rsa -b 4096 -C "loginemail@domain.com"  -- This Generates ssh key pair

We can use the below commands to create pgp, import pgp,list pgp. Same commands will be applicable for gpg also


#Below command will create PGP Keypair. We created rsa key with 2048 key length and passphrase password
pgp --gen-key "test@mailid" --key-type rsa --encryption-bits 2048 --pasphrase "password"

#Below command will display the generated key pair
pgp --list-keys | grep "test"

#Below command will export the key pair. key fair format looks like 0xABCDDSED
pgp --export-key-pair "key pairname"

#To export only public key we can give public key name
pgp --export "public key name"

#Below command will import the pgp key. Here we are importing pgppulickey.asc
pgp --import pgppulickey.asc

#Once import the pgp public key we can trust the key using the below command
pgp --set-trust 0xASCDTG --trust implicit

#to list all pgp keys we can simply run the below command
pgp -l

#To check PGP Version we can run the below command
pgp --version -v

#To add license for pgp we can use below command
pgp --license-authorize -license-number "license key"

#to add softlink for PGP software we can use below command
ln -s "pgp full path" "pgp shortcut path"

#to encrypt pgp key
pgp --always-trust -e -r "pgp id" "file.txt"

We can use below command to install and unstall mq and verify the version and instance that is running

#check MQ version
dspmqver

#check MQ running fine or not
dspmq

# uninstall software/lib
rpm -e MQSeriesServer*

#verfiy uninstall successfully
rpm -qa | grep -i mq

#install software/lib
rpm -ivh MQSeriesServer*

#To check Queue Depth
sudo qname.QDEPTH

#To suspend Queue
sudo qname.SUSPEND

#To resume
sudo qname.RESUME

Sunday, March 23, 2025

Linux Simple Shell Script to copy the content into file and replace text

 Below script is the simple bash script to create a dummy file and replace text in the script.



#!bin/bash
cd /tmp
mkdir Test_script
cd Test_script
touch -a -m -t $(date +"%Y%m%d%H%M.%S") dummyfile_$(date +"%Y%m%d%H%M%S%3N").txt
echo "ORACLE_HOME=/opt/sw/oracle/client/home" > dummfile.txt
sed -e 's:/opt/sw/oracle/client/home:/opt/sw/oracle/Oracle19c/client/home:g' dummyfile.txt > dummy2.txt
diff dummyfile.txt dummy2.txt
ls -lrt