INSTALLATION DOCUMENTS BY RAVI

Showing posts with label LINUX. Show all posts
Showing posts with label LINUX. Show all posts

Sunday, April 30, 2017

Some Linux Commands

How to delete files older than 3 days:
find . -name ‘*.*’ -mtime +3 -exec rm {} \;

How to list files modified in last 3 days:
find . -mtime -3 -exec ls -lt {} \;

How to sort files based on Size of file:
ls -l | sort -nrk 5 | more

How to find CPU & Memory:
cat /proc/cpuinfo
cat /proc/meminfo

How to find if any service is listening on particular port or not:
netstat -an | grep (port no)
Example :
netstat -an | grep 7001

How to find Process ID (PID) associated with any port:
lsof | grep 7001

How to find a pattern in some file in a directory:
To find pattern in particular file :
grep pattern file_name
To find in all files in that directory
grep pattern * 

How to create symbolic link to a file:
ln -s target source



Monday, April 24, 2017

RPM packages required for installing OBIEE on Linux

binutils-2.20.51.0.2-5.28.el6 
compat-libcap1-1.10-1 
compat-libstdc++-33-3.2.3-69.el6 for x86_64 
compat-libstdc++-33-3.2.3-69.el6 for i686 
gcc-4.4.4-13.el6 
gcc-c++-4.4.4-13.el6 
glibc-2.12-1.7.el6 for x86_64 
glibc-2.12-1.7.el6 for i686 
glibc-devel-2.12-1.7.el6 for i686 
libaio-0.3.107-10.el6 
libaio-devel-0.3.107-10.el6 
libgcc-4.4.4-13.el6 
libstdc++-4.4.4-13.el6 for x86_64 
libstdc++-4.4.4-13.el6 for i686 
libstdc++-devel-4.4.4-13.el6 
libXext for i386 
libXtst for i386 
libXi for i386 
openmotif-2.2.3 for x86_64Footref 2 
openmotif22-2.2.3 for x86_64Footref 2 
redhat-lsb-4.0-3.el6 for x86_64 
sysstat-9.0.4-11.el6 

Sunday, April 23, 2017

Steps for Creating Shared Storage in Linux Server

To Create Shared Storage in Linux Server:

 Login as root

And add the following entry(like the following one and save the file)

# vi /etc/exports

/mnt/shared *(rw,sync)

Assuming that you want to create mount point for /mnt/shared folder.

Then , restart the nfs service

# /etc/init.d/nfs restart

Then, in the client where you want to mount the same, goto /mnt and create

directory called shared(mkdir –p shared), then issue the following command

# mount -t nfs -o rw 172.16.10.133:/mnt/shared /mnt/shared

if you want to make this mount as permanent , then create entry into /etc/fstab file

# vi /etc/fstab

Add the entry like below and save the file

172.16.10.133:/mnt/shared /mnt/shared nfs defaults 0 0

Steps for Creating Virtual IP in Linux Server

To Create VIP’s in Linux Server:

Login as root

# cd /etc/sysconfig/network-scripts

# cp ifcfg-eth0 ifcfg-eth1

# vi ifcfg-eth1

device=eth0:1 (change only this and save the file)

# service network restart

# /sbin/ifconfig eth0:1 10.60.124.89 netmask 255.255.255.0

# /sbin/arping -b -A -c 3 -I eth0 10.60.124.89

Note: 10.60.124.89 is the VIP

255.255.255.0 is the subnetmask.

Saturday, April 22, 2017

MAKING A MOUNT DIRECTORY IN LINUX

Making /mnt/softwares as a mount point in linux

 Open linux terminal and type the following command

#vi /etc/exports



















Click enter and enter the directory path which you want to mount as shown below


















Save it and exit


















Restart the nfs service by typing the above command


















Now the directory was mounted


















In order to accesses this mount directory go to another linux machine and type the following command

 #mount –t nfs –o rw 10.0.0.17:/mnt/softwares /mnt/softwares

 Note: 10.0.0.17 is the ip address of the linux machine which contains the mount directory


Thursday, April 20, 2017

Swap size error

This error occurs due to the less space of the swap file than the expected value to resolve this error we have to increase the size of the swap file
The following dd command example creates a swap file with the name “myswapfile” under /root directory with required size
#free -k {to see the current swap size} # dd if=/dev/zero of=/root/myswapfile bs=1M count=1024














































Cahnge last line into /root/myswapfile swap swap defaults 0 0 ;
Save it and exit

Saturday, April 15, 2017

Command to mount windows directory to linux

1. Share a folder on windows system
2. Go to linux and open a terminal and type the below command to mount the shared directory in windows system

mount -t cifs -o username="windows user name",password="windows user password" //windows-hostname/shared-folder /mnt

3. The above command will mount windows shared folder to /mnt in linux

Command for unzip all files in a directory recursively linux

find . -name "*.gz" -exec gunzip {} \; -exec /bin/rm {} \;

Installing Open Office in Linux

Download Openoffice 3.4 rpm tgz from http://www.openoffice.org/download/
untar
cd en-US/RPMS
yum –nogpgcheck localinstall *.rpm
yum –nogpgcheck localinstall desktop-integration/openoffice.org3.4-redhat-menus-3.4-9590.noarch.rpm

Shell Script for Updating Table in a Oracle Database

