Linux Tutorial
Linux Tutorial
LINUX
TUTORIAL
LINUX TUTORIAL 2
Table of Contents
1. WHAT IS LINUX? .............................................................................................................................................................. 4
1.1. History of UNIX .......................................................................................................................................................... 4
1.2. History of LINUX ....................................................................................................................................................... 4
1.3. Why LINUX/UNIX .................................................................................................................................................... 4
1.4. Layers of LINUX/UNIX ........................................................................................................................................... 5
5. SHELL ................................................................................................................................................................................. 44
5.1. Built-in Commands ................................................................................................................................................... 44
5.2. Special Commands ................................................................................................................................................... 44
5.2.1Piping ....................................................................................................................................................................... 45
5.2.2 Command Seperator ............................................................................................................................................. 45
5.2.3Alias ......................................................................................................................................................................... 46
LINUX TUTORIAL 3
6. SHELL SCRIPTING........................................................................................................................................................ 47
6.1. Scripting ...................................................................................................................................................................... 47
6.2. Utilities ........................................................................................................................................................................ 47
6.2.1. Sort ......................................................................................................................................................................... 47
6.2.2. Join ........................................................................................................................................................................ 47
6.3. Shell Variables ......................................................................................................................................................... 48
6.3.1. Scalar Variables .................................................................................................................................................. 48
6.3.2 Array Variables ................................................................................................................................................... 48
1. What is Linux?
1.1 History of UNIX
v UNIX is an Operating System (OS).
v UNIX was developed about 40 years ago i.e., 1969 at AT&T Bell Labs by Ken Thompson
and Dennis Ritche.
v It is a Command Line Interpreter.
v It was developed for the Mini-Computers as a time sharing system.
v UNIX was the predecessor of LINUX.
U%er
1nterfec<?
Users
Library
Standard utility program
Shells editors compilers etc
mode
call Standard library
intertte.*
{open, close, read, write, fork, etc
3 "
Hardware
(CPU, memory,diskstterminals(etc)
1.4.1 Kernel:
v Kernel is the heart of the operating system.
v It is the low level core of the System that is the interface between
applications and H/W.
v Functions
• Manage Memory, I/O devices, allocates the time between user and
process, inter process communication, sets process priority
1.4.2 Shell:
v The shell is a program that sits on the as an interface between users and kernel
v It is a command interpreter and also has programming capability of its own.
v Shell Types
• Bourne Shell (sh) (First shell by Stephen Bourne)
• C Shell(sh)
• Korn Shell (ksh)
• Bourne Again Shell(bash)
LINUX TUTORIAL 6
2. Getting Started
v Use username and password for login.
v Login is user unique name.
v Linux is case sensitive.
v Password can be changed by the user at any time.
LINUX TUTORIAL 8
3. LINUX Commands
v Commands tell the operating system to perform set of operations.
v The syntax form of the commands are
Command options arguments
3.1Control Keys:
^S à Pause Display
^Qà Restart Display
^Cà Cancel Operation
^Uà Cancel Line
^Dà Signal end of file
^Và Treat following control character as normal character
3.2Getting Help:
v In LINUX/UNIX whenever you need help with a command type “man” followed by
the command name.
v The Syntax is
man [options] command
v Common options are
usage; man [-adfhktwW] [section] [-M path] [-P pager] [-S list]
[-m system] [-p string] name
-a à lists all the files and directories, even hidden ones which are preceded by (“.”)
-l à lists the size, creation date and permissions about all the files and directories in
the current directory
-d à lists the directory
-c à don’t create file if it already present
-f à force
-k à block Size
-R à recursive
-t à type
-V à version.
LINUX TUTORIAL 10
Command: ls
[rootSkacperGO llnux]$ Is
1 cpl.pl hello.pl listfn.pl replace.pl splitlist.pl
arrayfnO.pl* exl.txt md.pl* maplist.pl reuerse.pl subroutinel.pl
array.pl ex2.txt inputline.pl output.txt rpl.txt subroutine2.pl
copied_
file.txt fl.txt interpolation.pl popfn.pl rp2,pl tempsubroutine.pl
copyfile.pl greplist.pl joinlistfn.pl pushfn.pl shift.pl unshift.pl
[rootSkacperGO linux]$ |
Command: cd
v cd dir_name
Moves to directory called dir_name
v cd ~
Moves to your home directory
v cd ..
Moves one level hierarchy down from the current directory
v cd .. /../
Moves two level hierarchy down from the current directory
v cd -
Moves to your previous directory
xterm
[rootekacperGO linux]$ cd ..
[rootekacperGO deepak_dir]$ I
Command: mkdir
v To create a new directory use “mkdir”.
v Syntax: $ mkdir directoryname
v $mkdir –p dir1/dir2/dir3.
It will create the directory tree.dir3 will created under dir2 and dir2 is created
under dir1.
v $ mkdir dir5
$ cd !$ .
It will point the location of dir5.
root&kacper60:/root>iikdir dirl
root&kacper60:/root>cd !$
cd dirl
root&kacper60:/root/dirl>cd -
root&kacperGO:/root>rkdir dir2;cd dir2
root&kacper60:/root/dir2>|
k
A Shell I EDIT I Shell No. 2 I Shell No. 3 m Shell No. 4
Command: cat
v $ cat filename
It will display the contents of the file filename.
v $cat >flie1
Success is not a destination.
[Ctrl+d]
$
• The above command creates the file called file1 and you can enter the text
there only. After finishing your work press Ctrl+d (Press Enter after the
last line of your character to denote the end of the file).
• If file1 already exists then it over writes the contents of the file1.
• ”>” is called Redirection Operator.
v $cat >>flie1
It’s a progressive journey.
[Ctrl+d]
$ cat flie1
$ Success is not a destination. It’s a progressive journey.
• The above command is used to append more text to already existing file.
• The above command is used to write contents of the file1 and file 2 into
file3
LINUX TUTORIAL 14
Command: cp
v $ cp file1 file2
Copies file1 into file2
v Options:
-i à interactive
prompts before overwriting
-f à force
if an existing destination file cannot be opened, remove it and try again
-p à preserve
preserve mode, ownership, and timestamps
-R, -r à recursive
copy directories recursively
-u à update
copy only when the SOURCE file is newer than the destination file or
when the destination file is missing
LINUX TUTORIAL 15
Command: mv
Command: rm
Command: rmdir
Command: pwd
3.4.2Display Commands:
Command: less
Options
-c à clears the screen before displaying.
+n à starts printing from nth line
6 xterm
Kacper
Technology
VLSI
Software
Perl
Linux
Dot Net
Verilog
VHDL
C
C++
Java
Eel ipse
Websphere
linuxl.txt (END)
Command: head
v “head” displays the top part of a file.
v By default it shows the first 10 lines.
v -n allows you to change the number of lines to be shown.
v Syntax:$ head [options]filename
v Example: “head –n50 file.txt” displays the first 50 lines of the file.txt
£1 xterm
[root@kacper60 linux]$ head linuxi»txt
Kacper
Technology
VLSI
Software
Perl
Linux
Dot Net
Verilog
VHDL
C
[root@kacperGO linux]$ |
Command: tail
v Displays last 10(by default) lines of a file.
v Same as head command.
v Syntax:$ tail filename
Displays the last 10 lines from the ending
Command: more
v Read files and displays the text one screen at a time.
v Syntax:
$ more [options] filename
Options :
-c à clears the screen before displaying.
-n à displays the first n lines of the file. We can also see next lines by
pressing [Enter]
+n à displays the lines from nth line.
£)xterm BBS
[rootSkacperGO linux]$ Is -la / I more
total 95424
drwxr-xr-x 31 root root 4096 Jun 4 15:38 ./
drwxi-xr-x 31 root root 4096 Jun 4 15:38
-
Command: chmod
v If you own a file, you can change its permissions with “chmod”.
v Syntax:
$ chmod [user/group/others/all]+[permission] filename
Command: chgrp
Command: chown
chmod 7 7 7 filename
user group others
è Gives user, group and others r, w, x permissions
LINUX TUTORIAL 21
ESS
I[root@kacp(
[root@kacperGO linux]$ Is -1
total 124
-
Command: date
i
f Sxterm
[root@kacper60 linux]$ date
Sat Jun 6 16:01:15 1ST 2009
[rootekacperSO linux]$ |
Command: chsh
Command: passwd
v Set or change your password.
v Syntax:$ passwd [options]
fixterm SB®
[root@kacper60 linux]J passuid
Changing password for user root,
New UNIX password;
BAD PASSWORD; it is based on a dictionary word
Retype new UNIX password;
passuid; all authentication tokens updated successfully,
[rootQkacperGO linux]J |
Command: ps
v To view the processes that you are running.
v Syntax: ps [options]
v Example
$ ps –u username
Displays the process of the specified user
$ps –aux
Displays all processes including user and system process
$ps –aux |grep “user1”
Displays all the process of user1
fHxterm (IS
[root@kacper60 linux]$ ps
PID TTY TIME CMD
30380 pts/5 00:00:00 tcsh
30494 pts/5 00:00:00D ps
_
[root@kacperG0 linux]$
Command: top
v To view the CPU usage of all processes.
v Syntax:$ top
'
.
. ! JJ
top 16:11:52 up 2 days, 42 min, 6 users, load average: 0.00, 0.00, 0.00
-
Command: kill
v A user can only start/kill the process that have the user id.
v kill is used for terminating the process.
v Syntax: $ kill [-signal] [process id]
$kill -9 process id
It gives the guarantee that the process would be killed. It is stronger signal
called SIGKILL
$ kill 0
Terminates all current process except your shell
C xterm mm
root 3420 0.0 0.0 2420 408 tty4 Ss+ Jun04 0:00 /sbin/mingetty tt
root 3441 0.0 0.0 3300 408 tty5 Ss+ Jun04 0:00 /sbin/tningetty tt
[root@kacperG0 linux]$ ps -u
Darning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.3/FAQ
USER PID 2CPU 2MEM VSZ RSS TTY STAT START TIME COMMAND
root 3331 0,0 0.0 1764 408 ttyl Ss+ Jun04 0:00 /sbin/mingetty ttyl
root 3356 0.0 0.0 1496 404 tty2 Ss+ Jun04 0:00 /sbin/mingetty tty2
root 3357 0.0 0.0 1508 408 tty3 Ss+ Jun04 0:00 /sbin/mingetty tty3
root 3420 0.0 0.0 2420 408 tty4 Ss+ Jun04 0:00 /sbin/mingetty tty4
root 3441 0.0 0.0 3300 408 tty5 Ss+ Jun04 0:00 /sbin/mingetty tty5
root 3463 0.0 0.0 3116 408 tty6 Ss+ Jun04 0:00 /sbin/mingetty tty6
root 24009 0.0 0.0 4800 1660 pts/6 Ss+ 10:01 o:oo -tcsh
root 24649 0.0 0.0 6384 1688 pts/8 Ss+ 10:30 0:00 -bin/tcsh
root 24803 0.0 0.0 5584 1568 pts/3 Ss 11:27 0:00 -tcsh
root 25135 0.0 0.0 5800 1416 pts/3 S+ 11:43 0:00 bash
root 27578 0.0 0.0 5356 1680 pts/10 Ss+ 13:06 0:00 -tcsh
root 30380 0.0 0.0 5176 1916 pts/5 Ss 15:50 0:00 -tcsh
root 30508 0.0 0.0 3560 980 pts/5 T 16:12 0:00 top
root 30529 0.0 0.0 4336 772 pts/5 R+ 16:17 0:00 ps -u
[root@kacper60 linux]$ kill -
9 30508
[rootQkacper60 linux]$ |
Command: who
b xterm
[root@kacper60 linux]$ who
root ;0 Jun 4 15:31
root pts/5 Jun 6 15:50 (localhost)
root pts/6 Jun G 10:01 (192.168.1.208)
root pts/8 Jun 6 10:30
root pts/3 Jun 6 11:27 (192.168.1.208)
root pts/10 Jun 6 13:06 (192.168.1,167)
[root@kacper60 linux]$ |
Command: who am i
v Reports the details about the command user.
v Syntax:$ who am i
JJ US
[root@kacperGO linux]$ uho am i
root pts/5 Jun 6 15:50 (localhost)
[root@kacperG0 llnux]$ |
Command: whoami
v Reports the username of the command user.
v Syntax:$ whoami
(2 erm BE®
[rootQkacperGO linux]$ whoami
root
[root@kaoper60 linuxlJ |
v $df -h or df –kh
Gives the Available space mounted on file System
v $free
Gives the free space
O Shell - Konsole
root@k.acper60: /hoine/nithin>ls
cattest.txt rhdl/ regression/ textl.txt VMM s onet
_ _
vip froin kac90/
_ _
] « Shell
Fig 3.19 disk space commands
LINUX TUTORIAL 32
4 File System
v Linux files are organized by a hierarchy of labels, commonly known as hierarchy
structure.
v There are three types of files.
v They are
Ø Regular Files:
§ This contains a sequence of bytes that generally corresponds to code or
data.
Ø Directory Files:
§ Directory file contains an entry for every file and subdirectory that it is
placed.
Ø Device Files:
§ These files correspond to the printers or other devices connected to the
system.
john mary
portfolio
v Directory: /boot
/boot has all the files required for booting LINUX on system.
v Directory: /dev
/dev has the devices for all the files.
v Directory: /etc
/etc contains the configuration files of the various software.
Normally no one touch this directory.
v Directory: /home
/home is like My Documents in Windows.
This contains the username as the sub directory.
v Directory: /lib
/lib contains the libraries required fo r the system files.
v Directory: /lost+found
/lost+found contains the files which are damaged or which are not linked to
any directory
These damages are due to the incorrect shutdown.
v Directory: /mnt
This is the directory in which we mount the devices and other file systems.
v Directory: /opt
Here the optional softwares are installed.
v Directory: /root
The directory for the user root
LINUX TUTORIAL 34
Command: fgrep
Command: find
v The find command is used to find the files in the hard drive.
v By using the find command we can find the files by date and also we can
specify the range of times.
v Example: $ find /user/bin –type f –atime +100 –print
v We can also use find to show the postscript files in our directory.
v Example: $ find *.pl
v Syntax :$ find directory [options] [actions]
CI xterm
[rootlikacperGO linux]$ find **pl
arrayfnO,pi
array.pi
copyfile.pl
cpl,p1
greplist,pl
hello,pi
incUpl
input1ine.pl
i nterpo1at i on,p1
joinlistfn.pl
1istfn.pl
map1ist.pl
popfn,pl
pushfn.pl
replace.pl
reverse.pl
rp2.pl
shift,pl
splitlist.pl
subroutinel.pl
subrout i ne2.pi
tempsubrout i ne.p1
unshift,.pl
Command: locate
v The locate command is much faster than the find command.
v Finding a file using locate is faster when compared to the find command.
v The files are printed with the path if we use this command.
v Syntax:$ locate [search string]
ES xterm
[root@kacperGO linux]$ locate *.pl
/home/vanaj a/perl/list _
scalar array.pi
_
Command: wc
v $ wc[options] filename .
Gives the number of lines, words and characters in a file called filename
v wc –l filename
Gives the number of lines
v wc –w filename
Gives the number of words
v wc –c filename
Gives the number of characters
O Shell Konsole
root9kacper60: /hoiie/nithin>ls
cattest.txt rhdl/ regression/ textl.txt \rMM s on e t
_
v lp f r oii k a c 90 /
_ _ _
5 8 93 test color.v
_
root(9kacper60:/hore/nithin>cd sv
root@kacper60;/hore/nlthin/sv>ls |wc -1
68
root@kacper60; /hoiie/nithin/sv>|
M > a Shell
Command: sort
v It prints the lines of the file in sorted order.
v Syntax:
$ sort filename
65xterm BBS
[root@kacper60 linux]$ sort linuxl.txt
C
C++
Dot Net
Eclipse
Jaua
Kacper
Linux
Perl
Software
Technology
Verilog
VHDL
VLSI
Websphere
[root@kacperGO linux]$ |
Command: uniq
v Used to print the file by removing duplicate adjacent lines.
v Syntax: uniq filename
v Ex: $ uniq text
[root0kacper6O]Jcat text
SACHIN
DRAVID
DRAVID
SACHIN
GANGULY
GANGULY
KUMBLE
[root kacperGO]Juniq text
SACHIN
DRAVID
SACHIN
GANGULY
KUMBLE
[root0kacper6O]$sort text |uniq
DRAVID
GANGULY
KUMBLE
SACHIN
[root9kacper60]Juniq -u text
SACHIN
SACHIN
KUMBLE
[rootekacper60]$|
& M Shell
Command: touch
v Used to create empty file.
v Syntax :$touch file2
It will create the file called file2 of size zero bytes, if file2 doesn’t exist.
v Used to change the time stamps.(i.e. dates and times of the recent modification or
access)
v For example to change the last access time of file6 to 10:10 a.m. May 2, 2009, it can
be done in the following way.
O Shell - Konsole
[root@kacper60]Stouch text
[root©kacper60]$du -sh text
0 text
[rootekacper60]$ls -1 text
-
rw-r-r- 1 root root 0 Dec 9 12:37 text
[rootekacper60]$touch -d "2 May 2009 10:10" text
[root@kacper60]$ls -1 text
-
a Shell
Command: tee
D Shell - Konsole
& * Shell
Command: cmp
v This cmp command tests whether two files are identical and reports position of first
character.
v It shows 0 if they are identical, otherwise it shows 1.
v Syntax:
$ cmp filename1 filename2
JESxterm
[root@kacperGO linux]$ cmp exl.txt ex2.txt
exl.txt ex2.txt differ: byte 1, line 1
[root@kacperGO linux]$ |
Command: find
v This command is used to find the location of a file.
v Syntax: find path selection criteria
v Ex: $find . –name “top.v”
It will look for top.v in the current directory.
$find . –type d
Finds all directories.
$find . –type f
Finds all normal files
" "
, % M Shell
Command: diff
v $ diff filename1 filename2
It compare two files for differences .
v $vimdiff filename1 filename2 or sdiff filename1 filename2
It will display the two files side by side
'
J
l4uufi Ejdr 'r'PM > inut5 4Di[p Help
«rf v:
nil id).
it-al
'
-
I Mi
.I'bL;
19 h-'Ui
Myriti w B or >ej « y)
t±isiilir(\t tim ;\* b At k Vt U TJ:
a.
Dttf*T -
T
5. SHELL
v The shell is a unique and multi- faceted program.
v The shell is a command interpreter and a programming language in built.
v There are various types of shells.
v The commonly used shells are Bourne Shell (sh), C Shell (csh or tcsh) and Korn Shell
(ksh).
v The first shell is Bourne Shell (sh).
v These shells have their own built in functions which allow for the creation of the shell
scripts.
v Through the shell, user interacts with the kernel.
v The prompt for the Bourne shell is $ or # for the root user and the prompt for the C
shell is %.
v We can start shell and exit by using the CTRL+D.
v All shells use different syntax and provide different services.
5.2.1 Piping:
$ ls |wc –l
It will display number of files in the current directory. Here, the output of ls is
passed directly to input of wc, and ls is said to be piped to wc.
It will display last six lines of first of first ten lines. Like this we can connect
number of commands
5.2.3Aliases:
v Aliases are used to define shorthand for complex commands.
v The alias can be set and it be removed by using the unalias command.
v Syntax:
$ alias name command
$ unalias name command
v Example: $ alias cls clear
$ unalias cls clear
Bxterm US
[rootQkacperGO "]$ h
hostoryt Command not found,
[r-ootQkacperGO "]$ alias h history
[rootSkacperGO "]$ h
1 1G;59 unalias h history
2 1G:59 els
3 1G:59 h
4 1G:59 els
5 1G:59 h
G 1G;59 alias h hostory
7 1G:59 els
8 16:59 h
9 16:59 alias h history
10 16:59 h
[root@kaeper60 "]$ |
Fig. 5.1Alias
LINUX TUTORIAL 47
6. Shell Scripting
6.1Scripting:
v Shell scripting provides the solution to a task as a combination of the UNIX utilities.
v Here pipes and file handling are used to connect subtasks.
v Scripting uses advanced utilities such as sort, cut, paste, join, grep, sed, awk, etc.
6.2 Utilities:
6.2.1Sort:
v Sort records in file and the order default is ascending dictionary order.
v The available options for sort are
-t Field separator
-k Field to sort by
-n Use numeric order
-r Reverse direction
6.2.2 Join :
è Scalar variables.
è Array variables.
#! /bin/sh
echo “Enter the phrase \c”
read param
echo param = $param
Output:
$ ./filename.sh
Hello There
param = Hello There
#! /bin/sh
var1 = Kacper
var2 = Technology
echo $var1 $var2
Output:
$./filename.sh
Kacper Technology
LINUX TUTORIAL 50
v Example:
#! /bin/sh
echo $((5+5+5))
Output:
$./filename.sh
15
v The conditional if statement is present in present in sh shell and also in csh shell.
v Both shells have different syntax.
v Syntax:
if condition1
then command list if condition1 is true
elseif condition2
then command list if condition2 is true
else
command list if condition1 is false
fi
v Syntax:
if condition1) then
command list if condition1 is true
else if (condition2) then
command list if condition2 is true
else
command list if condition1 is false
endif
LINUX TUTORIAL 51
while condition
do
command list
break
continue
done
v One way to loop through a list of string values is with the for and foreach
commands.
v Syntax:
>>! Append output but overrides noclobber option of csh and creates the file if it
doesn’t already exist
| Pipe output to another command
Command: grep
[rootEkacperBO linux]$ |
Command: sed
sed works by sequentially reading a file into memory and then performs the
specified action.
.
%
. Shell Shell No. 2 x
v Example: $zip filename.zip [file1 file2 file3 ...] or [dir1 dir2 dir3 ...]
It will create a file named filename.zip containing all the files or
directories
$unzip filename.zip
It will copy all the files or directories from filename.zip into current
directory
v tar key[options] filename tar archive refer to man pages for details on creating,
listings and retrieving from archive files. These files can be stored in disk and tape.
v Example: $tar -cf filename.tar [file1 file2 file3… ] or [dir1 dir2 dir3...]
It will create a file named filename.tar containing all the files or
Directories
7.8 Applications
There are some frequently used applications or programs which may be invoked
through commands also. This will be useful particularly when user is working through
remote login. However, these commands will work only if the applications are installed.
v xpdf, kpdf and Acrobat Reader are viewers for Portable Document Format (PDF)
files
v Syntax: xpdf filename.pdf
kpdf filename.pdf
acroread filename.pdf
LINUX TUTORIAL 56
For OpenOffice
v oowriter is a viewer and editor for MS Office like document files.
v Syntax : oowriter filename.doc or filename.odt
It will open a file called filename.doc
oowriter
It will open new file
v oocalc is used to open and edit Spreadsheet like xls or sxc files .
v Syntax: oocalc filename.sxc or filename.xls
It will open a file called filename.sxc
oocalc
It will open new file
$firefox
It will open the browser
$opera
It will open the browser
LINUX TUTORIAL 57
7.9 Editors :
v Editors are the one by which we can edit the files.
v There are two types of editors and they are
èTextual editor.
èGraphical editor.
7.9.1 vi Editor:
v The vi editor is a visual editor.
v The vi editor is most commonly used editor in the LINUX.
v There are three modes in vi editor.
è Command mode
è Insert mode
è Command line mode
LINUX TUTORIAL 58
»ii v:
u ?! na.l .aC*).
I I.
.kill "I
.»<¥));
HC la
rut
'ID Ml;
KirtJj' HcrTUi.b.rel.y);
lUTjui v;
'
mlK - il" '
8. Keyboard Shortcuts
v [Ctrl] z :to suspend the process (moves the process into background ). bg can be
used to find the background jobs. fg can be used to bring the background
job into foreground.
v [Esc] p : find the last command that contains the letters you typed. For example
you had used this command sed ‘s/old1/new1/’ –e ‘s/old2/new2/’
filename earlier. If you want to use again no need to type the whole
command again instead yo u can type sed then press [Esc]p ,it will
display previous command.
9. Networking in LINUX
9.1 Network Addresses:
v The IP address of a host consists of two parts, network address and host address.
v Here the network address will be same for all nodes in the network.
v The host address is unique and it is for the host only.
v Example:
192.168.22.150
Here the network address is 192.168.22 and the host address is 150.
Command: ifconfig
v ifconfig sets the IP address and the subnet mask of the interface.
v It also used to activate and deactivate an interface.
v Command:$ ifconfig
JJ
Command: sftp
v Example
$ ls
and_gate.v fa.v Mem_ctr mux41.v SONET
$ sftp 192.168.1.167
Connecting to 192.168.1.167...
sftp> cd /hdd/backup
sftp> put fa.v /home/Kacper/
Uploading fa.v to /home/Kacper/fa.v
sftp> get /hdd/scratch/buglist.xls /home/Kacper/
Uploading buglist.xls to /home/Kacper/
sftp> quit
$ls
and_gate.v fa.v Mem_ctr mux41.v SONET buglist.xls
O Shell - Konsole
root@kacper60:/root>sftp 192.168.1.167
Connecting to 192.168.1.167...
sftp> put /home/test.txt /hdd
Uploading /home/test.txt to /hdd/test.txt
/home/test.txt 10OX 195 0 . 2KB/S 00:00
sftp> cd /hdd
sftp> Is test.txt
test.txt
sftp> get /hdd/test.txt /home/kacper
Fetching /hdd/test.txt to /home/kacper/test.txt
/hdd/test.txt 100% 195 0 . 2KB/S 00:00
sftp> quit
root@kacper60:/root>cd /home/kacper
root@kacper60:/home/kacper>ls test.txt
test, txt
root0kacpGr6O:/home/kacper -I
Command: ssh
v ssh (Secure SHell) is a program for logging into a remote machine and for
executing commands on a remote machine.
v Syntax: $ssh [-l login_name ] hostname
v Exampl: $ssh ip address
We can connect to that particular system
Command: netstat
fcxterm BBS
[root@kacper60 linux]$ netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flaps M5S Window irtt Iface
192.168.1*0 0 0 0 0
. . .
255.255.255.0 U 0 0 0 ethO
192.168.127,0 0 0 0 0
. . .
255.255.255.0 U 0 0 0 vmnet8
192.168.221.0 0 0 0 0
. . .
255.255.255.0 U 0 0 0 vmnetl
169.254.0.0 0 0 0 0
. . .
255.255.0.0 U 0 0 0 ethO
0 0 0 0
. . .
192.1G8.1.1 0 0 0 0
. . .
UG 0 0 0 ethO
[root@kacperG0 linux]$ |