Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Introduction
Linux is a Unix-like computer system assembled under the model of free and open-source
software development and distribution. The defining component of Linux is the Linux
kernel, an operating system kernel first released on September 17, 1991 by Linus
Torvalds. The Free Software Foundation uses the name GNU/Linux to describe the operating
system, which has led to some controversy.
Linux was originally developed for personal computers based on the Intel
x86 architecture, but has since been ported to more platforms than any other operating
system. Because of the dominance of Android on smartphones, Linux has the largest installed
base of all general-purpose operating systems. Linux is also the leading operating system
on servers and other big iron systems such as mainframe computers, and is used on 99.6% of
the TOP500 supercomputers. It is used by around 2.3% of desktop
computers. The Chromebook, which runs on Chrome OS, dominates the US K12 education
market and represents nearly 20% of the sub-$300 notebook sales in the US. Linux also runs
on embedded systems devices whose operating system is typically built into
the firmware and is highly tailored to the system. This includes TiVo and
similar DVR devices, network routers, facility automation controls, televisions, video game
consoles and smartwatches. Many smartphones and computers run Android and other Linux
derivatives.
The development of Linux is one of the most prominent examples of free and open-
source software collaboration. The underlying source code may be used, modified and
distributed-commercially or non-commercially-by anyone under the terms of its respective
licenses, such as the GNU General Public License. Typically, Linux is packaged in a form
known as a Linux distribution (or distro for short) for both desktop and server use. Some of
the most popular mainstream Linux distributions are Arch
Linux, CentOS, Debian, Fedora, Gentoo Linux, Linux Mint, Mageia, openSUSE and Ubuntu,
together with commercial distributions such as Red Hat Enterprise Linux and SUSE Linux
Enterprise Server. Distributions include the Linux kernel, supporting utilities and libraries,
many of which are provided by the GNU Project, and usually a large amount of application
software to fulfil the distribution's intended use.
The term "(shell) built-in" when referring to internal commands and perhaps "the rest" for the
external ones. But before we go that far, let's make sure we're on the same page. The shell
we're gonna work with is bash, as it's the most used on Linux distributions. That's not saying
it's the best, but that's a subjective term anyway. I don't know of any popular and still
maintained Linux distribution that uses any version of bash prior to 4.xx, so that's what we
will use too. Regarding the ever-controversial distribution support, LPI seems to focus mainly
on Red Hat and Debian or derivative distributions (e.g. Fedora or Ubuntu), so this is what
we'll support as well. However, at this level at least, the distribution is less relevant: what is
important is an up-to-date shell and distribution.
Please make sure that you have a shell ready, either in a pure console environment or
in a GUI, as our web pages are written with text-only friendliness in mind. Make sure your
shell is bash, and let's start! You can check the shell by typing
$ echo $SHELL
Unless your distribution hides its shell under peculiar locations, the above command
should return /bin/bash . Regarding the version, here's how you can check on Red Hat or
Debian plus derivatives:
Now that we're certain we're running the right version, let's see what internal and
external commands are. The internals (a small number, especially compared to the rest of
them) are the commands that are built in your shell. This is why we deemed important to
check the shell and the version, because other shells may have different built-ins or none at
all. Commands that you will use very often like cd - change directory - are shell built-ins.
Ironically, there is a shell built-in that tells us if a command is a built-in or not. Yes, I know,
sounds a bit crazy, but that's the truth. The command is type and it's usually used with no
options, just the name you want to know about. Observe:
$ type cd
cd is a shell builtin
$ type bash
bash is /usr/bin/bash
$ type type
Now, if you want to see all the built-ins bash offers, you can either check with your
shell's documentation for in-depth explanations that are a bit outside the scope of this
document, or you can read on and get a short description of some of them, as follows:
Alias your own, or replace existing ones. For example, 'alias rm=rm -i' will make rm
interactive so you don't delete any files by mistake.
Change directory. For example, 'cd /usr' will make the current directory be /usr. See
Cd
also pwd.
continu
Used mostly in shell scripting to continue the execution of a loop
e
Allows the user to export certain environment variables, so that their values are used
export
to all subsequent commands
Fg Resume the execution of a suspended job in the foreground. See also bg.
Read Used mostly in scripts, it is used to get input from the user or another program
Resources
www. linuxconfig.org