0% found this document useful (0 votes)
12 views81 pages

Introduction To Linux

This document is an introductory course on Linux designed for beginners, covering fundamental concepts, common commands, and the structure of the Linux operating system. It includes sections on Linux history, architecture, file systems, and essential commands for file management and system navigation. Additional resources for learning Linux and instructions for downloading a Linux environment are also provided.

Uploaded by

dpsguard-buy8922
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views81 pages

Introduction To Linux

This document is an introductory course on Linux designed for beginners, covering fundamental concepts, common commands, and the structure of the Linux operating system. It includes sections on Linux history, architecture, file systems, and essential commands for file management and system navigation. Additional resources for learning Linux and instructions for downloading a Linux environment are also provided.

Uploaded by

dpsguard-buy8922
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

v

Introduction to Linux

Overview
Intended Audience

This course is designed for students who have little


or no experience with Linux.

By the end of this introductory course, students


will:
 Understand the fundamentals of Linux
 Log in to and operate a Linux operating system

[Link]
Course Agenda

 Section 1: What is Linux?


 Section 2: Common Commands
 Section 3: Users & Groups
 Section 4: Processes & Services
 Section 5: Basic Networking
 Section 6: Editing Tools

[Link]
Learning More About Linux

Additional tutorials and help with Linux can be


found from these sources:
Resource Link
[Link] [Link]

[Link] [Link]

Linux Foundation [Link]

nixCraft [Link]

[Link]
Downloading a Linux Environment

 [Link]
[Link]
Thank You!

© 2015 Cumulus Networks. CUMULUS, the Cumulus Logo, CUMULUS NETWORKS, and the Rocket Turtle Logo (the “Marks”) are trademarks and service marks of Cumulus
Networks, Inc. in the U.S. and other countries. You are not permitted to use the Marks without the prior written consent of Cumulus Networks. The registered trademark Linux® is
used pursuant to a sublicense from LMI, the exclusive licensee of Linus Torvalds, owner of the mark on a world-wide basis. All other marks are used under fair use or license from
their respective owners.

[Link]
v

Introduction to Linux

Section 1: What is Linux?


History of Linux

Linux was developed in 1991 by a Finnish student


named Linus Torvalds
“Linux” is actually just the kernel itself
Combined with the GNU project, which lacked a kernel,
to produce a complete and free (open source)
operating system
Linux and the GNU project together is commonly
referred to as “GNU/Linux”

[Link]
Linux Distributions

 Because GNU/Linux is open


source, various distributions
(“distros”) have been created
from that source code over the
years

 All of these feature the Linux


kernel

 The User Space in each of these


distros is often quite different,
depending on the needs and
wants of the group creating them

[Link]
Linux Kernel

The kernel is the core of the


Linux operating system
 Translates requests from user
commands and applications Linux
into hardware calls Kernel

 Additional capabilities can be


enabled with additional code
such as drivers and libraries CPU Disk NIC

[Link]
Linux Architecture

Applications run in two distinct areas of system


memory: kernel space and user space

3rd Party

SPACE
Librarie

USER
OS Customer /
s Tools Application
s

System
KERNEL
SPACE

Kernel Drivers Call


Handler

Hardware

[Link]
Hierarchical File System

The file system tree begins with the Root Directory


(“/”) and contains many sub-directories

bin boot home etc root dev usr opt var

cumulus rocket bin sbin

[Link]
Directory Roles

Different file systems hold specific data

user files
log files
/

etc home root usr var

cumulus rocket bin sbin

user commands
configuration files
administrator commands
[Link]
Files in Linux

Everything is a file in a /
Directory

Linux system
Directory: list of other files home dev
Regular file: user or system
disk
data cumulus partition

text file sda4

[Link]

[Link]
Path Names

home
Absolute Path: Relative Path:
/home/cumulus/[Link] cumulus [Link]

Only valid if the user is in


the /home/cumulus
directory
[Link]

[Link]
Linux Shells

The shell is a command line interpreter that


provides a user interface for a GNU/Linux operating
system
cumulus@leaf1$ echo $SHELL
/bin/bash
cumulus@leaf1$ echo $BASH_VERSION
4.2.37(1)-release
cumulus@leaf1$ cat [Link]
#!/bin/bash
echo Hello World
cumulus@leaf1$ bash [Link]
Hello World

[Link]
Thank You!

© 2015 Cumulus Networks. CUMULUS, the Cumulus Logo, CUMULUS NETWORKS, and the Rocket Turtle Logo (the “Marks”) are trademarks and service marks of Cumulus
Networks, Inc. in the U.S. and other countries. You are not permitted to use the Marks without the prior written consent of Cumulus Networks. The registered trademark Linux® is
used pursuant to a sublicense from LMI, the exclusive licensee of Linus Torvalds, owner of the mark on a world-wide basis. All other marks are used under fair use or license from
their respective owners.

[Link]
v

Introduction to Linux

Section 2: Common Commands


File Naming Conventions

Linux is case sensitive for both commands and file


names

Special characters may have functionality in the


shell
cumulus@leaf1$ ls
[Link]
cumulus@leaf1$ cat [Link]
#!/bin/bash
echo Hello World
cumulus@leaf1$ cat [Link]
cat:[Link]: No such file or directory

[Link]
Displaying the Current Directory

The pwd command is used to output the path of


the current working directory

cumulus@leaf1$ pwd
/home/cumulus

[Link]
Changing Directories

The cd command is used to change the current


working directory

cumulus@leaf1$ pwd
/home/cumulus
cumulus@leaf1$ cd /etc
cumulus@leaf1$ pwd
/etc
cumulus@leaf1$ cd
cumulus@leaf1$ pwd
/home/cumulus

[Link]
Listing Files in a Directory

The ls command is used to list the contents of a


directory
cumulus@leaf1$ ls
testdir [Link] [Link]
cumulus@leaf1$ ls -lhR
.:
total 12K
drwxr-xr-x 2 cumulus cumulus 4.0K Sep 14 03:05 testdir/
-rw-r--r-- 1 cumulus cumulus 7 Sep 14 03:05 [Link]
-rw-r--r-- 1 cumulus cumulus 125 Sep 14 03:05 [Link]

./testdir:
total 4.0K
-rw-r--r-- 1 cumulus cumulus 20 Sep 14 03:05 [Link]

[Link]
Viewing Hierarchical Directories

The tree command cumulus@leaf1$ cd /etc/cumulus/


cumulus@leaf1$ tree

shows the contents |-- acl


| |-- [Link]

of the current |
|
|-- [Link]
`-- policy.d

directory in a visual |
|
|-- 00control_plane.rules
`-- 99control_plane_catch_all.rules

hierarchy |-- datapath


| |-- README
| `-- [Link]
|-- [Link]
| |-- lsb-release
| `-- os-release
|-- init
| |-- accton_as4600_54t
...

[Link]
Using Special Characters

*: a wildcard which denotes zero or more characters


cumulus@leaf1$ ls testfile*
testfileA testfileB testfileC

“, ‘, and \: characters which remove (“escape”) the


special meaning of other characters
cumulus@leaf1$ ls "testfile*"
ls: cannot access testfile*: No such file or directory
cumulus@leaf1$ ls testfile\*
ls: cannot access testfile*: No such file or directory
cumulus@leaf1$ ls 'testfile*'
ls: cannot access testfile*: No such file or directory

[Link]
Creating a Directory

 The mkdir command is used to create a new directory


 The –p option makes sub-directories automatically
cumulus@leaf1$ mkdir levelone
cumulus@leaf1$ mkdir levelone/leveltwo
cumulus@leaf1$ mkdir -p levelone/leveltwo/levelthree/levelfour
cumulus@leaf1$ cd levelone/leveltwo/levelthree/levelfour/
cumulus@leaf1$ pwd
/home/cumulus/levelone/leveltwo/levelthree/levelfour
Made automatically using the –p option

 The rmdir command deletes directories


 Only empty directories can be removed
 The –p options removes parent directories
[Link]
Copying Files

The cp command is used to copy a file


 Use the –r option to copy a directory, including its
contents

cumulus@leaf1$ cp directoryA/[Link] directoryB/


