How To Open Source Code In Terminal

Open source software is an important part of what the future of computing looks like, but there are many ways to get that code. The best way to make use of open source software is to contribute your changes back into that project’s development tree. Thankfully, Git provides a fast and easy way to do just that and help further develop many large open source projects such as Linux and Node.js. Here’s how to do it.

Open source is a powerful trend that is taking the IT world by storm. But, sometimes even seasoned techies are at a loss on how to begin. Whatever your level of experience, here’s your introduction to the open source way, with clear step-by-step explanations for varied techniques for getting started. So whether you’re just thinking of giving an open source project a try, or if you’re already an expert in the field, this guide can greatly benefit you. Let’s get Started!

Getting the source code from GitHub

Like many open-source projects, the sources of NodeJS can be found on GitHub: https://github.com/nodejs/node

So, let’s go directly there.

The NodeJS official GitHub repository

If you’re not familiar with GitHubgit or any other version control system worth mentioning the repository contains the current source for the software, as well as a history of all the modifications made through the years to that software. Eventually up to the very first line written for that project. For the developers, keeping that history has many advantages. For us today, the main one is we will be able to get the sources from for the project as they were at any given point in time. More precisely, I will be able to get the sources as they were when the 8.1.1 version I want was released. Even if there were many modifications since then.

Choose the v8.1.1 tag in the NodeJS GitHub repository

On GitHub, you can use the “branch” button to navigate between different versions of the software. “Branch” and “tags” are somewhat related concepts in Git. Basically, the developers create “branch” and “tags” to keep track of important events in the project history, like when they start working on a new feature or when they publish a release. I will not go into the details here, all you need to know is I’m looking for the version tagged “v8.1.1”

The NodeJS GitHub repository as it was at the time the v8.1.1 tag was created

After having chosen on the “v8.1.1” tag, the page is refreshed, the most obvious change being the tag now appears as part of the URL. In addition, you will notice the file change date are different too. The source tree you are now seeing is the one that existed at the time the v8.1.1 tag was created. In some sense, you can think of a version control tool like git as a time travel machine, allowing you to go back and forth into a project history.

NodeJS GitHub repository download as a ZIP button

At this point, we can download the sources of NodeJS 8.1.1. You can’t miss the big blue button suggesting to download the ZIP archive of the project. As for me, I will download and extract the ZIP from the command line for the sake of the explanation. But if you prefer using a GUI tool, don’t hesitate to do that instead:

wget https://github.com/nodejs/node/archive/v8.1.1.zip
unzip v8.1.1.zip
cd node-8.1.1/

Downloading the ZIP archive works great. But if you want to do it “like a pro”, I would suggest using directly the git tool to download the sources. It is not complicated at all— and it will be a nice first contact with a tool you will often encounter:

# first ensure git is installed on your system
sh$ sudo apt-get install git
# Make a shallow clone the NodeJS repository at v8.1.1
sh$ git clone --depth 1 \
              --branch v8.1.1 \
              https://github.com/nodejs/node
sh$ cd node/

By the way, if you have an issue, just consider the first part of this article as a general introduction. Later I have more detailed explanations for Debian- and RedHat-based distributions in order to help you troubleshoot common issues.

Anyway, whenever you downloaded the source using git or as a ZIP archive, you should now have exactly the same source files in the current directory:

sh$ ls
android-configure  BUILDING.md            common.gypi      doc            Makefile   src
AUTHORS            CHANGELOG.md           configure        GOVERNANCE.md  node.gyp   test
benchmark          CODE_OF_CONDUCT.md     CONTRIBUTING.md  lib            node.gypi  tools
BSDmakefile        COLLABORATOR_GUIDE.md  deps             LICENSE        README.md  vcbuild.bat

Vi/Vim Editor

Vim is a powerful command-line based text editor that has enhanced the functionalities of the old Unix Vi text editor. It is one the most popular and widely used text editors among System Administrators and programmers that is why many users often refer to it as a programmer’s editor. It enables syntax highlighting when writing code or editing configuration files.

You can install Vim editor in Linux systems using your default package manager as shown.

$ sudo apt install vim     [On Debian, Ubuntu and Mint]
$ sudo dnf install vim     [On RHEL, CentOS and Fedora]
$ sudo pacman -S vim       [On Arch Linux and Manjaro]
$ sudo zypper install vim  [On OpenSuse]

If you want to see our complete series on vi(m), please refer to the links below:

Vi/Vim Linux Editor

Cool Retro Term

Cool Retro Term

cool-retro-term is a terminal emulator which mimics the look and feel of the old cathode tube screens. It has been designed to be eye-candy, customizable, and reasonably lightweight. It uses the QML port of qtermwidget (Konsole) developed by the same developer. This terminal emulator works under Linux and macOS and requires Qt 5.2 or higher.

Although probably not a lot of people wants to work with such terminal nowadays, it’s pretty damn COOL and deservers to appear in this top. FFS, it just feels like working with a PipBoy or an 80’s terminal, what could be cooler than that? I know you will use this daily.

Understanding the Build System of the program

We usually talk about “compiling the sources”, but the compilation is only one of the phases required to produce a working software from its source. A build system is a set of tool and practices used to automate and articulate those different tasks in order to build entirely the software just by issuing few commands.

If the concept is simple, the reality is somewhat more complicated. Because different projects or programming language may have different requirements. Or because of the programmer’s tastes. Or the supported platforms. Or for historical reason. Or… or.. there is an almost endless list of reasons to choose or create another build system. All that to say there are many different solutions used out there.

NodeJS uses a GNU-style build system, it is a popular choice in the open source community and once again, a good way to start your journey.

Writing and tuning a build system is a pretty complex task, but for the “end user”, GNU-style build systems ease the task by using two tools: configure and make.

The configure file is a project-specific script that will check the destination system configuration and available feature in order to ensure the project can be built, eventually dealing with the specificities of the current platform.

Alacritty

Alacritty

Alacritty is a cross-platform, GPU-accelerated terminal emulator. Alacritty is the fastest terminal emulator in existence. Using the GPU for rendering enables optimizations that simply aren’t possible without it. Alacritty currently supports macOS, Linux, BSD, and Windows. 

Alacritty is a terminal emulator with a strong focus on simplicity and performance. With such a strong focus on performance, included features are carefully considered and you can always expect Alacritty to be blazingly fast. By making sane choices for defaults, Alacritty requires no additional setup. However, it does allow configuration of many aspects of the terminal. The software is considered to be at a beta level of readiness — there are a few missing features and bugs to be fixed, but it is already used by many as a daily driver. Precompiled binaries are available from the GitHub releases page.

Gedit

Gedit is a general-purpose GUI based text editor and is installed by default text editor on Gnome desktop environment. It is simple to use, highly pluggable and a powerful editor with the following features:

  • Support for UTF-8
  • Use of configurable font size and colors
  • Highly customizable syntax highlighting
  • Undo and redo functionalities
  • Reverting of files
  • Remote editing of files
  • Search and replace text
  • Clipboard support functionalities and many more
Gedit Editor
Gedit Editor

You can install Gedit editor in Linux systems using your default package manager as shown.

$ sudo apt install gedit     [On Debian, Ubuntu, and Mint]
$ sudo dnf install gedit     [On RHEL, CentOS and Fedora]
$ sudo pacman -S gedit       [On Arch Linux and Manjaro]
$ sudo zypper install gedit  [On OpenSuse]

Extraterm

Github

Extraterm Terminal Emulator

Extraterm is more than just a terminal emulator. It provides a toolbox for working with your terminal and command line applications. This application features:

  • Supports Linux and macOS, on Windows WSL, CMD, PowerShell and Cygwin
  • xterm compatible
  • Multiple tabs and panes, split and tiled any way you like
  • Show images in the terminal
  • Unicode support
  • Color emoji
  • Keyboard friendly “Command Palette”
  • Configurable key bindings
  • Keyboard based selections
  • Shell integration; can isolate and ‘frame’ command output. (bash, zsh and fish supported)
  • Easy uploads and downloads using the shell integration
  • Command output is editable in place. Multi-cursor editing
  • Previous command output can be used as input for new commands
  • Supports iTerm2 and TextMate themes
  • Text zoom

Conclusion

Open source software is usually distributed with an open-source license. This allows you to see what’s inside and adjust or improve the code as you see fit. Sometimes it’s a “zero-cost” deal, but any work you do will be closely monitored for quality and compliance. Below is a short list of common licences that the Linux kernel uses:

Similar Posts

0 Comments

No Comment.