LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 01-07-2003, 04:26 PM   #16
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58

Actually there are not very many commands that would affect config files. Most commands just read their config files. This is very much dependant on what it is though. Some programs may in fact write to a config file if it's more of a tool used to configure something else. Like XFree's configure tools.

Almost all config files can be, and should be edited by hand for best results ( with exception of sendmail.cf - which can be done if your feeling lucky ).

I normally always configure everything using vi.
 
Old 01-07-2003, 10:44 PM   #17
speck
Member
 
Registered: Nov 2001
Location: US
Distribution: Slackware 14.2
Posts: 342

Rep: Reputation: 83
Dunbar, have you tried to run "strace" on the programs? Running the following will show you the files a program is using:

strace -o /tmp/strace.txt program

where "-o" is the option to store the output in a file.

You can then look at the output trace file "/tmp/strace.txt" and search for the "open" function. The trace output if pretty verbose, so you can run:

grep "^open" /tmp/strace.txt

to remove the unwanted data from the trace info, if you're not interested in anything other than which files are being used. That should list every config file the program is reading from.

Speck
 
Old 01-08-2003, 10:03 AM   #18
dunbar
Member
 
Registered: Dec 2002
Location: Central New Hampster
Distribution: PCLinuxOS 2009.1, UNR 9.04
Posts: 53

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by speck
Dunbar, have you tried to run "strace" on the programs? Running the following will show you the files a program is using:
Umm, this works only for programs that are currently running, yes? If so, consider me as greedy, I want to know every config file, not just the files for programs that are active in any given instant of time. It's pretty hard to use lsof and similar command to get a list of files for a command which has already terminated.

Would grepping C source code for
Code:
*fp= fopen("file", "r");
or
Code:
fopen(fp,"file","r");
do something like what I want (reading file accessing instructions from source code)?
 
Old 01-16-2003, 11:38 AM   #19
dunbar
Member
 
Registered: Dec 2002
Location: Central New Hampster
Distribution: PCLinuxOS 2009.1, UNR 9.04
Posts: 53

Original Poster
Rep: Reputation: 15
Blah.
Any command that reads a config file has to have that information either built into the code (and thus the source code has the filename) or, is passed via environment variables. How else could any command ever know about the file?
 
Old 01-16-2003, 07:43 PM   #20
michaelk
Moderator
 
Registered: Aug 2002
Posts: 15,254

Rep: Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624Reputation: 1624
I agree with you on some points. The more complex OS's and applications become the less written documentation there is and the less helpfull the so called on line documentation becomes.

There have been many of times where it has required looking through several 500 page plus manuals to find some answer.
I have bought lots of books because I found after the fact that another one detailed a particular item better.

Yes you could grep the source code. But it probably will not work on everything. I doubt that all the source code is written by exactly the same methods of documentation and programmers have different techniques. Here is your opportunity to create the ultimate guide.

To answer your question "Where can I on my 'crashed' linux box, find an explanation of 'what comands are affecting what configuration files'?" Probably nowhere.

But then what do you mean by 'crashed'?
 
Old 01-16-2003, 08:13 PM   #21
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
grep for "*.conf" and "*.cf" filename occurences in the source...
 
Old 01-17-2003, 10:50 AM   #22
dunbar
Member
 
Registered: Dec 2002
Location: Central New Hampster
Distribution: PCLinuxOS 2009.1, UNR 9.04
Posts: 53

Original Poster
Rep: Reputation: 15
michaelk: I am presenting the issue facing any and all newbies; postulating that I may have already suffered any and all crashes which are possible. Further assume that the infamous newbie has crashed all of each and every possible {service, command, tool, manager}, etc.

What common search could I make, assuming a lame rescue setup (CD or maybe even floppy)? I am certain that the config files must be named by something, somewhere, aside from simply residing in a directory as a file. When a {service, command, tool, manager} calls for the contents of the config file, it must already know the name (or possibly the name is passed by an environment string, which is simply grepping a few .logins and .*rc files).

I need to get an index of everything, no matter which distro, simply because I cannot trust {man pages, info entries, /usr/doc} to relate the proper locations and names of the actual config files being used by a given distros filesystem.

bulliver:
Quote:
Distribution: RedHat 'psyche' Arch 'dragon' LFS 'no name'
Arch is my current distro; we already know that the /usr/doc files are gone. Do you post over at bbs.archlinux.org? Your solution is elegant; I will be looking forward to testing this!
Is it highly probable to work on other distros which you are aware of???
 
Old 01-17-2003, 04:37 PM   #23
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
will you not be in the same situation figuring out what service is causing said problem?

For instance..

My computer hangs at boot right after I see "Finding module dependencies"

Now how will you know what to grep for config files.
 
Old 01-18-2003, 01:28 AM   #24
moses
Senior Member
 
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152

Rep: Reputation: 48
I'm confused. I don't mean to be rude, but to me this is what it
sounds like you want:
"I want to have all the experiences of every guru written down in
one place so that I can look through there and find the answers I
need."
Well, LQ is gettting there, LDP is getting there, but you must
understand that very little of what any of us know about the
linux OS is from reading, it's from doing and failing. When I need
to find files that concern ssh, I do a
Code:
 locate ssh
.
That'll show that there are a bunch of files is /etc/ssh, and a
bunch in /usr/doc, /usr/bin, /blah/man,etc. I look through those
files and find what I need. If I need a config file, I look for
something that is obvously a config file (/etc/ssh/ssh_config,
/etc/ssh/sshd_config). If I want to know how to set up an
apache server, I'll do a
Code:
 locate apache
.
Ok, so there's an /etc/apache directory. Maybe /etc is a good place to
look for config files. Next time I'll do a faster command:
Code:
 
find /etc -name \*cron\*
.
Look, there are config files concening cron in /etc too. Ok,
maybe I don't find what I need in there. Back to
Code:
locate cron
.
I'm really not trying to be rude, but the truth is that there is no
such +5 Tome of Holy Documentation. Look for the files (on your
system) that are at all related (locate, man -k topic), and
you're pretty likely to find what you need. If you don't, it's time
to google, if that doesn't work, it's time to ask someone who might
know, which brings you to LQ or LDP, or whereever. You
simply cannot expect to be able to just absorb by osmosis all the
knowledge that so many people spend years learning, and they
simply can't write it down. They don't always remember what
was difficult, and you don't know which questions you have until
you've tried a few different things.

Last edited by moses; 01-18-2003 at 01:30 AM.
 
Old 01-18-2003, 07:21 AM   #25
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
Quote:
Do you post over at bbs.archlinux.org? Your solution is elegant; I will be looking forward to testing this! Is it highly probable to work on other distros which you are aware of???
No I don't post there, allthough I registered. To be honest I have not had a problem with Arch that I couldn't figure out on my own. Either good luck, or perhaps good distro?

I am certainly not a programmer or anything, but it seems to me if a program is going to read/write a file there must be some reference to it in the source right? So grep the source for extensions which typically indicate config files ie: .conf,.cf,rc,config etc...

It was just a thought, I have no idea if it will work, but if it does I can assure you it will work on any distro.
 
Old 01-21-2003, 01:48 PM   #26
dunbar
Member
 
Registered: Dec 2002
Location: Central New Hampster
Distribution: PCLinuxOS 2009.1, UNR 9.04
Posts: 53

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by moses
I'm confused. I don't mean to be rude, but to me this is what it sounds like you want: "I want to have all the experiences of every guru written down in one place so that I can look through there and find the answers I need."
I'm lost - you are referring to whom? Please use the little button on the lower left of each posted message - the button which says 'quote'.

I'll assume you intended to chastise my posts.
Quote:
Well, LQ is gettting there, LDP is getting there, but you must understand that very little of what any of us know about the linux OS is from reading, it's from doing and failing.
Hello? Are you still at the level of Linux newbie, the level where you just crashed your box, and since you've been lobotomized by Microsoft and just left it behind, you do not know anything about the structure? Does a newbie know where all the config files are stored AND know what program created them? Grep is an elegant solution, IMO, if it works, because the desire is for nothing to evade its answers and with the correct syntax, grep might also spew things like bash reads config data from /etc/rc.local and ~.bashrc Glad you offered to help that goal :-\.
Quote:
When I need to find files that concern ssh, I do a
Code:
 locate ssh
