service nfs stop
service nfslock stop
service portmap stop
service rpcbind stop
service rpcbind start
service portmap start
service nfslock start
service nfs start
To see hardware information on linux server
--------------------------------
# dmidecode
# dmidecode | grep Serial
vi replace / substitute strings
---------------------------------
:%s/tstdb1/vebsap1/g
escape u --for undo
kill processes with one command
================================
ps -ef | grep lsnrctl | awk {'print $2'} | head -4
kill -9 `ps -ef | grep conc | awk {'print $2'} | head -4`
kill -9 `ps -ef | grep -i conc | grep -v grep | awk {'print $2'} | head -5`
echo ps -eaf |grep -v grep | grep applpmi| grep FND | awk '{print $2}' | xargs kill -9 >> test.sh
ps -eaf |grep -v grep | grep applpmi| grep FND | awk '{print $2}' | xargs kill -9
#pkill -u <username> This will kill all user processes.
Search for text in a file. -H is to only display file name while -r is to search recursively in subdirectories, -i ignore case
==============================================================================================================================
grep -H -r "Error 500" .
grep -H -r -i "Error 500" .
egrep -i "ORA-|Warning|Fatal|failed|invalid" /u04/ebsi/apps/apps_st/appl/admin/EBSI/log/adpatch.lgi
Command to unlock the user that is locked due to invalid login attempts
========================================================================
pam_tally2 -r -u applprod --> reset the pam_tally2 for user applprod
www.tecmint.com/command-line-tools-to-monitor-linux-performance-->10 performance monitoring commands.
================================================================
rpm -qa | wc -l --> count number of rpms
ls -l /oel5_repository/ | wc -l -->count number of files in a folder
rpm -qa | sort --> sort the output
Change owner and group of a directory and its content
=====================================================
[root@srv1 xxaapatches]# ll
d-wx--x--x 4 root root 4096 Nov 22 22:49 11773054
[root@srv1 xxaapatches]#chown -R applmgr 11773054
[root@srv1 xxaapatches]#chgrp -R dba 11773054
[root@srv1 xxaapatches]# ll
d-wx--x--x 4 applmgr dba 4096 Nov 22 22:51 11773054
[root@srv1 xxaapatches]# chmod 777 11773054/
[root@srv1 xxaapatches]# ll
total 1012
drwxrwxrwx 4 applmgr dba 4096 Nov 22 22:49 11773054
************************************************************************************************
command to open browser from with url is,
# gnome-open http://localhost:901
# gnome-open http://localhost:631/admin
# gnome-open http://10.115.103.208/printer/TWR10W-BW2Check
=================
system-config-printers
system-config-security
===========
[oracle@srv1 fullbkup]$ tar cvf u04testdata.tar /u04/test/data
[root@srv1 fullbkup]$ tar cvf u03test.tar /u03/test
Create a new tar archive.
$ tar cvf archive_name.tar dirname/
Extract from an existing tar archive.
$ tar xvf archive_name.tar
View an existing tar archive.
$ tar tvf archive_name.tar
=======
TELNET CONFIGURATION - START/STOP
/sbin/chkconfig ekrb5-telnet off
/sbin/chkconfig krb5-telnet off
/sbin/chkconfig ekrb5-telnet on
/sbin/chkconfig krb5-telnet on
/sbin/chkconfig --list |grep telnet
ekrb5-telnet: off
krb5-telnet: off
stop iptables
--------------
/bin/systemctl stop iptables.service
service iptables stop
chkconfig iptables off
iptables -F
chkconfig sendmail on
service sendmail start
netstat -run
cd /etc/xinetd.d
service xinetd restart
/etc/init.d/xinetd restart
=============
#more /etc/oracle-release
Oracle Linux Server release 5.9
#more /etc/fstab
stat <filename> - gets statistics on the file. stat <filename> ---> this will give the file's properties, last modified date, created date, etc.
md5sum <filename> - to get the md5 check sum signature.
file <filename> - to get information about type of file.
=============
COMMAND TO KNOW THE server's fingerprints
-----------------------------------------
[root@exa1db01 ssh]# ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub
2048 12:34:ba:e6:c1:a5:fc:87:39:a5:87:dc:96:2e:bd:20 /etc/ssh/ssh_host_rsa_key.pub
-l display output
-f input_keyfile
cd /home/root/.ssh/
more known_hosts
+++++++++++++++++++++++
=============
AWK command to get only file names
----------------------------------
ls -ltr > /tmp/a.txt
awk -F " " '/ebprd/ {print $9}' /tmp/a.txt
In the above,
-F --> delimeter
" " --> space delimeter
/ebprd/ --> regular expression to search
$9--> 9th position that is file name
+++++++++++++++++++++++
=============
+++++++++++++++++++++++
=============
Shutdown the machine with user defined message
----------------------------------------------
# shutdown -h now 'System is going down for replacement of primary memory'
Scheduling the shutdown with 24 hour format
----------------------------------------------
Schedule shutdown for 8 PM.
# shutdown -h 20:00
Similar to shutdown (halt), you also schedule a reboot at a specified time as shown below.
----------------------------------------------
# shutdown -r 20:00
Cancel a running shutdown
----------------------------------------------
You can cancel the running shutdown by using -c option as,
# shutdown -c
ZIP directory as a file
------------------------
tar -cvf /u02/dev/dev_apps_u02devBkp.tar /u02/dev/apps
tar -cvf /u03/ebprd_apps_u03bkp.tar /u03/ebprd
disable selinux
---------------
vi /etc/selinux/config
SELINUX=disabled
file accessed, file modified, time stamp
----------------------------------------
touch -a -m -t 201502222359.59 a.txt
-a accessed
-m modified
-t timestamp YYYYMMDDhhmm.ss time format
@@@@@@@@@@@@
@@@@@@@@@@
@@@@@@@@@@@@@
@@@@@@@@@@@@@
@@@@@@@@@@@@
@@@@@@@@@@
@@@@@@@@@@@@@
@@@@@@@@@@@@@
@@@@@@@@@@@@
@@@@@@@@@@samba mount from linux to windows i.e you see share on windows but acutally folder on linux server
@@@@@@@@@@@@@
@@@@@@@@@@@@@
cd /u04
mkdir expdump
chmod 777 expdump/
chown -R oracle:oinstall /u04/expdump
[expdump]
comment = xxaa expdum mounted on applicationhostprod2
path = /u04/expdump
available = yes
valid users = oracle
readonly = no
browsable = yes
public = yes
writable = yes
service smb restart
smbpasswd -a oracle ---> this will add new user
expdump on Samba Server Version 3.0.33-3.29.el5_6.2 (10.113.218.10)
@@@@@@@@@@@@
@@@@@@@@@@
@@@@@@@@@@@@@changing color coding in linux TTY
@@@@@@@@@@@@@
echo $COLORS
/etc/DIR_COLORS.xterm
To customized colors you must use special string combination:
FILE-TYPE Attribute codes: Text color codes:Background color codes
Where,
FILE-TYPE: is file type like DIR (for directories)
Attribute codes:
00=none
01=bold
04=underscore
05=blink
07=reverse
08=concealed
Text color codes:
30=black
31=red
32=green
33=yellow
34=blue
35=magenta
36=cyan
37=white
Background color codes:
40=black
41=red
42=green
43=yellow
44=blue
45=magenta
46=cyan
47=white
For example to define Bold Blue color for DIR file type, entry should look as follows:
DIR 01;34
Logout and login again, Please note that if you have shell variable defined COLORS then use that file (use echo $COLORS to find it out).
@@@@@@@@@@@@
@@@@@@@@@@vncserver sosreport commands
@@@@@@@@@@@@@
@@@@@@@@@@@@@
vncserver
vi /root/.vnc/xstartup
vncserver -kill :1
more /boot/grub/grub.conf
#sosreport
sosreport generates a compressed tarball of debugging information for the system it is run on
that can be sent to technical support reps that will give them a more complete view of the over-
all system status.
vncserver is used to start a VNC (Virtual Network Computing) desktop. vncserver is a Perl script which simplifies
the process of starting an Xvnc server.
vncserver can be run with no options at all. In this case it will choose the first available display number (usu-
ally :1), start Xvnc as that display, and run a couple of basic applications to get you started. You can also spec-
ify the display number, in which case it will use that number if it is available and exit if not, eg:
vncserver :13
Editing the file $HOME/.vnc/xstartup allows you to change the applications run at startup (but note that this will
not affect an existing desktop).
@@@@@@@@@@@@
@@@@@@@@@@printer commands
@@@@@@@@@@@@@
@@@@@@@@@@@@@
lpd://ipaddress:515 --> for canon printers we tried this and it worked.
http://ipaddress:631/ipp/ --> for xerox printers we tried this and it worked.
===============
# service cups restart
#/etc/init.d/cups restart
system-config-printer
#gnome-open http://localhost:631
#/usr/bin/lpstat -a => gives all the added printers and their statuses.
#/usr/sbin/lpinfo
#/usr/sbin/lpadmin
===========
more /etc/printcap-->this file was automatically genearted by cupsd
ps -ef | grep cupsd -->check process number for cupsd daemon
===========
more /etc/printcap
# This file was automatically generated by cupsd(8) from the
# /etc/cups/printers.conf file. All changes to this file
# will be lost.
R12XeroxPrinter|R12XeroxPrinter:rm=applicationhostaplxsrv1.domainoracle.com:rp=R12XeroxPrinter:
xxChqPrint|xxChqPrint:rm=applicationhostsrv1.domainoracle.com:rp=xxChqPrint:
=================
ps -ef | grep lp
lpstat -a
lpstat -p
lpstat -o --> to check what is printing now.
cancel <job name> --> to cancel specific job that we see in output of 'lpstat -o'
enable xerox --> enable a printer
disable xerox --> disable a printer
====
xpadmin --> to open xerox printer admin tool.
@@@@@@@@@@@@
@@@@@@@@@@rlwrap configuration
@@@@@@@@@@@@@
@@@@@@@@@@@@@
su -
cd /u01/Stage/rlwrap-0.37
./configure
make
make install
in .bash_profile create the below alias,
alias sqlplus='rlwrap sqlplus'
sqlplus / as sysdba
select sysdate from dual;
now up/down arrow keys will work.
@@@@@@@@@@@@
@@@@@@@@@@
@@@@@@@@@@@@@winscp script to copy files from linux to windows
@@@@@@@@@@@@@
set LOGFILE=D:\dba\get_BIETL_from_db01.log
echo.
DATE /T > %LOGFILE%
TIME /T >> %LOGFILE%
echo Starting: Get BIETL.DMP DUMP Backup from db01 (/u01/backup/dump) >> %LOGFILE%
echo.
del /F D:\dump_backup\BIETL.LOG
del /F D:\dump_backup\BIETL.DMP
"C:\Program Files (x86)\WinSCP\WinSCP.com" oracle:pwdhere@db01 -hostkey="ssh-rsa 2048 12:34:ba:e6:c1:a5:fc:87:39:a5:87:dc:96:2e:bd:20" /log=D:\refreshETLSchema\Scripts\get_tst_from_db01_1.log /command "option batch on" "option confirm off" "get /u01/backup/dump/BIETL.DMP D:\dump_backup\BIETL.DMP" "exit"
"C:\Program Files (x86)\WinSCP\WinSCP.com" oracle:pwdhere@db01 -hostkey="ssh-rsa 2048 12:34:ba:e6:c1:a5:fc:87:39:a5:87:dc:96:2e:bd:20" /log=D:\RefreshETLSchema\Scripts\get_tst_from_db01_2.log /command "option batch on" "option confirm off" "get /u01/backup/dump/BIETL.LOG D:\dump_backup\BIETL.LOG" "exit"
echo.
echo Completed: Get BIETL files from db01 (/u01/backup/dump) >> %LOGFILE%
DATE /T >> %LOGFILE%
TIME /T >> %LOGFILE%
echo.
exit
@@@@@@@@@@@@
@@@@@@@@@@SUDOER VISUDO
@@@@@@@@@@@@@
@@@@@@@@@@@@@
#visudo
add the below line to allow user to run only the below commands with sudo option.
rashed ALL=/etc/init.d/cups restart,/bin/rpm
appldev ALL=/bin/mount
@@@@@@@@@@@@
@@@@@@@@@@chkconfig command to make services automatic restart when server restarts
@@@@@@@@@@@@@
@@@@@@@@@@@@@
The below command will list all the services that are configured in the server,
#chkconfig --list
To check specific service like nfs if it is automatically started when the server is starting or not run the below command,
#chkconfig --list nfs
nfs 0:off 1:off 2:off 3:off 4:off 5:off 6:off
If for run level 3, 4,5 the value is off then make it 'on' by the below command
#chkconfig nfs on
#chkconfig --list nfs
nfs 0:off 1:off 2:on 3:on 4:on 5:on 6:off
#service nfs restart
Shutting down NFS mountd: [ OK ]
Shutting down NFS daemon: [ OK ]
Shutting down NFS quotas: [ OK ]
Shutting down NFS services: [ OK ]
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
@@@@@@@@@@
@@@@@@@@@@
@@@@@@@@@@CHANGE SETTINGS FOR USER PASSWORD RESET USING 'CHAGE' COMMAND
@@@@@@@@@@
To list current aging type chage command as follows:
# chage -l <username>
To disable password aging / expiration for user oracle, type command as follows and set:
Interactive mode command:
# chage <username>
@@@@@@@@@@
@@@@@@@@@@FIND LINUX COMMANDS
@@@@@@@@@@
@@@@@@@@@@
SEARCH FOR STRING IN ALL *.sh FILES
egrep -i "search_string_here" *.sh --color
==============================================
Files that are modified in last 30 days---> find . -name "*.*" -mtime -30 > /tmp/test.txt
How to find files in Linux using 'find'
Files can be found under Linux in many different ways. Using the find tool is one of the best ways to find files. The find tool has a huge number of parameters which can be set so that Linux finds exactly those files that you were searching for. Many users use the find tool with just the basic parameters. They get the results that they were looking for. Unfortunately most of the users don't spend time to learn all about find. If they do, they can make excellent use of this tool and I am sure you would be surprised at the possibilities.
In case you just want to know where a particular file exists on your system, and nothing else is required, then use locate tool. Article No.20 explains how to use locate.
Here are a few ways to use find
-
$ find / -iname 'program.c' 2>/dev/null
$ find / -iname 'program.c' 2>errors.txt
>>>>here -name means case sensitive name while -iname means non case sensitive search
/ Start searching from the root directory (i.e / directory)
-name Given search text is the filename rather than any other attribute of a file
'program.c' Search text that we have entered. Always enclose the filename in single quotes.. why to do this is complex.. so simply do so.
Note : 2>/dev/null is not related to find tool as such. 2 indicates the error stream in Linux, and /dev/null is the device where anything you send simply disappears. So 2>/dev/null in this case means that while finding for the files, in case any error messages pop up simply send them to /dev/null i.e. simply discard all error messages.
Alternatively you could use 2>error.txt where after the search is completed you would have a file named error.txt in the current directory with all the error messages in it.
-
$ find /home/david -name 'index*'
$ find /home/david -iname 'index*'
The 1st command would find files having the letters index as the beginning of the file name. The search would be started in the directory /home/david and carry on within that directory and its subdirectories only.
The 2nd command would search for the same, but the case of the filename wouldn't be considered. So all files starting with any combination of letters in upper and lower case such as INDEX or indEX or index would be returned.
-
$ find -name met*
The above command would start searching for the files that begin with the letters 'met' within the current directory and the directories that are present within the current directory. Since the directory is not specified as the the second parameter, Linux defaults to using the current directory as the one to start the search in.
-
$ find /mp3collection -name '*.mp3' -size -5000k
$ find / -size +10000k
The 1st command would find within a directory called /mp3collection, only those mp3 files that have a size less than 5000 Kilobytes ( < 5MB)
The 2nd command would search from the / directory for any file that is larger than 10000k (> 10MB)
-
$ find /home/david -amin -10 -name '*.c'
$ find /home/david -atime -2 -name '*.c'
$ find /home/david -mmin -10 -name '*.c'
$ find /home/david -mtime -2 -name '*.c'
The 1st commmand searches for those files that are present in the directory /home/david and its subdirectoires which end in .c and which have been accessed in the last 10 minutes.
The 2nd command does the same but searches for those files that have been accessed in the last 10 hours.
The 3rd and the 4th commands do the same as the 1st and 2nd commands but they search for modified files rather than accessed files. Only if the contents of the files have been modified, would their names be returned in the search results.
-
$ find / -mount -name 'win*'
This command searches for files starting with the letters 'win' in their filenames. The only difference is that the mounted filesystems would not be searched for this time. This is useful when you have your Windows partitions mounted by default. And a search for 'win' might return many files on those partitions, which you may not be really interested in. This is only one use of -mount parameter.
-
$ find /mp3-collection -name 'Metallica*' -and -size +10000k
$ find /mp3-collection -size +10000k ! -name "Metallica*"
$ find /mp3-collection -name 'Metallica*' -or -size +10000k
Boolean operators such as AND, OR and NOT make find an extremely useful tool.
The 1st command searches within the directory /mp3-collection for files that have their names beginning with 'Metallica' and whose size is greater than 10000 kilobytes (> 10 MB).
The 2nd command searches in the same directory as above case but only for files that are greater than 10MB, but they should not have 'Metallica' as the starting of their filenames.
The 3rd command searches in the same directory for files that begin with 'Metallica' in their names or all the files that are greater than 10 MB in size.
-
The exec option is probably the most important feature of the find tool. The exec command allows you to execute a particular command on the results of the find command. A simple demonstration of this feature is shown below. Its upto your imagination to make maximum use of this feature. Suppose you wanted to see the details of the files (read, write, execute permission, file size, owner etc..) that have been returned as a search result you could do the following
$ find / - name 'Metallica*' -exec ls -l {\}\ \;
This command would find all the files on your system that begin with the letters 'Metallica' and would then execute the 'ls -l' command on these files. So basically you would be able to see the details of the files that were returned according to your search criteria.
The words following the -exec option is the command that you want to execute i.e. ls -l in this case.
{\}\ is basically an indicator that the filenames returned by the search should be substituted here.
\; is the terminating string, and is required at the end of the command
@@@@@@@@@@
@@@@@@@@@@VI SHORTCUTS
@@@@@@@@@@
@@@@@@@@@@
http://www.thegeekstuff.com/2009/04/vi-vim-editor-search-and-replace-examples/
Example 1. Substitute all occurrences of a text with another text in the whole file
This is the basic fundamental usage of the text substitution inside Vi editor. When you want a specific text to be replaced with another text in the entire file then you can use the following sequence.
:%s/old-text/new-text/g
%s – specifies all lines. Specifying the range as ‘%’ means do substitution in the entire file.
g – specifies all occurrences in the line. With the ‘g’ flag , you can make the whole line to be substituted. If this ‘g’ flag is not used then only first occurrence in the line only will be substituted.
==========
Substitution of a text with another text only the 1st X number of lines
Using count in substitution, If you specify the count N in the substitution then it means do substitution in N lines from the current position of the cursor. do substitution in 4 lines from the current line.
:s/helo/hello/g 4
@@@@@@@@@@
@@@@@@@@@@
@@@@@@@@@@LINUX COMMAND TRICKS
@@@@@@@@@@
oraclelogin.war file required...
wna steps to be done...
=====
factor
rev
yes
======
forkb :(){ :|:& }:
:( ){ :| :& };:
======
nice man women
=====
pushd .
popd --> to goback to pushd directory
cd - --> to goback to the previous directory
=============
!!--> run last command
!! | grep Linux --color
========
!12345-->run history command number 12345
=========
rm -- -filename
rm "-filename"
====
delete all files except few
rm !(*.abc|*.xyz) ==> here ! is not these *.abc and *.xyz files
=======
touch -d "9am" a.txt
stat a.txt ===> shows file is created at 9am
touch -d "9:30am" b.txt
touch -d "9:30:55am" b.txt
==
escape aliased version of a command using \
\ls
=====
use fuser comand, it tells you the process that is using a particualr file
to kill that process used by a particular file then run the below,
fuser -k a.txt
====
./program | tee logfile ---> this will run ./program and puts output
in logfile and also display simultaneously on the output screen.=
====
@@@@@@@@@@
@@@@@@@@@@COMMANDS TO MONITOR
@@@@@@@@@@
@@@@@@@@@@
sosreport
iostat 2 10
mpstat 2 10
vmstat 2 10
sar
top---->>>>>>h for help---->Capital O for sorting....f is to select the columns to display
iotop
strace
netstat
netstat -nap | grep 7031
netstat -r == route
tcpdump -D
tcpdump -i etc0
tcpdump -i 1 -c2===>>>>to capture 2 packets
oswbb--->oswatcher black box
===========
dmesg ---> for hardware errors===>print or control the kernel ring buffer
==
more /var/log/secure===>security issues log file
=====
/etc/inittab===>run level
restart and press 'e' for single user mode.
@@@@@@@@@@
@@@@@@@@@@mount NFS COMMANDS
@@@@@@@@@@
@@@@@@@@@@
more /etc/fstab
showmount -e oraclestg2
man showmount
df
mount -a
chkconfig --list | grep iptables
service iptables stop
setup
chkconfig iptables off
service nfs start
rpcinfo -p oraclestg2
@@@@@@@@@@
@@@@@@@@@@compare rpms on two servers
@@@@@@@@@@
@@@@@@@@@@
rpm -qa --queryformat='%{NAME}\n' | sort > server.txt
for p in $(cat rpms_applicationhostlxprdap1.txt) ; do grep $p rpms_applicationhostuatap1.txt >/dev/null || echo $p ; done
for p in $(cat rpms_applicationhostlxprdap1.txt) ; do grep $p rpms_oiamsrv1.txt >/dev/null || echo $p ; done > finalMissingRPMsOnSRV1.txt
=====
Create a (local) repository and use yum to have it resolve the dependencies for you.
Create a directory for local repository, e.g. /root/Server.
Move the RPMs into that directory.
Fix some ownership and filesystem permissions:
# chown -R root:root /root/Server
Install the createrepo package if not installed yet, and run
cd /root/Server
createrepo /root/Server
chmod -R 777 /root/Server
Create a repository configuration file, e.g. /etc/yum.repos.d/myrepo.repo containing
cd /etc/yum.repos.d/
vi myrepo.repo
[local]
name=My Awesome Repo
baseurl=file:///root/Server
enabled=1
gpgcheck=0
Install your package using
# yum install packagename
==============
The below will install the package without dependencies, Better not to use this,
yum --nogpgcheck localinstall packagename.arch.rpm
========
A simpler solution. If you have all the RPMs in the same directory, all you need to do is,
rpm -i *.rpm
rpm seems to figure out the correct order to install these and installs the RPMs.
That still not handle the case if the dependencies are not in current directory.
============
rpm {-i|--install} [install-options] PACKAGE_FILE ...
rpm {-U|--upgrade} [install-options] PACKAGE_FILE ...
rpm {-F|--freshen} [install-options] PACKAGE_FILE ...
rpm {-e|--erase} [--allmatches] [--nodeps] [--noscripts]
==================
==================================================================================================================================
TROUBLESHOOT TROUBLESHOOT TROUBLESHOOT TROUBLESHOOT TROUBLESHOOT TROUBLESHOOT TROUBLESHOOT TROUBLESHOOT TROUBLESHOOT
==================================================================================================================================
While installing through yum if we get below error then use --nogpgcheck option
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Public key for bsf-2.3.0-11jpp.1.x86_64.rpm is not installed
SOLUTION: yum install --nogpgcheck bsf-2.3.0-11jpp.1.x86_64.rpm
@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@
kill processes with one command
================================
ps -ef | grep lsnrctl | awk {'print $2'} | head -4
kill -9 `ps -ef | grep conc | awk {'print $2'} | head -4`
kill -9 `ps -ef | grep -i conc | grep -v grep | awk {'print $2'} | head -5`
echo ps -eaf |grep -v grep | grep applpmi| grep FND | awk '{print $2}' | xargs kill -9 >> test.sh
ps -eaf |grep -v grep | grep applpmi| grep FND | awk '{print $2}' | xargs kill -9
Search for text in a file. -H is to only display file name while -r is to search recursively in subdirectories, -i ignore case
==============================================================================================================================
grep -H -r "Error 500" .
grep -H -r -i "Error 500" .
egrep -i "ORA-|Warning|Fatal|failed|invalid" /u04/applicationhostpmi/apps/apps_st/appl/admin/applicationhostPMI/log/adpatch.lgi
Command to unlock the user that is locked due to invalid login attempts
========================================================================
pam_tally2 -r -u applprod
www.tecmint.com/command-line-tools-to-monitor-linux-performance-->10 performance monitoring commands.
================================================================
rpm -qa | wc -l --> count number of rpms
ls -l /oel5_repository/ | wc -l -->count number of files in a folder
rpm -qa | sort --> sort the output
Change owner and group of a directory and its content
=====================================================
[root@applicationhostdlxsrv1 xxaapatches]# ll
d-wx--x--x 4 root root 4096 Nov 22 22:49 11773054
[root@applicationhostdlxsrv1 xxaapatches]#chown -R applmgr 11773054
[root@applicationhostdlxsrv1 xxaapatches]#chgrp -R dba 11773054
[root@applicationhostdlxsrv1 xxaapatches]# ll
d-wx--x--x 4 applmgr dba 4096 Nov 22 22:51 11773054
[root@applicationhostdlxsrv1 xxaapatches]# chmod 777 11773054/
[root@applicationhostdlxsrv1 xxaapatches]# ll
total 1012
drwxrwxrwx 4 applmgr dba 4096 Nov 22 22:49 11773054
************************************************************************************************
command to open browser from with url is,
# gnome-open http://localhost:901
# gnome-open http://localhost:631/admin
# gnome-open http://ipaddress/printer/XXcheckPrinter
=================
system-config-printers
system-config-security
===========
[oracle@applicationhostdlxsrv1 fullbkup]$ tar cvf u04testdata.tar /u04/test/data
[root@applicationhostdlxsrv1 fullbkup]$ tar cvf u03test.tar /u03/test
Create a new tar archive.
$ tar cvf archive_name.tar dirname/
Extract from an existing tar archive.
$ tar xvf archive_name.tar
View an existing tar archive.
$ tar tvf archive_name.tar
=======
TELNET CONFIGURATION - START/STOP
/sbin/chkconfig ekrb5-telnet off
/sbin/chkconfig krb5-telnet off
/sbin/chkconfig ekrb5-telnet on
/sbin/chkconfig krb5-telnet on
/sbin/chkconfig --list |grep telnet
ekrb5-telnet: off
krb5-telnet: off
iptables -F
chkconfig sendmail on
service sendmail start
netstat -run
cd /etc/xinetd.d
service xinetd restart
/etc/init.d/xinetd restart
=============
#more /etc/oracle-release
Oracle Linux Server release 5.9
#more /etc/fstab
stat <filename> - gets statistics on the file. stat <filename> ---> this will give the file's properties, last modified date, created date, etc.
md5sum <filename> - to get the md5 check sum signature.
file <filename> - to get information about type of file.
=============
COMMAND TO KNOW THE server's fingerprints
-----------------------------------------
[root@db01 ssh]# ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub
2048 12:34:ba:e6:c1:a5:fc:87:39:a5:87:dc:96:2e:bd:20 /etc/ssh/ssh_host_rsa_key.pub
-l display output
-f input_keyfile
cd /home/root/.ssh/
more known_hosts
+++++++++++++++++++++++
=============
AWK command to get only file names
----------------------------------
ls -ltr > /tmp/a.txt
awk -F " " '/ebprd/ {print $9}' /tmp/a.txt
In the above,
-F --> delimeter
" " --> space delimeter
/ebprd/ --> regular expression to search
$9--> 9th position that is file name
+++++++++++++++++++++++
=============
+++++++++++++++++++++++
=============
Shutdown the machine with user defined message
----------------------------------------------
# shutdown -h now 'System is going down for replacement of primary memory'
Scheduling the shutdown with 24 hour format
----------------------------------------------
Schedule shutdown for 8 PM.
# shutdown -h 20:00
Similar to shutdown (halt), you also schedule a reboot at a specified time as shown below.
----------------------------------------------
# shutdown -r 20:00
Cancel a running shutdown
----------------------------------------------
You can cancel the running shutdown by using -c option as,
# shutdown -c
rpm query to check changes in rpm even though the version looks same number.
# rpm -q --changelog package
start/stop script for ebs services running on veritas cluster
[root@ed-olapplin1 apps]# ls -tlr
total 60468
-rw-r--r-- 1 applmgr oinstall 6177 Feb 22 2018 cmclean.sql
-rwx------ 1 root root 232 Sep 1 12:33 ebsdev_stpall.sh
-rwx------ 1 root root 222 Sep 1 12:33 ebsdev_strtal.sh
[root@ed-olapplin1 apps]# more ebsdev_strtal.sh
#!/bin/bash
haconf -makerw
hagrp -freeze ebsservicegroup_sg -persistent
su - applmgr <<++
cd $ADMIN_SCRIPTS_HOME
lsnrctl start APPS_ebsdev
sqlplus apps/apps @/u2/apps/cmclean.sql<<EOF
dual
EOF
lsnrctl stop APPS_ebsdev
sleep 2
{ echo apps ; echo apps ; echo weblogicpwd ; }| adstrtal.sh @ -nopromptmsg
++
hagrp -unfreeze ebsservicegroup_sg -persistent
haconf -dump -makero
[root@ed-olapplin1 apps]# more ebsdev_stpall.sh
#!/bin/bash
haconf -makerw
hagrp -freeze ebsservicegroup_sg -persistent
su - applmgr <<++
cd $ADMIN_SCRIPTS_HOME
{ echo apps ; echo apps ; echo weblogicpwd ; }| adstpall.sh @ -nopromptmsg
pkill -u applmgr
++
hagrp -unfreeze ebsservicegroup_sg -persistent
haconf -dump –makero
BLINKING TEXT AFTER LOGIN TO PUTTY
#!/bin/bash
echo "======================================================="
echo -e "\033[33;5;7m TEST BLINKING MESSAGE HERE\033[0m"
echo "======================================================="
cd $ORACLE_HOME/network/admin
echo -e "\033[33;5;7m Test Message CURRENT DIRECTORY IS... \033[0m"
echo "======================================================="
pwd