Linux crash lecture by Andrey Lukyanenko

Similar documents
Linux Command Line Primer. By: Scott Marshall

Perl and R Scripting for Biologists

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

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

Linux Kung Fu. Ross Ventresca UBNetDef, Fall 2017

Basic Linux Command Line Interface Guide

Linux Systems Administration Getting Started with Linux

System Administration

Linux Kung Fu. Stephen James UBNetDef, Spring 2017

Welcome to getting started with Ubuntu Server. This System Administrator Manual. guide to be simple to follow, with step by step instructions

Computer Systems and Architecture

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

Lab 2: Linux/Unix shell

Computer Systems and Architecture

GNU/Linux 101. Casey McLaughlin. Research Computing Center Spring Workshop Series 2018

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

Unix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University

*nix Crash Course. Presented by: Virginia Tech Linux / Unix Users Group VTLUUG

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

IMPORTANT: Logging Off LOGGING IN

Basic Linux Command Line Interface Guide

Carnegie Mellon. Linux Boot Camp. Jack, Matthew, Nishad, Stanley 6 Sep 2016

Introduction to Unix The Windows User perspective. Wes Frisby Kyle Horne Todd Johansen

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

Command-line interpreters

Lab Working with Linux Command Line

Introduction: What is Unix?

Linux Essentials Objectives Topics:

UNIX Quick Reference

Introduction to the Linux Command Line January Presentation Topics

Linux Command Line Interface. December 27, 2017

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

Introduction to the shell Part II

CS370 Operating Systems

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

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

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

CS197U: A Hands on Introduction to Unix

Command Line Interface The basics

CSCM98 Lab Class #5 Getting familiar with the command line

Introduction to Linux

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

CS Fundamentals of Programming II Fall Very Basic UNIX

A Brief Introduction to Unix

unix intro Documentation

UNIX. The Very 10 Short Howto for beginners. Soon-Hyung Yook. March 27, Soon-Hyung Yook UNIX March 27, / 29

Introduction to UNIX Command Line

Introduction to UNIX/Linux

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

When talking about how to launch commands and other things that is to be typed into the terminal, the following syntax is used:

The Unix Shell & Shell Scripts

Unix/Linux Operating System. Introduction to Computational Statistics STAT 598G, Fall 2011

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX

Introduction to the Linux Command Line

Linux Kung-Fu. James Droste UBNetDef Fall 2016

Introduction to Linux

List of Linux Commands in an IPm

Connecting to ICS Server, Shell, Vim CS238P Operating Systems fall 18

Lec 1 add-on: Linux Intro

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.

Linux Bootcamp Fall 2015

Lab #9: Basic Linux Networking

Hitchhiker s Guide to VLSI Design with Cadence & Synopsys

Read the relevant material in Sobell! If you want to follow along with the examples that follow, and you do, open a Linux terminal.

A Brief Introduction to the Linux Shell for Data Science

Advanced Linux Commands & Shell Scripting

Introduction to Linux

Introduction to Linux

Useful Unix Commands Cheat Sheet

Recap From Last Time:

Chapter-3. Introduction to Unix: Fundamental Commands

CSE 390a Lecture 3. Multi-user systems; remote login; editors; users/groups; permissions

BGGN 213 Working with UNIX Barry Grant

Introduction to Linux

Mills HPC Tutorial Series. Linux Basics I

CS CS Tutorial 2 2 Winter 2018

CENG 334 Computer Networks. Laboratory I Linux Tutorial

Practical Session 0 Introduction to Linux

Network Monitoring & Management. A few Linux basics

Unix Tutorial Haverford Astronomy 2014/2015

Working with Basic Linux. Daniel Balagué

INTRODUCTION TO LINUX

Getting your department account

Introduction to Linux for BlueBEAR. January

Linux for Beginners. Windows users should download putty or bitvise:

Introduction To. Barry Grant

Introduction p. 1 Who Should Read This Book? p. 1 What You Need to Know Before Reading This Book p. 2 How This Book Is Organized p.

LAB #7 Linux Tutorial

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

Introduction to Linux Workshop 1

Unix Processes. What is a Process?

Introduction to UNIX. Introduction EECS l UNIX is an operating system (OS). l Our goals:

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

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

Linux at the Command Line Don Johnson of BU IS&T

Part 1: Basic Commands/U3li3es

Oregon State University School of Electrical Engineering and Computer Science. CS 261 Recitation 1. Spring 2011

ECE 471 Embedded Systems Lecture 10

CS Unix Tools. Lecture 2 Fall Hussam Abu-Libdeh based on slides by David Slater. September 10, 2010

Chap2: Operating-System Structures

Transcription:

Linux crash lecture by Andrey Lukyanenko T-110.5102 Laboratory Works in Networking and Security 20.1.2015 Otaniemi based on material of Miika Komu, 2013

Traversing Directories cd Change Directory Change to a directory Give the directory as an argument With no arguments, changes to your home directory pwd Print Working Directory Displays your curret working directory Use the tab key for auto-completion! 2 / 19