.
Locate needs a functional OS, with an existing database which is already made prior to the crash. Not going to work unless they have a 90% functional system. XFree is only the last 10%, I'm postulating having blown away lilo.conf or XFconf.
Quote:
(/etc/ssh/ssh_config, /etc/ssh/sshd_config).
Raises the concept of "do all distros everywhere use only *config as a string".... not everything, from what I just read.
Quote:
find /etc -name \*cron\*[/code]. Look, there are config files concening cron in /etc too.
...same issues: this is not a newbie item because they must already know which file created the problem, which many newbies do not.
Quote:
I'm really not trying to be rude, but the truth is that there is no such +5 Tome of Holy Documentation.
Hence the concept of grepping sourcecode for commands which open and read and write configuration files, discern whatever they are called and spit out the answer; the souce has to have commands to open the files. ("+5 Tome of Holy Documentation"? Why mention Moriah? I do not play that game on this box...)
Quote:
Look for the files (on your system) that are at all related (locate, man -k topic),
Several times I have tried Debian Woody, on several platforms, and each time, I find that man -k does not work. I tried 'man -k ls', got the usual failure response, then I tried man ls and got the man page. Something didn't build the apropos database prior to me issuing the man -k command, and thus this is a non answer for a know nothing newbie.
Quote:
If you don't, it's time to google, if that doesn't work, it's time to ask someone who might know, which brings you to LQ or LDP, or whereever.
On a linux box which cannot surf because the man pages do not explain how to set up ppp? Exactly how far are you into your masters degree?
Quote:
You simply cannot expect to be able to just absorb by osmosis all the knowledge that so many people spend years learning, and they simply can't write it down. They don't always remember what was difficult, and you don't know which questions you have until you've tried a few different things.
You must have started your career with a degree, because you think as if each failure was already familiar to you, in the sense that you already know what cron does, what ssh does, etc. Step away from the keyboard, you are not helpful when you persist in that line of reasoning.

At this point, I have learned the following:

1] *fp= fopen("file", "r")
2] fopen(fp,"file","r")
and
3] grep for "*.conf" and "*.cf" filename occurences in the source.


Someone who has no idea of which configuration file to edit will get a lot further with the above 3 items than your piecemeal approach of 'learn which command' then 'man each command', because, as the thread opened up, I explained that the man pages failed to include a files section, my distro fails to include a /usr/doc section and some distros fail to build the apropos database.
Add in the concept that lilo.conf and configurations for ppp/ethernet can be trashed without the user knowing what caused the error (Mandrake wizards do not tell you the name of the file being edited, thus users rely on Mandrake to have the GUI tool to fix the problem), and now you have a recipe for one frustrated newbie. I repeat, go soak your heads, if this man -k and google stuff is the best you can come up with.

Lets revisit the issue, with a summary:
Assume the following: I am booting from a rescue floppy/CD. Doing so BECAUSE I cannot get into my Linux box any other way. I am not sure of the config file name, I can type a bit at the command line, I want as much of my problem answered as I can achieve. Man pages are off line or have no apropos database, I'm not in a GUI. What can I do, at a commandline, to get a listing of files that are user configurations for the OS?

EDIT:
moses: try reading this for a better idea of why you provided nothing useful to me.
/EDIT

EDIT:
corrected spellnig rerors and grammar
/EDIT

Last edited by dunbar; 01-23-2003 at 07:28 AM.
 
  


Reply


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
C++ man pages Guest1234 Ubuntu 0 05-11-2005 03:45 AM
What do you mean by MAN pages? inspectreo Linux - Newbie 2 05-08-2005 03:12 PM
Looking for man ppp-on and info ppp-on pages. rvijay Linux - General 1 02-26-2005 09:49 PM
howto access man and info pages? SciYro Programming 5 07-23-2004 12:21 PM
How to quit man (less) and keep man info on screen? peb Linux - Newbie 7 03-25-2004 11:02 PM


All times are GMT -5. The time now is 05:28 AM.

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