Operating System - HP-UX
1833356 Members
3180 Online
110051 Solutions
New Discussion

Is C programming neccesary to be UNIX Admin

 
Allen DuBeau
Advisor

Is C programming neccesary to be UNIX Admin

Hi folks -

I am curious to know if you feel C programming is neccessary to be a UNIX Admin? I know shell scripting is (basically, I can read it.. writing becomes a problem)....

And is there any good method to start "re-learning"

also I would like to compliment this forum, out of all the ones a frequent this is by far the best one... I may not post to often but I know I can always find answer here for most of the issues I have come across.

I have learned quite a bit just by reading the post..

and I would like to say Thank You for what I have learned and for what your experiences have taught me, the time it has saved me and even for saving me from support calls...

Sincere Regards,

Allen DuBeau...

P.S -

I wish I had an award to give for best UNIX forum, this one would win hands down!
"I'm not a guru,don't pretend to be,don't wanna be"
20 REPLIES 20
Pete Randall
Outstanding Contributor

Re: Is C programming neccesary to be UNIX Admin

Allen,

I would say it's not necessary. I'm sure it would be a nice skill to have but not absolutely necessary.

And you're right about this forum - it's the best!!!


Pete

Pete
Marvin Strong
Honored Contributor

Re: Is C programming neccesary to be UNIX Admin

Its not required, but it is helpful.

I learned C after I had already been an admin for a few years.
Patrick Wallek
Honored Contributor

Re: Is C programming neccesary to be UNIX Admin

I don't think it is an absolute requirement. I don't do much C coding, BUT I generally can look at C code and figure out what it is doing. If need be, I can usually make modifications if they are minor. I don't know that I could write a C program from scratch though.

As far as shell scripting goes, HP does offer a class or two on POSIX shell scripting. I would start with that if possible. There are numerous online resources for scripting as well.

Geoff Wild
Honored Contributor

Re: Is C programming neccesary to be UNIX Admin

I don't do any C programming at all (some compiling) and have been an Unix Admin for over 11 years now...

Shell scripting and Perl is where you should focus on. Again, this is one of those questions that depends on what you are comfortable with.

As far as learning - either pickup a book and/or take a course. I just finished "Perl Scripting" - online via RAIL:

http://www.hp.com/education/courses/h4311s.html

You get the latest O'rielly "Programming Perl" book when you register.

Rgds...Geoff

Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Mark Grant
Honored Contributor

Re: Is C programming neccesary to be UNIX Admin

As a Unix admin for far too many years and an on and off C programmer for almost as long, I think it's safe to say that C isn't required.

However, learning C gives you an insight into how so much of Unix actually works. It helps you understand some of the gibberish that goes on on the Linux kernel mailing lists too :)

It is a useful string to your bow but it's relevance to administration is far diminished these days.

Scripting is far more useful, especially perl. There are very few systems tasks where perl isn't a first choice over C these days.
Never preceed any demonstration with anything more predictive than "watch this"
Jeroen Peereboom
Honored Contributor

Re: Is C programming neccesary to be UNIX Admin

No, C is not necessary.

You do need to know shell scripting, sh or ksh or posix shell. Read a good book about the shell, especially quoting ;-).

Perl becomes more important. Unfortunately some perl programs are hard to read and perl is a more complete and complex programming language.
I think one needs a training / course to learn perl.

JP.
Allen DuBeau
Advisor

Re: Is C programming neccesary to be UNIX Admin

I read on line the some of the best UNIX admins know C because of the reason stated, you get to understand the workings of the OS better. I also heard that alot of collages that teach programing are making assembler a required course -- I would hate to tackle that one....

I will assign points based on the shell scripting answers and/or suggestions....

How about this question, is it possible to be a very good administrator without being a shell scripting expert?

Thanks again...


"I'm not a guru,don't pretend to be,don't wanna be"
Mark Grant
Honored Contributor

Re: Is C programming neccesary to be UNIX Admin

Allen,

I know some extremely good administrators who wouldn't know a shell script from a packet of mixed nuts. However, they will always be slightly less useful than one who knows scripting. Administration is not just about understanding the OS. You need to maintain environments for applications too. Apps like backup software or some weird app somebody threw on the machine three years ago. Often Scripting is nearly always required to keep these things going. From pre-exec and post-exec backup scripts to funky monitoring solutions, through to converting data from an old app to fit some hair brained new app, scripting makes you more complete.
Never preceed any demonstration with anything more predictive than "watch this"
Hein van den Heuvel
Honored Contributor

Re: Is C programming neccesary to be UNIX Admin


> How about this question, is it possible to be a very good administrator without being a shell scripting expert?

Only if you know PERL very well!

Mind you, supposedly there are lots of good windows administrators out there that never use a script... but I can not live without my commandlines and scripts myself.

The relation C - Perl is not too clear in my mind. On the one hand, knowing C first made it easy for me to work with printf and loop constructs and so on. On the other hand, knowing C you are tempted to _think_ you know perl already but end up writing C program using perl. It is probably better to learn Perl without knowing C, to have an open mind about perl's many feartures and powerful build-ins.

fwiw,
Hein.

Jeff_Traigle
Honored Contributor

Re: Is C programming neccesary to be UNIX Admin

Like everyone else has said... knowing C isn't necessary. The only programming I've ever done with it was in the last semester of my undergrad program 13 years ago. That, and other programming I had to do in college, gave me a foundation to understand code I looked at on the job, but I haven't even done that very much in the past 11 years.

As for shell programming, I'd say it's much more important by far. However, how much you end up having to do it really depends on your environment. Until my current job that I started in January, I probably wrote half a dozen shell scripts in my career. (Not because I didn't know how, but because there weren't a lot of repetative tasks where I was... only a few servers configured for different applications and not much common between them.) In the new job, I've written more than a dozen scripts in four months.

POSIX (or Korn or Bourne since they are all nearly identical) is a must. I'm sure HP's classes are good, but you can learn as much a lot cheaper by buying a book (O'Reilly makes some of the best computer books I've seen) and sit at a system to figure out how to do things you want done or to do exercises. Really depends how you learn best though.

As for perl, it's very powerful and has it's place, but despite some perl-heads' ideas isn't the answer to all scripting situations, IMO. :) I haven't done a lot with it, but got the entire O-Reilly library on perl topics when I was creating a CGI interface that needed to talk to an Oracle database (something you definitely can't do effectively with the other shells) in the previous job. Perl mostly just boggles my mind though when I see it. :)
--
Jeff Traigle
Leif Halvarsson_2
Honored Contributor

Re: Is C programming neccesary to be UNIX Admin

Hi,
You need basic knowledge about shell scripting but not to be an expert. I belive most system administrators don't write much scripts.

Some bacic knowledge about awk will not hurt.

If you want to learn a more advanced tool you should go for perl.

C and C++ is for developers, not for system administrators.
A. Clay Stephenson
Acclaimed Contributor

Re: Is C programming neccesary to be UNIX Admin

Necessary? No. If you were a passenger on a plane would you prefer a pilot who only knows how to fly? Or one who also knows the the systems and which end of a wrench to use? On most flying days, it wouldn't make much difference BUT on one of those other days, I know the one I'd like to have driving my plane.

Probably the biggest advantage for an admin knowing some C is that one is much better equipped to understand the underlying UNIX system calls and what can cause a certain errno value to be set. That is a huge advantage in tracking down obscure problems.
Moreover, UNIX really is the system calls so if you don't know C, you really don't know the system calls. Knowing C gives you a fundamental understanding of what fork()'ing, exec()'ing, and wait()'ing really do as well as understanding signal handlers (traps). This knowledge leads to much better shell and Perl programming as well.

I'll give you one more. Suppose a programmer comes to you and says, the stack is too small. I need it to be 512MB so my program will run? Is this reasonable? Could you ask the questions to find out if this is reasonable? If you were reasonably proficient in C in a UNIX environment, I assure you that you could.






If it ain't broke, I can fix that.
Fred Ruffet
Honored Contributor

Re: Is C programming neccesary to be UNIX Admin

Allen,

C programming is absolutely not requiered. Reading it (even approximatively) really helps. C is extremly used in Unix World, and you will oftenly see C programs.

Shell scripting is IMHO necessary in a certain measure, because you must understand and modify scripts in your everyday life.

