Difference: Lecture2:TheLinuxOperatingSystem (1 vs. 5)

Revision 52017-11-03 - uli

Line: 1 to 1
 
META TOPICPARENT name="LectureSlides"

Start Presentation

Slide 1: The Linux Operating System

Line: 111 to 111
  this is what I get:
Changed:
<
<
permissions.png
>
>
ls.png
  The left rwx means that the file owner can

Changed:
<
<
  • read
  • write
  • and execute
>
>
  • Read
  • Write
  • and eXecute
 the file. The middle 3 characters have the same meaning for group members

and the last 3 characters for any user.

Line: 138 to 138
  chmod 655 Makefile (what will be the file permissions after the command?)
Added:
>
>
Changing the eXexute flag in a shell script to make it executable is often done:
 chmod.png

The super user

Line: 234 to 236
  The current working directory is “.”
Changed:
<
<
“..” is the directory one level lower from the current working directory
>
>
“..” is the directory one level up from the current working directory

(goto the parent directory of the current directory)

 

Change Settings

Added:
>
>
settings.png
 

Settings

Added:
>
>
settings-2.png
 

bash scripts

Changed:
<
<
You can collect commands in a script file (e.g. myscript.sh)
>
>
You can collect a sequence of commands in a script file (e.g. myscript.sh)
  The command sh myscript.sh sequentially executes all commands in this file.
Actually bash is a command language with assignments,
Line: 253 to 259
  When making your script file executable by changing the permission
Changed:
<
<
bits you can run it (with the sh prefix) like any other program (how?).
>
>
bits, you can run it like any other program (how?).
 
Changed:
<
<
Have a look at your .profile file a shell script which is executed
>
>
Have a look at your ~/.profile, a shell script which is executed
  when you create a new shell (e.g. when opening a new command window).
Line: 290 to 296
 
META FILEATTACHMENT attachment="chmod.png" attr="" comment="" date="1504712375" name="chmod.png" path="chmod.png" size="27420" user="uli" version="1"
META FILEATTACHMENT attachment="pipe.png" attr="" comment="" date="1504714810" name="pipe.png" path="pipe.png" size="10774" user="uli" version="1"
META FILEATTACHMENT attachment="lecture_2.odp" attr="" comment="" date="1504774625" name="lecture_2.odp" path="lecture_2.odp" size="1075753" user="uli" version="1"
Added:
>
>
META FILEATTACHMENT attachment="ls.png" attr="" comment="" date="1509717285" name="ls.png" path="ls.png" size="16645" user="uli" version="1"
META FILEATTACHMENT attachment="settings.png" attr="" comment="" date="1509719504" name="settings.png" path="settings.png" size="38080" user="uli" version="1"
META FILEATTACHMENT attachment="settings-2.png" attr="" comment="" date="1509719504" name="settings-2.png" path="settings-2.png" size="106096" user="uli" version="1"

Revision 42017-09-11 - uli

Line: 1 to 1
 
META TOPICPARENT name="LectureSlides"

Start Presentation

Slide 1: The Linux Operating System

Changed:
<
<

Lecture 2

Uli Raich

>
>

Lecture 2

Uli Raich

First Semester 2017/2018

 

Starting the Linux System

Revision 32017-09-07 - uli

Line: 1 to 1
 
META TOPICPARENT name="LectureSlides"

Start Presentation

Slide 1: The Linux Operating System

Line: 289 to 289
 
META FILEATTACHMENT attachment="permissions.png" attr="" comment="" date="1504628063" name="permissions.png" path="permissions.png" size="14723" user="uli" version="1"
META FILEATTACHMENT attachment="chmod.png" attr="" comment="" date="1504712375" name="chmod.png" path="chmod.png" size="27420" user="uli" version="1"
META FILEATTACHMENT attachment="pipe.png" attr="" comment="" date="1504714810" name="pipe.png" path="pipe.png" size="10774" user="uli" version="1"
Added:
>
>
META FILEATTACHMENT attachment="lecture_2.odp" attr="" comment="" date="1504774625" name="lecture_2.odp" path="lecture_2.odp" size="1075753" user="uli" version="1"

Revision 22017-09-06 - uli

Line: 1 to 1
 
META TOPICPARENT name="LectureSlides"

Start Presentation

Slide 1: The Linux Operating System

Line: 14 to 14
 

Linux Distributions

Changed:
<
<
Linux comes in many flavors (distributions) which may be different of how they are configured,
their desktop, their software repository, their target user community
>
>
Linux comes in many flavors (distributions) which may be different

in how they are configured, their desktop, their software repository,

their target user community

  beginners, gurus, programmers, desktop, server …
Changed:
<
<
Here are some distributions:
Ubuntu (which we use), Mint, Debian, RedHat, Fedora, Kali...
>
>
Here are some distributions:

Ubuntu (which we use), Mint, Debian, RedHat, Fedora, Kali...

 

Linux versus Windows

Line: 31 to 37
  For certain commercial hardware there are no Linux drivers (caution!)
