8

I'm a bit amazed that this hasn't been asked by anyone yet, but at a high level, what should every developer know about working with UNIX-based systems?

My *nix experience is very limited, because I have absolutely no reason to use it over Windows for my own purposes, but I have two interviews coming up where the companies ideally want someone with *nix experience. I have no problem becoming acquainted with it if they make an offer I want to take, but it's not worth the investment when the majority of my offers are dealing with Windows systems; hopefully this is understandable.

Which tools should I know about? Any quirks that I should be aware of? Are there any good, concise resources that can be read quickly to get a broad understanding?

5
  • What type of development are you doing? For high level programming, knowing the basic commands on the terminal would be a huge plus, along with perhaps knowing one of the major text editors (vi, emacs). For lower level programming, you need to know more about system calls, system-specific header files, and how threading is handled on a system level. For example, cross-platform C++ has a lot of nuances - I have a system now that compiles on all major OSes except for Solaris.
    – Thomas Owens
    Commented Aug 1, 2011 at 0:06
  • Ah, sorry. I'm mainly interested in lower level programming, but knowing commands is also helpful.
    – rwar
    Commented Aug 1, 2011 at 0:07
  • You may also want to read this: programmers.stackexchange.com/questions/89249/… Commented Aug 1, 2011 at 0:21
  • 1
    Unix, notably Linux/FreeBSD/etc, are cheaper than Windows to run services on. Hence, if you can deliver on Unix as well as Windows, your company is more competitive.
    – user1249
    Commented Aug 1, 2011 at 0:36
  • Even young girls know it youtube.com/watch?v=dFUlAQZB9Ng
    – MattyD
    Commented Aug 1, 2011 at 1:41

4 Answers 4

8

Besides the basics like how to use the command line and so on I think that the fundamental is to understand how the system is structured.

I think the biggest difference when one comes from Windows to Unix is understanding how the system fits together. Windows fits together by the means of it's API and underlying OS components like COM. Although this is often abstracted away from the programmer, one when coding for a long time will know about COM threading model, GDI, and so on. Unix fits in a completely different way. Unix is based on the idea of building small components and building larger systems from them using IPC (often through simple pipes).

You ask for a concise resource and, at least for me, the single starting point to understanding how Unix works as a programming environment is the Kernighan and Pike book Unix Programming Environment. While the book itself feels a little bit dated, it's the perfect example of what is the Unix philosophy and how one can leverage the "Unix way" when coding.

If you at least skim through it's pages, you're going to understand how to use Unix to help you to create better programs. Even if you identify yourself as a Windows guy, the knowledge you will gain from it is more or less universal like design patterns or software engineering practices are.

If want to know more - maybe for your job or maybe just because you liked it - after reading the Unix Programming Environment give Advanced Programming in the UNIX(R) Environment from Stevens a try. It complements the Kernighan and Pike book well and, after both, you will have covered most of what I expect a Unix programmer to know. There's also a Stevens book on network programming, it's also recommended.

Besides Linux, there's two OS worth trying: one is Plan9, which in some ways is a better Unix than Unix, and the other one is OpenBSD. OpenBSD is constructed by a small team so it's very consistent and it's very well documented, so it's fun to poke around it.

5

If an organization is using Unix-like operating systems, all developers should know the basic terminal commands to navigate the file structure, create new files and directories, delete files, command-line build tools, using version control on the command-line, and perhaps basic shell scripting to help automate repetitive tasks. In my opinion, the power of the terminal and availability of command-line tools on Unix-like systems is a huge advantage, coupled with how easy it is to write scripts to automate a number of complex tasks that you might be performing on a regular basis.

There are a number of command-line applications that you might want to familiarize yourself with. Tools such as cat, grep, head, tail, more, and less come in handy for a number of tasks, ranging from searching through files to find text matches, to reading through log files to assist in debugging applications. The ability to use pipes and feed output through these applications is also useful to help you parse through the information that is available.

