Geeks Talk

Prepare for your Next Interview




Unix Basic Scripts

This is a discussion on Unix Basic Scripts within the Unix/Linux forums, part of the Operating Systems category; Whats the difference between ll and ls command? Where can i get the set of commands in UNIX? What is a shell? If i am working on UNIX, What do ...


Go Back   Geeks Talk > Operating Systems > Unix/Linux

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 09-18-2007
Expert Member
 
Join Date: Feb 2007
Posts: 1,279
Thanks: 0
Thanked 164 Times in 138 Posts
Geek_Guest is on a distinguished roadGeek_Guest is on a distinguished road
Unix Basic Scripts

Whats the difference between ll and ls command?
Where can i get the set of commands in UNIX?
What is a shell?
If i am working on UNIX, What do i need to know?
Can you tell me some basic scripts in unix?
I know its long but urgent..

Question asked by visitor sameer
Reply With Quote
The Following User Says Thank You to Geek_Guest For This Useful Post:
Sponsored Links
  #2 (permalink)  
Old 09-19-2007
Junior Member
 
Join Date: Sep 2007
Location: chennai
Posts: 10
Thanks: 0
Thanked 1 Time in 1 Post
lakshmananindia is on a distinguished road
Re: Unix Basic Scripts

there is no command called as ll.
ls displays the files in current directory.
if you want set of commands in unix then press tab twice in the terminal.
for in detail about a particular command you can use man command
Reply With Quote
  #3 (permalink)  
Old 12-13-2007
Junior Member
 
Join Date: Dec 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Amit Shiknis is on a distinguished road
Re: Unix Basic Scripts

Hi,

You may refer to unixguide.net for basics of UNIX.

Here is an example of shell script which will show you disk space.

#!/bin/ksh


init()
{

day=`date |tr -s " " "-"|tr -s ":" "."`
lpat=/home/cmabct/vinod
mach=`uname -s`
myn=`uname -n`
mailp=/usr/sbin/sendmail
ids=${lpat}/dsk_ids.txt

logs=${lpat}/LOGS/dsk_${day}.txt
limit=${lpat}/LOGS/tmp_dsk.txt

##############################
#


sub="Subject: Disk Space Status($myn) on $day"
header="Filesystem kbytes used avail %used Mounted on"


if [ ! -d ${lpat}/LOGS ]
then
mkdir -p ${lpat}/LOGS
fi
if [ ! -f $ids ]
then
return 1
fi

>$logs
>$limit
}

cmds()
{
case $mach in
HP-UX) bdf | egrep "9[0-9]%|100%" > $limit;;
SunOS) df -lkF ufs > $logs
df -lkF tmpfs >> $logs
cat $logs | egrep "9[0-9]%|100%" > $limit
mailp=/usr/lib/sendmail;;
Linux) df -h | egrep "9[0-9]%|100%" > $limit;;
*) rm $logs $limit
return 1
esac
}

creatfile()
{
if [ -s $limit ]
then
> $logs
cat $ids >$logs
echo "$sub\n\n">>$logs
echo "$header">>$logs
cat $limit >>$logs
sleep 1
$mailp -t < $logs
else
rm $logs $limit
return 1
fi
}


mast()
{
init
if [ $? -ne 1 ]
then
cmds
fi

if [ $? -ne 1 ]
then
creatfile
fi
if [ $? -ne 1 ]
then
rm $limit
fi
}



Thanks,
Amit Shiknis
Reply With Quote
  #4 (permalink)  
Old 12-13-2007
Junior Member
 
Join Date: Dec 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Amit Shiknis is on a distinguished road
Re: Unix Basic Scripts

Hi,

You may refer to unixguide.net for basics of UNIX.

Here is an example of shell script which will show you disk space.

#!/bin/ksh


init()
{

day=`date |tr -s " " "-"|tr -s ":" "."`
lpat=/home/test/test
mach=`uname -s`
myn=`uname -n`
mailp=/usr/sbin/sendmail
ids=${lpat}/dsk_ids.txt

logs=${lpat}/LOGS/dsk_${day}.txt
limit=${lpat}/LOGS/tmp_dsk.txt

##############################
#


sub="Subject: Disk Space Status($myn) on $day"
header="Filesystem kbytes used avail %used Mounted on"


if [ ! -d ${lpat}/LOGS ]
then
mkdir -p ${lpat}/LOGS
fi
if [ ! -f $ids ]
then
return 1
fi

>$logs
>$limit
}

cmds()
{
case $mach in
HP-UX) bdf | egrep "9[0-9]%|100%" > $limit;;
SunOS) df -lkF ufs > $logs
df -lkF tmpfs >> $logs
cat $logs | egrep "9[0-9]%|100%" > $limit
mailp=/usr/lib/sendmail;;
Linux) df -h | egrep "9[0-9]%|100%" > $limit;;
*) rm $logs $limit
return 1
esac
}

creatfile()
{
if [ -s $limit ]
then
> $logs
cat $ids >$logs
echo "$sub\n\n">>$logs
echo "$header">>$logs
cat $limit >>$logs
sleep 1
$mailp -t < $logs
else
rm $logs $limit
return 1
fi
}


mast()
{
init
if [ $? -ne 1 ]
then
cmds
fi

if [ $? -ne 1 ]
then
creatfile
fi
if [ $? -ne 1 ]
then
rm $limit
fi
}
mast


Thanks,
Amit Shiknis
Reply With Quote
Reply

  Geeks Talk > Operating Systems > Unix/Linux


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
Basic relation between AP,AR, GL and PO Geek_Guest Oracle Apps 3 09-09-2008 03:37 PM
XML in Visual Basic Lokesh M AJAX & XML 0 08-28-2007 09:55 AM
What are all the basic things i should know Geek_Guest Career Advice 1 08-04-2007 02:44 AM
Descriptive Programming and Visual Basic Scripts Geek_Guest QTP 1 07-11-2007 04:24 PM
What is ""developing procedures and scripts (UNIX/Windows/Oracle) spd15 Testing Issues 1 04-04-2007 09:01 AM


All times are GMT -4. The time now is 12:38 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved