Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Jack H.Integration and automation of manufacturing systems.2001.pdf
Скачиваний:
86
Добавлен:
23.08.2013
Размер:
3.84 Mб
Скачать

page 28

2.Insert a provided floppy disk (you can also boot from a CD on newer computers)

3.Turn the computer on, it will start to load Linux

4.You will be asked some questions about the type of installation you want

5.Linux will format the disks, and start to load the software

6.While it is loading you will be able to set times, dates and passwords

7.You be asked to set up the graphics for the window manager

8.When the installation is done the computer will reboot, and you will be ready to use it

2.2 USING LINUX

This section is a brief overview of the Linux operating system. The intention is to overview the basic components in the operating system. An administrator can manage the operating system using the graphical user interface (GUI), or using typed commands. New users often prefer to use the system using the GUI. Advanced users often prefer to use commands to administer the system, they are often faster and more reliable.

Commands can be typed in a command window. Typed commands are case sensitive, and most commands are lower case. Spaces are used to delimit (separate) commands and arguments, so they should also be used when typing. Linux allows users to perform some very sophisticated operations with a single command. But, while learning this should not pose a problem, unless logged in as root. While learning the user is encouraged to use a normal user account so that accidental damage to the system can be minimized.

2.2.1 Some Terminology

The terms below are some of the keywords that are unique to Linux. These will appear during the installation, or during common usage of the system.

booting When a Linux computer starts it checks the hardware, and then starts software. The process of booting takes less than a minute in most cases

page 29

kernelThe core of the operating system that talks to all hardware and programs shellA windows that allows you to type commands

permissionsControl who can change what

GNU(Gnu’s Not Unix) A group that develops free software comprising a large portion of Linux

rootThis is the user name of the system administrator

2.2.2 File and directories

The directory and file structure of Linux is hierarchical, much like other popular operating systems. The main directory for the system is call root and is indicated with a single slash ‘/’. There are a number of subdirectories listed below that are used for storing system files, user files, temporary files and configuration files. A sample of the standard directories are shown below, and can be viewed with a file manager, or with keyboard commands. If other disks are used, such as a CDROM, or floppy disk, they are mounted under the root directory. (i.e., there are no ‘C’, ‘A’ or other drives, they are all under ‘/’.) (Note: the UNIX slash is ‘/’, not the ‘\’ used on DOS.)

/

home

bin

lib

....etc....

jackh davisa

bin public_html

A list of some of the more important directories follows with a brief description of each. Most users have their home directories under the ’/home’ directory. Most of the other directories are of interest to the system administrator.

/etc - device and software configuration files are kept here /tmp - temporary files are created here

page 30

/home - user directories are kept here

/var - this is a place for log files, mail storage, etc. /usr - software is installed under this directory

/dev - where devices are kept - they are accessed like files /bin - some of the programs are kept in this directory

Every file and directory has a unique name which can be used to refer to it. Sometimes it is

useful to be able to refer to groups of files without typing the name of each one. Wildcard allow

file and directory names to be matched to patterns. The list below shows some of the wildcards

commonly used.

*Any string ?Any Character

..The directory above

.this directory

~your home directory

Some examples of filenames with wildcards, and files they would match are shown below.

Ad*Advertise Advent.not Ad Ad?Ad. Ade

Ad?.?Ade.d

??e.*ape.exe eee.thisisanother

../hi.*hi.there (in directory above) ~/*.therehi.there (in your home directory)

Filenames can contain numbers, letters and a few other symbols, but care should be used to

avoid symbols that also have meaning to Linux, such as the asterisk ’*’. File names that begin

with a period ’.’ are system files that are normally hidden. For example, most users will have a file

in their home directories called ’.profile’ or ’.login’. These are used when a user logs.

Some of the standard Linux commands for files and directories are listed below. Most of the

file and directory names can be used with wildcards.

cd newdir

change directory to ’newdir’

pwd

show present working directory

ls

list the files in the current directory

page 31

ls -la list the files in the current directory in full form ls files list files that match the ’files’

rm files removes the named ’files’

rm * removes all the files in the current directory (use with care)

rm /* removes all of the files in the computer (only do this if you are insane) mkdir namemake a directory ’name’

rmdir nameremove a directory ’name’

mv from tomove a file/directory ’from’ an old name ’to’ a new name cp from to copy a file ’from’ the an old name ’to’ a new name

more file type out the contents of ’file’ on page at a time

cat file

type out the contents of ’file’

vi file

a text editor for ’file’ (some commands given below)

 

‘dd’ - cut a line (command mode)

 

’p’ - paste a line below the current line (command mode)

 

‘x’ - delete a character (command mode)

 

‘r’ - replace a character (command mode)

 

‘R’ - replace a string (command mode -> edit mode)

 

‘a’ - append to a line (command mode -> edit mode)

 

‘i’ - insert a string (command mode -> edit mode)

 

‘:w’ - write to a file (command mode)

 

‘:q’ - quit from a file (command mode)

 

ESC - move from edit to command mode

 

cursor key - move the cursor

du

check the disk usage of the current directory

du ~

check the disk usage of your home directory

df

check total disk space available

sort

this will sort the contents of a file

ln -s to from create a symbolic link ’from’ a name ’to’ a file grep thing filessearch ’files’ for the string ’thing’ compress file compress a ’file’

uncompress file uncompress a ’file’

2.2.3 User accounts and root

Linux follows very strict conventions for file and directory permissions. These require that

each file and directory be given specific permissions for public reading, writing and execution.

Each user is given their own account with a password, so that access to the system is controlled.

Only the root user can access all files and directories on the system. Other users are limited to files

they own, or files that have been marked public. Typically the root user is only used for adminis-

page 32

tration, and normal users use non-root accounts. This generally keeps the system safe from careless damage, and security breaches. Each user has their own home directory, normally in the ‘/ home’ directory. The permissions for files and directories are set so that the user has complete control over that directory.

The permissions for files can be seen by doing a directory listing with ’ls -la’. This will show flags something like ’-rwxrwxrwx jackh user’ for a file that everybody can read ’r’, write ’w’ or execute ’x’. The leftmost ’rxw’ is for the user ’jackh’, the second ’rwx’ is for the group ’user’ and the rightmost ’rwx’ is for everybody on the system. So if the permissions were ’-rwxr--r--’ everybody on the system can read the file, but only the owner can write and execute it.

For security reasons, write permissions for files are normally only allowed for the owner, but read permissions are normally given to all. Execute permissions are normally set for all users when the file can be executed, such as a program. Sometimes more than one user wants to have access to a file, but there are reasons to not permit permission to everybody. In this case a group can be created and given permission to use a file.

Commands that are oriented to users and permissions follow.

passwd user change the password for a user

chmod flags files change the permission ’flags’ for ’files’ chown user files change the owner of ’files’ to ’user’ finger user give information about a ’user’

who look at who is logged into your machine last a list of the last users logged in whoami give your current user name

su - name change to a different user chgrp group files add a ’group’ to a file

Most of the user information is stored in the ’/etc’ directory. For example, user account information is stored in the ’passwd’ file. User passwords are stored in the ’shadow’ file. Group information is stored in the ’groups’ file. It is possible to add users to the system by editing these files, but there are commands that make it easier to update and maintain these files.