Basic LINUX Commands That A DBA Should Know Oracle Database Experience
Basic LINUX Commands That A DBA Should Know Oracle Database Experience
know
groupadd
This is the command used to create new group. At OS level group is used
to give and take pivillages.
Syntax : groupadd <group name>
Ex : [root@rac5 ~]# groupadd group1
View : [root@rac5 ~]# cat /etc/group -This command used to
view which user belongs to which group.
Output: group1:x:607:
useradd
This is the command used to create a new user in a group.
Syntax : useradd -g <group name> <user name>
Ex : [root@rac5 ~]# useradd -g group1 user1
passwd
This is the command used to give password for create use or to update
the password.
Syntax : passwd <user name>
Ex: [root@rac5 ~]# passwd user1
Output :
[root@rac5 ~]# Changing password for user soufir.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
date
cal
pwd
This command is to view the present working directory.
Ex : [root@rac5 ~]# pwd
Output : [root@rac5 ~]# /root.
cd
a.This is the command used to change a directory
Ex : [oracle@rac5 ~]$ ls
authorized_keys file
file2 oraInventory
authorized-keys file1 file3 soufir
[oracle@rac5 ~]$ cd soufir
[oracle@rac5 soufir]$
b.This is used to go back to parent directory
Ex : cd ..
mkdir
rmdir
This commad is used for remove a directory.
Ex : rmdir dir1
rm -rf
stand.ora
man
This command is used to show the online manual pages of related
commands
Ex : man ls
ls
ls -lt
This command is used to list lot of information about contents of
directories
Ex
: ls
-lt
The permissions are the first 10 characters of the line (-rwxrwx---) and
can be broken down as follows.
-
rwx
r--
r--
root
root
765
Apr 23
File type
Owner
Group
All
Links
Owner
Group
Size
Mod date
touch
This
command
Ex : touch file1
is
used
create
an
cat
empty
file
cp
mv
This command is used to rename the name of a file to other
Ex : mv file1 filenew
su
This command is used to switch one user to other. it doesnot change the
current working directory. so you cant access the /usr/sbin directories.
Ex : su soufir
su -
This command is used to switch one user with changing current working
directory.
Ex : su - soufir
RAME SH NATARAJAN
on NOVEMBER 8, 2010
Print the matched line, along with the 3 lines after it.
# find ~ -empty
When you copy a DOS file to Unix, you could find \r\n in the
end of each line. This example converts the DOS file format to
Unix file format using sed command.
$sed 's/.$//' filename
Print all lines from /etc/passwd that has the same uid and gid
$awk -F ':' '$3==$4' passwd.txt
2c2,3
declare -x ORACLE_BASE="/u01/app/oracle"
declare -x ORACLE_HOME="/u01/app/oracle/product/10.2.0"
declare -x ORACLE_SID="med"
declare -x ORACLE_TERM="xterm"
compressed
23709
Archive: jasper.zip
Length
--------
Date Time
---- ----
Name
----
/ftptest/features.html
/ftptest/index.html
/ftptest/othertools.html
/ftptest/samplereport.html
/ftptest/usage.html
Restart a service.
# service ssh restart
total
Mem:
used
3566408
free
1580220
shared
1986188
902960
-/+ buffers/cache:
Swap:
4000176
473272
3093136
4000176
buffers
cached
203988
total
Mem:
used
-/+ buffers/cache:
Swap:
free
shared
buffers
cached
total
used
free
shared
buffers
cached
Mem:
3566408
1592148
1974260
204260
912556
-/+ buffers/cache:
Swap:
Total:
4000176
7566584
475332
1592148
3091076
4000176
5974436
Select sort field via field letter, type any other key to return
a: PID
= Process Id
d: UID
= User Id
v: nDRT
y: WCHAN
= Sleeping in
Function
e: USER
= User Name
z: Flags
= Task Flags
........
More top examples: Can You Top This? 15 Practical Linux Top
Command Examples
25. df command examples
$ df -k
Filesystem
1K-blocks
/dev/sda1
/dev/sda2
Filesystem
/dev/sda1
/dev/sda2
ramesh@ramesh-laptop:~$ df -T
Filesystem
Type 1K-blocks
/dev/sda1
ext4
/dev/sda2
ramesh
$ kill -9 7243
00:00:00 vim
/var/log/btmp {
missingok
monthly
rotate 1
You can also add this to the fstab for automatic mounting. i.e
Anytime system is restarted, the filesystem will be mounted.
Revoke all access for the group (i.e read, write and execute )
on a specific file.
$ chmod g-rwx file.txt
$ mkdir -p dir1/dir2/dir3/dir4/
lsmk: /tmp/lsmk
ls
$ whatis ifconfig
ifconfig (8)
Using locate command you can quickly search for the location
of a specific file (or group of files). Locate command uses the
database created by updatedb.
The example below shows all files in the system that contains
the word crontab in it.
$ locate crontab
/etc/anacrontab
/etc/crontab
/usr/bin/crontab
/usr/share/doc/cron/examples/crontab2english.pl.gz
/usr/share/man/man1/crontab.1.gz
/usr/share/man/man5/anacrontab.5.gz
/usr/share/man/man5/crontab.5.gz
/usr/share/vim/vim72/syntax/crontab.vim
3. C library functions
4. Special files (usually devices, those found in /dev) and
drivers
5. File formats and conventions
6. Games and screensavers
7. Miscellaneous
8. System administration commands and daemons
For example, when you do whatis crontab, youll notice that
crontab has two man pages (section 1 and section 5). To view
section 5 of crontab man page, do the following.
$ whatis crontab
crontab (1)
crontab (5)
$ man 5 crontab
View the content of the file in real time using tail -f. This is
useful to view the log files, that keeps growing. The command
can be terminated using CTRL-C.
$ tail -f log-file
$ less huge-log-file.log
One you open a file using less command, following two keys
are very helpful.
CTRL+F forward one window
[john@dev-server]$
$ ping -c 5 gmail.com