Академический Документы
Профессиональный Документы
Культура Документы
Introduction to Linux
- Created by Linus Torvalds in response to his frustrations
with MINIX licensing
- First release was on October 5 1991
- Designed to be an open source, free, and easy to use
(somewhat)
- Distro, Shell, Root & Capitalization.
Linux Introduction
1: Navigation
5: Network Basics
It’s easy to pipe the output of a command into the input of another
Example: ls | more
ls : List files
General form: ls <argument><argument>
Common arguments:
List hidden directories: - a
List permissions (or long list): - l
Human readable format: -h
(Usually combined with –l)
cd : Change Directory
Common usage: cd <directory name>
Relative path names
Relative to where you currently are
Example: cd ..
• Important folders
• /var/log - This is where all Avaya logs are located
• /home – Location of home folder
• /tmp – Temporary folder that can be used to move
files
• /etc – System configuration
Clear : Clears the screen
Clears the screen
Usage: clear
VI:
I insert
dd delete the line (2dd delete 2 lines) the contents and modify them
x cut
IE: vi test
yw Yank pulls highlight word You can use the legend to move around in
Y Yank line these files.
:q! Quit
:w Write file
Lab 1 : Navigation
2: Ownership, Privileges,
Change, Modify.
File permissions
https://www.ics.uci.edu/computing/linux/file-security.php
Chown: Change ownership of file/dir
Description: This command allows you to change the owner of a file or directory.
-R is Recursive and will change the ownership of all subsequent files in the directory
Allows you to change the group as well
Useful options:
Enable line numbers: -n
Number nonempty output lines –b
Tac: Display contents of file in reverse
Displays the contents of a file with the newest events displayed first
Arguments:
<filename> Example: more <filename>
/ Search the text for a specific string
SPACE Advance to the next page
Can be called directly or data can be ‘piped to it’
Less : Page breaks (with navigation)
Less allows you to filter through large amounts of text with the added bonus of
being able to use arrow keys.
rm filename.txt
rmdir directoryname
5: Network Basics
SSH: Secure remote terminal
Uses strong encryption (AES 256) to provide a secure terminal shell
Can forward X sessions, and provide socks tunneling
General form: ssh username@hostname –p port
Ifconfig : Display network adapter info
Description: Allows for network interfaces to be configured
Displays statistics on RX/TX packets received
Shows IPV4 and IPV6 mac addresses
eth0.100: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>
mtu 1500
inet 172.22.23.56 netmask 255.255.255.0 broadcast
172.22.22.255
inet6 fe80::20c:29ff:fe41:26bb prefixlen 64 scopeid
0x20<link>
ether 00:0c:29:41:26:bb txqueuelen 1000 (Ethernet)
RX packets 409051 bytes 105465093 (100.5 MiB)
RX errors 0 dropped 299 overruns 0 frame 0
TX packets 68167 bytes 10118400 (9.6 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Network bridges
Layer 2 (OSI model) bridge
Allows for many virtual machine interfaces to be attached to one physical NIC
Used in System Platform
Route – Modify/Show routing information
A route modified with this command with not survive a reboot.
Shows routing information
Allows you to temporarily change a route
Nslookup : DNS resolver tool
Used to convert an IP address to a DNS hostname
General form: nslookup <domain name>
Ping: ICMP echo tool
Determines if a resource is ‘reachable’
Also has uses for VOIP engineers
Fields of interest
Rtt avg = delay
Mdev = jitter
Packet loss = loss
This should only be used as an indicator, and the results should never be
provided to a customer. QOS can easily skew these results
Netstat: Shows listening ports
Typically this tool would be used to determine if a service is actively listening
on a port
Options:
-l show listening ports
-t show only tcp
-u show only udp ports
-n do not resolve commonly used port names (display only the port number)
Arp: Address Resolution Protocol
ARP table contains the layer 2 MAC addresses and the corresponding IP
address.
ARP tool takes an IP address as an input, and returns the corresponding layer
2 MAC address
Arping
Tool is commonly used to detect IP conflicts.
Gratuitous arp requests are sent to an IP address. The response should come
from a single MAC address (only 1 device should have an IP at any given time).
If multiple devices reply, then you will see multiple MAC addresses in the
response.
Traceroute
Print the route packets trace to network host by sending ICMP “Time
Exceeded” messages to each host.
Can be easily blocked by a firewall (and it should be). Do not rely on it.
FTP/SFTP: Secure FTP
Uses the same encryption and ports as SSH
Used to transfer files between systems
Options:
put <filename>
get <filename>
Lab 5: Network Basics
6: Additional Linux
Process Details
Linux Kernel
Linux kernel is responsible for loading device drivers
Kernel writes logs to /var/log/dmesg
Systemd or init is called when the kernel is ready to
pass control to user-space.
Init and Systemd will always have process #1
Top – Shows system processes
Description: Top will show all system processes in a GUI like interface.
This is what a lot of hacker movies use when they want to show off Linux
Able to sort by CPU utilization, memory utilization, and process state
Linux Processes
Processes carry out tasks within the operating system
Multi-tasking occurs when processes fork child processes
Each process will have a ‘state’ associated with it
Running – Currently consuming CPU cycles
Waiting – Waiting for an event or resources
Stopped – Received a signal indicating that the process is to ‘stop’ or ‘pause’
Zombie – Not responding, or child process no longer has a parent
w – Shows logged in users
Description: Shows who is logged on and what they are doing
Example: bash# w
ps – Print process list
Description: Reports a snapshot of the current processes
Options:
-a Select all processes
-u Select user (if blank select all users)
-x Display all processes regardless if they have a tty
Example: ps –aux
Free: Shows memory information
Description: Displays the memory information for the system.
Kills the bash process with the PID (process ID) of 11131
uname: Print System Information
Description: Prints system information such as kernel version and hostname
Options:
-a All
-s Kernel-name
-o Operating system
du : Estimate file space usage
Description: Summarize disk usage of each FILE, recursively for directories.
Options:
-h Print output in human readable form