cumulus@leaf1$ ls directoryB
[Link]
cumulus@leaf1$ cp -r directoryB/ directoryC
cumulus@leaf1$ ls
directoryA/ directoryB/ directoryC/
cumulus@leaf1$ ls directoryC
[Link]

[Link]
Moving Files

The mv command is used to move or rename a file


or directory
cumulus@leaf1$ ls directoryA
[Link]
cumulus@leaf1$ ls directoryB
cumulus@leaf1$ mv directoryA/[Link] directoryB/
cumulus@leaf1$ ls directoryB
[Link]
cumulus@leaf1$ cd directoryB
cumulus@leaf1$ mv [Link] [Link]
cumulus@leaf1$ ls
[Link]
cumulus@leaf1$ mv [Link] ../directoryA/[Link]
cumulus@leaf1$ cd ../directoryA/
cumulus@leaf1$ ls
[Link]
[Link]
Deleting Files

The rm command is used to delete a file or directory


 Use the –r option to remove directories and their contents
recursively

cumulus@leaf1$ ls
intro2linux/ levelone/ testdir/ [Link]
cumulus@leaf1$ rm [Link]
cumulus@leaf1$ ls
intro2linux/ levelone/ testdir/
cumulus@leaf1$ rm -r levelone/
cumulus@leaf1$ ls
intro2linux/ testdir/

[Link]
Displaying the Contents of a File

The cat command is used to display the contents


of a file
cumulus@leaf1$ cat [Link]
This is the text in the [Link] file!

Output is displayed to standard output, which


defaults to the screen in Linux

[Link]
Displaying the Contents of a Large File

The less command is used output the contents


of a file one screen at a time
cumulus@leaf1$ less /etc/network/interfaces

When used with the pipe character (|), more can


page output from any command
cumulus@leaf1$ ls –lR /etc | less

[Link]
Reading the Top of a File

The head command is used to display the first few


lines of a file
 Displays first 10 lines by default
 Use the –n option to specify how many lines to show
cumulus@leaf1$ head -n 2 /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5), ifup(8)
cumulus@leaf1$

[Link]
Reading the End of a File

The tail command is used to display the last few


lines of a file
 Use the –F option to watch a file being updated in real-time

cumulus@leaf1$ tail -F /var/log/messages


Sep 14 14:33:17 leaf1 : /usr/sbin/smond : : Temp2(MPC8541(CPU) Sensor): state
changed from LOW to OK
Sep 14 16:13:30 leaf1 : /usr/sbin/smond : : Temp2(MPC8541(CPU) Sensor): state
changed from OK to LOW
Sep 14 16:13:42 leaf1 : /usr/sbin/smond : : Temp2(MPC8541(CPU) Sensor): state
changed from LOW to OK

[Link]
Searching for Strings in a File

The grep command searches a file for specified


arguments
cumulus@leaf1$ cat [Link]
red
blue
purple
cumulus@leaf1$ grep purple [Link]
purple

grep can be used with the | character to search


standard output for patterns
cumulus@leaf1$ ls -l /etc | grep ssh
drwxr-xr-x 1 root root 4096 Sep 11 07:22 ssh/

[Link]
Accessing a Remote System

ssh (SSH Client) allows users to log into or run a


command on a remote systm
 Based on the Secure Shell (SSH) protocol

remote user name remote host

cumulus@leaf1$ ssh cumulus@leaf2

cumulus@leaf1$ ssh cumulus@leaf2 “ls /home/cumulus/”

[Link]
Transfering Files to Another System

Secure copy (SCP) allows you to transfer files


between hosts
 Based on the Secure Shell (SSH) protocol

remote user name remote host

cumulus@leaf1$ scp [Link] cumulus@leaf2:/home/cumulus/


Password:
[Link] remote directory
100% 258 0.3KB/s 00:00

[Link]
Man Pages

Linux systems have a


built in reference
manual, known as
“man pages”
 The man page to the
right is the result of
entering man man

[Link]
Thank You!

© 2015 Cumulus Networks. CUMULUS, the Cumulus Logo, CUMULUS NETWORKS, and the Rocket Turtle Logo (the “Marks”) are trademarks and service marks of Cumulus
Networks, Inc. in the U.S. and other countries. You are not permitted to use the Marks without the prior written consent of Cumulus Networks. The registered trademark Linux® is
used pursuant to a sublicense from LMI, the exclusive licensee of Linus Torvalds, owner of the mark on a world-wide basis. All other marks are used under fair use or license from
their respective owners.

