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

Similar documents
Perl and R Scripting for Biologists

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

Brief Linux Presentation. July 10th, 2006 Elan Borenstein

Introduction: What is Unix?

EECS 470 Lab 5. Linux Shell Scripting. Friday, 1 st February, 2018

Introduction. Let s start with the first set of slides

EECS2301. Lab 1 Winter 2016

Introduction to Linux

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

Introduction to the shell Part II

UNIX Kernel. UNIX History

Unix/Linux: History and Philosophy

Introduction to Linux

INTRODUCTION TO LINUX

Unix Handouts. Shantanu N Kulkarni

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

Introduction to Linux

Command-line interpreters

CS246 Spring14 Programming Paradigm Notes on Linux

Linux Command Line Interface. December 27, 2017

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

System Administration

ScazLab. Linux Scripting. Core Skills That Every Roboticist Must Have. Alex Litoiu Thursday, November 14, 13

Systems Programming. The Unix/Linux Operating System

CST Algonquin College 2

Lec 1 add-on: Linux Intro

CISC 220 fall 2011, set 1: Linux basics

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

Overview of Unix / Linux operating systems

Introduction to Unix: Fundamental Commands

UNIX Concepts COMPSCI 386

CS 3410 Intro to Unix, shell commands, etc... (slides from Hussam Abu-Libdeh and David Slater)

Unix. Examples: OS X and Ubuntu

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

Linux Essentials. Programming and Data Structures Lab M Tech CS First Year, First Semester

Operating Systems. Copyleft 2005, Binnur Kurt

Operating Systems 3. Operating Systems. Content. What is an Operating System? What is an Operating System? Resource Abstraction and Sharing

CSC209H Lecture 1. Dan Zingaro. January 7, 2015

Linux & Shell Programming 2014

Today. Operating System Evolution. CSCI 4061 Introduction to Operating Systems. Gen 1: Mono-programming ( ) OS Evolution Unix Overview

Chap2: Operating-System Structures

Introduction to Linux

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

LAB #7 Linux Tutorial

Lecture 3. Unix. Question? b. The world s best restaurant. c. Being in the top three happiest countries in the world.

Exercise Sheet 2. (Classifications of Operating Systems)

Today. Operating System Evolution. CSCI 4061 Introduction to Operating Systems. Gen 1: Mono-programming ( ) OS Evolution Unix Overview

Getting your department account

GNU/Linux Course Lesson 1. Puria Nafisi

XSEDE Scholars Program Introduction to the Linux Environment. Tips and Tricks for Linux Users John Lockman III June 5 th, 2012

Crash Course in Unix. For more info check out the Unix man pages -orhttp:// -or- Unix in a Nutshell (an O Reilly book).

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

Welcome to Linux. Lecture 1.1

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

5/20/2007. Touring Essential Programs

NASA Lecture 2 (with lab) 2018/03/05 Michael Tsai Kai-Ling Lo

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

Linux Systems Administration Getting Started with Linux

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

CS 300. Data Structures

CS197U: A Hands on Introduction to Unix

Advanced Linux Commands & Shell Scripting

Unix System Architecture, File System, and Shell Commands

CS370 Operating Systems

CSCI 2132 Software Development. Lecture 3: Unix Shells and Other Basic Concepts

Essential Unix and Linux! Perl for Bioinformatics, ! F. Pineda

3/8/2017. Unix/Linux Introduction. In this part, we introduce. What does an OS do? Examples

Linux Operating System Environment Computadors Grau en Ciència i Enginyeria de Dades Q2

EECS 2031E. Software Tools Prof. Mokhtar Aboelaze

Introduction To Linux. Rob Thomas - ACRC

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

CSCI 2132 Software Development. Lecture 2: Introduction to UNIX and Unix-like Operating Systems

Introduction to UNIX. SURF Research Boot Camp April Jeroen Engelberts Consultant Supercomputing

CS356: Discussion #1 Development Environment. Marco Paolieri

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

Virtual Machine. Linux flavor : Debian. Everything (except slides) preinstalled for you.

Processes. Shell Commands. a Command Line Interface accepts typed (textual) inputs and provides textual outputs. Synonyms:

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

An Introduction to Unix Power Tools

Assume that username is cse. The user s home directory will be /home/cse. You may remember what the relative pathname for users home directory is: ~

UNIX System Programming Lecture 3: BASH Programming

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

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

Computer Systems and Architecture

CSE 390a Lecture 1. introduction to Linux/Unix environment

Chapter-3. Introduction to Unix: Fundamental Commands

SBGrid RELION Workshop 2017

Filesystem and common commands

CptS 360 (System Programming) Unit 2: Introduction to UNIX and Linux

Appendix A GLOSSARY. SYS-ED/ Computer Education Techniques, Inc.

Operating System Labs. Yuanbin Wu

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

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

Computer Systems and Architecture

Practical Computing-II. Programming in the Linux Environment. 0. An Introduction. B.W.Gore. March 20, 2015

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

Introduction in Unix. Linus Torvalds Ken Thompson & Dennis Ritchie

Lecture 01: welcome and intro what LSD and Unix have in common

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

Introduction to Linux

Transcription:

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

Brief History UNIX (1969) written in PDP-7 assembly, not portable, and designed for programmers as a reaction by Bell Labs to Multics (GE, MIT, and Bell) Ken Thomson developed B machine independent programming language Dennis Ritchie rewrote UNIX in C (1972) Multi-tasking, multi-user, time-sharing Two main flavors, BSD and System V All proprietary

Brief History Began as a server OS as a free (as in beer) alternative to UNIX Strictly speaking, only the kernel is Linux (1991), most of the software on linux systems is GNU (started 1983 by Richard Stallman, not free like beer) Monolithic kernel as opposed to a microkernel used in Minix (1987) and GNU Hurd (1990) huge debate online! https://en.wikipedia.org/wiki/tanenbaum%e2%80%93torvalds_debate GNU Hurd released 0.9 in 2016

Philosophy of UNIX Write programs that do one thing and do it well. Write programs to work together. Write programs to handle text streams, because that is a universal interface. -Peter Salus in A Quarter-Century of Unix (1994) A command is followed by flags and parameters separated by white space Pretty much every thing is treated as a file, and this allows a standard API for I/O on all linux systems

User Interaction Unlike DOS, MacOS, Windows, the user interacts with just another program Command line interaction via one of the many shells available (korn, csh, sh, bash, zsh you all should probable learn zsh, but I ll be talking about bash) Graphic User Interface via one of the many X11 windowing systems (gnome, KDE, Xfce) or Unity (in ubuntu, although they are going back to gnome)

If you want to play along If you're on windows, use putty to connect to hayesville.cs.unc.edu with your onyen and password. If you're on a mac, open terminal and connect with ssh. If you on linux, why are you here? ssh your-onyen@hayesville.cs..unc.edu Once you're there, you can run this command to see what shell you're running: echo $0

bash Brian Fox began bash in 1988 at FSF riffing off the bourne shell (sh) Bash is the Bourne Again shell Some commands you will use are baked into bash, most are not Bash is the default shell on hayesville. Our default in CS is tcsh, but we're changing that to bash. If you want a different shell with us, send email to help, but do some research into bash and zsh first. I recommend you go to zsh.

Filesystem No drive letters root of the filesystem is / --everything hangs off of that Files are represented by inode numbers. You can have softlinks and hardlinks / separates files and directories ls: lists the contents of a directory pwd: outputs the current path cd changes directories. means this directory,.. means this directory above tree: outputs the directory tree from where you are

Directories There's a lot of variety in usage /etc is for system wide configuration files /home is for home directories /media is where one usually mounts external media like USB sticks /tmp is for temporary files /dev stores handles to devices (which look like files)

Directories Where is software installed? /usr is where the distro software goes /opt is one place 3rd party software goes /usr/local is where software you build goes./bin and./sbin are for binaries and system binaries./etc is where most configuration files go

Try these Try running these commands in your terminal session on hayesville To see where you are: pwd To list your home directory showing all files/directories in long format: ls la To list files/directories in the dir above you: ls.. To see the files/directories at the top of the directory tree ls /

Try These List the contents of a file of a with cat: cat.profile Display a line of text with echo: echo "my beautiful string" Print out the number of lines, words and bytes in a file wc.profile Make a directory in your home dir: mkdir ~/temp-dir

Linux Filesystem Permissions Three permission groups: user, group, others Three permission types: read, write, execute Use the chown command to set the user:group for a file/directory: chown hays:wheel example-file.txt Use the chmod command to set permissions,: chmod u+x script.sh You can also set permission with octal numbers: r=4, w=2, x=1, So to set a file to permissions on file1 to read _rwxr, you would enter chmod 740 file1

root On hayesville, you have no administrative privileges If you did, you could run sudo to run commands as root: sudo apt update; sudo apt upgrade (The semicolon ends a command string, so that s two commands) You can also become root: sudo i

Key Concept: Standard I/O One input stream, one output string and maybe one error string stdin, stdout, stderr Originally keyboard and screen, but then abstracted Can be redirected remember pretty much everything is treated as a file This command echoes the string inside the quotes into a file named tmp.txt: echo "This nice string goes into a file" > tmp.txt Use >> to append to a file Input can also be redirected: cat < tmp.txt What happens if you type this: > tmp.txt

Key Concept: Pipes You can use the character to pipe the output of one command to another This line uses the ls command to list files and the output is passed to sed, which replaces each a, e, i, and o with a u: ls -la sed -e "s/[aeio]/u/g" The -a with ls outputs all files files beginning with a dot are usually hidden sed is Streaming Editor, you use it to edit a text stream

Processes Running progams are called processes, and they can be parents/children Add & to the end of a command to throw a process in the background ps -A will show a list of all processes ps -f will show a list of processes in fuller format, -F even fuller format top shows the most active processes in a list that updates Processes run under a user, real or system, and have process IDs kill is a program used to force a process to stop ^c will try to stop the foreground process

Misc Tab expansion History tail less find grep

Going further man pages! Read this: http://catb.org/~esr/faqs/smart-questions.html Check out the sources at the end of the slide deck If you want to play with ubuntu, you can download the stock image, burn it to an optical disk and boot to that and play with it live. Even better, download virtual box from Oracle and install ubuntu in a virtual machine (we can do a talk on that if there s interest). After it's installed make a snapshot. Whenever you get ready to try something new, make a snapshot. Snapshots are your new best friend.

One more thing Our home dirs on most cs machines and the ones on login.its.unc.edu are in in AFS, which is not part of the standard filesystems used in linux. In afs, unix file system permission settings are almost meaningless, afs has it's own set of Access Control Lists and control access to directories including home directories. More info on AFS and our systems is in the help articles on the cs.unc.edu web site

Reading https://en.wikipedia.org/wiki/gnu/linux_naming_controversy http://www.tldp.org/guides.html https://www.tecmint.com/subscribe-to-blog/ https://web.archive.org/web/20120131042028/http://code.google.com/ed u/tools101/index.html https://linuxconfig.org/ https://www.server-world.info/en/

Training http://cs.unc.edu/help-article/it-training-opportunities/ Next week, we have an intro to git talk. Knowing a bit about git is a prereq for the workshops on the CloudApps (docker) system we ll have later this semester. lynda.com has some nice courses on git