Você está na página 1de 58

Linux programming overview

A driver design approach


Why Linux?
Why Linux?
How to use Linux?
As a host OS in your PC
As a server
What is a shell?
Simply put, the shell is a program that takes
commands from the keyboard and gives them
to the operating system to perform. In the old
days, it was the only user interface available
on a Unix-like system such as Linux.
Nowadays, we have graphical user interfaces
(GUIs)in addition to command line interfaces
(CLIs) such as the shell.
What is a terminal?
It's a program called a terminal emulator. This
is a program that opens a window and lets you
interact with the shell. There are a bunch of
different terminal emulators you can use.
Most Linux distributions supply several
Emuling a Linux terminal
http://bellard.org/jslinux/
Testing the keyboard
Moving though directories: Navigation commands
pwd (print working directory)
cd (change directory)
ls (list files and directories)

pwd command
ls command
ls command with options
A closer look to long formats
cd command
cd command variations
less program
less is a program that lets you view text files.
This is very handy since many of the files used
to control and configure Linux are human
readable.

The less program is invoked by simply typing:
less text_file
This will display the file.

file command
file will examine a file and tell you what kind
of file it is.
To use the file program, just type:
file name_of_file

The file program can recognize most types of
files.

Time to practice
cd into each directory.
Use ls to list the contents of the directory.
If you see an interesting file, use
the file command to determine its contents.
For text files, use less to view them.

A closer look to Linux default directories
A closer look to Linux default directories
A closer look to Linux default directories
Manipulating files
This lesson will introduce you to the following
commands:
cp - copy files and directories
mv - move or rename files and directories
rm - remove files and directories
mkdir - create directories

Wildcards usage
Wildcards usage
cp command
cp command syntax
Copying content to another file:



Copying a file to a different directory:

cp command implementation
mv command syntax
To rename a file:



To move files to a different directory:

mv command and its options
rm command syntax
To remove/delete files:



To remove/delete directories:

rm command and its options
Be careful!
mkdir command
How to create directories:



Using commands with wildcards
Working with commands
This lesson will introduce the following
commands:

type - Display information about command type
which - Locate a command
help - Display reference page for shell builtin
man - Display an on-line command reference

What are commands?
Commands can be one of 4 different kinds:

An executable program like all those files we saw in /usr/bin.
Within this category, programs can be compiled binaries such as
programs written in C and C++, or programs written in scripting
languages such as the shell, Perl, Python, Ruby, etc.
A command built into the shell itself. bash provides a number of
commands internally called shell builtins. The cd command, for
example, is a shell builtin.
A shell function. These are miniature shell scripts incorporated into
the environment. We will cover configuring the environment and
writing shell functions in later lessons, but for now, just be aware
that they exist.
An alias. Commands that you can define yourselves, built from
other commands. This will be covered in a later lesson.

type command

which command

help command

--help command

man command

I/O redirection commands

I/O redirection commands


I/O redirection commands
Filters usage in Linux

echo command for expansion
Activity: Write down the function of each command, after that,
try it in a /bin directory in Linux
The arithmetic expansion usage
The arithmetic expansion examples
The brace expansion usage
The brace expansion examples
Using a combination of commands
Writing a shell script
Writing our first shell script

Actividad: Realizar una pgina web simple
mediante el uso de shell scripts. El contenido
de esta pgina el alumno deber mostrar las
10 personas o cosas que ms importan en su
vida.
Utilizar la mayor cantidad de herramientas
conocidas para html.

Você também pode gostar