Perl is the perfect mix between shell and C. It can be *very* usefull to admins and can been learn really good with the Lama book and the Camel book (from O'reilly, and partially by Larry Wall himself).

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Dave Johnson_1
Super Advisor

Re: Is C programming neccesary to be UNIX Admin

I have been a UA full time for the past 8 years. I learned PERL here at my current job. Some times I use POSIX shell script, sometimes I use PERL. I have only writen one suit of C programs, as a wrapper for RCS to hide the library from the developers, at my current company.

Prior to being a UA I wrote a several million line C application using a couple dozen source files for a modem manufacturer as a test bed for the products.

I can write C no problem, writting shell script and PERL are so much easier I only go to C about once per year to keep in touch with it.

My current challenge is to learn Python. My first hurdle is to get it and the GUI running on my HP system.

Good luck
-Dave
Scott J. Showalter
Frequent Advisor

Re: Is C programming neccesary to be UNIX Admin

C - I've taken classes for it, never used it much.

On the other hand, I use shell scripting, every day. I use the techniques even on the command line. For instance:

Say you have a volume group that has 30 logical volumes in it. You want to unmount the logical volumes and deactivate the volume group.

A SA that canâ t script, might umount the first logical volume, then recall the command, edit the line for the second logical volume, then execute the command. This SA would then repeat the process for all 30 logical volumes. This is a lot of typing, and takes quite a while.

A SA that is familiar with scripting could do the following all from the command line:

for lv in `bdf | grep vgXX | awk '{print $6}'
do
print ${lv}
umount ${lv}
done

Now, you might say what if some of the logical volumes are mounted to mount points that reside within other logical volumes of the same volume group, you would want to make sure that they get unmounted in the correct order. Well, with the above command line script, any LV that is â busyâ will not get unmounted. So, all you have to do is recall the previous command, and execute it again. If there is a file system that is busy because of another reason, then fix that problem and again recall the previous command and execute it.

As you can see, you donâ t even have to type a single mount point in order to get all of the LVâ s unmounted. This method can be accomplished in a matter of seconds. You can then issue the vgchange command.

I normally type something like the above command line script leaving out the umount command. After making sure that the result shows the correct logical volumes, I simply recall the command, press â vâ to edit the command line in vi (another necessity to be familiar with) and insert the umount command in the correct location.

Yes, a SA can do the job without using shell scripting, but that SA will not be
In a world without fences, who needs Gates?
Scott J. Showalter
Frequent Advisor

Re: Is C programming neccesary to be UNIX Admin

I missed a character in the script for the above post, it should read:

for lv in `bdf | grep vgXX | awk '{print $6}'`
do
print ${lv}
umount ${lv}
done



Also the character represented by a " should be a double quotation mark. I didn't realize that it wouldn't show up correctly.
In a world without fences, who needs Gates?
Scott J. Showalter
Frequent Advisor

Re: Is C programming neccesary to be UNIX Admin

OK, I know what's going on now. Dumb microsoft editor that I cut and paste from. Smart Quotes. Anyway, the â  characters are supposed to be the " character. Sorry for the bl
In a world without fences, who needs Gates?
Dani Seely
Valued Contributor

Re: Is C programming neccesary to be UNIX Admin

What makes a good Administrator is getting the job done. If your systems do not have C code on them that you need to manage then DON'T GO THERE! I believe you can get the job done (administrating systems) easier by using shell scripts rather than focusing on C.

Don't get me wrong, C is a GREAT language, however, you can do SO much in shell scripting. Shell scripting is SO much easier and forgiving. I believe that time would be better spent focusing on shell scripting or learning POSIX, PERL, etc.
Together We Stand!
dirk dierickx
Honored Contributor

Re: Is C programming neccesary to be UNIX Admin

I think it depends, most people will get by just fine without the need for C ever. But it can be good to have, and if you use a lot of Open Source Software it is nice to know some C as some things don't compile out of the box.. hue.. tar.gz ;) on HPUX.
But for anybody else, i'd say a good admin just knows Perl or Python (with Perl being the most popular).
rmueller58
Valued Contributor

Re: Is C programming neccesary to be UNIX Admin

Common sense is better and desire goes a lot farther the a programming language.

I've been doing this for 15 yrs, and truthfully, it's much better skill development to had a good grasp of shell programming. the contructs you use in C are helpful but limit your scope. SED, AWK, BASH, SH, KSH, PERL, EXPECT do not require as much effort as C and can generally do anything that might be required. What may take 2 lines of code in a shell might take 20 in C. As an Admin I don't have time to fart with C when I need to get a job done I need it done so I can get on to other things. Programmers are notorious for sucking the budget dry. Leaving little room for hardware and new technologies.

Don't waste your companies money unless you are the developer. Let those code geeks handle it.

IMHO