#!/bin/bash
export ORACLE_HOME=/app/oracle/product/11.2.0/dbhome1/
export SID=orcl
export PATH=/app/oracle/product/11.2.0/dbhome1/bin
sqlplus -s scott/tiger@orcl <<EOF
UPDATE EMP_ID='10';
commit;
/
EOF

Copy the above code to a file and save it as .sh file and by running this file the script will update the table.

Mailx commands in linux

$ echo "Message Body Here" | mailx -s "Subject Here" user@example.com -a path-of-the-file-to-attach

$ echo 'These are contents of my mail' | mailx -s 'This is my email subject' -a /path/to/attachment_file.log email_id@example.com

$ mailx -s "Sending Files" -a First_LocalConfig.conf -a Second_LocalConfig.conf Recipient@myemail.com


s : subject name of the mail
a : path of the files to be attached to the mail


Command to Check All Writable ( 777 permission) Files and Folders on Linux

To check the files and folders which has 777 permissions in linux file system use the below command

$ find / -perm -2 ! -type l -ls


Commands to get top memory usage processes in linux

$ ps aux --sort=-%mem | awk 'NR<=10{print $0}'
This will show you top 10 process that using the most memory


$ ps -eo pmem,pcpu,vsize,pid,cmd | sort -k 1 -nr | head -5
This will give the top 5 processes by memory usage.



$ ps axu | awk '{print $2, $3, $4, $11}' | head -1 && ps axu | awk '{print $2, $3, $4, $11}' | sort -k3 -nr |head -5



$ cat /proc/meminfo
This will give memory usage information



$ ps auxwww|grep -i 'server' 
This should return all process which has server in them. Otherwise, server may have already stopped

Friday, April 14, 2017

Linux command to find files created today and with in a hour

Command to get files updated in a hour
$find / -name "*.log" -mmin -60

Command to get log files updated in a day
$find / -name "*.log" -mtime -1

Find commands in linux and unix

1. Files got updated in last hour
#find . -mmin -60

2. Files got updated in last day
#find . -mtime -1

3. Files accessed in last 1 hour and last 1 day
#find . -amin -60
#find . -atime -1

4. Files changed in last 1 hour and last 1 day
#find . -cmin -60
#find / -ctime -1

5. Files which are modified after the modification of a particular file
#find -newer FILE

6. Files which are accessed after modification of a particular file
#find -anewer FILE

7. Files whose status got changed after the modification of a particular file
#find -cnewer FILE

8. Perform any operation on files found from find command
#find <condition to find files> -exec <operation> \;
Eg:  
 #find -mmin -60 -exec ls -l {} \;

9. Searching only in the current file system
#find / -name "*.log"
#find / -xdev -name "*.log"

10. Using more than one {} in same command
#find -name "*.txt" cp {} {}.bkup \;

11. Redirecting errors to /dev/null
#find -name "*.txt" 2>>/dev/null

12. Substitute space with underscore in the file name
#find . -type f -iname "*.mp3" -exec rename "s/ / _/g" {} \;


How to change hostname on Red Hat Linux or Oracle Linux

Method 1:

1. Open Terminal
2. Type the below command to change the hostname
# hostname new-hostname-we-want
3. check the updated hostname with below command
# hostname
4. Update the new hostname in /etc/hosts and /etc/sysconfig/network files

Method 2:















Thursday, April 13, 2017

INSTALLING FTP SERVER IN LINUX

#yum install vsftpd
#service vsftpd restart
#ftp localhost
FTP FILE COPYING PATH
/var/ftp/pub
FTP URL
ftp://hostname/pub/
FTP FILE URL
ftp://hostname/pub/52665_Exalytics_VMTemplate_2.0.1.1.0.tar.gz
REMOVING FTP SERVER IN LINUX
#yum remove vsftpd
STARTING FTP SERVER
#/etc/init.d/vsftpd start
STOPPING FTP SERVER
/etc/init.d/vsftpd stop
CHECKING STATUS OF FTP SERVER
/etc/init.d/vsftpd status
CHANGING THE DEFAULT DIRECTORY FOR FTP
#vi /etc/passwd
Modify the below line

ftp:x:14:50:FTP User:NEW_DIRECTORY_PATH:/sbin/nologin

Wednesday, April 12, 2017

Installing Python 2.6 on Linux


# wget https://www.python.org/ftp/python/2.6.6/Python-2.6.6.tgz

# tar -zxvf Python-2.6.6.tgz

# cd Python-2.6.6

# ./configure &amp;&amp; make &amp;&amp; make install

There can be a dependency error use

# yum install gcc cc

Add the install path (/usr/local/bin/python by default) to ~/.bash_profile.

# ln -s /usr/bin/python26 ~/bin/python

# export PATH=~/bin:$PATH # Append this to your ~/.bash_profile for persistence

Now, python command will execute python 2.6

Command to get the Hostname of remote server using ip address

Reverse dsn
$dig -x <ip>
$host <ip>

Multicast dns:
$avahi-resolve -a <ip>

Netbios :
samba server is required
$nmblookup -A <ip>
or install nbtscan and try
$nbtscan <ip>

  Opatch reports 'Cyclic Dependency Detected' error when patching ODI   Issue: When applying a Patch Set Update (PSU) to WebLogic Se...