In this post i am going to share few of the oracle Linux commands .. i have posted total 4 post for Complete Linux high level commands . this post you can see Part 3/4..
check the previous parts details below .
part 1 : https://anjaniappsdba.blogspot.com/2023/09/oracle-linux-commands-part-14.html
part 2 : https://anjaniappsdba.blogspot.com/2024/02/oracle-linux-commands-part-24.html
Unix/Linux Awk Commands:
===================
Awk {print;} filename>>
Awk '/searchword/' filename
ex:
-bash-4.2$ awk '/db_name/' awrrpt_1_10_11.html
Awk '{print $2,$3;}' filename ( it will print the 2nd and 3rd line of the file )
Awk '{print $2,$5;}' filename ( it will print the 2nd and 5th line of the file )
awk '{print $2,$NF;}' filename
awk '{print $2,$NF;}' awrrpt_1_10_11.html
Unix Sed Commands :
====================
Sed 's/oldname/newname/' filename >> to change first occurrence of the each line old name to new name
Sed 's/oldname/newname/2' filename >> to change second occurrence of the each line old name to new name
Sed 's/oldname/newname/g' filename >> to change all occurrence of the each line old name to new name.
Sed –n '/name/p' filename >> to print pattern match the line
Sed '/^#\|^$| -*#/d' httpd.conf : to empty line file and start the # beginning remove that lines
Linux Rpm Commands
=================
rpm –ivh rpmpkgname >> to install rpm package independently(with
in dependence)
[root@proddb01 ~]# rpm -qa oracle*
oracleasm-support-2.1.11-2.el7.x86_64
oracle-database-server-12cR2-preinstall-1.0-5.el7.x86_64
oraclelinux-release-el7-1.0-11.el7.x86_64
oracle-logos-70.7.0-1.0.5.el7.noarch
oracle-database-preinstall-19c-1.0-3.el7.x86_64
oracle-database-preinstall-21c-1.0-1.el7.x86_64
oracle-database-preinstall-18c-1.0-1.el7.x86_64
oraclelinux-release-7.8-1.0.7.el7.x86_64
rpm –qa >> to display the all rpm packages installed details
bind-libs-lite-9.11.4-26.P2.el7_9.16.x86_64
urw-base35-nimbus-mono-ps-fonts-20170801-10.el7.noarch
abrt-2.1.11-57.0.1.el7.x86_64
pinentry-0.8.1-17.el7.x86_64
tigervnc-server-minimal-1.8.0-19.0.1.el7.x86_64
flite-1.3-22.el7.x86_64
gnome-screenshot-3.26.0-1.el7.x86_64
tog-pegasus-libs-2.14.1-8.0.1.el7.x86_64
xterm-295-3.el7.x86_64
mod_session-2.4.6-93.0.1.el7.x86_64
libarchive-3.1.2-14.el7_7.x86_64
xorg-x11-drv-void-1.4.1-2.el7.1.x86_64
sos-3.8-6.0.1.el7.noarch
xsettings-kde-0.12.3-7.el7.x86_64
c-ares-1.10.0-3.el7.x86_64
librsvg2-2.40.20-1.el7.x86_64
rpm –q kernel >> it display the kernel version
rpm –e packagename >> to uninstall the rpm package
rpm –l package >> to search the rpm location path
Linux Compressed / uncompressed Commands
============================
tar –cvf filename.tar directory/filepath>> to create tar file
tar -cvf ashrpt_1_0910_1111.html.tar ashrpt_1_0910_1111.html
ashrpt_1_0910_1111.html.tar
tar –xvf filename.tar>> to extract the tar file
bash-4.2$ tar -xvf ashrpt_1_0910_1111.html.tar
tar –cvf filename.tar directory1 directory2 directory3>> to create tar
file multiple directory
tar –xvf filename.tar –d directorypath>> to extract the tar file in
specific location
tar –tvf filename.tar>> to see the contents tar file without extract
tar –czvf filename.tar.gz directory1 directory2 directory3>> to create
tar file multiple directory
tar –xzvf filename.tar.gz>> to extract the tar file
tar –tzvf filename.tar.gz>> to see the contents tar file without extract
zip –r filename.zip directory1 >> to creates zip files
unzip filename.zip >> to unzip the files
unzip –l filename.zip (or) less filename.zip>> to see the content
without extract to see the content
Gzip filename>> to create only the files not directories
Example: gzip filename
Output:filename.gz
Gzip –r directory>> to create only zip In files in directories
Gunzip filename.gz >> to extract the gz file
Tar –cjvf filename.tar.bz filename>> to create bz file
tar –cvf filename.tar file1 file2 >> to create a tar file
tar –xvf filename.tar >> extract the tar file
tar –tvf filename.tar >> to see the content of tar file without extract
tar –cvf filename.war directorypath>> create a tar file
tar –xvf filename.war>> extract the tar file
tar –xvf filename.war –d directorypath>> extract the war file in
specific location
tar –tvf filename.war>> to see the tar file content without extract
Moving data one location to another
================================
Cp >> copy the files or duplicate the files / backup the existing file / folder / directories
Cp source destintion>> to copy the files one location to another.
Cp -r source destintion>> to copy the directories one location to
another.
mv source destintion>> to cut and paste the files one location to another. Or rename the files /directories
-bash-4.2$ cp test.txt test.txt_old
-bash-4.2$ ls -ltr
total 8
-rw-r--r-- 1 oracle oinstall 20 Nov 15 14:58 test.txt
-rw-r--r-- 1 oracle oinstall 20 Nov 15 14:58 test.txt_old
-bash-4.2$
Linux Common Commands
============================
pwd >>present working directory
w>> to display system uptime ,load avg ,how many users
working full information of users
who>>to display the current active users
whoami>> current user name
who am i>>it gives first login user in the system command
prompt
which command >> to know the execution command location
path
cd>> to go the home directory
cd ~ >> to go the home directory
cd ..>> to go the previous directory
cd /somepath>> to go the given path
man >> to given the commands information
ls >> to display the list of files and directories
ls –a >> to display the list of files and directories and hidden
directories and files
ls –l >>
ls –lt>>it display the files with time based
ls –ltr>> it display the files with time reverse order
ls –ltrh>> it display the files with human readable format (like
gb,mb)
-bash-4.2$ pwd
/home/oracle/racsinfotech
-bash-4.2$ ls
test.txt
-bash-4.2$ ls -ltr
total 4
-rw-r--r-- 1 oracle oinstall 20 Nov 15 14:58 test.txt
-bash-4.2$
Thanks,
Srini
No comments:
Post a Comment
No one has ever become poor by giving