http://goo.gl/EmKxy0

Home > ASE, Sybase ASE/REP Interview Questions, UNIX > Essential DBA Unix

Essential DBA Unix

September 12th, 2011 Leave a comment Go to comments

Hi All,

I am listing the command which we are frequently used in our DBA unix enviorment. I would lile to thnx Abhay for sharing this.

============================
Essential DBA Unix
============================
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!System Administration!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

su : Acquiring super user status
su – henery : Crearting Other users (henery) environment
passwd : Changing Passowrd
date : Setting the system date
wall : Write message all users desktop , terminate
calender : display calender

ulimit : Setting Limits on File Size

shutdown : Shutdown systems
shutdown -g2 : Shutdown after 2 minutes
shutdown -g0 : Shutdown immediately
shutdown -y -g0 -i6 : Shutdown and reboot (init level 6)
shutdown 17:30 : Shutdown at 17:30 hours
shutdown -r now : Shutdown immediately and reboot.

df : Reporting Free Space.
df -t : total amount of free disk space.

du : disk Usages
du -s : Assigning Space Consumed by Users

compress filename : compressing file and making compressed file filename.z
uncompress filename.z : it produce uncompress filename file.

zcat filename.z : Uncompress file,display content and compress it back.

gzip abcd : produce abcd.gz zip file.
gunzip abcd.gz : again produce abcd
————————————————————————————————————————————————————————
find : examine all file from path_list,maching desired selection criterion and taking some action.
find -mtime -2 -print : find and print all file those are not modified from last two days.
find -atime -2 -print : find and print all file those are not accessed from last two days.

find /home -name -newer file123 : find out all files which is created after creation of file123

find /home -size +2048 -print : find out all file which size are large than 2048.

find /home ( -name ‘*.sh’ -o -name ‘*.pl’) -print : o ‘or’ Operator
find /home ( -name ‘*.sh’ -a -name ‘*.pl’) -print : a ‘and’ Operator

————————————————————————————————————————————————————————

dd : COPYING DISLETTES AND TAPES

dd if=/dev/rdsk of=temp bs=147456 : if=input_file_name, of=output_file_name and bs=block_size

fdformat : formatting floppy diskettes

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

ifconfig : know mac(MEDIA ACCESS CONTROL) address
cat /etc/hosts : display all name-address host mapping
hostname : know your machine information
telnet : connecting to IP address,remote login

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!—PROCESS—!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

echo $$ : showing current Process information
echo $PPID : showing parent process ID
pidof : showing all process information
ps -fx (-fax) : showing all processes parent child relationship
ps -C sleep or pgrep sleep : showing all sleeping process
top : can order the process according the CPU usages and kill process by choossing comannd by K.

kill : to kill or stop process
kill -l : Running all processes can recieve signal from others
kill -1 1 : command forces the init process (init always runs with pid 1) to re-read its configuration file
kill -15 : by default kill
kill -9 : sure kill or force kill , signail send to kernal.
killall : kill all proceesses.
pkill : killing command by process name.

top -p : showing deatail info

renice +8 1670 : increase nice value of process by 8.(nice value can be from 0 to 20)
nice : work same as renice but it is used starting of command.

jobs : display back ground processes.
jobs -p : an interesting option is jobs -p to see the process id of background processes.

fg 3 : fg [job code 3 ]command will bring a background job to the foreground.
bg : Jobs that are suspended in background can be started in background with bg.

————————————————————————————————————————————————————-
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

fdisk -l | grep Disk : device information
fdisk -l /dev/sda : device information for specific hard disk ( all disk info stores in /dev/sdx).
badblocks -ws /dev/sdb : finding out bad block
hdparm /dev/sdb

cat /proc/filesystems : displays a list of supported file systems.

————————————————————————————————————————————————————-
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! SCHEDULING !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

at 22:01 : One time job scheduling with at
at> date
at>
job 1 at Wed Aug 1 22:01:00 2007

atq : easy to check when jobs are scheduled with the atq or at -l commands.

atrm : Jobs in the at queue can be removed with atrm.
at.allow and at.deny : files to manage who can schedule jobs with at.

crontab file

8 14 * * * script42 : run script42 eight minutes after two, every day of the month, every month and every day of the week.
25 0 1 * * script8472 : Run script8472 every month on the first of the month at 25 past midnight.
: #Instead of these five fields, you can also type one of these: @reboot, @yearly or
@annually, @monthly, @weekly, @daily or @midnight, and @hourly.#
crontab -e : Edit the crontab FILE_NAME
crontab -l : Users can display their cron table.
cron.allow/cron.deny : allow to run or deny to run.

————————————————————————————————————————————————————-
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! LOGGING !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

who : Currently logging System.
last : List of last re boots.
lastlog : display list og last logging users.
lastb : failed loging information.

————————————————————————————————————————————————————-
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Memeory Information !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

cat /proc/meminfo : display memory information.
free -om : display memory information in more readable format(in MB).
top : shows processes consuming most of the cpu, also display memeory information by pressing key ‘M’
vmstat : displaying memory information in megabytes

Check the Sybase Wiki @ sybasewiki.com
  1. No comments yet.
  1. No trackbacks yet.