Sei sulla pagina 1di 6

Linux Internal and external commands

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.

Dept of CS & Engg Page 1


Linux Internal and external commands

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.

Desktop Linux distributions include a windowing system, such as X11, Mir or


a Wayland implementation, and an accompanying desktop environment such as GNOME or
the KDE Software Compilation; some distributions may also include a less resource-intensive
desktop, such as LXDE or Xfce. Distributions intended to run on servers may omit all
graphical environments from the standard install, and instead include other software to set up
and operate a solution stack such as LAMP. Because Linux is freely redistributable, anyone
may create a distribution for any intended use.

Dept of CS & Engg Page 2


Linux Internal and external commands

Internal and external commands

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:

$ rpm -q bash #on RH

$ dpkg -l bash #on Debian

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

Dept of CS & Engg Page 3


Linux Internal and external commands

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

type is a shell builtin

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:

This command allows you to define commands of

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.

Break Used mostly in shell scripting to break the execution of a loop

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

List the value of variables, either environment-specific or user-declared ones, but


echo
can also display a simple string.

Allows the user to export certain environment variables, so that their values are used
export
to all subsequent commands

Dept of CS & Engg Page 4


Linux Internal and external commands

Fg Resume the execution of a suspended job in the foreground. See also bg.

With no arguments, gives a numbered list of previously issued commands. With


history
arguments, jumps to a certain number in said list.

Send a termination signal by default, or whatever signal is given as an option, to a


Kill
process ID.

Pwd Print working directory

Read Used mostly in scripts, it is used to get input from the user or another program

Used with an expression as an argument, it returns 0 or 1, depending on the


test
evaluation of said expression

Type Indicates what kind of command the argument is taken.

Resources

www. linuxconfig.org

Dept of CS & Engg Page 5


Linux Internal and external commands

Dept of CS & Engg Page 6

Potrebbero piacerti anche