Translate

Sunday, 2 February 2020

How to Begin Programming on Linux Platform

Unless you’ve been living in a cave for the last decade, you know that Linux has pretty much taken over the enterprise business world. From web servers, frameworks, clouds, containers, AI, and so much more, Linux powers it all.

Because of this, businesses need programmers who can develop both for and on the Linux platform. If you’re not already savvy enough to transition back and forth between macOS or Windows to Linux, it’s time you learned.

But where do you start? How do you begin programming on Linux platform? If you’re already comfortable with one or more programming languages, you already have the hard part taken care of. In fact, programming on Linux isn’t really all that much of a challenge, compared to working with other platforms. Why? The available tools.

With Linux, you have a lot of tools you can work with. And although some of those tools might be command line only, you’re a programmer, so the command line is second nature.

But how do you take this necessary plunge? Let’s dive in and find out.

How to Begin Programming on Linux Platform

First Things First

Before you write, debug, or compile that first program on Linux, you should first read Richard Esplin’s “Advanced Linux Programming”. What this book will do is help you to quickly understand the following concepts:

  • Develop GNU/Linux software that works as expected.
  • Writing more sophisticated programs that take advantage of Linux multiprocessing, multi-threading, interprocess communication, and hardware interaction.
  • Create programs that run faster, more reliably, and more securely.
  • The unique peculiarities of a GNU/Linux system (such as specific limitations, special capabilities, and standard UNIX conventions).

Some of the chapters of what should be considered the Linux programming bible include:

  • Editing with Emacs
  • Compiling with GCC
  • Automating with GNU Make
  • Using the GNU Debugger
  • Interacting with the executing environment
  • Writing and using libraries
  • Looking at and creating processes
  • Signals
  • Process termination

Because there are fundamental differences between the Windows and Linux environments, you should consider this book a must-read, if only to gain a better understanding of how Linux works.

Bash Scripts

Bash scripts are easy-to-write scripts that run from within the Linux shell. These scripts can be written to do just about anything and should be considered one of the first stepping stones for learning to program in Linux.

By creating simple bash scripts, you’ll learn things like:

  • Execution privileges
  • The Linux $PATH
  • How to use variables in Linux
  • Permissions
  • Shell scripting “dialects”
  • File manipulation

Because bash scripts don’t need to be compiled, they are a great place to begin your journey. This is also a good way to start understanding how to problem-solve without having to employ QA services. Because bash scripts aren’t compiled, they are very easy to troubleshoot.

Installing the Tools

Every tool you’ll need is either already installed or can be quickly installed. A good example is a build-essential package, which can be installed on Ubuntu-based Linux distributions. By installing this one package, you’ll wind up with tools like:

  • dpkg-dev – Debian package development tools
  • g++ – GNU C++ compiler
  • gcc – GNU C compiler
  • libc6-dev – GNU C Library
  • make – Utility for direction program compilation

These are, as the name implies, essential tools for building applications on Linux. To install this software on a Ubuntu-based Linux distribution, you only need to issue the command:

sudo apt-get install build-essential -y

Learn an Editor

Although you will find plenty of graphical tools available for developing with Linux, you should consider it a must-do to learn the ins and outs of one of the available editors. Although you could do well with the simplicity of nano, you will probably find a tool like vim or emacs to be better suited to the task of programming on Linux.

And although you might think using a text editor is a simple affair, you would be wrong. In order to get the most out of the vim text editor, you really need to take the time to understand how the tool is used. For example, the simple act of saving a file requires you to hit Escape and then type :wq. That’s right, vim isn’t like Notepad.

In fact, vim is incredibly powerful. The vim editor includes features like:

  • Perform complex tasks with a few quick commands
  • Highly configurable
  • Powerful plugin system, to expand the feature set
  • Multi-window/buffer support
  • Tab support
  • Macro support
  • Syntax highlighting
  • Auto indent

There is no way around learning a solid editor. No matter if you’re programming heavy duty, enterprise-grade software or if you’re working with a software QA outsourcing, you’ll need to know the ins and outs of this tool.

Learn a Widget Toolkit

If you plan on creating GUI applications, you’ll need to learn one (or more) of the Widget toolkits. You’ll be surprised at how many toolkits there are. For example:

  • GTK – used for the GNOME desktop
  • Qt – used by the KDE desktop
  • Tcl – used for web and desktop programming
  • SWT – used with the Java platform.
  • FLTK – cross-platform C++ GUI toolkit.

You will not be creating any graphical applications on Linux without knowing one of the toolkits. Make sure to go through the official documentation for whichever toolkit you decide to work with.

Conclusion

This short list of tips will get you started on your Linux programming journey. Of course, no matter how well of a start you get, you’re going to have to have a solid grasp on the fundamentals of programming first. So before you dive into coding for the open-source community, make sure you know how to write those first lines of code.

The post How to Begin Programming on Linux Platform appeared first on The Crazy Programmer.



No comments:

Post a Comment