Confusion with configuration files
Hello.
I'm completely new to linux. Linux configuration files are text files with a lot of strange characters. I really wonder how people (the linux pros) can understand that stuff and be able to edit those configurations and do a lot of fun stuff. My questions are: 1. Is it some kind of scripting language like html that linux uses?? 2. Do i have to learn all those syntax to be able to understand what's in those files, and if i do, will i be learning something that is specific only to linux or is this type of syntax and language used elsewhere than in configuration files for linux? |
The config files that end with .sh, and whose first line of code is:
#!/bin/bash are written in the bash scripting language. Some of these files don't end with .sh; they're just a name, like S10networking. You can learn Bash here. Bash doesn't work on windows; idk about other OS's. Files that end in .cpp, .c and .h are written in a variant of C. Those that end in .py are written in python. As far as programming goes, many find it easier to learn python first, then C; both languages are used on Linux, windows, etc. There are more (Perl, Tcl/Tk) but i know nothing about those. |
Aloha,
1. No. Configuartion files in linux are text files that can be edited in any text editor. 2. Yes you will need to learn and understand what the options in the files are and what they are used for and how they apply to the system you are using. For the most part this is only Linux specific but it can be helpful with other systems that are similiar, BSD, Solaris, et al. Also, I have not seen to many "special" characters in configuartion files. Although what you mean by special may not be what I think it means. Mahalo |
Quote:
Seriously, what do you mean by "strange characters"? What you will see in the typical configuration scripts is the BASH shell language---something you definitely should learn to be really proficient with Linux. The language is all done with the ascii character set---nothing strange there.... Start with the Bash Guide for Beginners---free at http://tldp.org (html is not a scripting language---it's for page layout----totally different world.) |
Hi,
I guess I'm stuck in a file! :) You should look at 'UNIX Tutorial for Beginners'. The 'BASH' guide that was suggested is a must if you plan on scripting. Another good guide would be the 'Advanced Bash-Scripting Guide'. You can also look at the 'Programming' section of the 'Slackware-Links'. More than just SlackwareŽ links! |
Quote:
Maybe comment characters (#, ; ) meaning that the line isn't to be executed, or is just a comment. Beyond those, if you are seeing lots of "strange characters" (and it isn't paranoia or delusions, which are often beyond the scope of LinuxQuestions) then that's difficult to understand. Do you have a strange language or keyboard set-up (strange = using characters not in the normal English set, which may not be strange to you, of course)? Beyond that, maybe you can post a sample so we can see which characters you consider strange, please? |
I'm sorry i confused you all with that 'strange' word. I used it metaphorically to mean that those characters, that are perfectly normal ASCIIs, look strange to me because they do not make sense as to why they are there and the way they are used. That's just what i meant by strange.
But from the replies i guess i am right in thinking that they are part of the BASH SCRIPTING language, am i? Oh btw... I learnt that these scripts are interpreted. What is responsible for interpreting them?? The shell, the kernel or something else??? Thanks for your help so far people ;) |
The bash shell program reads those script lines one at a time and acts on them. Note that some cmds in a script may be internal shell cmds eg 'cd' (see 'man bash'), others are external aka standalone programs eg sed.
You should find these links helpful: http://rute.2038bug.com/index.html.gz http://www.tldp.org/LDP/abs/html/ |
There are different kinds of configuration files/. I'm sure you will find more "strange characters" in the Windows registry.
Often a configuration file will have entries of the form: item=value This type of configuration file is run and the items are variables that the script or program uses. An example of this form is the ifcfg-eth0 config file that configures your NIC device. Code:
BOOTPROTO='dhcp' Another type of config file is similar to the old Windows 3.1 .ini files. An example of this is /etc/samba/smb.conf. Code:
[global] Another common type of config file has items separated by a character such as a colon. Look at the /etc/passwd file for an example. Look at the /etc/sudoers file (sudo less /etc/sudoers). Notice how well commented it is. It also contains examples you might use simply by uncommenting the line. Look also at the comments above the line with "UsePAM yes" line in /etc/ssh/sshd_config. The comments contain full instructions what to do if you want to use Public Key encryption. Also, configuration files often have their own man pages. man 5 passwd man 5 smb.conf man 5 sshd_config |
Hi,
Quote:
The 'BASH' file consists of commands that the shell will perform when executed. The file must have the execute attributes/permission set to allow the script to be executed by the user. For the script to be interpreted by the shell the first line must contain the (sha-bang); '#!/bin/sh'. This indicates to the bash shell it is a script. The '#!/bin/sh' states that the following commands by the head of a script tells your system that this file is a set of commands to be fed/passed to the command interpreter. Some commands are internal shell commands while others are external commands to the shell. You must be certain to provide the complete path to the external commands if the 'PATH' is not setup to indicate or have proper direction to the desired commands. The 'Advanced Bash-Scripting Guide' is a excellent document with good examples that you should read for reference. BASH scripts along with other programs or commands will greatly enhance your system administration abilities. |
sendmail.cf is enough to make anyone run away screaming,
And as for 'sudoers'... have you ever looked at the man page for it? Its one of the rare cases where you're likely to understand the file better without reading the manpage. On the whole though, linux config files are usually pretty simple. (I have a pet hate about the more recent trend to xml based config files though) |
Quote:
The "Art of Unix Programming" by Steven Raymond is available on the web. Chapter 10 deals with configuration files. Steven Raymond shares your aversion for XML configuration files because of the large overhead needed to process them when writing an app and the diversion from being able to use simple text utilities for processing, which Unix/Linux is so famously good at. http://catb.org/~esr/writings/taoup/html/ For very complicated configurations, it can be a plus. Richard "Fyoder" Lyons resisted XML but not prefers processing XML output for results over the grep option. http://nmap.org/book/ I agree with you about the sudoers man page vs the self-documenting configuration file (/etc/sudoers) itself. |
All times are GMT -5. The time now is 10:56 AM. |