[Link]
v

Introduction to Linux

Section 3: Users and Groups


The Linux Administrative Account - root

The top-level administrator in a Linux system is the


root account
 Also referred to as the root user or superuser
 Should be rarely used, as it has no security restrictions
on it
 The root user can do anything on the system
 May be disabled for security purposes

[Link]
Users

There are two types of users on a Linux system:


 System accounts – used for administrative purposes
 User accounts – allow users and administrators access to
the system
cumulus@leaf1:~$ cat /etc/passwd
root:x:0:0:root:/root:/bin/bash System
daemon:x:1:1:daemon:/usr/sbin:/bin/sh accounts
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
...
ntp:x:104:107::/home/ntp:/bin/false
User
snmp:x:105:108::/var/lib/snmp:/bin/false
cumulus:x:1000:1000::/home/cumulus:/bin/bash account

user name home default


user ID group ID directory shell
[Link]
Groups

Groups allow permissions to be assigned to


multiple users simultaneously
cumulus@leaf1:~$ cat /etc/group
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:
...
sudo:x:27:cumulus,rocket
...

Group name Group members

password Group ID (GID)


[Link]
What is sudo?

sudo allows a user to execute commands as


another user (typically root)

useradd –m rocket

sudo useradd –m rocket ✔

[Link]
Controlling sudo Access

By default, adding a user to the sudo group gives


privileged command access.
cumulus@leaf1:~$ cat /etc/group
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:
...
sudo:x:27:cumulus,rocket
...

[Link]
Changing Your Password

Use the passwd command to change your password


 Requires your previous password for security
 Can be used by the root user to change any password
without the previous password
cumulus@leaf1$ passwd
Changing password for cumulus.
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
cumulus@leaf1$ sudo passwd rocket
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
cumulus@leaf1$
[Link]
File Permissions

Permissions control what actions a user can take


on a file

Permissions can be viewed with the ls –l


command
cumulus@leaf1$ ls -l
size
total 4.0K
-rw-r--r-- 1 cumulus cumulus 5 Sep 14 02:23 [Link]

User Group Last File name


Permissions (owner) modified
date

[Link]
Understanding Permissions

Permissions are based on three object types:


 User – the owner of the file
 Group – the set of associated users
 Other – anyone else

Group
File type
-rwxrwxrwx
User Other
[Link]
Understanding Permissions

Permissions allow three actions:


 Read – see the contents of the file
 Write– change the contents of the file
 Execute – run the file as an executable

-rwxrwxrwx
[Link]
Permissions Examples

Which users could take which actions on files with the


following permissions?

 A file marked as rwxrwxrwx belonging to user cumulus


and group users:

 A file marked as rw-r--r-- belonging to user cumulus


and group users:

 A file marked as rw-rw---- belonging to user cumulus


and group users:

[Link]
Changing File Permissions

File and directory permissions can be changed


using the chmod command
 Specify the type of permission to change
• u (user), g (group), o (other), a (all)
 Specify how to change the permission
• + (add), - (delete), = (set)
 Specify which permission to change
• r (read), w (write), x (execute)

[Link]
Example: Changing File Permissions

cumulus@leaf1$ ls –l
total 0
-rw-r--r-- 1 cumulus cumulus 0 Nov 5 12:48 [Link]
cumulus@leaf1$ chmod g+x,o= [Link]
cumulus@leaf1$ ls -l
total 0
-rw-r-x--- 1 cumulus cumulus 0 Nov 5 12:48 [Link]
cumulus@leaf1$ chmod g-x [Link]
cumulus@leaf1$ ls -l
total 0
-rw-r----- 1 cumulus cumulus 0 Nov 5 12:48 [Link]
cumulus@leaf1$ chmod a=rw [Link]
cumulus@leaf1$ ls -l
total 0
-rw-rw-rw- 1 cumulus cumulus 0 Nov 5 12:48 [Link]

[Link]
Changing File Ownership

The user and group cumulus@leaf1$ ls -l


