Saturday, June 8, 2013

Basic LINUX commands that a DBA should know

Basic LINUX commands that a DBA should 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
a. This is the command used to view the current system date.
Syntax : date
Output : Wed Oct 27 21:55:36 IST 2010
b. In order to update the date we can give :
Syntax : [root@rac5 ~]# date -s "2 OCT 2010 14:00:00"  OR
[root@rac5 ~]# date --set="27 OCT 2010 21:56:00"
Output : Sat Oct  2 14:00:00 IST 2010

cal
This command shows the calender of current year or any.
Ex : [root@rac5 ~]#  Cal
Output : [root@rac5 ~]#    October 2010
                        Su Mo Tu We Th Fr Sa
                            1  2
             3  4  5  6  7  8  9
            10 11 12 13 14 15 16
            17 18 19 20 21 22 23
            24 25 26 27 28 29 30
            31

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  stand.ora
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
This command is used for make a new directory.
 Ex : mkdir dir1

rmdir
This commad is used for remove a directory.
 Ex : rmdir dir1

rm -rf
This command is used to forcefully remove a direcory.
Ex : rm -fr dir1

man
This command is used to show the online manual pages of related commands
Ex : man ls

ls
This command is used to list all contents of directories
Ex : 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--
1
root
root
765
Apr 23
file.txt
File type
Owner
Group
All
Links
Owner
Group
Size
Mod date
Filename


touch
This command is used create an empty file
Ex : touch file1

cat
This command is used to create and view files of directories
Ex : cat file1
cat file1 > newfile   // owerwrite newfile with file1
cat file1 >> newfile  // append newfile the contents with file1

cp
This command is used to copy a file from one to another 
Ex : cp file1 filenew 

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

No comments:

Post a Comment