commands exercises Linux System Administration and IP Services AfNOG 2015 Linux Commands # Notes

Similar documents
Network Monitoring & Management. A few Linux basics

Linux Systems Administration Getting Started with Linux

Linux Kung Fu. Ross Ventresca UBNetDef, Fall 2017

Using RANCID. Contents. 1 Introduction Goals Notes Install rancid Add alias Configure rancid...

CSE 303 Lecture 2. Introduction to bash shell. read Linux Pocket Guide pp , 58-59, 60, 65-70, 71-72, 77-80

Ticketing Service 1 Request Tracker (RT) Installation and Configuration

Linux Kung Fu. Stephen James UBNetDef, Spring 2017

Log Management Part 1: Using rsyslog

Sysinstall main menu. Move the cursor down by using the DOWN-ARROW and select Standard.

Introduction. What is Linux? What is the difference between a client and a server?

Exercise Sheet 2. (Classifications of Operating Systems)

Using RDP with Azure Linux Virtual Machines

Introduction to UNIX Shell Exercises

CS 460 Linux Tutorial

More Raspian. An editor Configuration files Shell scripts Shell variables System admin

Contents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version...

Post Ubuntu Install Exercises

Network Monitoring and Management Cacti Plugin Configuration and Use (Settings and Thold)

Lab Working with Linux Command Line

Introduction to the shell Part II

Installing LAMP on Ubuntu and (Lucid Lynx, Maverick Meerkat)

Linux Essentials Objectives Topics:

The Wonderful World of Services VINCE

No Food or Drink in this room. Logon to Windows machine

A Brief Introduction to the Linux Shell for Data Science

ELE409 SPRING2018 LAB0

Using LINUX a BCMB/CHEM 8190 Tutorial Updated (1/17/12)

Using UNIX. -rwxr--r-- 1 root sys Sep 5 14:15 good_program

The kernel is the low-level software that manages hardware, multitasks programs, etc.

Some Ubuntu Practice...

Unix Tutorial Haverford Astronomy 2014/2015

FreeBSD Installation ISOC/AfNOG

FreeBSD Installation

Perl and R Scripting for Biologists

CSE 390a Lecture 3. bash shell continued: processes; multi-user systems; remote login; editors

Linux Command Line Primer. By: Scott Marshall

Review of Fundamentals

LAB #7 Linux Tutorial

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering

bash Scripting Introduction COMP2101 Winter 2019

CSE 390a Lecture 2. Exploring Shell Commands, Streams, Redirection, and Processes

Exercises. Notes: Exercise 1. Install the Cacti Plugin Architecture (Cacti PA)

Introduction to Linux (Part I) BUPT/QMUL 2018/03/14

Lab 2: Linux/Unix shell

Embedded Linux Systems. Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island

CSE 391 Lecture 3. bash shell continued: processes; multi-user systems; remote login; editors

Week 5 Lesson 5 02/28/18

Hands-on Keyboard: Cyber Experiments for Strategists and Policy Makers

Computer Systems and Architecture

Tcpdump. For this exercise you must again be root. Login and obtain root privileges: Note that we use three computers for this exercise.

Getting Started With UNIX Lab Exercises

CSE Linux VM. For Microsoft Windows. Based on opensuse Leap 42.2

In this exercise you will practice working with HDFS, the Hadoop. You will use the HDFS command line tool and the Hue File Browser

HANDS UP IF YOU DON T HAVE A VM OR IF YOU DON T REMEMBER YOUR PASSWORDS. Or something broke

Introduction to UNIX command-line

Chapter-3. Introduction to Unix: Fundamental Commands

Introduction to UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines

CENG 334 Computer Networks. Laboratory I Linux Tutorial

Overview LEARN. History of Linux Linux Architecture Linux File System Linux Access Linux Commands File Permission Editors Conclusion and Questions

CS 143A. Principles of Operating Systems. Instructor : Prof. Anton Burtsev

Introduction to the Linux Command Line January Presentation Topics

Commands are in black

Unix as a Platform Exercises. Course Code: OS-01-UNXPLAT

CS Fundamentals of Programming II Fall Very Basic UNIX

UNIX COMMANDS AND SHELLS. UNIX Programming 2015 Fall by Euiseong Seo

EECS Software Tools. Lab 2 Tutorial: Introduction to UNIX/Linux. Tilemachos Pechlivanoglou

Brief Linux Presentation. July 10th, 2006 Elan Borenstein

CSE 390a Lecture 2. Exploring Shell Commands, Streams, and Redirection

CST Lab #5. Student Name: Student Number: Lab section:

Table of contents. Our goal. Notes. Notes. Notes. Summer June 29, Our goal is to see how we can use Unix as a tool for developing programs

Operating Systems Lab 1 (Users, Groups, and Security)

Introduction to Linux

First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion.

Introduction to Linux

Basic Linux Command Line Interface Guide

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX

Basic Linux Command Line Interface Guide

Introduction to Unix May 24, 2008

Ubuntu Practice and Configuration Post Installation Exercises interlab at AIT Bangkok, Thailand

Linux Bootcamp Fall 2015

Review of Fundamentals. Todd Kelley CST8207 Todd Kelley 1

Introduction to Linux Environment. Yun-Wen Chen

Introduction to Linux. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University

Introduction to remote command line Linux. Research Computing Team University of Birmingham

An introduction to Linux Part 4

Processes and authentication

Scripting Languages Course 1. Diana Trandabăț

COMS 6100 Class Notes 3

Intro to Linux. this will open up a new terminal window for you is super convenient on the computers in the lab