total 0
ownership of files and -rwx---rw- 1 cumulus cumulus 0 Sep 21 03:20
[Link]
directories can be cumulus@leaf1$ sudo chown rocket [Link]
modified using the cumulus@leaf1$ ls -l
total 0
chown and chgrp -rwx---rw- 1 rocket cumulus 0 Sep 21 03:20
[Link]
commands. cumulus@leaf1$ sudo chgrp users [Link]
cumulus@leaf1$ ls -l
 The –R option can be total 0
used to change -rwx---rw- 1 rocket users 0 Sep 21 03:20
ownership recursively [Link]

 Requires superuser
privileges
[Link]
Thank You!

© 2015 Cumulus Networks. CUMULUS, the Cumulus Logo, CUMULUS NETWORKS, and the Rocket Turtle Logo (the “Marks”) are trademarks and service marks of Cumulus
Networks, Inc. in the U.S. and other countries. You are not permitted to use the Marks without the prior written consent of Cumulus Networks. The registered trademark Linux® is
used pursuant to a sublicense from LMI, the exclusive licensee of Linus Torvalds, owner of the mark on a world-wide basis. All other marks are used under fair use or license from
their respective owners.

[Link]
v

Introduction to Linux

Section 4: Processes and Services


Viewing Processes – ps

The ps command is used to view a list of processes


running on the Linux system
cumulus@leaf1$ ps -ef cumulus
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 22:12 ? 00:00:00 init [3]
root 2 0 0 22:12 ? 00:00:00 [kthreadd]
root 3 2 0 22:12 ? 00:00:00 [ksoftirqd/0]
root 5 2 0 22:12 ? 00:00:00 [kworker/u:0]
root 6 2 0 22:12 ? 00:00:00 [migration/0]
...
root 1961 1 0 22:14 ? 00:00:00 /sbin/mstpd -v2
ntp 2003 1 0 22:14 ? 00:00:00 /usr/sbin/ntpd -p
/var/run/[Link] -g -U0 -c /var/lib/ntp/[Link] -u 104:107
root 2089 1 0 22:14 ? 00:00:00 /usr/bin/python
/usr/lib/python2.7/dist-packages/clcmd_server.py
cumulus 3873 2957 0 23:04 pts/0 00:00:00 ps -ef
[Link]
Modifying ps

Many options exist for the ps command --


some examples include:
Option Behavior
-f Shows the output in full
format
-e Shows all processes

-u <UID> Shows processes for a


specific user
-p <PID> Shows processes for a
specific process ID (PID)
-C <process_name> Shows processes of a
specific name

[Link]
Managing Services

Services are maintained by daemons, background


processes which maintain the service’s functions

Services can be controlled using the service


command:
service <service name> [ start | stop |
restart]

[Link]
Example: Managing Services

cumulus@leaf1$ ps -C lldpd
PID TTY TIME CMD
2277 ? 00:00:00 lldpd
2299 ? 00:00:01 lldpd
cumulus@leaf1$ sudo service lldpd stop
cumulus@leaf1$ ps -C lldpd
PID TTY TIME CMD
cumulus@leaf1$ sudo service lldpd start
cumulus@leaf1$ ps -C lldpd
PID TTY TIME CMD
24166 ? 00:00:00 lldpd
24184 ? 00:00:00 lldpd

[Link]
Controlling the System

The Linux system can be shut down or restarted


using the shutdown command
 Default behavior is to shutdown the system
 Use the –r option to reboot
 Use a time delay to run the command later
cumulus@leaf1$ sudo shutdown now
Broadcast message from root@leaf1 (pts/0) (Sun Sep 21 18:49:48 2014):

The system is going down for reboot NOW!


cumulus@leaf1$ Connection to leaf1 closed by remote host.
Connection to leaf1 closed.

[Link]
Thank You!

© 2015 Cumulus Networks. CUMULUS, the Cumulus Logo, CUMULUS NETWORKS, and the Rocket Turtle Logo (the “Marks”) are trademarks and service marks of Cumulus
Networks, Inc. in the U.S. and other countries. You are not permitted to use the Marks without the prior written consent of Cumulus Networks. The registered trademark Linux® is
used pursuant to a sublicense from LMI, the exclusive licensee of Linus Torvalds, owner of the mark on a world-wide basis. All other marks are used under fair use or license from
their respective owners.

