Unix - Linux Command - FAQ

Windows:

C:\Users\> hostname
ABCDE000123
 
C:\Users\> wmic bios get serialnumber
SerialNumber
ABCD123

C:\> ipconfig/flushdns


Linux/Unix:
$ uname -a
Linux oam-ohs 4.18.0-193.el8.x86_64 #1 SMP Fri Mar 27 14:35:58 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
 
$ hostnamectl
   Static hostname: oam-ohs
         Icon name: computer-vm
           Chassis: vm
        Machine ID: adaf69d723c14f179ff541b6d37a350b
           Boot ID: 6d090b2d2d104957a5ccfffe178b65ca
    Virtualization: vmware
  Operating System: Red Hat Enterprise Linux 8.2 (Ootpa)
       CPE OS Name: cpe:/o:redhat:enterprise_linux:8.2:GA
            Kernel: Linux 4.18.0-193.el8.x86_64
      Architecture: x86-64
 
 
$ nslookup <Your_hostname>
 
$ cat /etc/resolv.conf
OR
$ less /etc/resolv.conf
 
$ grep "nameserver" /etc/resolv.conf
 
  
Just a note: after restart, Unix machines will reapply iptables. You may need to run following using root:
iptables -F
iptables -X
 
 

$vi test.txt

Open any file content into vi editor

I

click "I" to insert the line into vi editor

:wq!

without saving exit from file into vi editor

:wq

With save exit file into vi editor

chmod -R 777 Home

chmod -R 775 Folder

Change the permission of directory

df -h

Check the volume of disk

sqlplus / as sysdba

To connect to SQL prompt

echo $JAVA_HOME

To check java home path details

echo $PATH

To check server path details

whereis java

which java

Check path of java installed path on Linux

 

 

systemctl stop firewalld

Firewall to be stop if URL not accessible outside

 

 

nodemanager.properites

Port number to be increment by one if OHS installed on same server to avoid conflict in start node manager

sudo rpm -i <pkg name>

Install Linux package manually (pkg name is name of package to be install)

rm -Rf

Remove full directory recursively

find . -name "*.xml" -exec grep -i -l -n "SearchStr" \{\} \;

Find specific word in .xml file (e.g. SearchStr)

find -type d -exec du -sh {} + | sort -hr

 

Get the list of files order by disk space

rm -rf cache/* logs/* tmp/*

Remove all temp files, logs and cache file

lsblk

To check disk space

grep MemTotal /proc/meminfo

To check memory size RAM

sudo ss -tulwn | grep LISTEN

To check port being listen and running

hostname -i | awk '{print $1}'

How to Find My DNS Server IP Address

useradd oracle

Add user in Linux and reset password (run from root user)

userdel <>

Delete user in Linux

passwd oracle

sudo passwd oracle

Change password for passed username (e.g. oracle)

iptables -F

iptables -X

Just a note:

After restart, Unix machines will reapply iptables. (run from root user)

grep -rl 'String1' //Directory | xargs sed -i 's/String1/String2/g'

Found string1 and replace with another string2

E.g.

 

grep -rl 'string123' //home/oracle/Oracle/Middleware | xargs sed -i 's/string123/string456/g'

du -sh <DIR_NAME>

Disk size of specific folder directory

echo-e ${PATH//:/\\n}

Print $PATH values in each line for better read

sudo du -sh <Folder Name>

Check size of specific folder/directory

find . -type f -name FileName

Find specific file in Linux                                                                  

 
ss -antpl    :: To check listening port is running or not? - in UNIX

setx /m JAVA_HOME "C:\Program Files\Java\jdk11.0.17.8"    ::  Set JAVA_HOME path in Window machine

netstat -aon
netstat -aon -o | findstr 9000     ::  To check listening port is running or not? - in Windows


Comments

Popular posts from this blog

PUTTY - The server's host key is not cached in the registry cache

OIM-12c Installation - FMW - SOA - IDM

SAML & OAuth 2.0