Files and Directories on Linux By default, all file names are case sensitive! Foo.txt is different than foo.txt (unless working with FAT32) Dot. Means current directory Example: find. Double dot.. The previous directory Example: cd.. Asterisk * Matches zero or more characters (use? for a single character) Example (list all files ending in txt ): ls *.txt 3 / 19

More on Files and Directories cp copy files cp source dest mv move files mv source dest rm remove file/dir rm file rm rf directory Use with care! ls list files mkdir make directory mkdir mydir head front of a file tail tail of a file tail /var/log/syslog default is 10 lines follow: -f 4 / 19

Access Privileges Check file permissions ls ld filename ls la Change file permissions chmod ugo+rwx User, Group, Others Add +, remove Read, Write, execute S = Set user id or Set group id (extra rights) What are my groups? groups Change ownership chown change user chgrp change group Switch to root shell su sudo s See also /etc/sudoers.d/ 5 / 19

Important directories Your personal home directory is tilde: ~ Usually maps to /home/myaccountname Superuser home directory is /root Temporary storage in /tmp Wiped out on reboot! Configuration files usually located in /etc Sometimes in /var (as with BIND DNS server) Log files in /var/log Important in diagnosing problems with services 6 / 19

Usage of Files What type of file is it? file filename displays file type System executables System applications: just type the command, e.g. ls Non-system applications:./my_binary Text files cat file displays the contents less file displays scrollable contents (q=quit) Text editors: nano, emacs, vi(m) 7 / 19

Searching for Files Locate Searches file names using a precreated index Fast, but may not be up-to-date Example: locate foo.txt Find Searches file names without a precreated index Slow but always up-to-date Example: find /etc name *cfg Grep Search file contents (always up-to-date) Example: grep r ssh /etc 8 / 19

Searching for Executables Where is tool xyz located? which xyz displays the path of xyz What was the tool related to keyword? man k keyword Note: manual pages describe command line use Start with the examples in the manual pages What was the command I used yesterday? history displays all typed commands 9 / 19

Installing software in Debian based Linux distributions aptitude or apt-get Use one of them but don t mix them! Here, the syntax is the same for both Searching aptitude search softwarename apt-cache search softwarename Installation aptitude/apt-get install softwarename Uninstalling aptitude/apt-get remove softwarename 10 / 19

Volumes and Disks mount attaches a volume to a directory umount detaches a volume df how full is the disk? Human readable: df h 11 / 19

Reading and Writing I/O Read from an unnamed input stream < grep abc <file Redirect normal output of a tool to a file > find. >file cat > foo.txt Ctrl+d ends stdin! Redirect error output of a tool to a file 2> find /etc 2>file Just redirect everything to a file find /etc >file 2>&1 Appending is >> echo foo >>file Note: > overwrites the file Piping find /etc less Stop/resume output Ctrl+s / Ctrl+q 12 / 19

Process Management Process running? ps axu grep ssh Or just top Kill process kill process id kill pidof processname killall processname Start in background & processname & Bring a background application to the foreground fg Put the application to the background bg Suspend: Ctrl+z Terminate Ctrl+c 13 / 19

Service Management Is cups service running? service cups status Stop cups service service cups stop Start cups service service cups start Stop + start cups service service cups restart Reload configuration service cups reload Old style invocation /etc/init.d/cups start In Debian, services are in /etc/rc2.d/ S start in boot runlevel tells the run level 14 / 19

SSH Access Login ssh user@hostname.domain Exiting: exit (if unresponsive, press alt-gr+~+.) Clear terminal: reset Upload: scp local_file user@remotemachine:dir/ Download scp user@remotemachine:remote_file. Recursive copy: -r Annoyed by password prompts? man ssh-keygen, man authorized_keys Make sure ~/.ssh permissions are correct! Spend 5 minutes now to set up, save countless minutes later! SSH tunneling / proxying (ssh L) 15 / 19

Miscellaneous System Information uname a (processor architecture) lsb_release a (linux release) Crontab execute binaries periodically Chroot (or jail) sandbox Execute processes in constrained environment Apparmor and SElinux security enhancements Screen Exiting ssh kills running processes Screen avoids this (e.g. for IRC sessions) - screen programname opens up the program inside a screen - Ctrl+a+d to detach - screen r to reattach - screen list lists all opened screen sockets TMUX Alternative for screen 16 / 19

Networking Commands 1 of 2 Recommended ip addr, ip neigh ip route ip xfrm ip iw Old skool ifconfig, arp route setkey (ipsec) iwconfig DNS look-up host dig nslookup (depr.) hosts file Firewall iptables ip6tables No DNS: -n flag ping, ping6, traceroute 17 / 19

Networking commands 2 of 2 Netmasks netmask nw/mask Traffic capture tcpdump wireshark Fine tune n/w stack /proc/sys/net /proc/net What service is up? netstat (local) nmap (remote) Web testing lynx wget (note r) curl Performance iperf, netperf t-stat, httperf, jperf 18 / 19

Questions? Was something missing?