Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-18-2004, 08:37 AM   #1
LQ Newbie
Registered: Jun 2004
Posts: 1

Rep: Reputation: 0
Exclamation some basic queries..

hi friendzz..i had a set of queries..generally relating to linux and programming in c..

1.shutdown command..
how do i shutdown the computer from the shell prompt using this command..
i tried shutdown all..but it just exited the kde and showed me some other non-graphical inteface..

2.minimal use of root..
i was going through a tutorial on intro of linux..
in that i found this this mentioned several times..that the root account must be used only when u really need it..i normally work on the root only all the time..havent made any special account as such for my daily is that a bad habit really..??

if yes then why is it so..??

3.databases in c..
can i manage databases through c..??
i havent till now found that feature in any of the c if thats a yes where do i find it..??
and if there any other way to interact with databases with c compatibility..??

4.printer port..
is it possible to write a socket program for directly sending data to the printer port..i tried this but found no results..what i did was used 'write' function to a socket which was binded on to the printer port..any suggesstions..

also whatis the port number generally used for prinetrs..yes it is lpt1..but the number is what i am searching...

huhhh..the last one guyzz..

5.accept() function
this function returns a socket which to interact with a connected i want to know the port to which this socket is the the one tro which the listener socke is attached..??

i believe thats much for the day..hope to have my doubts clarified soon..!!

thank you for ur patience

Old 06-18-2004, 08:48 AM   #2
Registered: May 2004
Location: Osaka
Distribution: FreeBSD 5.2, Mandrake 9.2
Posts: 39

Rep: Reputation: 15
i will answer some of your questions:

(1) the following will explicitly turn off your machine
shutdown -h now
(2) you really should make a user account and just issue "su" whenever you need to do some administrative jobs. reason: in case you make something stupid, you won't ruin your system.

(3) sure you can interact with databases using c. but it would be better if you're just using one of those scripting languages like ruby.
Old 06-18-2004, 09:10 AM   #3
LQ Newbie
Registered: Jun 2004
Location: Baroda
Distribution: Fedora Core 1
Posts: 2

Rep: Reputation: 0

1. Use following for shutdown at shell prompt
#shutdown -h now
you can use -h option for halt, -r option for restart. The last option is time of shutdown. NOW indicates immidiate.

You can check other options by following command ( actually for any command help

#shutdown --help
Old 06-18-2004, 01:26 PM   #4
Senior Member
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,284

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
(3) You can manage databases through C. How you do this depends on what database you're using (MySQL is totally different than Posgres is totally different from Oracle etc.). Consult your database's documentation for more details.

(5) You can find out which port the client is using be analysing the struct sockaddr_in that get filled in when accept returns. I don't think there's any way to get other information about the socket itself. What do you need this info for? The OS handles all the different sockets behind the scenes so you don't need to worry about the exact details. If you're going to get heabvily into this you should purchase volume 1 of Unix Netowrk Programming by W. Richard Stevens.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Queries about KDE... mani_iips Linux - Newbie 1 08-05-2005 04:37 AM
snmp queries alaios Linux - Networking 2 05-16-2005 07:06 AM
***Queries for all of u***** LinuxRam Linux - General 6 08-02-2004 02:09 PM
**Basic Queries**** LinuxRam Linux - Newbie 2 07-31-2004 10:58 PM
I'm a BASIC chap, looking for some info on BASIC programming CragStar Programming 2 01-21-2001 10:19 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:36 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration