What language for starting on Linux? [closed]

Solution 1:

First and foremost: bash, along with the common command line utilities. Bash is the default user interface to the operating system, and a lot of programs on a Linux system will be wrapped in a shell script at some level. It can be quirky, has some idiosyncrasies, and often seems downright dumb, but it's something you will have to deal with, so get comfortable with it. The standard tools like grep, diff, head, tail, sort, uniq, and so on, will be very helpful not only with shell scripting, but with your productivity on the command-line.

Learn at least some c. It's what the lowest levels of the system are written in, and it will give you a better understanding of the system as a whole.

Pick any higher level language you like. Python, ruby, perl, java, whatever - as long as you enjoy it. This is where you really start to learn how to "program", and from here on out it will be easier to pick up more languages, and keep learning.

Solution 2:

You will find that everyone will pretty much just recommend their favorite language. My favorite language is Perl so that's what I recommend. :) However, beyond my personal preference, there are some great reasons why you should consider using perl:

First, perl is a wonderful general-purpose language. It's easy to get started in perl by writing simple scripts to do the same sorts of things you do in shell scripts, like manipulate files and make decisions based on user input. This provides a very easy and gradual introduction to the general ideas of programming. Perl has been around for quite a while so there are lots of resources (books and websites) for getting started.

Second, perl is an incredibly powerful and expressive language that supports all modern programming features. I've been using it for over fifteen years and I'm still learning new ways to do things more efficiently. For example, if you want to explore object oriented programming, perl has that (particularly through Moose).

Third, perl comes with the almost infinite power and flexibility of it's official add-on repository, CPAN. For example, to follow the idea of writing security software, say you want to develop some sort of custom network security scanner. Instead of writing all that yourself, you could start by using NMAP::Scanner as a scanning engine, and then write your own tweaks and improvements on top of that.

Finally, if you want to explore web programming, Perl has that too. One popular modern way to write web software in Perl is Catalyst, which provides a modern MVC web framework for quickly developing any sort of web app.

Putting all that together, the advantage of perl is that it allows you to start small writing little command line scripts and programs, and gradually grow into writing full-featured modern applications. Of course, the price of this flexibility is complexity. It's up to you to study and learn how to do things the right way, perl doesn't enforce good practices the way other languages do. I personally like this freedom, especially coupled with all the great resources out on the web for learning how to use perl.

Solution 3:

Three languages will hold you in good stead. In decreasing order of importance (i.e., the first is the most important):

  1. Pseudocode. Oftentimes, the implementation with which you're working will be an amalgam of a half-dozen languages and tools, only some of which you'll know directly. If you know what pattern is being implemented, however, you can figure out what input is being handed to a piece and what output it should give, test it in exclusion, and figure out whether it's the piece that's breaking.
  2. C. For better or for worse, it's what runs the (Linux) universe, and it gives you a close-enough-to-the-ground view of things that you can understand what any of the higher-level languages are actually doing (e.g. PHP's pass-by-reference, or Java's thread model).
  3. Just About Anything Else except C++. A functional language like SQL or, better yet, Haskell, or something not quite as C-ey—if all else fails, Java can work for this, but it's still very procedural—get high marks here; the idea is to wrap your brain around something sufficiently completely different from what you've done before that you can't help but realize the limitations of what you've done before. In terms of sheer utility, bash probably also belongs in this list, but if you don't have a basis in something else, you'll just end up writing C with bash syntax instead of really exploring its power.

Solution 4:

You should learn several languages. I would suggest starting with Python. It's widely recommended for being easy to learn and for being very useful, lots of excellent self-study materials are available for free, and I gather it's widely used by IT security professionals. Almost every time I see security pros post demonstration code, it's Python.

Solution 5:

I am about to begin a 4 year information security degree at Purdue. The degree does not call for any programming courses.

Am I the only one one to think OMG!!!! at this point?

I also believe it will be important for me to also learn a few programming languages

I would say so. Although you're not really expecting to become a proficient programmer, you probably need the skills required to simulate / recreate attacks and understand how the programming process works. You will also need the skills to analyse data, and extract information from bulk sources (like logs). JimB has mentioned bash - and while you'll no doubt be using this - it only takes around a couple of hours to learn the essential bits. Actualy the only place you're ever likely to see bash is on Linux systems - but the other shells are very similar.

I'd recommend learning awk and/or Perl for data crunching. Don't bother about any requirement to tick an object-oriented box - but I would recommend looking at non-procedural langauges too.

Learning C will also expose you to alot of information about how code turns into an executable program (compiling is just one step in a very complex process).

The obvious choice for someone interested in Android/mobile development would be java - but java tries very hard to insulate the developer from having to deal with the realities of the operating and protocols - its my experience that this is where you get security problems with Java apps. i.e. it might help you achieve your ultimate objective, and it will look nice on your CV but don't expect learning Java to supplement your security knowledge much.