Knowledge of one of the major text editors (vi or emacs) would also be helpful. Which one you use is a personal opinion, but I would recommend using what your team uses (that way, if you have questions, there will be someone on your team to answer them). In my experiences, a lot of "hardcore" Unix developers prefer these tools to IDEs. Myself, I prefer an IDE (even in a Unix-like environment), but text editors do have their advantages when reading files. Their command-line nature makes it easy to search through files with the tools I mentioned in the last paragraph and then open all matching files within one of these editors.

Beyond the use of the tools provided with the operating system, you'll also want to be aware of differences in libraries. Libraries that make system calls (things involving threading come to mind, as a specific example) will probably be different across operating systems. Makefiles that have flags to compile on a specific architecture or for a specific OS will also potentially introduce problems. Knowing which operating system(s) are used would make this easier - you can find references that address how to implement certain functions within that OS. However, this is something that I would expect you to be able to pick up on-the-job (especially for operating systems that are typically used in enterprise environments and that individuals don't often have access to, such as Solaris).

0
3

The book I used in my UNIX class was Glass and Ables' "UNIX for Programmers and Users". Good solid introduction to system commands, filing and programming tools, system and networking overview and the various shells. Fairly short as well if somewhat expensive new. Comes in a Linux flavor as well.

For more depth: "The Linux Programming Interface". It's no lightweight intro but if ever you needed a reference manual to end all reference manuals on system level programming on *nix family systems, I'd pick this.

1
  • I am about halfway through "The Linux Programming Interface" at the moment. It is a very in-depth read, and the information that it contains is extremely beneficial. It even talks about things that are portable and how portable they are, which is very useful as well. Commented Aug 1, 2011 at 0:56
-1

First of all, I would recommend you installing ubuntu, which is a good starting point, in a partition in your computer. Try to play with it a little bit. Like, watching a video with strange codecs... Then you will probably need to use terminal to run some apt-get install commands, and bang! you're learning how to use a Unix-like system. That's it. Start coding and you will feel the need to learn as you code.

A quick list that comes into mind:

  1. apt-get - how to install packages
  2. top - processes running
  3. ps - list processes , shortcut: ps -fea | grep "process_name"
  4. kill -9 PID - kill a process
  5. sudo cmd - executes command with root permissions
  6. vi file - opens quick editor, google for vi and learn how to use it
  7. gedit - learn how to use it and expand it with plugins (it may very well work like a full featured IDE)
  8. tail -fn500 file - tails a file and prints the last 500 lines, very useful for checking logs
  9. man cmd - man!!! it should have been the first one in the list... Basically you will get all the help you need regarding a command named cmd
  10. learn .sh bash scripts. Google it and add it to your programmer toolkit. One day you're going to use it.
  11. cd folder - navigation
  12. ls - list files in a directory
  13. ll - shorcut to ls -l, list files with details

If you're willing to truly know how an OS works and how Unix-like systems work start by taking a look at minix and reading Tanenbaum's OS book.

7
  • 2
    Of those, apt-get is probably useless and gedit should be familiar to anyone who has used a text editor before. Every Linux distro (and Unix-based OS) has a different install/update tool, and I wouldn't expect a developer to have to maintain the environment as that would be done by IT. Also, you forgot to mention emacs as an alternative to vi - which one you use depends a lot on personal preferences (and, in my opinion, team preferences).
    – Thomas Owens
    Commented Aug 1, 2011 at 0:21
  • 1
    yes! emacs! You should learn how to use it. Well, I'm talking about ubuntu (hence apt-get) here.. And yes, you should learn how to manage your packages.. Otherwise you would get stuck one day trying to fix some dependency and you may need to purge something... You never know.
    – wleao
    Commented Aug 1, 2011 at 0:24
  • I wish I had an IT staff to keep my development environment ready to go every time =/
    – wleao
    Commented Aug 1, 2011 at 0:31
  • Like I said, in any decently-sized corporation, no software engineer should ever be installing software. If something needs to be installed on the system, IT should be handling that.
    – Thomas Owens
    Commented Aug 1, 2011 at 0:32
  • 1
    @Thomas, for development systems involving IT is usually just a waste of time. Production system is quite another matter.
    – user1249
    Commented Aug 1, 2011 at 0:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.