Linux
Linux
Unit 1
Definition
2001 Linus Torvalds releases version 2.4 of the Linux Kernel source
code on January 4th.
2003 Alias Shrike version 9
Minimum System Requirements
● After you have loaded successfully root and boot images, installation routine
starts.
● For most part you just have to read the screen and make logical choices.
● The steps encountered in installation routine will be now discussed :
Choosing text or graphic Installation
● Linux give you two choices:
▪ Text based
▪ X based
● In text mode for taking input from user keyboard is used, to move the cursor we
can use [left], [right], [up],[down] keys. To choose a button press enter or space
● x based is a graphical user interface, use your mouse to navigate the screen
Setting up your hard drive
● If you need to partition your hard disk, linux gives you two choices:
▪ fdisk
▪ cdisk
● Fdisk is used to configure computers fixed drives, with fdisk you will be able to
delete, create and partition the hard drive.
● Cdisk is similar to fdisk except full screen mode. It uses simple mnemonics
commands to perform functions such as delete to delete, create to create etc.
Cdisk over fdisk
● Using cdisk it is possible to enlarge extended partiton when there is free space after
the partition which can’t be done with fdisk.
● Cdisk Uses simple mnenonics to perform a function.
Formatting the partition
● The installation routine displays a window listing the device names of all your
partitions. To format the partitions :
▪ Choose one of the partitions listed.
▪ Choose yes from the menu to start the formatting.
Setting up Ethernet
● After that red hat asks whether you want to install ethernet now.
● If you have ethernet card you can do so.
● Then you are asked for a machine name and a domain name.
● Then you are prompted for the I.P. address of your machine.
● You can set default for the configuration.
Configuring X
● If you opted for x based installation, linux tries to determine your video system to
start x.
● You will see a message that whether you want installation routine to autoprobe.
● If you don’t choose autoprobing, you must supply the configuration manually.
● After auotoprobing, the installation routine displays the type of video chip set it
found.
● For most systems accept default unless you know exactly what type of chipset and
RAM you have.
● After this x strarts.
Selecting packages to install
● Then a screen appears that lists all the packages on linux CD-ROM.
● You select which packages you want to install
Using LILO
● Now, you are asked whether you want to run LILO to set up the boot system.
● Choose yes or no according to your need.
Partitioning the hard disk
● The more RAM you have the less swap space you required.
● You can calculate the amount of RAM linux uses by the formula:
Linux RAM = RAM + Swap Space
● Swap Space is much slower than RAM.
LINUX’s fdisk
● d := delete
● l := list known partitions
● n := create new
● p := display current partition table.
● q := quit fdisk without saving changes.
● v := verify partition table
● w := Write current partition to disk.
We must have swap space of at least 8 MB and preferably 16 MB if we have only 4
MB
or less of RAM in our system.
If we have a small amount of RAM and we are getting memory error messages,
then the swap space is needed and we should enable it to help the installation
process.
To enable the swap space issue the following command in which ‘partition’ is the
name of the partition where the swap space is located and ‘size’ is the size of the
partition in the block:
mkswap –c <partition> <size>
Example:
The command
After the swap space has been configured and is working, linux file system can be set up.
This step can be automated by some linux installation script or can be manually done.
To create a file system we use the mkfs command. The exact format of this command
depends on the type
Type of filesystem
of file system we are setting.Command
extended mkefs
basic mkfs
xiafs mkxfs
The most popular file system is the second extended file system, so the command we will be
using is
Using LILO
LILO does not depend on a specific file system, and can boot an operating system (e.g., Linux
kernel images) from floppy disks and hard disks. One of up to sixteen different images can be
selected at boot time.
The lilo.conf file specifies LILO's behavior for certain aspects of the boot process and also
defines the kernels and operating systems that it can boot.
The LILO configuration file contains a ``stanza'' for each operating system that you want to
boot. The best way to demonstrate this is with an example LILO config file.
# Tell LILO to modify the boot record on /dev/hda (the first non-SCSI hard drive). If you boot from a drive
other than /dev/hda, change the following line.
boot = /dev/hda
# Name of the boot loader. No reason to modify this unless you're doing some serious hacking on LILO.
install = /boot/boot.b
The first operating system stanza in the config file will be the default OS for LILO to boot. You
can select another OS to boot at the LILO boot prompt
When LILO loads itself it displays the word “LILO”. Each letter is printed before or
after some specific action. If LILO fails at some point, the letters printed so far can
be used to identify the problem.
(nothing)
No part of LILO has been loaded. LILO either isn't installed or the partition on
which its boot sector is located isn't active. The boot media is incorrect or
faulty.
L
The first stage boot loader has been loaded and started, but it can't load the
second stage boot loader. The two-digit error codes indicate the type of
problem. This condition usually indicates a media failure or bad disk
parameters in the BIOS.
LI
The first stage boot loader was able to load the second stage boot loader, but
has failed to execute it. This can be caused by bad disk parameters in the BIOS.
When LILO loads itself it displays the word “LILO”. Each letter is printed before or
after some specific action. If LILO fails at some point, the letters printed so far can
be used to identify the problem.
LIL
The second stage boot loader has been started, but it can't load the descriptor
table from the map file. This is typically caused by a media failure or by bad disk
parameters in the BIOS.
LIL?
The second stage boot loader has been loaded at an incorrect address. This is
typically caused by bad disk parameters in the BIOS.
LIL-
The descriptor table is corrupt. This can be caused by bad disk parameters in
the BIOS.
LILO
All parts of LILO have been successfully loaded.
STARTING AND STOPPING
LINUX SYSTEM:
STARTING:
▪Linux starts automatically from your hard drive or from a boot floppy disk.
▪When you start Linux system, you see few Linux initialization messages
scroll across the screen.
▪When Linux completes its startup sequence, you should see a login prompt.
STOPPING
▪You already know how to start Linux, but it is even more important to know
how to shut down the system properly.
▪The easiest way to ensure a proper shut down is to press the ctrl+alt+del
keys simultaneously.
LINUX SHUTDOWN COMMANDS
▪ There are several other ways to shut down the system, but ctrl+alt+del is
the easiest way .
▪ Depending upon the different version of Linux, the shut down commands
can vary.
▪ Commonly used commands are “shutdown, haltsys and fasthalt”.
▪ The second most commonly used method to shutting down the Linux is
“shutdown” command.
▪ Example: shutdown –t45
shutdown now
▪ The “fasthalt” and “haltsys” commands do as their names imply and
OPTIONS
▪ -t sec
It waits for specified number of seconds.
▪ -k
Don't really shutdown; only send the warning messages to everybody.
▪ -r
Reboot after shutdown.
▪ -h
Halt after shutdown.
LOGGING IN
▪ After you boot the system, Linux waits for the login.
▪ Its simply a name that you supply to Linux to identify yourself to the
operating system.
▪ Allows only valid users to have access.
▪ Every login name on the system is unique and password is assigned to
them.
▪ The login’s privileges are controlled by Linux.
ROOT LOGIN
▪ Most likely, the only valid login on your Linux system after system
installation is “root”.
▪ Linux prompt you to create a user login during the installation procedure,
so you have two logins that you can use.
▪ Syntax :
who [-a] [-b] [-d] [-H] [-l] [-m] [-p] [-q] [-r] [-s] [-t]
OPTIONS
▪ -a: Process /var/adm/utmp or the named file with -b, -d, -l, -p, -r, -t, -T, and
-u options turned on.
▪ -b: Indicate the time and date of the last reboot.
▪ -d: Display all processes that have expired and not been respawned by init .
-H:Output column headings above the regular output.
▪ -l:List only those lines on which the system is waiting for someone to
login. The name field is LOGIN in such cases. Other fields are the same as
for user entries except that the state field does not exist.
▪ -m:Output only information about the current terminal.
▪ -r:Indicate the current run-level of the init process.
▪ -s:(default) List only the name, line, and time fields.
▪ -t:Indicate the last change to the system clock (using the date utility) by
root. See su and date.
COMMANDS AND PROGRAMS
▪ The command is what you type, and the program is what performs your
command.
▪ However, very simple programs with straightforward results such as
“who”, are often referred to as commands, although there is actually a
“who”, program on your hard disk.
▪ More complicated programs usually interactive ones such as “adduser” or
open-ended ones such as a text-editor, are called programs in more
traditional sense.
BASIC LINUX COMMANDS
HOW LINUX COMMAND WORKS
•When you enter a Linux command, there are several ways to tailor
the basic commands to your specific needs.
•There are two ways to modify the effect of a command:
• Any text standing by itself, and not within [ ],< > or { } must be typed
exactly as shown.
• Any text within square brackets [ ] is optional. Example: type “ls [-1]”
• Angle brackets < >. Do not use the angle bracket when you actually
type the command. If you want to look at the file “output”, type:
$ls more output
• Curly braces { } indicate that you must choose one of the values given
within the braces. The values are separated by “ | “. The syntax:
command {a | b}
• An ellipse (….) means “and so on”. They are normally used with
parameters such as file names.
• The sixth basic rule states that the you can type more than one file
with one command.
• Example: $more output output1 output2
Online Help Available In Linux
•Man
• Info
• help
MAN
•Man command provide online help about every Linux command, with all
the option that command supports.
Syntax:
$man command-name
Example:
•Man clear
Man command display the brief information about clear command.
$man cat
•man command will display the brief information about the cat command.
Man command Using Option
$man –k mkdir
•It searches a summary database and displays online description of the
•Info: The purpose of info command provide online help to each and every
linux command.
Syntax:
$info command-name
Example:
$info ls
•This command display all information about ls command.
Help:This command also provide online help about every linux command.
Syntax:
$command name --help
Example:
$date --help
•
THE LINUX MAN PAGES
•For Example
$man man
•The command we type at the prompt, the shell program takes what
you’ve written interprets it as necessary and passes result to the Linux
operating system.
• Linux then perform the action requested to it.
• Editing and completion.
History and command Re-entry: The history list may be of unlimited size.
The history list may be saved across shell sessions.
•Array: Bash support indexes arrays of unlimited size.
Command Timing :Bash allows external commands, shell builtin
commands and shell functions to be timed. The format used to display the
timing information may be changed by the user.
•Tilde Expansion: Users' home directories may be expanded using
this feature. Words beginning with a tilde may also be expanded to
the current or previous working directory.
• Help: Bash includes a built-in help factility.
Directory Stack: Bash provides a `directory stack', to which
directories may be added and removed. The current directory may
be changed to any directory in the stack.
• Security:Bash provides a restricted shell environment. It is also
possible to control the execution of setuid/setgid scripts.
Arithmetic: Bash allows user to perform integer arithmetic, in any
base from 2 to 64.
WILDCARDS
•Wildcard are used as a convenient and powerful shortcut when specifying
files(or directories) that a command is to operate on.
•Star(*):The most frequently employed and usually the most useful is the
star wildcard, which is the same as an asterisk (*).
•The star wildcard has the broadest meaning of any of the wildcards, as it
can represent zero characters, all single characters or any string.
$file *
•This would display information about every object in the
current directory (i.e., the directory in which the user is currently
working):
•If there are no matches, an error message is returned, such as *: can't stat
`*' (No such file or directory).
$ls *.html *.txt
QUESTION MARK WILDCARD
•The question mark (?) is used as a wildcard character in shell commands
to represent exactly one character.
Example:
$file ???
•This would return data on all objects in the current directory whose
names, inclusive of any extensions, are exactly three characters in length:
$file ? ?? ???
•This would provide data on all objects whose names are one, two or three
characters in length.
$file a????
•This would provide information about all objects in the current directory
that begin with the letter a and are five characters in length:
ENVIRONMENT VARIABLE
root
bin dev etc home lib sbin stand temp usr var
⮚ Bin
❑ Commonly used UNIX commands
❑ Binary files, hence the name bin
❑ Binary file – contains all printable and unprintable
characters
⮚ Etc
❑ Contains configuration files
⮚ Lib
❑ Contains all library files in binary form
❑ C programs need to be linked with them
⮚ tmp
❑ Contains temporary files
❑ These files are wiped away regularly by the system
⮚ dev
❑ Contains all device files
Commands for managing files
and directories
⮚ chmod
❑ You can use this command to change the access
permissions of any file for which you are the owner.
⮚ du and df
❑ The du command displays the sizes in kilobytes of all
files in the specified directory.
❑ The total of all those sizes; if no directory is specified,
the current directory is assumed.
File manipulative commands
⮚ cat
❑ Reads one or more files
❑ Prints them to standard output
❑ Operator
a) > used to combine multiple files into one
b) >> used to append to an existing file
❑ Syntax
cat [options] [file]
❑ Options
i. -e $ is printed at the end of each line
ii. -v display control characters and non printing
characters
iii. -n numbering lines
❑ Eg.
cat file1
cat file1 file2 > all
cat file1 >> file2
cat > file3.txt
⮚ ls
❑ Display list of files in current directory
❑ Syntax
❑ ls [options] [names]
❑ Options
i. -a show hidden files also
ii. -x output in multiple columns
iii. -r display file in reverse order
iv. -t sorts the files by time modified
v. -l list the files of current directory in long
format , including file permissions, size and date
❑ Eg.
ls –a note
⮚ cp
❑ Make copy of a file or directory
❑ Syntax
❑ cp [options] <filename> <newfilename>
❑ Options
i. -i warns before overwriting destination file
ii. -R copy entire directories along with content
❑ Eg.
cp –i chap1 unit2
⮚ mv
❑ move file from one place to another
❑ original file is removed
❑ used to rename file/directory
❑ Syntax
$ mv <old file> <new file>
❑ Eg
$mv data.txt target.txt
⮚ Rm
❑ Removes or delete one or more files
❑ Syntax
$ rm <file name>
❑ Options
-r Recursive deletion
-f forcing removal
-d directory deletion
❑ Eg
$ rm *
⮚ sort :
❑ Sort is an utility program that can used to sort
the text files in numeric or alphabetical order.
❑ Attributes : -n (ascending order, by default)
-r (descending order)
❑ Syntax :
$ sort [options] filename
❑ Example: if we have file named ‘colors’ then
⮚ File :
❑ Used to find the type of the data in the file
❑ Analyze the contents of the file.
❑ Example :
$ file first.c second.txt info.html
⮚ Find :
❑ Used to locate the file from the entire file
system.
❑ After locating, we can perform various
⮚ Head :
❑Used to display first n lines of the given file.
❑By default it takes 10 lines.
❑Example :
$ head -5 list.txt
⮚ Tail :
❑It is a counterpart of head command.
❑Used to display last n lines
❑By default it takes 10 lines.
❑Example :
⮚ Grep : (global regular expression printer)
❑It is one of the useful filters.
❑Used to search the specified text from
mentioned files and to display the lines on
screen which consist the supplied text.
❑Options :
❖ -c displays a count of
number of lines that
match
❖ -v displays the lines that
⮚ wc : word count
⮚ pwd
❑Display the path of current working directory
❑Syntax :
$ pwd
❑Example :
$ pwd
/usr/kumar
⮚ mkdir
❑Used to create a new directory/subdirectory in
the current directory
❑Multiple directories can be created with this
single command
❑Name of the directory must be less than 14
characters
❑Syntax :
$mkdir directoryname
❑Example :
⮚ rmdir
❑Used to remove the directory
❑Before deleting, make sure it is empty
❑If it contains sub-directories or files, then it
must be removed first using rm command
❑Syntax :
$rmdir [path] directoryname
❑Example :
$ rmdir usr/kumar/progs
❑Changes the present working directory to the
new directory
❑When used with arguments, it changes the
current directory to the directory specified as
arguments
❑Syntax :
$cd
❑Example :
$cd progs
$pwd
$/home/kumar/ progs
alias command
The name of a file can only be found in its directory; the file
itself doesn’t contain its own name or any of its attributes, like
its size or access rights.
File & inode
/sbin &/usr/bin If there is a command that we can’t execute but the system
administrator can, then it would be in one of these
directories.
/etc This directory contains the configuration files of the
systemYour login name and password are stored in files
/etc/passwd and /etc/shadow.
/tmp The directory where users are allowed to create temporary
files. These files are wiped away by the system regularly.
This directory contains all device files.
/dev These files don’t occupy space on the hard disk
“Less” is just like a “more” except that it has few extra features
such as allowing users to scroll backwards and forwards through
a displayed file. “less” is its standard pager.
But “less” does have one serious limitation. Unlike more (which
uses .) , it can not repeat the last command.
ln : link
❑Used to make a link between two files
❑A link allow a one directory to point to a file in
another directory.
❑Utilize less memory.
❑Two types of link :
❖Soft link (more flexible and reliable)
❖hard link
❑Syntax : ln [-options] {source} {link}
❑Options:-
Soft links
⮚ Hard Link is a mirror copy of the original ⮚Soft Link is a symbolic link to the original
file. file.
⮚Hard links share the same inode. ⮚Soft Links will have a different Inode
value.
⮚Any changes made to the original or Hard
linked file will reflect the other. ⮚A soft link points to the original file.
Even if you delete any one of the files,
nothing will happen to the other. ⮚ If you delete the original file, the soft link
fails. If you delete the soft link, nothing will
⮚Hard links can't cross file systems. happen.
echo */ | wc
Count only the directories in the current directory
echo *.* | wc
Unit 5
OWNERSHIP:
When you create a file , you automatically become its owner. The Third
column shows owner of all these files. Whatever GROUP you are in
when the file is created is placed in 4th columns . Being the files owner
gives the privilege of changing the file permission and ownership.
Users and Ownerships:
Files owner are set up by the system during installation.
Linux files are owned by ID’s such as root,bin.
We can use chown command(change ownership) command to change
the ownership of a file.
Syntax:
Continue..
Ex:
~$ ls –l myfile
-rwxrwxrw- 1 fido user 114 dec 7 14:31 myfile
Note:
changing ownership require SU permission, so first change our status to that of super user
with su
$ su
Password:*******
~$ ls –l myfile
-rwxrwxrw- 1 fido user 114 dec 7 14:31 myfile
Chgrp command is used to change the group the file belong to:
Chgrp <group> <filename>
No super user permission is required to change the group ownership.
Ex:
~$ ls –l myfile
-rwxrwxrw- 1 fido user 114 dec 7 14:31 myfile
Ex:
-rw-rw-rwx
UMASK Setting
⮚ The system administrator UMASK( users file creation mask)
setting for any users or the entire set of users on the system.
⮚ You can change you’re your UMASK setting But not that of others.
⮚ The system have default permission for all file and directories.
Relative:
When changing pemission in a relative manner chmod
Only changes the permission specified in the command line and leave the
other permission unchanged.
What is Shell ???
❑ Computer understand the language of 0's and 1's called binary language, In early
days of computing, instruction are provided using binary language, which is difficult
for all of us, to read and write. So in O/s there is special program called Shell. Shell
accepts your instruction or commands in English and translate it into computers
native binary language.
❑ Shell is a programme used to interface between the user and the Linux Kernel.
❑ Every command the user type at the programme on the screen is interpreted by the
Shell and then passed to the Linux Kernel .
❑ It has its own set of built –in –shell commands.
Working of Shell
✔ The shell can also make use of all the linux utility and application programs that are
available on the system.
✔ All the commands which a user enters at the command prompt are first interpreted
by the linux shell which is currently being used
✔ As a user, one does not know if the command is built-in to the shell or is a separate
programme .The shell interprets the command and forwards it for the further
execution.
✔ The shell fist check to see weather the command is one of its own built in
commands or it is an application programme.
✔ Application programme can be utility programs that are part of linux such as ls and
rm or they can be application programs that are either purchase commercially or
are available as public domain soft wares.
Working of Shell Programming
USER
Shell
command(cd,pwd,
kill )etc
Linux Kernel
How to start the Shell
⮚ Shell is a main method through which a user interacts with the Linux kernel
⮚ The shell is started after we successfully login to the system and it continues to
be the main method of interaction between the user and the kernel until we
logout
⮚ Each user on the system has a default shell .The default for each user is specified
on the system password file called /etc / passwd. The system password file
contain each persons user id, an encrypted copy of each users password and the
name of the program to run immediately after a user logs into the system.
Bash Shell
⮚ Linux has a variety of different shells:
Bourne shell (sh), C shell (csh), Korn shell (ksh), TC shell (tcsh), Bourne Again shell (bash).
⮚ Certainly the most popular shell is “bash”. Bash is the shell that will appear in the GNU
operating system. Bash is an sh-compatible shell that incorporates useful features from the
Korn shell (ksh) and C shell (csh).
⮚ Bash is not only an excellent command line shell, but a scripting language in itself. Shell
scripting allows us to use the shell's abilities and to automate a lot of tasks that would
otherwise require a lot of commands.
Diff B/w Programming & Scripting
Lang.
⮚ A Programming languages are generally a lot more powerful and a lot
faster than scripting languages. Programming languages generally start
from source code and are compiled into an executable. This executable is
not easily ported into different operating systems.
⮚ A scripting language also starts from source code, but is not compiled
into an executable. Rather, an interpreter reads the instructions in the
source file and executes each instruction. Interpreted programs are
generally slower than compiled programs. The main advantage is that
you can easily port the source file to any operating system. bash is a
scripting language. Other examples of scripting languages are Perl, Lisp,
Diff B/w Bourne Shell & CShell
Diff B/w Bourne Again & Korn
Shell
Command Line Completion
❑ When we enter commands into bash , the complete text of the command is not necessary in
order for the Shell to be able to determine What we want it to do.
❑ For example if we have following files and sub-directories:
news/.bin/,games/,mail/,simplefile test
❑ If we want change the current working directory to test sub-directory, we have enter the
command as:
cd test
but in bash we can just simply type t as follows:
cd t <tab key>
After typing the command press tab key is that bash can complete the command because test
is the only directory that begin with t.
Command mode actually execute until we press Enter Key.
Command History
⮚ Bash also support command history that means it keeps track of certain number
of previous commands that have been entered to the shell.
⮚ The number of command is given by the shell variable called HISTSIZE.
⮚ Bash stores the text of previous command in the history list .when we logged into
the account the history s initialized from a history file whose file name is set
using HISTFILE bash variable. The default file name of history file is .bash-
history and it is located in our home directory. since it is beginning with (.period)
that signifies into hidden file that appear into only with (-a) option with ls
command.
⮚ The simplest way of using the history list is with the up and down arrows
keys .which scroll through the commands that that have been previously entered
.
Wildcards
In the Linux CLI that task is just as simple to perform as moving only one
HTML file, and it's so easy because of the shell wildcards.
Wildcards are special characters that allow you to select filenames that match
certain patterns of characters. This helps you to select even a big group of
files with typing just a few characters, and in most cases it's easier than
selecting the files with a mouse.
Continue..
Redirection in linux
⮚ Most Linux commands read input, such as a file or another attribute for the
command, and write output.
⮚ By default, input is being given with the keyboard, and output is displayed
on your screen.
⮚ Your keyboard is your standard input (stdin) device, and the screen or a
particular terminal window is the standard output (stdout) device.
In Linux there are many redirecting operators
(File descriptors) some are shown below :
Suppose if u want to redirect the output of ls to a text file, then > redirection
operator is used.
Ex 1
$ ls - l myfile.txt > test.txt
Ex: 2
nancy:~> cat test1
some words
nancy:~> cat test2
some other words
nancy:~> cat test1 test2 > test3
Continue..
Ex 3:
$ who > user
To see the contents of file, we use Cat command
$cat user
Merry pts/1 May 13 08:20
John pts/2 May 14 09:10
File concatenation
To concatenate more then one file into single file we use
$ cat f1 f2 f3> f4
Grep Command :
The grep utility is one of the most useful filters in Unix. Grep searches line-by-line for a
specified pattern, and outputs any line that matches the pattern.
⮚ PS1 – Default interactive prompt (this is the variable most often customized).
⮚ PS4 – Prompt used when a shell script is executed in debug mode (“set -x” will
turn this on) default ="++"
Example :
Set a prompt like: [username@hostname:~/CurrentWorkingDirectory]$
PS1="[\u@\h:\w]\$ "
Continue…
Example :
PS3="Choose an option: “
select i in yes maybe no
do
# code to handle reply
done
which will output:
1) yes
2) maybe
3) no Choose an option:
Job Controls
Job control refers to the ability to control the execution behavior of a
currently running process. job is refer to move process b/w bg & fg.
There are various commands that can be used to control
processes.
You can put any commands each time bash is started into this initialization
file. Commands that are typically found in this file are alias commands and
variable initializations . The bash initialization file is named profile. Each
user who uses bash has a profile file in his home directory. This file is read
by bash each time it starts, and all of the commands contained within it are
executed..
Bash Commands
⮚ alias
The alias command can be useful if you want to create a 'shortcut' to a
command.
The format is alias name='command‘
Ex. > alias home='cd /home/dave/public_html‘
> alias chdir='cd'
> alias copy='cp'
⮚ bg
To move job to the background
⮚ cd
It allows you to browse the directory tree.
> cd directory_name
Continue..
⮚ fc :
The 'fc' utility lists or edits and re-executes, commands previously entered to
an interactive sh.
fc -l - Would list the history of commands on the computer similar to the
following:
2 grep –help
3 bg
4 fg
5 cd public_html
6 rm index.html
7 chmod 755 index.htm
⮚ fg:
VI EDITOR
● Vi text editor is default text editor of linux system.
● Type vi on the prompt to start vi.
● A blank screen appears
● In every line ~ (tilde) sign appears telling that line is empty of text.
● We can open file or list of files to edit with vi
vi file1 file2…..
Alternatively
vi +n filename
$ cat asong
Down I walk
by the bay ,
Where I can
hear the water.
Moving The Cursor
● Moving the cursor around in vi essentially involves the following four keys :
● (“) tells the yank command to overwrite the contents of the named buffer a.