1. tar command examples
·
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
·
Search
for a given string in a file (case in-sensitive search).
$ grep -i "the" demo_file
·
Print
the matched line, along with the 3 lines after it.
$ grep -A 3 -i "example" demo_text
·
Search
for a given string in all files recursively
$ grep -r "DBA" *
·
Find
files using file-name ( case in-sensitve find)
# find -iname "DBA"
·
Execute
commands on files found by the find command
$ find -iname "DBA" -exec md5sum {} \;
·
Find
all empty files in home directory
# find ~ -empty
·
Login
to remote host
ssh -l oracle remotehost.example.com
·
Debug
ssh client
ssh -v -l oracle remotehost.example.com
·
Display
ssh client version
$ ssh -V
·
Remove
duplicate lines using awk
$ awk '!($0 in array) { array[$0]; print }' temp
·
Print
all lines from /etc/passwd that has the same uid and gid
$awk -F ':' '$3==$4' passwd.txt
·
Print
only specific field from a file.
$ awk '{print $2,$5;}' employee.txt
·
Go
to the 143rd line of file
$ vim +143 filename.txt
·
Go
to the first match of the specified
$ vim +/search-term filename.txt
·
Open
the file in read only mode.
$ vim -R /etc/passwd
·
Ignore
white space while comparing.
# diff -w name_list.txt name_list_new.txt
2c2,3
< John Doe --- > John M Doe
·
To
extract a *.zip compressed file:
$ unzip test.zip
·
View
the contents of *.zip file (Without unzipping it):
$ unzip -l jasper.zip
Archive: jasper.zip
Length
Date Time Name
-------- ----
---- ----
40995 11-30-98 23:50
META-INF/MANIFEST.MF
32169 08-25-98 21:07
classes_
15964 08-25-98 21:07
classes_names
10542 08-25-98 21:07
classes_ncomp
·
If
you want to quickly check how many GB of RAM your system
If you want to see a total memory
(including the swap)
·
To
install apache using yum.
$ yum install httpd
·
To
upgrade apache using yum.
$ yum update httpd
·
To
uninstall/remove apache using yum.
$ yum remove httpd
uuencode filename filename |mailx -s
subject mail_id
13. To use multiple shell windows from a single SSH session
screen -s rman -> to save the screen in
Linux box
screen -x rman -> to open saved session
14. How to extract multi-part, e.g. .z01, .z02 type of zip
files on Linux
In order to
extract on Ubuntu, do the following:
zip -s-
dac_win_11g_infa_linux_64bit_951.zip -O output.zip
This will
gather the Input.zip file and all following .z0x in one file called output.zip,
which you can then extract and do whatever you want on it,
e.g.
zip -s-
dac_win_11g_infa_win_64bit_901.zip -O output.zip
15. To deinstall and install jdk
[root@ogslab2
java]# rpm -qa jdk
jdk-1.6.0_43-fcs.i586
[root@ogslab2 java]# rpm -ev
jdk-1.6.0_43-fcs.i586
[root@ogslab2 ogsbkp]# rpm -ivh
jdk-6u24-linux-i586.rpm
Preparing...
########################################### [100%]
1:jdk
######################################## [100%]
Unpacking JAR files...
rt.jar...
jsse.jar...
charsets.jar...
tools.jar...
localedata.jar...
plugin.jar...
javaws.jar...
deploy.jar.
16. Create
download-file-list.txt in you user home (here its mine
mxm129)
[mxm129@bdopprka001 SPSR15151]$ pwd
/export/home/mxm129/SPSR15151
[mxm129@bdopprka001 SPSR15151]$ ls -ltr download-file-list.txt
-rwxrwxrwx 1 mxm129 efx 2156 Dec
26 00:23 download-file-list.txt
[mxm129@bdopprka001
SPSR15151]$ cat download-file-list.txt
http://scm.devcentral.equifax.com/svn/GCP/Oracle%20Financials/branches/DEV%20(Developer%20Only)/Oracle%20R12%20CORP/XXAR/ldt/XXAR_BCP_AUTOMATION_CP.ldt
http://scm.devcentral.equifax.com/svn/GCP/Oracle%20Financials/branches/DEV%20(Developer%20Only)/Oracle%20R12%20CORP/XXAR/ldt/XXAR_BCP_AUTO_OUT_CP.ldt
[mxm129@bdopprka001 SPSR15151]$
wget --user=mxm129
--password=********* -i download-file-list.txt
When you run above commnad it
will download all latest version of files from SVN. Give fill permission to all
below files ....
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[mxm129@bdopprka001 SPSR15151]$ ls -ltr
total 480
-rwxrwxrwx 1 mxm129 efx 20514
Dec 1 13:48 XXAR_BCP_AUTO_OUT_CP.ldt
-rwxrwxrwx 1 mxm129 efx 23463
Dec 1 13:48 XXAR_BCP_AUTOMATION_CP.ldt
-rwxrwxrwx 1 mxm129 efx 2156 Dec 26 00:23 download-file-list.txt
[mxm129@bdopprka001 SPSR15151]$
Copy all files from
(/export/home/mxm129/SPSR15151) to
/export/home/appllut/SPSR15151 using apps
user
17. To get more info about the listening ports in linux machine
Login to root user and execute below cmds,
fuser 8453/tcp
8453/tcp: 3813
lrwxrwxrwx 1 vivek vivek 0 2010-10-29 11:00 /proc/3813/exe -> /usr/bin/transmission
[OR]
lsof -i TCP:8453
lrwxrwxrwx 1 vivek vivek 0 2010-10-29 11:00 /proc/3813/exe -> /usr/bin/transmission
17. To get more info about the listening ports in linux machine
Login to root user and execute below cmds,
fuser 8453/tcp
8453/tcp: 3813
lrwxrwxrwx 1 vivek vivek 0 2010-10-29 11:00 /proc/3813/exe -> /usr/bin/transmission
[OR]
lsof -i TCP:8453
lrwxrwxrwx 1 vivek vivek 0 2010-10-29 11:00 /proc/3813/exe -> /usr/bin/transmission
No comments:
Post a Comment