Professional Documents
Culture Documents
Linux Full
Linux Full
Linux Full
Linux Full
S4 BCA A LINUX MI
Unit-1 - Overview of Linux: What is Linux, Linux‘s root in Unix, Common Linux Features, advantage of
Linux, Overview of UNIX and Linux architectures, Linux files system, hardware requirements for Linux,
Linux standard directories. Commands for files and directories cd, ls, cp, rm, mkdir, rmdir, pwd, file, more,
less, Creating and viewing files using cat, file comparisons.
History of Linux
In 1969, Ken Thompson and Dennis Ritchie developed a small, general-purpose operating system written
in Assembly Language called UNIX.
In 1973, Ken Thompson and Dennis Ritchie rewrote the UNIX operating system in C.
Many vendors, such as Sun, IBM, and Hewlett-Packard, purchased the source code of UNIX and
developed their own version of UNIX. The source code of these versions was not freely available, so
the developers had to wait for a long time for the release of bug fixes.
In 1984, Richard Stallman's Free Software Foundation (FSF) began the GNU (gnu's Not UNIX)
project to create a free version of the UNIX operating system. The FSF built a number of tools that
could be freely used, read, modified, and redistributed but the kernel was still not created.
In 1991, Linus Torvalds developed a kernel and called it Linux.
In 1992, the Linux kernel was combined with the incomplete GNU system to form a completely free
operating system. This operating system is called GNU/Linux because it is a combination of GNU
and Linux. The GNU/Linux operating system is commonly referred to as the Linux operating
system.
Distributors of Linux
There are several distributors of Linux. All the distributors use the Linux kernel.
Some of the distributors of Linux are:
Red Hat
Ubuntu
Caldera
Mandrake
Debian
SuSE,
Slackware
1 GG
S4 BCA A LINUX MI
Official mascot
Tux is a penguin character and the official brand character of the Linux kernel. Tux is the most commonly
used icon for Linux, although different Linux distributions depict Tux in various styles.
2 GG
S4 BCA A LINUX MI
6. Portability: Portability means software can works on different types of hardware in same way. Linux
kernel and application programs support their installation on any kind of hardware platform.
7. Hierarchical File System: Linux provides a standard file structure in which system files/ user files
are arranged.
8. Shell: Linux provides a special interpreter program which can be used to execute commands of the
operating system.
9. Security: Linux provides user security using authentication features like password protection/
controlled access to specific files/ encryption of data.
10. Free to use (Low Cost): Linux is freely available on the web to download and use. We do not need to
buy the license for it as Linux and many of its software come with GNU General Public License.
11. Software Updates: In Linux you encounter a larger number of software updates. These software
updates are much faster than updates in any other operating system. Updates in Linux can be done
easily without facing any major issue or concern.
12. Customization: You can customize any feature, add or delete any feature according to your need as
it is an open source operating system.
13. Various Distributions: There are many distributions available also called bistros of Linux. It provides
various choices or flavors to the users. You can select any distributor according to your needs.
14. Support for application development: Offers an excellent platform for many development languages,
such as C, C++, JAVA, Python, PHP, and Perl.
15. Graphical User Interface (GUI): Is a user interface that helps the users to interact with the computer
easily. The GUI of Linux is X Window system. The X Window system consists of two subsystems:
server and client. Linux has a number of GUIs called Desktop Environments, such as K Desktop
Environment (KDE) and GNU Object Model Environment (GNOME).
3 GG
S4 BCA A LINUX MI
1. Boot Block: This represents the beginning of the file system. It contains a program called 'bootstrap
loader ‘which is executed when we 'boot' our machine. Although only one boot block is needed to
start up the system, all file systems contain one (possibly empty) boot block.
2. Super Block: The super block describes the state of the file system - how large it is, how many files
it can accommodate, It contains information like:
3. Inode Table- The information related to all these files (not the contents) is stored in an Inode Table
on the disk. For each file, there is an inode entry in the table. These details are:
Owner of the file
Group to which the owner belongs
Type of file
File access permissions
Date and time of last access
4. Data Block- These contain the actual file contents. An allocated data block can belong to only one
file in the file system.
Linux Directory Structure/Linux Standard Directories
The Linux file system looks like a tree.
The file system begins with a directory known as root. The root directory is denoted as slash(/). All
files and directories are logically contained inside the root directory.
The root Directory is subdivided into subdirectories like Bin, Boot ,home ,usr, etc, dev etc
.
4 GG
S4 BCA A LINUX MI
1. /bin: Bin directory stores many utilities available in linux. These utilities are commands in the Linux
operating system Many Linux commands, such as cat, cp, ls, more, and tar, are locate in /bin
2. /home: Home directory is the parent to the home directories of users which contains the home
directories of all the users.
3. /dev: contains all device files. Linux treats each device as a special file. All such files are located in
/dev.
4. /lib: Lib directory contains data libraries for the compilers, such as C Language routine installed in
the Linux OS.
5. /usr: Stores the operating system files that are not required during the startup process
6. /boot: contains the Linux kernel and other files.
7. /etc : Contains the data related to the operating system, including the essential operating system
programs and configuration files
ARCHITECTURE OF LINUX
1. Kernel
2. Shell
3. Utilities and application programs
1. Kernel
Kernel is the core of the Linux operating system.
It provides services for all other components of the operating system.
Kernel controls the resources of a computer by allocating them to different Linux users and tasks
It interacts directly with the hardware.
5 GG
S4 BCA A LINUX MI
The kernel forms an interface between the user and the hardware.
Linux Kernel performs: I/O management, process management, device & file management and
memory management.
2. Shell
Shell is a user interface that helps a user to interact with the Linux operating system.
Shell provides services requested by Linux users, such as viewing a file and creating or removing a
directory or a file.
It hides the complex hardware details from the Linux users.
Shell is used as a Command Line Interpreter (CLI) to run commands and programs.
Acts as a mediator between kernel and the user
3. System Utilities
The utilities in Linux are collections of programs that provide day-to-day processing requirements,
such as searching a word in a file and viewing access permissions of files.
These programs are invoked through the shell of the Linux operating system.
6 GG
S4 BCA A LINUX MI
pwd
/home/student/D1
Here the user are currently in the Directory D1
2. CD
The cd Command. The cd command is used to change the current directory (i.e., the directory in
which the user is currently working)
CD [directory] to move inside a subdirectory
CD / This command is used to change directory to the root directory, the
root directory is the first directory in your file system hierarchy.
CD Dir1/Dir2/Dir3 This Command is used to Change the directory to Dir3 by giving the
relative path Name
CD This command is used to change directory to the home directory.
CD .. This command is used to move to the parent directory of current
directory or the directory one level up from the current directory.
3. MKDIR
MKDIR command in Linux allows the user to create directories (also referred to as folders in some
operating systems).
mkdir BCAS4 The mkdir command creates a directory called ‘BCAS4’.
mkdir –p ABC/XYZ/PQR The option –p allows you to create multiple generations
of directories. If the ABC and XYZ Directories not
exists it will be created and inside XYZ , PQR is
created.
4. RMDIR
rmdir command is used remove empty directories from the file system in Linux. The rmdir
command removes each and every directory specified in the command line only if these directories
are empty. So if the specified directory has some directories or files in it then this cannot be removed
by rmdir command.
rmdir BCAS4 The rmdir command removes a directory called ‘BCAS4’.
rmdir –p ABC/XYZ/PQR This will first remove the child directory and then
remove the parent directory.
7 GG
S4 BCA A LINUX MI
rm -r DIR1 To remove non-empty directories and all the files within them, use
the rm command with the-r (recursive) option
5. RM
To remove (or delete) a file in Linux from the command line, use either the rm (remove)
rm filename To Remove File1
rm filename1 filename2 filename3 To Remove Multiple Files
rm *.pdf To Remove all the PDF Files
6. CP
To copy the contents of one file to another one use the following method. If destination file
doesn’t exist it will be created. If it exists Linux will over write the contents of destination file.
cp F1 F2 To Copy the Contents of File F1 to F2
cp F1 F2 Dir1 To Copy the Files F1 and F2 to the Directory Dir1
cp ABC/XYZ/F1 DIR1/F2 Here F1 is copied from the directory ABC/XYZ to the
Directory DIR1. The New Name is F2 for the File.
7. MV
mv is for moving a file.mv stands for move. mv is used to move one or more files or directories from
one place to It has two distinct functions:
(i) It rename a file or folder.
(ii) It moves group of files to different directory.
mv F1 F2 To Rename the File F1 to F2
mv Dir1 Dir2 To Rename the Directory D1 to D2
mv F1 F2 Dir1 To move the Files F1 and F2 to the directory Dir1
8. FILE
File command is used to determine the type of a file.
File F1 To display the type of File F1
File * To Display all the files type in the current directory
File Dir1/* To Display all the files type in the Dir1 directory
8 GG
S4 BCA A LINUX MI
9. MORE
More command is used to view the text files in the command prompt, displaying one screen at a time
in case the file is large (For example log files). The more command also allows the user do scroll up
and down through the page.
More command pauses when the screen fills and waits for pressing a spacebar key before it moves to
another screen full of text. A message at the bottom of the screen tells us the percentage of file that
has been displayed so far. We can press Ctrl-C to quit more command before reaching the end of
file.
More F1
10. LESS
The less command works like more except that it moves both forward and backward in the file while
the command is running. We can use the B key on your keyboard to back up one screen or a
spacebar to move forward and display the next screen. Less command is faster than more command
because it does not load the entire file at once and allows navigation though file.
Less F1
11. LS
List all the directories, or list the contents of the current or specified directory.
Ls To display the contents of the current directory
Ls –a To display hidden files in the current directory
ls p* List all files starting with p followed by any other character
ls ?ain List all files starting with any character but ends with ‘ain’
ls /mydir/*x List all files in directory ‘mydir’ which end in ‘x’
ls [aeiou]* List the files with the first character can be either a,e,i,o,u and
the remaining can be any other letter.
ls [!aeiou]* List the files with the first character not being a,e,i,o,u and the
remaining can be any other letter
ls [a-m][c-z][4-9] ?? List all 5 character file names whose first character in range a-
m 2nd character in the range c-z, 3rd character in the range 4 to
9and 4th and 5th are any valid characters.
9 GG
S4 BCA A LINUX MI
Cat>F1 Creates a File F1 and allows us to add some contents to the file
F1. Use Ctrl+d to indicate the EOF
Cat F1 To Display the Contents of F1
Cat<F1 To Display the Contents of F1
Cat F1 F2 To Display the Contents of F1 and F2
Cat>>F1 To append the contents of File F1(old +New Contents)
Cat F1 > F2 To create a New File F2 with the content of F1
Cat F1 F2 > F3 To create a New File F3 with the content of F1 and F2
Cat F1 F2 >> F3 To append the contents of F3 with the contents of F1 and F2
FILE COMPARISONS
1. Diff Command
The Linux diff command analyses a file line by line and gives an output of a list of changes made between
two files. The command diff is short for difference, which in essence gives the differences between two
files.
Diff Command Output Symbols
The less than symbol indicates lines from the first line
The greater than symbol indicates lines from the second line
a - Denotes that text was added to the file
c - Denotes that changes were made in the file
d - Indicates that the line was deleted
10 GG
S4 BCA A LINUX MI
Case A: Change
The 2,3c2,3 line implies that lines 2 and 3 from the first file need to be changed in order to match lines 2
and 3 from the second text file.
Case B: Add
[student@localhost p1]$ cat F1 [student@localhost p1]$ cat F2
RED RED
BLUE GREEN
BLUE
1a2
> GREEN
11 GG
S4 BCA A LINUX MI
From the output above, 1a2 implies that after line 1 from the first file, another line needs to be added to
match line 2 from the second file.
Case C: Delete
RED RED
GREEN GREEN
BLUE
3d2
< BLUE
Here the output 3d2 means that delete the 3rd line from the first file to sync up with the second file at line
number 2.
2. Comm Command
Comm compare two sorted files line by line and produce three-column output. Column one contains lines
unique to FILE1, column two contains lines unique to FILE2, and column three contains lines common to
both files.
12 GG
S4 BCA A LINUX MI
3. CMP Command
cmp command in Linux is used to compare the two files byte by byte and finds out whether the two files are
identical or not. If difference is found between 2 files, it reports the location of the first mismatch between 2
files.
13 GG
Unit-II - Essential Linux commands: Processes in Linux, process fundamentals, connecting processes
with pipes, redirecting input/output, Background processing, managing multiple processes, process
scheduling – (at, batch), nohup command, kill, ps, who, find, sort, touch, file, file processing commands -
wc, cut, paste etc Mathematical commands - expr, factor etc. Creating and editing files with vi editor.
PS Command
By using PS Command we can see the process that is currently running at any instant.
$ ps
1 GG
➢ PID- Process ID is a unique number assigned to each process running in the memory. The PID starts
from 0 and run up to a maximum of 32767. As soon as the process terminates, its PID is released for
eventual reuse.
➢ TTY- Terminal from which the process were launched.
➢ Time- The time that has elapsed since the process was launched.
➢ Command - Name of the Process.
• Ps –a [displays all the process that are running for the other users]
• Ps -u username [displays the process of a particular user]
• Ps –t terminal id[displays all the process that are launched from a particular terminal]
Kill command
Kill command is used to Terminate a process. Some of the reasons are given below:
• The terminal has hang.
• The program, which is running, has gone in an infinite loop.
• The system performance has gone below acceptable limits because of too many processes running in
the background.
To carry out killing a process first note the PID of the process to be killed using the ps command and use
kill command.
• $ kill 5001
5001 terminated
• $ kill –9 3216
The –9 refers to sure 100% killing. The signal number 9 (sure kill) forcibly terminates a process.
• killall Netscape
It kills all instances of Netscape.
Who
Since Linux is a multiuser system ‘who’ will display the users are currently logged on.
[mca@chavara ~]$ who
mca tty1 Dec 19 13:57
2 GG
Who am i
It tells who you are (working on the current terminal)
[mca@chavara ~]$ who am i
mca tty1 Dec 19 13:57
BACKGROUND PROCESSING
To run a process in the background, Linux provides the ampersand (&) symbol. While executing a
command, if this symbol is placed at the end of the command then the command will be executed in the
background. When you run a process in the background a number is displayed on the screen. This number is
the PID of the process that you have executed in the background.
The above example sorts the files employee in the background and stores the sorted result in the file S1.
The major limitations of background processing are:
• We need to search in the PID in the output of ps to verify whether the process is still running or
has been terminated.
• The output of a background process should, always be redirected to a file. Otherwise you would
get a garbled screen showing the output of the background process along with whatever you are
doing in the foreground.
• With too many processes running in the background the overall system performance is likely to
degrade.
• If you log out while some of your processes are running in the background all these processes
would be abandoned halfway through.
The nohup command
Nohup stands for no hang ups. This command ensures that the processes that we have executed should not
die even when we log out. Using this command we can submit the time consuming commands in the
3 GG
background. If we log out from the terminal it automatically works on the background and performs the
desired task.
MANAGING MULTIPLE PROCESSES/PROCESS SCHEDULING
Linux provides tools to permit scheduling of processes as per the user /system requirements. Once the user-
has submitted a process to, Linux directing it to execute the process at a specified time and date in future,
Linux will execute that process at that specified time. Cron daemon is a system process responsible for
scheduling of other processes. During booting of Linux cron automatically started and its checks any
scheduled job is available for it to execute, and if it is, it executes the job.
1. at
The ‘at’ command schedules a command, to be run once at a particular time. The ‘at’ command can be
anything from a simple reminder message, to a complex script.
You start by running the ‘at’ command at the command line, passing it the scheduled time as the option. It
then places you at a special prompt, where you can type in the command (or series of commands) to be run at
the scheduled time. When you're done, press Control-D on a new line, and your command will be placed in
the queue.
Example
at> <EOT>
4 GG
On pressing ‘Ctrl+d’ the ‘at’ command displayed the job-id and the date and time we requested for the
execution. Once submitted this way, the message would be echoed on our terminal (/dev/pts/0) 1 minute
after the current time.
There are two options available with the ‘at’ command which permit us to view the list of jobs submitted
using at and to remove any unwanted jobs from this job queue. These options are -l for listing jobs and -r for
removing jobs. While removing a submitted job its job-id should be mentioned.
Following are some of the specifications that can be used with at:
• $ at 9:15 am Mar 24
• $ at now + 10 minutes
• $ at now + 1 day
• $ at 7 pm Thursday next week
once jobs submitted using these commands have been executed, the jobs will have to be rescheduled if they
5 GG
Crontab is used to execute the commands or programs on a regular schedule including backup, recovery,
copying or any other activity. crontab can carry out a submitted job every day for years together, without
needing any prompting from us. The jobs can be carried out on a regular basis using the crontab command
as shown below:
$ crontab cmdfile
The above command will echo the message at 10:30 am on 15 day of August month.’*’ indicates any day.
REDIRECTING INPUT/OUTPUT
In all Operating systems the standard input device is keyboard and standard output device is
monitor (display screen). Linux allow you to change the standard input and output temporarily by using
redirection. Redirection is the process of changing the assignment of standard input device, standard output
device.
Output Redirection
Most command line programs that display their results do so by sending their results to a facility called
standard output. By default, standard output directs its contents to the display. To redirect standard output to
a file, the ">" character is used like this:
$ ls > file_list.txt
In this example, the ls command is executed and the results are written in a file named file_list.txt. Since the
output of ls was redirected to the file, no results appear on the display.
6 GG
Each time the command above is repeated, file_list.txt is overwritten from the beginning with the output of
the command ls. To have the new results appended to the file instead, we use ">>" like this:
Input Redirection
Many commands can accept input from a facility called standard input. By default, standard input gets its
contents from the keyboard. To redirect standard input from a file instead of the keyboard, the "<" character
is used like this:
$ sort < file_list.txt
In the example above, we used the sort command to process the contents of file_list.txt. The results are
output on the display since the standard output was not redirected. We could redirect standard output to
another file like this:
$ sort < file_list.txt > sorted_file_list.txt
Connecting processes with pipes
Piping facility ( | ) connects more than 1 command. By using piping facility the output of one
command will become the input of another command.
• $ ls | wc -l
Here the output of ls becomes the input to wc which counts the number of lines it receives as input and
displays this count on the screen.
• $ ls | wc –l > countfile
Instead of displaying this count, if we want to store the count value in a file, use the output redirection.
File Processing Commands
1. wc
wc stands for word count. As the name implies, it is mainly used for counting purpose. It is used to
find out number of lines, number of words count and number of characters in one or more files.
Syntax:
7 GG
wc [OPTION]... [FILE]...
Example
$ cat F1
Andhra Pradesh
Arunachal Pradesh
Assam
Bihar
Chhattisgarh
• $ wc F1
5 7 63 F1 Displays the count of Lines, Words and Characters in the file F1
• $ wc -l F1
5 F1 Displays the number of Lines in F1
• $ wc -W F1
7 F1 Displays the number of Words in F1
• $ wc -C F1
63 F1 Displays the number of Characters in F1
2. cut
Cut command is used to extract specific columns from a file or extract the output of some commands.
$ cat F1
1 CHEMISTRY 25
2 ENGLISH 30
• $ cut –f 2,3 F1 displays the 2nd and 3rd Field from file F1
• $ cut –f 1-3 F1 displays the 1st ,2nd and 3rd Field from file F1
8 GG
• $ cut –c 1-3 F1 displays the 1st ,2nd and 3rd character from file F1
• $ cut –d ‘:’ –f 2,3 F1 displays the 2nd and 3rd Field from file F1- When fields are
separated by characters other than the default tab use –d option which
allows us to set the delimiter.
3. Paste command
This command concatenates the contents of the specified files into a single file vertically. Paste command
merges the columns
$ cat F1
CHEMISTRY
ENGLISH
$ cat F2
25
30
CHEMISTRY 25
ENGLISH 30
• Paste –d ‘:” F1 F2 Combines the data vertically of file F1 and F2 and the
delimiter is ‘:’. The default delimiter is Tab Space.
4. Sort command
It can be used for sorting the contents of a file. It can merge multiple sorted files and store the result in the
specified output file.
9 GG
• $ sort myfile
• $ sort –r myfile
This would the sort the contents of myfile in the reverse order
• $ sort –k 2 myfile
This would the sort the contents of myfile based on the 2nd field of myfile
TOUCH COMMAND
Touch command: It is used to create a file without any content. The file created using touch command is
empty. This command can be used when the user doesn’t have data to store at the time of file creation.
MATHEMATICAL COMMANDS
1. Factor
Print the prime factors of each NUMBERs. If no arguments are specified on the command line,
they are read from standard input.
• $ factor 2
2: 2
• $ factor 12
12: 2 2 3
• $ factor 13
13: 13
• $ factor15
15: 3 5
10 GG
2. expr
It is used to perform arithmetic operations on integers.
+ Addition
- Subtraction
* Multiplication
/ Division (decimal portion will be truncated, division is done only on integers,
gives the quotient only)
% Remainder of division (modulus operator)
A white space must be used on either side of an operator. The * operator has to be escaped to
prevent the shell from interpreting it as the filename meta character. So use \ before the *
character.
[mca@chavara ~]$ x=5
[mca@chavara ~]$ y=2
[mca@chavara ~]$ expr $x + $y
7
3. bc [Binary Caclualator]
Binary calaculator is used for real number calculations, Number Conversion etc.
[mca@chavara ~]$ bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc. This is free software with
ABSOLUTELY NO WARRANTY. For details type `warranty'.
10 + 20 arithmetic expression
30 result is displayed on the screen
Press ctrl d to end work
[mca@chavara ~]$ bc
ibase = 2 set ibase to binary(2) ibase means input base
101 type the input in binary number
5 result in decimal
[mca@chavara ~]$ bc
obase = 2 set obase to binary obase means output base
11 GG
A text editor is a program that enables you to create and modify text files. Typically, a text editor
provides a screen with a fixed line length and line numbers. You can type text line by line, navigate
through the documents by using different commands, and save the document. Typically, a text editor
enables you to perform the following functions: Create files, Open files Copy text, Search for text
etc.
Editors Available with Linux
• vi • emacs • red • pico
• vim • ed • joe
THE VI EDITOR
The visual editor, popularly known as the vi editor, is one of the most widely used Linux -based text
editors. It offers a compact interface and enables you to control the system by using the keyboard.
The vi editor is commonly used to enter and edit source code and write short notes, such as e-mail
messages.
It is a screen oriented text editor developed by Bill Joy in 1976. Commands are entered through
keyboard. We can also use mouse support and a GUI version with scrollbars and menus can be
activated.
Running vi
To run vi and create a new file, simply run the command 'vi' from any shell prompt:
$ vi
To create a File and giving a name to that file use
$ vi F1
To load an existing text file into vi, run the command 'vi [filename]', from the shell prompt:
$ vi F1
Your file will be loaded into vi, and the cursor will be placed at the beginning of the first line. Note
that an empty line is shown as a tilde (~).
12 GG
Modes of operation
1) Command mode: To switch to command mode Press ESC key. Here all keys pressed by the user
are interpreted as commands. The keys that are hit are not displayed on the screen.
2) Insert mode: It is activated by pressing ‘i’. It allows insertion of new text, editing and replacements
of text. In insert mode the characters we type are added to the file. It is also known as input text mode.
3) The ex command mode: It permits us to give commands at the command line. The bottom line of
the vi screen is called the command line.vi uses command line to display messages and commands. All
commands entered in this mode are displayed in the command line. It is so called because commands given
in this mode are compatible with the commands of the ex editor
To move the cursor around the screen, you must be in command mode.
h - Cursor left
j - Cursor down
k - Cursor up
l - Cursor right
Command Description
:e file edit file (save current file with :w first)
:w save (write out) the file being edited
:w file save as file
:w! file save as an existing file
:q quit vi
:wq save the file and quit vi
:x save the file if it has changed and quit vi
:q! quit vi without saving changes
13 GG
Shell programming - Basics of shell programming, various types of shell available in Linux, comparisons
between various shells, shell programming in bash. Conditional and looping statements, case statement,
parameter passing and arguments, Shell variables, system shell variables, shell keywords, Creating Shell
programs for automating system tasks
1 GG
KORN SHELL
• Was written by David Korn at AT&T Bell Labs
• It combines the features of Both Bourne shell and C Shell.
• The executable file name for this shell is ksh.
• Has an interactive feature comparable to those in the C shell.
• Includes convenient programming features like built-in arithmetic and C-like arrays, functions,
and string-manipulation facilities.
• Is faster than the C shell.
• Runs scripts written for the Bourne shell.
2 GG
RESTRICTED SHELL
• Restricted shell provides limited access on the operating system to a user.
• The restricted shell is typically used for guest users who only need limited rights and permissions.
• You can use this shell to restrict the users of the operating system to a limited environment.
BASH SHELL
• It is an enhancement on the Bourne Shell
• Bash stands for Bourne Again Shell.
• The executable file name for this shell is sh.
• Bash is product of Free Software foundation’s GNU project.
• It stores all of the commands that you use in a session and also in the previous shell.
• Incorporates useful features from the Korn and C shells.
• Have arrow keys that are automatically mapped for command recall and editing.
Tcsh SHELL
• Tcsh stands for Tom’s C shell
• It is an enhancement of the C shell.
• It is also known as the TC shell.
• The executable file name for this shell is tcsh.
A SHELL
• It was developed by Kenneth Almquist of the University of Berkeley.
• The A shell is suitable for computers that have limited memory.
• The executable file name for the A shell is ash.
Z SHELL
• It offers the features of Tcsh and Korn shells.
• It also provides a large number of utilities and extensive documentation.
• The executable file name for the Z shell is zsh.
3 GG
COMPARISON OF SHELLS
4 GG
echo, read, set, unset, readonly, shift, export, if, else, fi, while, do, done, for, until, case, esac, break,
continue, exit, return, trap, wait, eval, exec, ulimit, umask etc
Shell Variables
Variables in Linux are of 2 Types
1. Linux defined/System Variables/Environment Variables
These are the standard variables which are always accessible. The shell provides the values of these
variables. These variables are usually used by the system itself and govern the environment we are
working. If we needed we can change the values of these variables as per our preferences and
customize the system environment.
Example
[student@localhost ~]$ printenv HOME
/home/student
[student@localhost ~]$ printenv SHELL
/bin/bash
5 GG
6 GG
On execution the read command waits for you to enter a value for the variable. When you press the <Enter>
key the value is read and assigned it to the variable.
echo "Enter the Phone Number"
read phno
echo $phno
Command Substitution
Using command substitution we can combine more than one command.
echo "The date is `date`"
The date is Mon Feb 10 23:21:52 PST 2020
The command date is enclosed in single backward quotation marks. While executing the command the shell
first replaces the enclosed command with the output of the command. Then the shell executes the entire
command.
7 GG
echo $ ( ( 45 + 34 ) )
79
a=12
b=10
echo $ ( ( a + b ) )
22
Conditional Execution in Shell Script
A shell script might contain a list of statements. To execute statements conditionally we can use IF construct
and case construct.
I. IF Construct
If we want to check a specific condition and execute commands based on whether the status of the
condition is true or false. In such cases we can use IF Construct.
The IF construct evaluates a given condition expression. If the result is true, then the statements
following the IF construct is executed. If the result is false, the statements are skipped and the
control moves to the else statement. Here FI is used to indicate the end of the construct.
read x
read y
if [ $x -ge $y ]
then
echo " X is greater"
else
echo " Y is greater"
fi
IF…ELIF Construct
In this construct the ELIF specifies the ELSE IF Condition. The ELIF statement is executed only
when the IF condition is false.
read mark
if [ $mark -lt $75 ]
then
echo " C+ "
elif [ $mark -lt 90 ]
8 GG
then
echo " B+ "
else
echo " A+ "
fi
Numerical Tests
Operator Meaning
9 GG
10 GG
3. For
1. While Construct
In the while iteration construct, the commands to be executed are specified within the do and done
keywords. The do and done keywords are used to delimit commands in an iteration construct. The syntax is:
While<Condition> i=1
Do while [ $i -le 5 ]
<Commands> do
Done echo $i
((i=$i+1))
done
In the above syntax, the commands within the do and done keywords are executed as long as the condition
evaluates to true.
2. Until Construct
until<Condition> i=1
Do until [ $i -gt 5 ]
<Commands> do
Done echo $i
((i=$i+1))
done
If the condition becomes true the until loop will terminates.
If the condition becomes false the while loop will terminates.
3. For Construct
The for loop accepts a list of variables or expressions as input and executes the commands within do and
done, based on the value of the variable or expression. The syntax for the for construct is given below.
11 GG
$* variable contains the entire string [Above example $* contains Dir1 and Dir2]
$# variable contains the number of arguments specified in the command [Above example $# contains 2
which means 2 arguments are passed as command line arguments]
12 GG
1 GG
Configuration files: The directory for such file is the /etc directory. Most of the configuration files
resides in the /etc directory. Some of them are as follows:
/etc/passwd contains user password and login configurations
/etc/shadow contains user encrypted passwords.
/etc/shells shells installed on the system that users can use.
/etc/group Configuration file for the user groups.
/etc/filesystems Known file systems
/etc/fstab Lists partitions and their mount points.
/etc/inittab Information for booting.
/etc/ftp* Configuration of the ftp-server
/etc/mail Behavior of the mail server
/etc/ printcap Printer Configuration Files
Log files: The directory for such files is the /var directory. We can use log files to help tracking the
different problems.
BootLog-contains messages indicating which systems services have started & shut down successfully
and which have failed to start and stop.
CronLog -Contains message from Cron, a daemon that periodically runs scheduled jobs like backups.
I. Adding users
2 GG
When we add a new user in Linux with ‘useradd‘ command it gets created in locked state and to unlock that
user account, we need to set a password for that account with ‘passwd‘ command.
[root@tecmint ~]# passwd S4BCA
Changing password for user S4BCA.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
Once a new user created, it’s entry automatically added to the ‘/etc/passwd‘ file.
3 GG
Secondary Groups are used to organize and administrate user accounts. Example All the users
having same privilege/ All the users of a Project can be added to a Secondary group.
The main purpose of groups is to define a set of privileges such as reading, writing, or executing permission
for a given resource that can be shared among the users within the group.
When creating a new user the default behavior of the useradd command is to create a group with the same
name as the username, and same GID as UID.
We can create users with specific group[Secondary Group] with -g option. We can specify either group
Name or Group ID, Here in this example, we are adding a user ‘S4BCA‘ with a specific GID with ‘-g‘
option.
[root@tecmint ~]# useradd -g 500 S4BCA
In this example we are adding the user S4BCA to the secondary group ‘Projects’
[root@tecmint ~]# useradd –g Projects S4BCA
5. Add a User to Multiple Groups/Secondary Groups
The ‘-G‘option is used to add a user to multiple groups. Each group name is separated by a comma, with no
intervening spaces. Here in this example, we are adding a user ‘S4BCAt‘into 3 groups
nameily admins, webadmin and developer.
[root@tecmint ~]# useradd -G admins,webadmin,developers S4BCA
6. Create a User with Account Expiry Date
By default, when we add user’s with ‘useradd‘ command user account never get expires i.e their expiry date
is set to 0 (means never expired).
However, we can set the expiry date using ‘-e‘option, that sets date in YYYY-MM-DD format. This is
helpful for creating temporary accounts for a specific period of time.
Here in this example, we create a user ‘S4BCA‘ with account expiry date i.e. 27th April 2014 in YYYY-
MM-DD format.
[root@tecmint ~]# useradd -e 2014-03-27 S4BCA
7. Create a User with Password Expiry Date
The ‘-f‘argument is used to define the number of days after a password expires. A value of 0 inactive the
user account as soon as the password has expired. By default, the password expiry value set to -1 means
never expire.
4 GG
Here in this example, we will set a account password expiry date i.e. 45 days on a user ‘S4BCA’ using ‘-
f‘option..
[root@tecmint ~]# useradd -f 45 S4BCA
The command ‘usermod‘ is used to modify or change any attributes of a already created user. After creating
user accounts, in some scenarios where we need to change the attributes of an existing user such as, change
user’s home directory, login name, login shell, password expiry date, etc, where in such case ‘usermod’
command is used.
-d = To modify the directory for any existing user account.
# usermod -d /var/www/ S4BCA
-e = Using this option we can make the account expiry in specific period.
# usermod -e 2014-11-01 S4BCA
-g = Change the primary group for a User.
# usermod -g Projects S4BCA
-G = To modify supplementary groups.
# usermod -G PHPPROJECTS S4BCA
-l = To change the login name from S4BCA to S4BCAB. To change any existing user login name,
we can use ‘-l‘ (new login) option. In the example below, we changing login name S4BCA to
S4BCAB..
# usermod -l S4BCAB S4BCA
-L = To lock the user account. This will lock the password so we can’t use the account. To
Lock any system user account, we can use ‘-L‘ (lock) option, After the account is locked we
can’t login by using the password
# usermod -L S4BCA
-U = To unlock the user accounts. This will remove the password lock and allow us to use
the user account.
# usermod -U S4BCA
5 GG
-s = Create a Specified shell for new accounts. For example, the user ‘S4BCA‘ has
the /bin/bash shell by default, now I want to change it to /bin/sh.
# usermod -s /bin/sh S4BCA
III. Deleting User Accounts
userdel command in Linux system is used to delete a user account and related files. This command basically
modifies the system account files, deleting all the entries which refer to the username. The userdel command
takes a single argument which is the login name of the account to delete. Use –r option to delete user’s
home directory and all files in it.
Examples
$ userdel S4BCA delete user account with login name S4BCA
$ userdel –r user1 To delete S4BCA’s home directory along with user account.
Linux systems allow you to lock or disable access to a particular user account without changing anything
from the account.
Linux distributions use /etc/shadow file to store the encrypted user passwords. A user account can be
temporarily disabled or permanently removed.
6 GG
Managing Groups
In Linux, groups are used to organize and administer user accounts. The primary purpose of groups is to
define a set of privileges such as reading, writing, or executing permission for a given resource that can be
shared among the users within the group.
In a scenario where there are many users, there might be some privileges that some users have and some
don’t, and it becomes difficult to manage all the permissions at the individual user level. So using groups,
we can group together a number of users, and set privileges and permissions for the entire group.
When you add a group to the system, the system places the group’s name in the /etc/group file and gives it a
group ID number.
I. Creating Groups
7 GG
To get the access of files on a storage device user must first direct the Linux where to
mount the device known as Mount Point. For example, to get the access of files on a CDROM, user must
direct the Linux to make the file system on the CDROM appear in some directory, typically /mnt/cdrom
(which already exists for this very purpose).
Mount Point refers to the empty directory in the currently available file system with
which a newly created or additional file system is mounted. The /mnt directory already exists in Linux
by default on all Unix like systems. This directory with its subdirectories like /mnt/floppy , /mnt/usb are
intended specifically to be used as mount points for removable media such as CDROMS, USB key drives
and floppy disks.
Mounting can be done by the root user by using the mount command with the name of the
device to be mounted and its mounting point / destination.
For eg: to mount the second partition on the first HDD , which is designated by /dev/hda2
, using a directory named / BCA as the mount point we use - $ mount /dev/hda2 /BCA.
We can remove the connection between the mounted device and the rest of the file
system. This process is called Unmounting. It is done by executing the umount command, followed by
the name of the device to be detached or unlinked and its mount point. For eg : to umount the second
partition from the root file system We use the command:
8 GG
Hostname
A hostname is a name which is given to a computer and that is attached to the network. Its main purpose
is to uniquely identify over a network.
sccs
Display the IP address of the system
[root@sccs student]# hostname -i
172.25.0.15
Set the hostname of the system to MGU
[root@sccs student]# hostname MGU
[root@sccs student]# hostname
MGU
Uname
9 GG
-a option: It prints all the system information in the following order: Kernel name, network node
hostname, kernel release date, kernel version, machine hardware name, hardware platform,
operating system
Linux MGU 2.6.18-53.el5 #1 SMP Wed Oct 10 16:34:02 EDT 2007 i686 i686 i386 GNU/Linux
3.23.57 – Version
1 – Release
i386 – Architecture
10 GG
When you install a RPM, it checks whether your system is suitable for the software the RPM package
contains, figures out where to install the files located inside the rpm package, installs them on your system,
and adds that piece of software into its database of installed RPM packages.
Installing a RPM package Using rpm -ivh
The following rpm command installs Mysql client package.
# rpm -qa
cdrecord-2.01-10.7.el5
bluez-libs-3.7-1.1
setarch-2.0-1.1
# rpm -q MySQL-client
MySQL-client-3.23.57-1
# rpm -q MySQL
11 GG
1:MySQL-client ###########################################
# rpm -e MySQL-client
12 GG
r Read Allows you to display, copy and Allows you to list the contents of
Permission compile the file the directory
w Write Allows you to edit, rename and Allows you to create directories and
permission move the file to another location subdirectories with in this directory
x Execute Allows you to execute the file Allows you to move to the specified
Permission with read permission directory using the cd command
1. Absolute Mode- In this mode we are using a series of digits to represent the file access
permissions. The Following table explains the number that denotes each type of permissions:
Number Permission
4 Read
2 Write
13 GG
Number Permission
1 Execute
To get the permission bits you want, by add up the numbers accordingly. For example, the rwx
permissions would be 4+2+1=7, rx would be 4+1=5, and rw would be 4+2=6. We are assigning separate
permissions for the owner, group, and others, so we need a three-digit number representing the
permissions of all these groups.
Example:
2. Symbolic Mode
In symbolic mode we are using symbols to specify the permissions and the types of the users.
The Following table represents the symbolic notation for the users.
14 GG
The symbolic mode uses an operator to specify how the modes of a file should be adjusted. The following
operators are accepted:
+ granting a permission to a class of users
Example:
chmod u+x file1 Assigning Execute Permission to the Owner
chmod u-x-w file1 Revoking Execute abd write Permission from the Owner
To change the owner of a file uses the chown command followed by the user name of the new owner and the
target file as an argument:
For example, the following command will change the ownership of a file named File1 to a new
owner named S4BCA
Chown S4BCA File1
To change the ownership of multiple files or directories, specify them as a space-separated list. The
command below changes the ownership of a file named file1 and directory dir1 to a new owner
named S4BCA
Chown S4BCA File1, Dir1
15 GG
Module V
Simple filter commands: pr, head, tail, cut, sort, uniq, tr - Filter using regular expression grep, egrep,sed
Understanding various Servers: DHCP, DNS, Squid, Apache, Telnet, FTP, Samba.
1. Pr Command
The pr command prepares a text file for printing in Linux. By default, pr adds headers that include
the filename, date and time, and the page number.
[student@localhost ~]$ cat > F13
Simple filter commands: pr, head, tail, cut, sort, uniq, tr - Filter using regular expression grep, egrep, sed
Understanding various Servers :DHCP, DNS, Squid, Apache, Telnet, FTP,Samba.
1 GG
2 GG
2 Green
1 Red
3 Violet
5. TR Filter
TR (short for translate) is a filter utility that deletes or translates characters from one set to another set.
Syntax is
$ tr [options] [SET1] [SET2]
[student@localhost ~]$ cat > F9
1: DBMS BCA
2: CPP MCA
3: LINUX BCA
The following command replaces each occurrence of the word BCA with MCA and display the output
[student@localhost ~]$ tr 'BCA' 'MCA' <F9
1: DMMS MCA
2: CPP MCA
3: LINUX MCA
The following command replaces each occurrence of: with - and display the output
[student@localhost ~]$ tr ':' '-' <F9
1- DBMS BCA
2- CPP MCA
3- LINUX BCA
The following command converts each occurrence of uppercase letter with lowercase and display the output
[student@localhost ~]$ tr "[A-Z]" "[a-z]" <F9
1: dbms bca
2: cpp mca
3: linux bca
FILTER USING REGULAR EXPRESSION
Regular expressions are special characters which help search data, matching complex patterns.
I. Grep
II. Egrep
III. sed
3 GG
Grep
The GREP filter searches a file for a particular pattern of characters, and displays all lines that contain that
pattern. The pattern that is searched in the file is referred to as the regular expression (GREP stands for
globally search for regular expression and print out).
[student@localhost ~]$ cat gs
unix is a OS.
UniX is portable.
UNIX is free.
Linux is a freeware.
Liunix is opensourse
1. Case sensitive search: The grep command without any option will search for a particular word
from a file. The searching is case sensitive
[student@localhost ~]$ grep "unix" gs
unix is a OS.
2. Case insensitive search: The -i option enables to search for a pattern case insensitively in the give
file. It can also search substring also.
[student@localhost ~]$ grep -i "unix" gs
unix is a OS.
UniX is portable.
UNIX is free.
Liunix is opensourse
3. Displaying the count of number of matches: We can find the number of lines that matches the
given pattern
[student@localhost ~]$ grep -c "unix" gs
2
[student@localhost ~]$ grep -c -i "unix" gs
4
4. Display the file names that match the pattern: We can just display the files that contain the given
string/pattern.
[student@localhost ~]$ grep -l "unix" *
Gs
4 GG
5. Checking for the whole words in a file : By default, grep matches the given string/pattern even if it
found as a substring in a file. The -w option to grep makes it match only the whole words.
[student@localhost ~]$ grep -w "unix" gs
unix is a OS.
6. Displaying only the matched pattern : By default, grep displays the entire line which has the
matched string. We can make the grep to display only the matched string by using the -o option
[student@localhost ~]$ grep -o -i "unix" gs
unix
UniX
UNIX
Unix
7. Show line number while displaying the output using grep -n : To show the line number of file
with the line matched.
[student@localhost ~]$ grep -n "unix" gs
1:unix is a OS.
5:Liunix is opensourse
8. Inverting the pattern match: You can display the lines that are not matched with the specified
search sting pattern using the -v option.
[student@localhost ~]$ grep -v -i "unix" gs
Linux is a freeware.
9. Matching the lines that start with a string: The ^ regular expression pattern specifies the start of a
line. This can be used in grep to match the lines which start with the given string or pattern.
[student@localhost ~]$ grep "^Li" gs
Linux is a freeware.
Liunix is opensourse
10. Matching the lines that end with a string : The $ regular expression pattern specifies the end of a
line. This can be used in grep to match the lines which end with the given string or pattern.
[student@localhost ~]$ grep "e$" gs
Liunix is opensourse
11. Specifies expression with -e option. Can use multiple conditions
[student@localhost ~]$ grep -e "free" -e "OS" gs
5 GG
unix is a OS.
UNIX is free.
Linux is a freeware.
Egrep
Stands for Extended globally search for regular expression and print out. Which is same as grep with –e
option. Egrep is used for search multiplie patterns from a given document.
sed
Command 'sed' stands for stream editor. You can use this command to edit streams (files) using regular
expressions. But this editing is not permanent. It remains only in display, but in actual, file content remains
same.
Syntax:command | sed 's/<oldWord>/<newWord>/'
[student@localhost ~]$ cat > F10
unix is simple unix
unix is powerfull
[student@localhost ~]$ cat F10 | sed 's/unix/linux/'
linux is simple unix
linux is powerfull
[student@localhost ~]$ sed 's/unix/linux/' < F10
linux is simple unix
linux is powerfull
The above 2 commands changed the word unix to linux, But all the “unix” is not changed to “linux”. To edit
every word in a line we have to use a global replacement 'g'. It will edit all the specified word in a file or
string.
[student@localhost ~]$ sed 's/unix/linux/g' < F10
linux is simple linux
linux is powerfull
The 'd' option will let you to remove a complete line from a file. You only need to specify a word from that
line with 'd' option and that line will be deleted. But please note that all the lines having that same word will
be deleted.
[student@localhost ~]$ sed '/simple/d' < F10
6 GG
unix is powerfull
LINUX SERVERS
I. DHCP Server
Computers that are connected to IP networks must be configured before they can communicate with other
host. The most essential information needed is an IP address.
A DHCP Server [Dynamic Host Configuration Protocol] is a network server that automatically provides and
assigns IP addresses.
DHCP servers assign each client with a unique dynamic IP address, without it, the network administrator
has to manually set up every client that joins the network, which can be difficult, especially in large
networks.
DHCP provides a central database of devices that are connected to the network and eliminates duplicate
resource assignments.
When a DCHP configured client connects to a network the DHCP client sends a broadcast query requesting
necessary information from a DHCP server. The DHCP server manages a pool of IP addresses and assign
the computer with an Dynamic IP address a lease time (length of time the allocation in valid).
II. DNS Server
DNS servers are responsible for translating domain names to numeric IP addresses. When users’ type
domain names such as ‘google.com’ into web browsers, DNS is responsible for finding the correct IP
address for those sites. Browsers then use those addresses to communicate with origin servers.
Our computer uses a DNS server to look up the domain name you're trying to access. The proper term for
this process is DNS name resolution, and the DNS server resolves the domain name to the IP address.
Step 1: Request information-To resolve a hostname, the first place your computer looks for the
corresponding IP address is its local DNS cache, which stores information that your computer has recently
retrieved. If your computer doesn’t already know the answer, it needs to perform a DNS query to find out.
Step 2: Ask the recursive DNS servers-If the information is not stored locally, your computer queries
(contacts) the recursive DNS servers (resolvers) from your internet service provider (ISP). Resolvers have
their own caches, and given that many of the ISP’s customers are using the same resolvers, there is a
reasonable chance that popular domains will already be cached. If this is the case for our example, dyn.com,
the process usually ends here and the information is returned to the user.
7 GG
Step 3: Ask the root name servers-If the recursive servers don’t have the answer, they query the root name
servers. A root name server is a computer that answers questions about domain names, such as IP addresses.
The Root Name Servers can direct DNS queries to someone that knows where to find it.
Step 4: Ask the TLD name servers-The root name servers will look at the first part of our request, reading
from right to left — www.dyn.com — and in our case, direct our query to the top-level domain (TLD)
name servers for .com. Each TLD, such as those for .com, .org, and .us, has its own set of name servers.
These servers can refer us directly to the servers that do have the information.
Step 5: Ask the authoritative DNS servers-The TLD name servers review the next part of our request —
www.dyn.com — and direct our query to the name servers responsible for this specific domain.
These authoritative name servers are responsible for knowing all the information about a specific domain,
which is stored in DNS records. If we want to know the IP address for www.dyn.com, we ask the
authoritative name server for the address record (A record).
Step 6: Retrieve the record- The recursive server retrieves the Address Record [A record] for dyn.com
from the authoritative name servers and stores the record in its local cache for handling the further requests
from other users.
Step 7: Receive the answer- The recursive server returns the A record back to your computer. Your
computer stores the record in its cache, reads the IP address from the record, and then passes this
information to your browser. The browser then opens a connection to the web server and receives the
website.
III. SQUID
SQUID is released in July 1996.it is a proxy server and web server.
Proxy server is a server that acts as an intermediary for request from clients seeking resources from other
servers. A client connects to the proxy requesting some service such as a file, connection, web page on other
resources available from a different server. The proxy server evaluates the request according to its filtering
rules. If the request is validated by the filter the proxy server provide the resource by connecting to the
relevant server and requesting the service on behalf of the client.
Proxy servers provide varying levels of functionality, security, and privacy depending on your use case,
needs, or company policy.
If you’re using a proxy server, internet traffic flows through the proxy server on its way to the address you
requested. The request then comes back through that same proxy server (there are exceptions to this rule),
and then the proxy server forwards the data received from the website to you.
8 GG
IV. Telnet
Telnet is a protocol that allows you to connect to remote computers (called hosts). Using telnet client
software on your computer, you can make a connection to a telnet server (that is, the remote host). Once
your telnet client establishes a connection to the remote host, your client becomes a virtual terminal,
allowing you to login and communicate with the remote host from your computer.
Telnet was developed in 1969. Telnet was initially developed for private use where security was not primary
concern.
Telnet Sever
Telnet server software is installed on remote host. You need to configure it before client can connect with it.
Telnet Client
Telnet client software allows you to connect telnet server. Once telnet client establishes a connection to the
remote host, client becomes a virtual terminal, allowing you to communicate with the remote host from your
computer.
V. Apache Web Server
Apache is an open-source and free web server software. When someone wants to visit a website, they enter
a domain name into the address bar of their browser. Then, the web server delivers the requested files by
acting as a virtual delivery man.
The job of a web server is to serve websites on the internet. To achieve that goal, it acts as a middleman
between the server and client machines. It pulls content from the server on each user request and delivers it
to the web.
The biggest challenge of a web server is to serve many different web users at the same time — each of
whom is requesting different pages.
We call Apache a web server; it is not a physical server, but rather software that runs on a server. Its job is
to establish a connection between a server and the browsers of website visitors (Firefox, Google Chrome,
Safari, etc.) while delivering files back and forth between them (client-server structure). Apache is a cross-
platform software, therefore it works on both Unix and Windows servers.
When a visitor wants to load a page on your website, for instance, the homepage or your “About Us” page,
their browser sends a request to your server and Apache returns a response with all the requested files (text,
images, etc.). The server and the client communicate through the HTTP protocol and Apache is responsible
for the smooth and secure communication between the two machines.
9 GG
VI. SAMBA
Many organizations need to provide network storage and print services for a range of desktop operating
systems; Linux uses the samba server to provide services that Microsoft windows clients can use.
Linux Samba Server is one of the powerful servers that help you to share files and printers with Windows-
based and other operating systems. It is an open-source implementation of the Server Message
Block/Common Internet File System (SMB/CIFS) protocols.
This means you can use a Linux server to provide file sharing, printing, and other services to other non-
native Linux clients such as Microsoft Windows.
Samba performing these 4 key things –
▪ File & print services
▪ Authentication and Authorization
▪ Name resolution
▪ Service announcement (browsing)
VII. FTP
An FTP server is a computer which has a file transfer protocol (FTP) address and is dedicated to receiving
an FTP connection. In order to ensure that connections can be established at all times from the clients, an
FTP server is usually switched on.
In order for the client to establish connection to the FTP server, the username and password are sent over
using USER and PASS commands. Once accepted by the FTP server, an acknowledgement is sent across to
the client and the session can start.
The FTP server can provide connection to users without need of login credentials; however, the FTP server
can authorize these to have only limited access.
FTP servers can provide anonymous access. This access allows users to download files from the servers
anonymously, but prohibits uploading files to FTP servers.
10 GG