Monday, September 19, 2011

Basic Linux for DBAs


cd
The cd command enables you to change directories. The format is cd new-location
$ cd /temp

date
 The date command gives you the time and date.
$ date
Mon Sep 19 11:30:13 EDT 2011

$ echo
echo command lets  you display text on screen
$ echo Bilal Ashraf

grep
The grep command is a pattern-recognition command. It enables you to see if a certain word or set of words occurs in a file or the output of any other command. In the example shown
$ grep find_text test.txt

history
The history command gives you the commands entered previously by you or other users

pwd
Use the pwd command to find out your present working directory or to simply confirm your  current location in the file system.
$ pwd
/u02/test

uname
In the example shown here, the uname command tells you that the machine’s symbolic name and it’s an Linux machine. The -a option tells LINUX to give all the details of the system. If you omit the -a option, LINUX will just respond with Linux.
$ uname – a
Linux warehouselab 2.6.18-194.el5 #1 SMP Mon Mar 29 22:10:29 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

whereis
As the name of this command suggests, whereis will give you the exact location of the executable file for the utility in question.
$ whereis who
who:  /usr/bin/who 
/usr/share/man/man1.z/who.1

who
This command provides you with a list of all the users currently logged into the system.

whoami
The whoami command indicates who you are logged in as. This may seem trivial, but as a DBA, there will be times when you could be logged into the system using any one of several usernames. It’s good to know who exactly you are at a given point in time, in order to prevent the execution of commands that may not be appropriate, such as deleting files or directories. The example shown here indicates that you are logged in as user Oracle,
$ whoami
Oracle

Getting help:  The man command
UNIX and Linux systems both come with a built-in feature called the man pages, which provide copious information about all the operating system commands. You can look up any command in more detail by typing man followed by the command you want information on, as follows:
$ man who

cat /proc/cpuinfo

Provides information such as number of CPUs, memory size, and
number of cores for the Linux environment



No comments:

Post a Comment