[Link]
v

Introduction to Linux

Section 5: Basic Networking


Configuring the Hostname

Changing the hostname in Linux is a three-step


process:
 Edit the /etc/hostname file
 Assign the new hostname to the [Link]
address in the /etc/hosts file
 Reboot the switch

[Link]
Formatting /etc/network/interfaces Entries

Bring up interface during boot up


or after sudo ifup -a Interface name

inet type: dhcp, loopback or static


auto <int_name>
iface <int_name> inet <type>
<option> <value>
<option> <value>
...

[Link]
Defining eth0 in /etc/network/interfaces

eth0 – default configuration


dhcp inet type
auto eth0
iface eth0 inet dhcp

[Link]
Defining eth0 in /etc/network/interfaces

eth0 – with IP address

auto eth0
iface eth0 inet static
address [Link]/24 IP address settings for interface,
only if using static
address 2001:db8::1/32
gateway [Link] Install IPv4 and IPv6 default route
gateway 2001:db8::2

[Link]
Defining lo in /etc/network/interfaces

lo – loopback interface


Loopback inet type
auto lo
iface lo inet loopback
address [Link]/32
address 2001:da8::1/32

Optional IP address(es)

[Link]
Displaying Port State for all Interfaces and Specific Interfaces

cumulus@leaf1$ ip link show


1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
link/ether 08:9e:01:f8:90:7e brd ff:ff:ff:ff:ff:ff
3: swp1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 500
link/ether 08:9e:01:f8:90:80 brd ff:ff:ff:ff:ff:ff
4: swp2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 500
link/ether 08:9e:01:f8:90:80 brd ff:ff:ff:ff:ff:ff
...

cumulus@leaf1$ ip link show dev swp1


3: swp1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 500
link/ether 44:38:39:00:03:c1 brd ff:ff:ff:ff:ff:ff

cumulus@leaf1$ ip addr show dev swp1


3: swp1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 500
link/ether 44:38:39:00:03:c1 brd ff:ff:ff:ff:ff:ff
inet [Link]/30 scope global swp1
inet6 2001:DB8::1/126 scope global tentative

[Link]
Verifying IP Connectivity with ping

The -I option verifies connectivity through a


specific interface.
cumulus@leaf1:~$ ping -I [Link] [Link]
PING [Link] ([Link]) from [Link] : 56(84) bytes of data.
64 bytes from [Link]: icmp_req=1 ttl=64 time=0.825 ms
64 bytes from [Link]: icmp_req=2 ttl=64 time=0.750 ms ...

[Link]
Verifying IP Connectivity with traceroute

traceroute follows a packet to a target to


help determine where the routing fails.
cumulus@leaf1:~$ traceroute [Link]
traceroute to [Link] ([Link]), 30 hops max, 60 byte packets
1 [Link] ([Link]) 0.614 ms 0.863 ms 0.932 ms
2 [Link] ([Link]) 15.459 ms 16.447 ms 16.818 ms
3 [Link] ([Link]) 18.470 ms 18.473 ms 18.897 ms
4 [Link] ([Link]) 20.419 ms 20.422 ms 21.026 ms
5 [Link] ([Link]) 22.347 ms 22.584 ms 24.328 ms
6 [Link] ([Link]) 24.371 ms 25.757 ms 25.987 ms
7 [Link] ([Link]) 27.505 ms 22.925 ms 22.323 ms
8 [Link] ([Link]) 23.544 ms 21.851 ms 22.604 ms
...

[Link]
Verifying IP Routes with ip route

ip route show prints the current routing table.


ip route get prints the next hop for a route
cumulus@leaf1$ ip route show
default via [Link] dev eth0
[Link]/24 dev eth0 proto kernel scope link src [Link]

cumulus@leaf1$ ip route get [Link]/24


[Link] dev eth0 src [Link]
cache ipid 0x7b98 rtt 8ms rttvar 12ms cwnd 10

cumulus@leaf1$ ip route get [Link]


[Link] via [Link] dev eth0 src [Link]
cache

[Link]
Displaying the System ARP Cache

The arp command manages the kernel’s IPv4


network neighbor cache.
 To display the ARP cache:
cumulus@leaf1:~$ arp -a
? ([Link]) at 00:02:00:00:00:10 [ether] on swp3
? ([Link]) at 00:02:00:00:00:01 [ether] on swp4
? ([Link]) at 44:38:39:00:01:c1 [ether] on swp1

 To delete an ARP cache entry:


cumulus@leaf1:~$ arp -d [Link]
cumulus@leaf1:~$ arp -a
? ([Link]) at <incomplete> on swp3
? ([Link]) at 00:02:00:00:00:01 [ether] on swp4
? ([Link]) at 44:38:39:00:01:c1 [ether] on swp1

[Link]
Thank You!

© 2015 Cumulus Networks. CUMULUS, the Cumulus Logo, CUMULUS NETWORKS, and the Rocket Turtle Logo (the “Marks”) are trademarks and service marks of Cumulus
Networks, Inc. in the U.S. and other countries. You are not permitted to use the Marks without the prior written consent of Cumulus Networks. The registered trademark Linux® is
used pursuant to a sublicense from LMI, the exclusive licensee of Linus Torvalds, owner of the mark on a world-wide basis. All other marks are used under fair use or license from
their respective owners.

[Link]
v

Introduction to Linux

Section 6: Editing Tools


The nano Text Editor

Nano is a text editor that


behaves like a GUI-based
text editor
 Commands are executed by
keyboard shortcuts
 Common commands are
listed at the bottom of the
screen for easy reference

[Link]
The nano Help Screen

Press <ctrl>-g to show all nano commands

[Link]
Common nano Commands

Managing Files
Key Sequence Action
<ctrl>-o Save the current file

<ctrl>-x Exit nano (will prompt if Managing Text


save is needed
Key Sequence Action
<meta>-<ctrl> Copy current line into
buffer
<ctrl>-k Cut current line into buffer

<ctrl>-u Paste from buffer

<ctrl>-w Search for a string or


regex
<ctrl>-\ Search and replace

Note: <meta> is the <alt>, <meta>, or <esc> key, depending on the user’s keyboard mapping.
[Link]
The vi Text Editor

vi is a text editor included with all Linux


distributions
When using vi, the editor is in one of three modes:
 Command mode: all keys on the keyboard map to editor
commands
 Insert mode: the keys on the keyboard work as expected,
allowing users to input text into the file; press the Esc key
to return to command mode
 Command line mode: this mode is entered from
command mode by using the colon (:), allowing
commands to be typed at the bottom of the screen

[Link]
vi Modes
command mode command mode

vi [Link]

<esc>
I :wq
insert mode command line mode

[Link]
Common vi Keystrokes

Cursor Movement
Key Sequence Action
<down arrow> or j Move cursor down

<up arrow> or k Move cursor up


Entering Insert Mode
<left arrow> or h Move cursor left
Key Sequence Action
<right arrow> or l Move cursor right i Insert text at cursor
location
a Append text after cursor
location
I Insert text at the
beginning of the line
A Append text to the end of
the line
<esc> Exit insert mode

[Link]
Common vi Keystrokes

Managing Text
Key Sequence Action
x Delete character

dd Delete row
Using Command Line Mode
yy Copy row
Key Sequence Action
4yy Copy 4 rows into buffer :wq Write file and exit
(number can be changed)
p Paste from buffer :q Exit without saving
r Replace character (type in
replacement after)
cw Change word (type in
replacement after)

[Link]
vi Tutorial

[Link]
Thank You!

© 2015 Cumulus Networks. CUMULUS, the Cumulus Logo, CUMULUS NETWORKS, and the Rocket Turtle Logo (the “Marks”) are trademarks and service marks of Cumulus
Networks, Inc. in the U.S. and other countries. You are not permitted to use the Marks without the prior written consent of Cumulus Networks. The registered trademark Linux® is
used pursuant to a sublicense from LMI, the exclusive licensee of Linus Torvalds, owner of the mark on a world-wide basis. All other marks are used under fair use or license from
their respective owners.

[Link]

You might also like