Overview. Unix/Regex Lab. 1. Setup & Unix review. 2. Count words in a text. 3. Sort a list of words in various ways. 4.

Part I. UNIX Workshop Series: Quick-Start

Operating System Interaction via bash

LOG ON TO LINUX AND LOG OFF

Linux Kung-Fu. James Droste UBNetDef Fall 2016

Monitoring Netflow with NFsen

Unix basics exercise MBV-INFX410

Command-line interpreters

LAB #5 Intro to Linux and Python on ENGR

CSE 303 Lecture 4. users/groups; permissions; intro to shell scripting. read Linux Pocket Guide pp , 25-27, 61-65, , 176

22-Sep CSCI 2132 Software Development Lecture 8: Shells, Processes, and Job Control. Faculty of Computer Science, Dalhousie University

Transcription:

Linux System Administration and IP Services AfNOG 2015 Linux Commands # Notes * Commands preceded with "$" imply that you should execute the command as a general user not as root. * Commands preceded with "#" imply that you should be working as root with "sudo" * Commands with more specific command lines (e.g. "RTR GW>" or "mysql>") imply that you are executing commands on remote equipment, or within another program. 1. Log in as the sysadm user using ssh username: sysadm password: <given in class> 2. Become the root user At the command prompt type the following command: $ sudo s Enter the sysadm password when prompted Now that you are root the command prompt will change. We indicate this using the # symbol. You are now the super user be careful! Ok, exit the root account: # exit $ 3. Look at the network configuration of your host $ cat /etc/network/interfaces Notice that configuration of your host is done using DHCP. "cat" is for "concatenate" and is one way to view what is in a file. 4. List files: Page 1

Use ls to list files: $ cd [go to your home directory] $ ls Do you see anything? Try this instead: $ ls lah What's inside one of these files? $ cat.profile $ less.profile $ clear Press q to get out of the less display. If you don't understand what cat, clear or less do, then type: $ man cat $ man clear $ man less 5. Working with the command prompt: You can recall previous commands by using the up arrow and down arrow keys. Give this a try now. Alternately, try typing this command: $ history If you wish to execute one of the commands in the list you saw type: $!nn Where nn is the number of the command in the history list. This is useful if you want to run a past command that was long and/or complicated. Command completion: With the bash shell you can auto complete commands using the tab key. This means, if you type part of a command, once you have a unique string if you press the TAB key the command will complete. If you Page 2

press the TAB key twice you'll see all your available options. Your instructor will demonstrate this, but give it a try by doing: $ hist<tab> $ del<tab><tab> $ rm <TAB><TAB> [Include the space after the rm ] 6. Working with pipes: We saw an example of using pipes when we sorted the contents of our /sbin directory during the presentation. What if you wanted to have this information available in a file and sorted? $ cd $ ls /sbin sort > sbin.txt Now view the contents of what is in sbin.txt to verify that this worked. $ less sbin.txt Press the "q" key to quit viewing the contents. 7. Finding text strings: Use the command grep to print lines matching a pattern in a data stream (such as a file). For example, view the entry for the sysadm account in the system passwd file: $ sudo grep sysadm /etc/passwd You should see something like: sysadm:x:1000:1000:system Administrator,,,:/home/sysadm:/bin/bash The previous items above are: userid:passwd:uid:gid:name,extrastuff,,:homedir:loginshell grep is often used with a pipe to FILTER the output of commands. For instance: $ history grep ls Page 3

Will display your previous use of the ls command from exercise 2. 7. Install a new software package (Apache) We will now instead the Apache web server on your machine: $ sudo apt get install apache2 Say "Y" or "Yes" if prompted. Once the apt program finishes you will have the Apache web server running on your machine. 8. Stopping and starting a service In a web browser go to your machine's home page: http://hostn.ws.nsrc.org/ You should see something like "It Works!" on the page. Now, let's stop the web server (Apache) that is installed on your virtual machine. To do this you can do: $ sudo service apache2 stop Now reload the web page for your machine. It should indicate that no web server was found. Now let's start the service again: $ sudo service apache2 start You can see if a service is running by typing: $ sudo service apache2 status If a process ID is displayed, then the service is running, but our next exercise will show you another way to verify this. 9. Finding and stopping processes If you wish to find something that is running and then stop it you can use the "ps" (process) command with "grep" and "kill". Let's do this by opening two connections to your virtual machine. Page 4

a. Using SSH open two terminal connections to your Linux server (user: sysadm machine: hostn.ws.nsrc.org) b. One you have opened two terminals go in to one terminal and type: $ tail f /var/log/syslog This will let you look at the end of the syslog log file in real time. If events take place that are logged you will see them as they happen. Now, in your other terminal let's look for this process: $ ps auxwww grep tail The "auxwww" are options to the ps (process) command. The options mean display all process running that belong to you and to other users and provide information about who owns what process. The three "www"'s mean display the entire command line regardless of how long it is and wrap it in your window. You will likely see something like this: root 6903 0.0 0.0 7200 612 pts/0 S+ 03:28 0:00 tail f /var/log/syslog root 6986 0.0 0.0 9388 924 pts/1 S+ 03:28 0:00 grep color=auto tail You could press "CTRL C" in the terminal window where the tail command is running, or to stop the process right now you can use the kill command. You need to replace the Process ID (PID) with the process ID number of the tail command running on your machine. In this example the number is "6903". At the command prompt type: $ kill NNNN Where NNNN is the PID of your tail process. Once you do this return to the other terminal screen. The "tail f" process should now have exited and you should see something like: Terminated sysadmt@hostn:~$ Page 5