Changed:
<
<
Writing your own Linux driver is possible but often the manufacturers do not open the
hardware specs (register meaning, initialization procedure…)
which makes this a very tedious job.
>
>
Writing your own Linux driver is possible but often the manufacturers do not

open the hardware specs (register meaning, initialization procedure…)

which makes this a very tedious job.

Programmers mostly use the command line interface something

that is hardly ever used in Windows.

 
Changed:
<
<
Programmers mostly use the command line interface something that is hardly ever used in Windows.
The file system layout on disk is different (ext4 vs ntfs) but there exist drivers on both systems
>
>
The file system layout on disk is different (ext4 vs ntfs)

but there exist drivers on both systems

  reading and writing the others files systems

Linux Command Line

Changed:
<
<
When you start up a terminal window, you start a command shell with it.
We will be using bash
>
>
When you start up a terminal window, you start a command shell with it.

We will be using bash

When you type a command, bash will check if it is a command

 
Changed:
<
<
When you type a command, bash will check if it is a command implemented in bash,
in which case it is executed immediately,
otherwise a new process is created, the command loaded and executed
>
>
implemented in bash, in which case it is executed immediately,


otherwise a new process is created, the command loaded and executed

  After termination of the command the process is removed again.
Changed:
<
<
Either bash waits for termination of the process
or it is run in parallel (“&” after the command)
>
>
Either bash waits for termination of the process

or it is run in parallel (“&” after the command)

  Where are the commands and how many are there?

Most used Linux Commands

Changed:
<
<
Here are a few very frequently used comnmands
>
>
Here are a few very frequently used commands
 
Command Action
ls List directory content
cat, less, more Print content of a text file
Line: 64 to 89
 
vi, nano, emacs, gedit ... Edit a text file
rm, rmdir Remove a file / directory
grep Search for a string in files
Changed:
<
<
Have a look in /bin /usr/bin.

The environment variable PATH tells the system where to look for commands.
The number of commands is unlimited since you can write your own commands
and include them into the system.
>
>
Have a look in /bin /usr/bin.

The environment variable PATH tells the system where to look for commands.

The number of commands is unlimited since you can write your own commands

and include them into the system.

Manual pages

This is a small sample of /usr/sbin binaries.png
Each of these commands has plenty of parameters! How do I remember all this?

Well… you don’t, but there is a man (manual) command where you can find

a description of the parameters.

File permissions and user groups

Typing ls -l (l means long listing format) in one of my directories,

this is what I get:

permissions.png

The left rwx means that the file owner can

  • read
  • write
  • and execute
the file. The middle 3 characters have the same meaning for group members

and the last 3 characters for any user.

Changing file permissions

The chmod command allows the file owner to modify file permissions.

This can be done for

  • u: user who owns the file
  • g: users in the same group
  • a: any user
You may add (+) or remove (-) permissions

Example: chmod a+w Makefile (what does it do?)

You can also give octal values representing the permission bits:

chmod 655 Makefile (what will be the file permissions after the command?)

chmod.png

The super user

As we have seen the owner of a file / directory can do with it whatever he wants

including to refuse access to anybody but himself.

You can modify or destroy your file but you cannot modify system files

or files of other another user if he does not explicitly allow it.

There is one user who has the power to do anything: root: the super user.

Sometimes you may need this power to adapt the system to your needs:

sudo command executes a command with super user privileges.

Be careful when doing this, you have the power to destroy your system!

Adding Software packages


The apt command is a package management to allowing you to

add new software packages

  • remove them
  • upgrade them
  • find out which packages are installed
Software installation and removal can only be done by the super user

Find commands on the system

To find any command click this button

and type a command name in the search box

startButton.png
ubuntuSoft.png

Here you may try to see which software is available on Ubuntu

clicking the Ubuntu Software button

stdin, stdout, stderr

Every program has 3 input/ouput channels associate with it:

stdin: the standard input channel

stdout: the standard output channel

stderr: the error channels

stdin in usually associate with the keyboard

stdout and stderr with the terminal window

from which the application was started.

Any of these may be re-directed with “<” for stdin,

'“>” for stdout and “2>” for stderr

pipes

Unix (and Linux) uses many small programs that can however be

connected to produce more complex commands.

stdout of one command is connected to stdin to another one through a pipe.


Let’s say, I want to know how many instances of bash are running on the system

(with each terminal you get an associated shell)

In this case I can give the command ps ax, which will however print all processes

currently running. If I pipe this output into grep bash

(showing every line containing the string “bash”)

then I have constructed the command I was looking for.

pipe.png

The home directory

Every user has his own home directory into which his personal files are stored.

This also concerns configuration files

Most configuration files are “hidden files” whose file names start with “.” To see these type

ls -a ~ Meaning: show all files in my own home directory.

cd (without parameters) takes you to your home directory

The current working directory is “.”

“..” is the directory one level lower from the current working directory

Change Settings

Settings

bash scripts

You can collect commands in a script file (e.g. myscript.sh)

The command sh myscript.sh sequentially executes all commands in this file.
Actually bash is a command language with assignments,

