[Ilugc] day to day Doubts..

  • From: girish1729@xxxxxxxxx (Girish Venkatachalam)
  • Date: Tue Sep 19 06:07:13 2006

On Tue, Sep 19, 2006 at 02:09:06AM +0530, raja sekar wrote:
|hi sens
|
|i hav following doubts and problems that have been encountered during the
|course of my proj and regular use.
|
|1.difference between locate and find command.
locate uses a static database updated from cron. I think most linux distros run 
it once a day at nite. which means that unless u update it manually with 
updatedb run as root, u will not find recently deleted or created files.

find works in real time and can be painfully slow since it has lot of work to 
do. so unless u r looking for needles in a haystack find is for u.
|2 in ctime(3) what does 3 in the parentheses signify.
3 is the man page section. this is to avoid confusion in cases where socket(1) 
and socket(2) are two diff things. One is a shell command and another is a 
system call. Read man man to know more about what each section contains. You 
can also do a "man 2 intro" or a "man 3 intro" on a decent linux distro to know 
what each section is supposed to contain. 

Also there are cases where the same program is split into multiple man pages , 
for instance, when i do an "apropos cron", i get several pages and crontab(1) 
and crontab(5) both refer to diff parts of the same program. 
|3.  give a simple sample code that uses to find the time of execution of
|thread (thread created using the pthread.h)
        I wonder why you guys are so hung up with threads. Real UNIX never had 
any threads and never will have. fork() is the way to go. Multi threaded 
programs are buggy and crash often. I know nobody in this list will appreciate 
this fact but this is the truth. 
|4.whenever i boot debian linux the esd starts running automatically and
|gives sound ,for which i goto th e terminal and kill it every time.
|Is there a way to stop this?what config file should ideal with.
My debian doesnt do that. Maybe ur using gnome? ESD is gnome sound daemon. I 
think sound daemons like esd and arts are used for software mixing and other 
cool audio mixing stuff. Never got the time to play with it. 

But I dont know the answer to ur question. sorry.
|
|5)the concept of I-node
Pick up any book on UNIX and u will know the answer. Even google will help. It 
is very simple. It is nothing but the index of a file. In UNIX file systems 
like ffs, ufs, ext*fs etc., files are represented as a doubly linked liston 
disk. And i-nodes are linked list node identifiers. Simple and straight. Of 
course, files mean directories too.
|6)Is there any limit for the number of args that can be passed to the shell
What do u mean passed to shell? Shell is also a userland program like any 
other. It has no special privileges. Generally there is a limit on the buffer 
size of command line arguments enforced by the C compiler or something else. I 
dont know where the limit comes from ,but u cant pass a 1024 char long string 
on the command line. It will cause a buffer overflow.

Number of args purely depends on the program in question. 

RTFM getopt(1).
|7what is the use of sticky bit .
It is a theoretical concept not used much practically. sticky is often used in 
the context of CVS tags. It is used in file permissions to signify something, I 
dont remember, pick up a book and find out. Or RTFM chmod(1) or chattr(1)
|8)give me simple recursion program explaining how the values are viewed thru
|gdb,,using all possible commands such as setting breakpoint,backtrace,step
|over and so on.

I dont use gdb much. I prefer using printf() for debugging. You can set 
breakpoints easily using the command "b <line>" or "b <function>". Very easy to 
use. 

You can use bt or where to backtrace after a crash. Two steps are useful, step 
and next, which is abbreviated as s and n.

Simple recursion program? what do u mean? recursion is a theoretical concept 
not used much in practice. It finds use during directory traversal and other 
such niche areas where recursion is an elegant way to solve problems. Usually 
real life doenst demand much recursion. :-)
|9)The differnce b/w simple bidirectional and cascaded pipe..along with a
|simple code..(some confusion already)
        I dont know what u mean. I know only unidirectional pipe as the man 
page for pipe clearly mentions that pipe is a unidirectional channel for 
communication between related processes.

        I know that perl supports some bidirectional pipe using two pipes,maybe 
u r talking some advanced stuff I dont know. But pipes have always been 
unidirectional. If there are variants, they may be built on top of the basic 
thing, not in exclusion of it.
|10) how to send a message from
|                            i)one linux system to another running linux
|.(provided n/w are all well configured)
        You can use write(1) or talk(1). talk is junk , so ur better off 
running an irc server. Or use mail to send mail bet users. Noadays ppl simply 
use something like yahoo! or jabber even for local chat. Not an ugly solution 
IMHO.
|                            ii)system in windows to linux .
yahoo! seems to be a good idea. If u dont have internet, u can of course do a 
ssh and use linux mechanisms or use one of Windoze clients for the above.
|                     list the package or utility  and steps to follow
|clearly and briefly
|
|11) how to rename some 1000 files in a dir with *.txt to *.htm  (tried mv
|*.txt *.htm --> not working)
yes, move does not work with shell patterns. For good reason, if you were to 
write mv, how would u do it. You have to write a simple script like this.
for i in *
do
 j=`echo $i | cut -d'.' -f1`
 mv $j.txt $j.htm
done
|
|thanks in advance
|regds
|Rajasekar
Wish u all the best in ur UNIX journey!

regards,
Girish
|
|Erger in the field of free and open source..
|_______________________________________________
|To unsubscribe, email ilugc-request@xxxxxxxxxxxxx with 
|"unsubscribe <password> <address>"
|in the subject or body of the message.  
|http://www.ae.iitm.ac.in/mailman/listinfo/ilugc

-- 
Whenever people agree with me I always feel I am wrong.

    - Oscar Wilde

Other related posts: