From /tech/ Wiki
(Redirected from GNU)
Jump to navigationJump to search

Article rewrite in progress.

Linux is a kernel shipped with billions of computers worldwide. A kernel is the component of an operating system responsible for resource allocation, virtualization, process prioritization, and other important duties. While the kernel is critically important it is not in itself an operating system. The Linux kernel is part of the Android operating system and is therefore shipped with most mobile devices worldwide. Linux also dominates computer servers, embedded devices and appliances. The Linux kernel paired with the GNU userland is sometimes referred to as the GNU/Linux operating system, but more commonly as just Linux. This semantic distinction is subject to an ongoing name dispute.


Richard Stallman, founder of GNU.

The GNU project, started in 1983 by Richard Stallman, has the goal of creating a "complete Unix-compatible software system" composed entirely of free software. Work began in 1984. Later, in 1985, Stallman started the Free Software Foundation and wrote the GNU General Public License (GNU GPL) in 1989. By the early 1990s, many of the programs required in an operating system (such as libraries, compilers, text editors, a shell, and a windowing system) were completed, although low-level elements such as device drivers, daemons, and the kernel were stalled and incomplete.

Linux Kernel

Linus Torvalds

Linus Torvalds has stated that if the GNU kernel had been available at the time (1991), he would not have decided to write his own.

In 1991, while attending the University of Helsinki, Torvalds became curious about operating systems and frustrated by the licensing of MINIX, which at the time limited it to educational use only. He began to work on his own operating system kernel, which eventually became the Linux kernel.

Torvalds began the development of the Linux kernel on MINIX and applications written for MINIX were also used on Linux. Later, Linux matured and further Linux kernel development took place on Linux systems. GNU applications also replaced all MINIX components, because it was advantageous to use the freely available code from the GNU Project with the fledgling operating system; code licensed under the GNU GPL can be reused in other projects as long as they also are released under the same or a compatible license. Torvalds initiated a switch from his original license, which prohibited commercial redistribution, to the GNU GPL. Developers worked to integrate GNU components with the Linux kernel, making a fully functional and free operating system.

Alternative Kernels

Alternative Linux Kernels are variations to, or patch sets for the Linux kernel.

grsecurity Active.png Libre.png

  • grsecurity is an extensive security enhancement to the Linux kernel that defends against a wide range of security threats through intelligent access control, memory corruption-based exploit prevention, and other system hardening that generally requires no additional configuration. It has been actively developed and maintained for the past 13 years. Commercial support for grsecurity is available through Open Source Security, Inc.

linux-ck Active.png Libre.png

  • linux-ck is a package available in the AUR and in the linux-ck repo that allows users to run a kernel/headers setup patched with Con Kolivas' ck1 patchset, including Multiple Queue Skiplist Scheduler. Many Arch Linux users elect to use this package for the BFS' excellent desktop interactivity and responsiveness under any load situation. Additionally, the bfs imparts performance gains beyond interactivity.

linux-libre Active.png Libre.png

  • linux-libre is a alternative kernel that is maintained by GNU. The aim of the project is to remove so-called "binary blobs" from the Linux kernel. While usable for most purposes, it does not include a myriad of firmware nor any binary blobs. It is the default kernel used in Parabola GNU/Linux-libre and Trisquel. Debian makes their own similarly de-blobbed kernel.

linux-clear Active.png Libre.png

  • linux-clear is a highly-optimized kernel made by Intel and used by default in their Clear Linux distribution.


A result of the permissive licensing used by both Linux and GNU is the proliferation of distributions - sometimes shortened to distros.

A distro is an operating system based upon the Linux kernel, built from a software collection. The main differences between distributions are the init system, package manager, desktop environment, and default configurations. Most distros have their own little niche. Some are FSF approved (Trisquel, Parabola), for customization (Arch Linux/Gentoo), for stability (CentOS, Debian), for ease-of-use (Manjaro, Linux Mint), etc. Many people can't decide which to distro to stick with and engage in "distro hopping". Fortunately, there is a solution.

Most distributions are built off those pre-existing. Distros can thus be divided into different "families": Red Hat, Debian, Arch Linux, Gentoo, Slackware are some of the notable families.

When choosing a distro, keep some things in mind. Linux in itself is not about choice, but its variety of distros however are. There are stable and rolling distributions. Some stable distros can be made rolling by selecting the proper repositories and vice versa. Some are semi-rolling, they release snapshots of packages. Stable is best for beginners and rolling is best for developers and advanced users who want the latest and greatest.

Almost every distro can be riced (customized) by setting up the right DE and/or WM.

Name Dispute

There is a dispute as to whether the operating system commonly known as Linux should be called GNU/Linux. GNU/Linux was a term originally created by the Free Software Foundation to refer to the combination of the GNU corelibs and the Linux Kernel, which they argued to form a functioning operating system. The Free Software Foundation recommends the term GNU/Linux because it argues the GNU project was part of a project to develop an operating system, from which the kernel was the last piece to complete (see GNU Hurd). The Free Software Foundation suggests that the inclusion of the term GNU in the operating system’s name would recognize their contribution and their free software ideals ("Free Software as a Social Movement". ZNet.). Richard M. Stallman writes:

Today tens of millions of users are using an operating system that was developed so they could have freedom—but they don't know this, because they think the system is Linux and that it was developed by a student 'just for fun'.

On the opposite side of the argument, Linux supporters argue that the contribution of the Free Software Foundation is minimal (for example, GNU components make up only 8% of Ubuntu). Eric S. Raymond writes:

Some people object that the name "Linux" should be used to refer only to the kernel, not the entire operating system. This claim is a proxy for an underlying territorial dispute; people who insist on the term GNU/Linux want the FSF to get most of the credit for Linux because [Stallman] and friends wrote many of its user-level tools. Neither this theory nor the term GNU/Linux has gained more than minority acceptance.

When Linus Torvalds was asked in the documentary Revolution OS whether the name "GNU/Linux" was justified, he replied:

Well, I think it's justified, but it's justified if you actually make a GNU distribution of Linux ... the same way that I think that "Red Hat Linux" is fine, or "SuSE Linux" or "Debian Linux", because if you actually make your own distribution of Linux, you get to name the thing, but calling Linux in general "GNU Linux" I think is just ridiculous.

Linux proponents also argue that since the operating system is often referred to as Linux by the mainstream media and most users, that it should be used as such, as opposed to GNU/Linux.

Let's learn about Linux

The shell and terminal

Main article: Shell

The shell is a command interpreter. The default shell used in Linux is bash, the Bourne-Again Shell which is derived from the sh shell written by Steven Bourne of Bell Labs for Unix. The terminal is a thoughtless file from which data is read and written to. The term "terminal" has also come to mean the graphical program in which the shell is run, i.e. xterm or st.

To manage multiple user sessions on a single machine, Linux (and UNIX) use what is called a TeleTYpeWriter (TTY) for each user to interface with the kernel. Each tty is handled by its own special device file, located in the directory /dev. It also uses Pseudo Terminal Slave (pts) to handle other types of terminal interface, but this is beyond the scope of this guide.

You may be wondering what the difference between shell and TTY is. Shell is the command interpreter that runs everything you type in, and TTY is the connection that handles the data between Linux and the shell.

A good explanation of the above can be found here.

The shell uses files called stdout, stdin and stderr to handle text input and output to and from programs.

  • stdin - Standard Input - All your typed text input goes into programs through here.
  • stdout - Standard Output - All successful program output goes to here.
  • stderr - Standard Error - All error messages and problem codes go to here.

You should get familiar with man pages, which are essentially the manual, and will display help pages on almost all commands.

$ man command

Where command is replaced with whatever command you want help on. Press q to exit a manual page. Alternatively, most commands will allow you to add --help or just -h on the end to get their own personal help pages. Some commands use another form of documentation called info pages, accessed with the info command. If you just want to know what a command does in a sentence then run:

$ whatis command

Every key pressed sends a character to the terminal and you can send different characters by holding down keys like [Ctrl] or [Alt]. This is how the shell can tell what key is pressed, and thus, allow shortcuts to be defined. Some of the more useful keyboard shortcuts are defined:

  • UpArrow or DownArrow - Scroll through typed commands
  • Shift+PageUp or Shift+PageDown - Scroll up or down through shell output
  • Home or End - Move to the start or end of a line, respectively
  • Tab - Autocomplete a file name, directory name or command name. May require the bash-completion package in some distributions.
  • Ctrl+c - End a running process
  • Ctrl+d - End-Of-File (EOF) character (usually ends a process or signifies the end of input data)
  • Ctrl+z - Send the currently running process to the background
  • Ctrl+l - Clear the screen, same as running the clear command

Common commands

  • pwd - Print Working Directory. Outputs the full path of the current directory.
  • cd - Change Directory. Used to switch to a different directory.
  • ls - List. Lists files and directories in the current directory.
    • ls -a Lists "hidden" files and directories also. Hidden files are preceded with a full stop.
    • ls -l Lists further information about the files, including size, modification date, owner and permissions.
    • ls -t List by modification date, with the most recently modified files at the top.
  • cp - Copy a file
    • cp -r Descend into directories (recursively copy all directory contents).
  • mv - Move or rename a file.
  • rm - Delete a file.
    • rm -r Delete directory contents. (Never rm -r /) Note: this won't work anymore anyway.
  • chmod - Changes file permissions for the Owner, Group and Others, also known as World.
  • chown - Changes the owner of a file.
  • chgrp - Changes the group owner of a file.
  • date - Display or modify current date and time.
  • who - Displays a list of currently logged in users.
  • echo - Prints to stdout.
  • cat - Concatenates text to stdout.
  • grep - Searches for strings in a file or stdin.
  • su - Switch user. Defaults to root.
  • sudo - Similar to su but uses your own password instead. Lets you configure access in /etc/sudoers.
  • passwd - Change password. Defaults to current account.
  • rsync - Synchronizes files and directories. May not be available by default.
  • halt - halt the system
    • halt -p - also shut off the power
  • systemctl - Interface to systemd.
    • systemctl poweroff - Shutdown.
    • systemctl reboot - Reboot.
    • systemctl start service Start a service.
    • systemctl stop service Stop a service.
  • journalctl - Interface to systemd logging.

Some commands alias other commands. For instance ls is commonly aliased to ls -la. You can escape an alias by prepending \ to the command. The type command can reveal aliases. Running type type reveals that type is shell-builtin command. Builtin commands are just what they sound like - they represent part of the shell itself rather than external programs invoked by the shell.

Piping and redirection

Piping takes the stdout of the left program and connects it (i.e. pipes it) into stdin of the right program with the pipe operator.

For example:

  • Count number of words in helloworld.txt
$ cat helloworld.txt 

Redirection directs data in and out of files, i.e.:

  • Redirect stdout to file
$ echo "Hello world" > helloworld.txt
  • Redirect stdout to the end of a file
$ echo "world." >> hello.txt
  • Redirect a file to stdin
$ cat < helloworld.txt

Useful links regarding command-line

  • Linux Command explains the shell, indispensable to users who want to take full advantage of GNU/Linux distributions.
  • Commandlinefu provides a fun experience while offering a lot of useful command-line gems making it a great site to explore and learn more about the command line.

External links

  • Videos