LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   2 Questions... (https://www.linuxquestions.org/questions/linux-software-2/2-questions-66057/)

AMDPwred 06-16-2003 09:20 PM

2 Questions...
 
1. Does anyone know where I can go to learn more about how a Linux system works from an architecture point of view? I understand the basic concept of an OS (Command -> System -> Kernel), but I really want to get specifics on the Linux systems.

2. Say I wanted to add my own little function in Linux. Now I'm not really sure where it would need to go, so stay with me here. I'd basically like to be able to say "chris -message" (just like 'man', 'rm', etc) in the command line and get some random message printed out. Instead of writing my own program to do so, I'd like this built into the kernel (again, I'm not sure if it's build into the kernel or command level system).

Any input is very welcome! Thanks. :)

contrasutra 06-16-2003 10:07 PM

Well, for your second question, you can use Bash Aliases.

in your /home/user/.bashrc file (you may have to create it) , add things like:

alias "chris -message"="fortune"

Now whenever you type "chris -message" at a command line, the "fortune" command will be executed. This is just an example.

AMDPwred 06-17-2003 12:15 AM

Not quite what I'm lookin for...

MasterC 06-17-2003 01:01 AM

Could you expand more on what you are looking for then? I started to reply with the above option, but figured you meant something else. But couldn't really figure out what?

Cool

AMDPwred 06-17-2003 01:06 AM

Quote:

Originally posted by MasterC
Could you expand more on what you are looking for then? I started to reply with the above option, but figured you meant something else. But couldn't really figure out what?

Cool

I was going to write a little source file in C that returns a phrase or something (doesn't really matter what) when I type my name in the command line. Just like you can type rm, ls, df, etc, into the command line and do stuff, I want to do the same. I don't know whether I need to add code to the kernel, then recompile it and boot into it. Or do I need to edit the shell code I use, recompile it and so on. That's what I'm trying to figure out.

Does that make better sense?

MasterC 06-17-2003 01:31 AM

Sure. Whatever you call yout binary that you create with C (I'm quite rusty on programming, but I think it's an a.out binary or elf binary right, well whatever you rename a.out to) simply place that in your PATH and call it just like you do with ls and such.

Is that what you mean? If you need help with the code that's a different story, but scripting it to call something would be a piece of cake. ;)

Cool

AMDPwred 06-17-2003 01:35 AM

I know I could do it that way, by just writing a program and adding it to my path. So when I ran the command, the system picked it up.

But, I was hoping to intergrate this into my system from a kernel level or something.

MasterC 06-17-2003 02:06 AM

I'm not really sure I see the point, other than just doing it. ls cp and modprobe aren't kernel level programs. Do you mean to write a daemon? Still wouldn't be too hard, look into xinet.d and inetd.

Possibly look into kernel patches to see if that's what you are talking about.

Cool

AMDPwred 06-17-2003 02:12 AM

There really is no "point". I just wanna fool around I guess. :D

MasterC 06-17-2003 02:15 AM

:D

Sounds cool then ;) I think for an application like that, daemons would be as close as I'd go.

Cool

MasterC 06-17-2003 04:51 AM

http://freshmeat.net/projects/kml/

Would that be something you may be interested in?

:)

Cool


All times are GMT -5. The time now is 01:00 AM.