conditional and loop statements just like any conventional programming language.

When making your script file executable by changing the permission

bits you can run it (with the sh prefix) like any other program (how?).

Have a look at your .profile file a shell script which is executed

when you create a new shell (e.g. when opening a new command window).

Other script files

bash is a command interpreter but it is not the only one

There are other command shells like csh, tcsh …

And there are script base programming languages like python, perl …

Often the first comment in the script file tells the

system which interpreter to use:

#!/bin/sh

#!/bin/python

  -- Uli Raich - 2017-09-05
Line: 75 to 285
 
META FILEATTACHMENT attachment="mainScreen.png" attr="" comment="" date="1504627283" name="mainScreen.png" path="mainScreen.png" size="340586" user="uli" version="1"
META FILEATTACHMENT attachment="startButton.png" attr="" comment="" date="1504627283" name="startButton.png" path="startButton.png" size="5653" user="uli" version="1"
META FILEATTACHMENT attachment="ubuntuSoft.png" attr="" comment="" date="1504628063" name="ubuntuSoft.png" path="ubuntuSoft.png" size="437438" user="uli" version="1"
Changed:
<
<
META FILEATTACHMENT attachment="binaries.png" attr="" comment="" date="1504628062" name="binaries.png" path="binaries.png" size="66948" user="uli" version="1"
>
>
META FILEATTACHMENT attachment="binaries.png" attr="" comment="" date="1504712375" name="binaries.png" path="binaries.png" size="66948" user="uli" version="1"
 
META FILEATTACHMENT attachment="permissions.png" attr="" comment="" date="1504628063" name="permissions.png" path="permissions.png" size="14723" user="uli" version="1"
Added:
>
>
META FILEATTACHMENT attachment="chmod.png" attr="" comment="" date="1504712375" name="chmod.png" path="chmod.png" size="27420" user="uli" version="1"
META FILEATTACHMENT attachment="pipe.png" attr="" comment="" date="1504714810" name="pipe.png" path="pipe.png" size="10774" user="uli" version="1"

Revision 12017-09-05 - uli

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="LectureSlides"

Start Presentation

Slide 1: The Linux Operating System

Lecture 2

Uli Raich

Slide 2: Starting the Linux System

This is how the screen may loop like after some programs have been started

mainScreen.png

Slide 3: Linux Distributions

Linux comes in many flavors (distributions) which may be different of how they are configured,
their desktop, their software repository, their target user community

beginners, gurus, programmers, desktop, server …

Here are some distributions:
Ubuntu (which we use), Mint, Debian, RedHat, Fedora, Kali...

Slide 4: Linux versus Windows

Linux can be downloaded and installed for free

The sources of the OS can be accessed freely

Linux has a window system based on X11 and has most facilities Windows offers

For certain commercial hardware there are no Linux drivers (caution!)

Writing your own Linux driver is possible but often the manufacturers do not open the
hardware specs (register meaning, initialization procedure…)
which makes this a very tedious job.

Programmers mostly use the command line interface something that is hardly ever used in Windows.
The file system layout on disk is different (ext4 vs ntfs) but there exist drivers on both systems

reading and writing the others files systems

Slide 5: Linux Command Line

When you start up a terminal window, you start a command shell with it.
We will be using bash

When you type a command, bash will check if it is a command implemented in bash,
in which case it is executed immediately,
otherwise a new process is created, the command loaded and executed

After termination of the command the process is removed again.

Either bash waits for termination of the process
or it is run in parallel (“&” after the command)

Where are the commands and how many are there?

Slide 6: Most used Linux Commands

Here are a few very frequently used comnmands

Command Action
ls List directory content
cat, less, more Print content of a text file
mkdir Create a directory
cd Change working directory
pwd Print current working directory
echo Print variable
vi, nano, emacs, gedit ... Edit a text file
rm, rmdir Remove a file / directory
grep Search for a string in files
Have a look in /bin /usr/bin.

The environment variable PATH tells the system where to look for commands.
The number of commands is unlimited since you can write your own commands
and include them into the system.

-- Uli Raich - 2017-09-05

Comments

<--/commentPlugin-->

META FILEATTACHMENT attachment="mainScreen.png" attr="" comment="" date="1504627283" name="mainScreen.png" path="mainScreen.png" size="340586" user="uli" version="1"
META FILEATTACHMENT attachment="startButton.png" attr="" comment="" date="1504627283" name="startButton.png" path="startButton.png" size="5653" user="uli" version="1"
META FILEATTACHMENT attachment="ubuntuSoft.png" attr="" comment="" date="1504628063" name="ubuntuSoft.png" path="ubuntuSoft.png" size="437438" user="uli" version="1"
META FILEATTACHMENT attachment="binaries.png" attr="" comment="" date="1504628062" name="binaries.png" path="binaries.png" size="66948" user="uli" version="1"
META FILEATTACHMENT attachment="permissions.png" attr="" comment="" date="1504628063" name="permissions.png" path="permissions.png" size="14723" user="uli" version="1"
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback