Sunteți pe pagina 1din 9

Linux

Linux (also known as GNU/Linux) is one of the most prominent examples of free software and
open source development which means that typically all underlying source code can be freely
modified, used, and redistributed by anyone. The name “Linux” comes from the Linux kernel,
started in 1991 by Linus Torvalds.
The system’s utilities and libraries usually come from the GNU operating system (which is why
it is also known as GNU/Linux).
Linux is predominantly known for its use in servers. It is also used as an operating system for a
wide variety of computer hardware, including desktop computers, supercomputers, video game
systems, and embedded devices such as mobile phones and routers.

Design
Linux is a modular Unix-like OS. It derives much of its basic design from principles established
in Unix during the 1970s and 1980s. Linux uses a monolithic kernel which handles process
control, networking, and peripheral and file system access. The device drivers are integrated
directly with the kernel. Much of Linux’s higher - level functionality is provided by seperate
projects which interface with the kernel. The GNU userland is an important part of most Linux
systems, providing the shell and Unix tools which carry out many basic OS tasks. On top of the
kernel, these tools form a Linux system with a GUI that can be used, usually running in the X
Windows System (X).Linux can be controlled by one or more of a text-based command line
interface (CLI), GUI, or through controls on the device itself (like on embedded machines).
Desktop machines have 3 popular user interfaces (UIs): KDE, GNOME, and Xfce. These UIs
run on top of X, which provides network transparency, enabling a graphical application running
on one machine to be displayed and controlled from another (that’s like running a game on your
computer but your friend’s computer can control and see the game from his computer). The
window manager provides a means to control the placement and appearanceof individual
application windows, and interacts with the X window system.
A Linux system usually provides a CLI of some sort through a shell. Linux distros for a server
might only use a CLI and nothing else. Most low-level Linux components use the CLI
exclusively. The CLI is particularly suited for automation of repetitive or delayed tasks, and
provides very simple inter-process communication. A graphical terminal is often used to access
the CLI from a Linux Desktop.
Development
The primary difference between Linux and many other OSs is that the Linux kernel and other
components are free and open source software. Free software projects, although developed in a
collaborative fashion, are often produced independently of each other. A Linux distribution,
commonly called a “distro”, is a project that manages a remote collection of Linux-based software,
and facilitates installation of a Linux OS. Distros include system software and application software in
the form of packages. A distribution is responsible for the default configuration of installed Linux
systems, system security, and more generally integration of the different software packages into a
coherent whole.
Linux is largely driven by its developer and user communities. Some vendors develop and fund their
distros on a volunteer basis. Others maintain a community version of their commercial distros. In
many cities and regions, local associations known as Linux Users Groups (LUGs) promote Linux and
free software. There are also many online communities that seek to provide support to Linux users
and developers. Most distros also have IRC chatrooms or newsgroups for communication. Online
forums are another means for support. Linux distros host mailing lists also.
Most Linux distros support dozens of programming languages. The most common collection of
utilities for building both Linux applications and OS programs is found within the GNU toolchain,
which includes the GNU Compiler Collection (GCC) and the GNU build system. GCC provides
compilers for Ada, C, C++, Java, and Fortran. Most distros also include support for Perl, Ruby,
Python and other dynamic languages. The two main frameworks for developing graphical
applications are those of GNOME and KDE.
As well as those designed for general purpose use on desktops and servers, distros may be
specialized for different purposes including: computer architecture support, embedded systems,
stability, security, localization to a specific region or language, targeting of specific user groups,
support for real-time applications, or commitment to a given desktop environment. Linux runs on a
more diverse range of computer architecture than any other OS.
Although there is a lack of Linux ports for some Mac OS X and Microsoft Windows programs in
domains such as desktop publishing and professional audio, applications roughly equivalent to those
available for OS X and Windows are available for Linux. Most Linux distros have some sort of
program for browsing through a list of free software applications that have already been tested and
configured for the specific distro. There are many free software titles popular on Windows that are
available for Linux the same way there are a growing amount of proprietary software that is being
supported for Linux.

Background:
Linux is based on Unix
♦ Unix Philosophy
♦ Unix commands
♦ Unix standards and conventions
Architecture:

♦ The shell and the window environment are programs


♦ Programs’ only access to hardware is via the kernel
What is Linux?

♦ Linux kernel
Developed by Linus Torvalds
Strictly speaking, ‘Linux’ is just the kernel
♦ Associated utilities
Standard tools found on (nearly) all Linux systems
Many important parts come from the GNU project
i. Free Software Foundation’s project to make a free Unix
ii. Some claim the OS as a whole should be ‘GNU/Linux’
♦ Linux distributions
Kernel plus utilities plus other tools, packaged up for end users
Generally with installation program
Distributors include: Red Hat, Debian, SuSE, Mandrake

Getting Started with Linux


Using a Linux System
♦ Login prompt displayed
o When Linux first loads after booting the computer
o After another user has logged out
♦ Need to enter a username and password
♦ The login prompt may be graphical or simple text
♦ If text, logging in will present a shell
♦ If graphical, logging in will present a desktop
o Some combination of mouse movements and keystrokes will make a terminal
window appear
o A shell runs in the terminal window

Linux Command Line


♦ The shell is where commands are invoked
♦ A command is typed at a shell prompt
o Prompt usually ends in a dollar sign ($)
♦ After typing a command press Enter to invoke it
o The shell will try to obey the command
o Another prompt will appear
♦ Example:

$ date
Sat March 01 11:59:05 BST 2008
$
♦ The dollar represents the prompt in this course, do not type it

2.2.3 Logging Out

♦ To exit from the shell, use the exit command

♦ Pressing Ctrl+D at the shell prompt will also quit the shell

o Quitting all programs should log you out

o If in a text-only single-shell environment, exiting the shell should be sufficient


♦ In a window environment, the window manager should have a log out command for this
purpose
♦ After logging out, a new login prompt should be displayed

Command Syntax
♦ Most commands take parameters
♦ Some commands require them
♦ Parameters are also known as arguments
o For example, echo simply displays its arguments: $ echo

$ echo Hello there Hello there


♦ Commands are case-sensitive
o Usually lower-case $ echo whisper whisper

$ ECHO SHOUT
bash: ECHO: command not found

Files
♦ Data can be stored in a file
♦ Each file has a filename
A label referring to a particular file
Permitted characters include letters, digits, hyphens (-), underscores (_), and
dots (.)
o
Case-sensitive — NewsCrew.mov is a different file from NewScrew.mov
♦ The ls command lists the names of files

Creating Files with cat


♦ There are many ways of creating a file
♦ One of the simplest is with the cat command:
$ cat > shopping_list
Cucumber

Bread

Yoghurts

fish fingers

♦ Note the greater-than sign (>) — this is necessary to create the file
♦ The text typed is written to a file with the specified name
♦ Press Ctrl+D after a line-break to denote the end of the file
o The next shell prompt is displayed
♦ ls demonstrates the existence of the new file
Displaying Files’ Contents with cat
♦ There are many ways of viewing the contents of a file
♦ One of the simplest is with the cat command:
$ cat shopping_list
Cucumber
bread
yoghurts
fish fingers
♦ Note that no greater-than sign is used
♦ The text in the file is displayed immediately:

o Starting on the line after the command

o Before the next shell prompt

Deleting Files with rm


♦ To delete a file, use the rm (‘remove’) command
♦ Simply pass the name of the file to be deleted as an argument:
$ rm shopping_list
♦ The file and its contents are removed
There is no recycle bin
o There is no ‘unrm’ command

♦ The ls command can be used to confirm the deletion

Unix Command Feedback


♦ Typically, successful commands do not give any output
♦ Messages are displayed in the case of errors
♦ The rm command is typical
o If it manages to delete the specified file, it does so silently
o There is no ‘File shopping list has been removed’ message

o But if the command fails for whatever reason, a message is displayed


♦ The silence can be off-putting for beginners
♦ It is standard behavior, and doesn’t take long to get used to

Copying and Renaming Files with cp and mv


♦ To copy the contents of a file into another file, use the cp command:
$ cp CV.pdf old-CV.pdf
♦ To rename a file use the mv (‘move’) command: $ mv commitee_minutes.txt
committee_minutes.txt

o Similar to using cp then rm


♦ For both commands, the existing name is specified as the first argument and the new
name as the second

o If a file with the new name already exists, it is overwritten

Filename Completion
♦ The shell can making typing filenames easier
♦ Once an unambiguous prefix has been typed, pressing Tab will automatically ‘type’ the
rest
♦ For example, after typing this:

$ rm sho
pressing Tab may turn it into this:
$ rm shopping_list
♦ This also works with command names
- For example, da may be completed to date if no other commands start ‘da’

Command History
♦ Often it is desired to repeat a previously-executed command
♦ The shell keeps a command history for this purpose
Use the Up and Down cursor keys to scroll through the list of previous
commands
Press Enter to execute the displayed command
♦ Commands can also be edited before being run
a. Particularly useful for fixing a typo in the previous command
b. The Left and Right cursor keys navigate across a command
c. Extra characters can be typed at any point
d. Backspace deletes characters to the left of the cursor
o Del and Ctrl+D delete characters to the right
 Take care not to log out by holding down Ctrl+D too long

S-ar putea să vă placă și