Grades Please hand in your homework Quizzes coming back today Current grade on back with missing assignments Anything missing can be turned in late There.

Slides:



Advertisements
Similar presentations
A Guide to Unix Using Linux Fourth Edition
Advertisements

Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
PacNOG 6: Nadi, Fiji Using Commands in Linux Hervey Allen Network Startup Resource Center.
Editing with vi Or more fun than you thought you’d have without a mouse Prof. Chris GauthierDickey.
Cosc 4750 Getting Started in UNIX Don’t be afraid of the prompt, in linux it can be your best friend. In some cases, the only way to do certain things.
CIS 240 Introduction to UNIX Instructor: Sue Sampson.
VIM: The basics Tang Wai-Chung, Matthew (MaFai) 29/12/2006.
Working Environment - - Linux - -.
1 Using Editors Editors let you create and edit ASCII files UNIX normally includes two editors: vi and Emacs Vi and Emacs are screen editors: they display.
Starting Vi Opening an existing file vi filename Creating a new file vi filename In your workshop directory, create a new file called mysong vi mysong.
Introduction to Linux Workshop February Introduction Rob Lane & The HPC Support Team Research Computing Services CUIT.
CSCI 330 T HE UNIX S YSTEM Editing files. E DITOR C ONCEPTS Editing a file is to modify the content of a file Text editor: Enter and modify text in a.
Using the “CLI” Unix / Linux Preparation Course May 25 Djibouti.
Introduction to UNIX/Linux Exercises Dan Stanzione.
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
Chapter 3 Mastering Editors
Unix Basics Chapter 4.
– Introduction to the Shell 10/1/2015 Introduction to the Shell – Session Introduction to the Shell – Session 2 · Permissions · Users.
CENT 305 Information Systems Security Linux Introduction.
An Introduction to Unix Shell Scripting
Chapter Three The UNIX Editors. 2 Lesson A The vi Editor.
The UNIX development environment CS 400/600 – Data Structures.
Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.1 © Copyright IBM Corporation 2008 Unit 7 Editing.
Intro. To Unix commands For those who’ve never used Unix before Quick tutorial to let you move around your Unix Accounts No discussion of inner workings.
Using Commands Unix/IP Preparation Course July 19, 2009 Eugene, Oregon, USA
Agenda Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Review next lab assignments Break Out Problems.
Quiz 15 minutes Open note, open book, open computer Finding the answer – working to get it – is what helps you learn I don’t care how you find the answer,
UNIX Intro vi  vi is the standard UNIX text editor v Contents 1.Why use vi ? 2. vi Basics 3.Moving Around 4.Inserting Text.
Using Commands Unix / Linux Preparation Course May 6, 2012 Serrekunda, The Gambia.
Text editors Why should I use an editor ? It is very important to able to use at least one text mode editor a text mode editor is so useful on remote machines.
Unix Editors. u Editors in Unix come in two general flavours: –modal editors have "modes" v generally input mode and command mode –input mode allows entry.
Tony Kombol.  Why text edit?  Many programs and features require configuration ▪ Configuration is kept in files ▪ Usually in the /etc directory  Changes.
Text Editing February 2 nd, 2004 Class Meeting 3.
Chapter Three Text Editing1 System Programming Text Editing.
Unix Environment Input Output 2  List Content (ls) ◦ ls (list current directory) ◦ ls –all (include hidden files/folders)  Make directory (mkdir) ◦
VI EDITOR University of Mississippi. Vi Editor What is Vi ? ▫Vi is a screen based editor. ▫The screen of your terminal will act as a window into the file.
Homework & Review Questions? Everything after this is for accuracy – “All your permanent teeth are in, okay? You’re playing for keeps now!” -Psych Review:
Getting Started with Linux Linux System Administration Editors.
Introduction to Unix (CA263) File Editing By Tariq Ibn Aziz.
Lesson 4-Mastering the Visual Editor. Overview Introducing the visual editor. Working in an existing file with vi. Understanding the visual editor. Navigating.
Chapter Three The UNIX Editors.
Isecur1ty training center Presented by : Eng. Mohammad Khreesha.
Review Please hand in any homework and practicals Vim Scripting Inter-device communication.
PacNOG 6: Nadi, Fiji Editing, vi & Configuration Files Hervey Allen Network Startup Resource Center.
Using the “CLI” Unix / Linux Preparation Course June 9, 2013 Lusaka, Zambia.
Vi editor Pronounced: `vee eye‘’. Agenda Describe the background of vi Editor Use vi editor to: create text files edit text files Our Goal is to create.
PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Workshop III - Part A Shell Commands Professional Training.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
Creating Your Own Online Classroom MOODLE. Welcome Amy Basket – 17 years with Bay City Public Schools – Gifted and Talented Program – Volunteer Program.
Getting Started with Linux Linux System Administration Editors.
BIF703 FTP (File Transfer Protocol) Utility vi editor Utility.
CS 120 Extra: The CS1 Server Tarik Booker CS 120.
Intro to GNU/Linux See, Stallman? I said GNU. Are you happy now?
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
CS:414 introduction to Unix and Linux
Development Environment Basics
SUSE Linux Enterprise Desktop Administration
Vim basics Vi IMproved.
UNIX The Basics Source:
Guide To UNIX Using Linux Third Edition
Vi Editor.
Vim.
Vi Introduction Tony Kombol.
Linux System Administration Editors
Users and Accounts Lab 0.1. Users and Accounts Lab 0.1.
You do want to create and edit programs?
Chapter 2 Basic vi Editor.
CSE 303 Concepts and Tools for Software Development
The Emacs Editor Read: Forouzan, Appendix C
CSCI The UNIX System Editing files
Presentation transcript:

Grades Please hand in your homework Quizzes coming back today Current grade on back with missing assignments Anything missing can be turned in late There will be a 2 point penalty (as with late assignments) plus whatever you miss You can re-submit any assignment You must attach the original, and there will be a one-point penalty per re-submission (after the first)

Review Folders /var and /tmp Redirection Grep and command-line grouping

Today Folders /home/root/opt Advanced redirection Text editors (vi/vim) Scripting

Folders (/home) /home – user data Most accounts exist under /home useradd ndillon Will create /home/ndillon by default To not use /home you must specify this at the time the account is created useradd -d /var/log audit_user Individual users are then responsible for the structure of everything under /home/ Root user has a special home directory (/root)

Folders (/root) /root – root user’s home directory This is created on install Permissions lock down to only the root user Again, it is up to the admin (or admin team) to ensure structure of everything below this level I usually have a backups directory, some admins use this as a staging area (instead of /tmp)

Folders (/opt) /opt – application directory What is an application as it relates to a server? This is the directory these things should be installed in (unless well-known database or web server) If the company has more than 20 people, there’s a 90% chance it will install into /opt If the company has a decent Linux/Unix admin it will install into /opt If it doesn’t it’s a possible red flag that they don’t know ‘best practice’ or standards

Quick Aside – ‘Best Practice’ Does anyone know what this means as it relates to IT? It is in every specialization under “IT” For programmers there are ‘coding standards’ such as Google’s Java Standards For sysadmins it’s how to set up and architect the system For network admins it’s planning of a network, protocol handling, etc…

Redirection Quick Refresher – what do these do? | > < What are the three file channels? Standard

Advanced Redirection >> What happens when you use > on an already existing file? cat teams.txt > /tmp/teams2_copy.txt We can use >> to append cat teams.txt >> /tmp/teams2_copy.txt >> Leaves all data that was in the original file, find the “EOF” marker at the bottom, and copies the newly redirected STDIN below the original file

Advanced Redirection 2> We can also redirect standard error./script.sh will return an error./script.sh 2> err.out will redirect ONLY the error This is incredibly useful when debugging a script, especially one that has a lot of output So what do you think 2>> does?./script.sh 2>> /tmp/system_errors.txt

Advanced Redirection &> We can also redirect everything./script.sh will output STDOUT and STDERR./script.sh &> all.out will redirect everything Useful for “set it and forget it” tasks you’ve automated, or something that’s going to take a while So what do you think &>> does?./script.sh &>> /tmp/all_output.txt

Quick Demo

Text Editors On that note: text editors So we created a user, how do we let it run administrative commands? sudo - run single command as root To add our new user, we use a text editor There are three popular ones – vi, emacs, and nano You can use whatever you want, but the homework (and the test) will be on vi

Emacs - Probably Best emacs emacs teams.txt Has built-in menus, which make it easy to navigate Emacs is written in Lisp Built-in documentation and tutorial Full Unicode support (aka) Supported on Linux, BSD, Unix, Solaris, Windows, and Mac

Nano is also very good as well nano nano teams.txt Originally a byte-by-byte match of Pico Called TIP (TIP Isn't Pico – recursive name, like GNU – GNU's Not Unix) FYI – Linux admins are weird about GNU & GPL Now a 'superset' of Pico – includes Pico support, and more

VIM – Just Awful vi No nice menu Very common Two modes – 'command' and 'insert' Command mode allows saving, quitting, skipping around text, copying/pasting, replacing, the arrow keys, etc... Insert mode allows typing, deleting, etc... OLD ARCHIAC EVERYWHERE!

Guess What We’re Going to Use - vi Two modes: command and insert Very confusing Usually (USUALLY) INSERT appears in bottom left Insert mode – adding content to file (typing) Command mode – manipulating content copying, pasting, saving, moving, exiting, etc… I always assume I’m in INSERT mode, and press Esc a few times, then go back to what I was doing

Insert Mode We opened a text editor, we probably want to type The i key takes you into 'insert' mode – you can type wherever the cursor is a is 'append' – it will move the cursor over one space and then be in insert mode What else puts you into ‘insert’ mode? Once you’re in insert mode, you can type all you want until you press the escape key

Command Mode Type in vi, you start in command mode Already in vi, enter command mode by pressing, the escape key Then the colon key Save is :w Quit is :q Save & quit is :wq You only have to press escape one time Man vi (or Google ‘man vi’) What does :wq! do?

Quick Demo I will access vi by editing our teams.txt file I will show you I am in command mode by copying/pasting I will enter edit mode and undo my copy/paste by manually writing I will save the file I will save the file as a new file I will edit the file again, realize I didn’t want to edit it, and then discard my changes

Demo

Scripting What differentiates Linux with Windows A script is a file that holds multiple commands Starts at the top, works its way down Executes everything as if you were at the command line typing it in Does not stop on error – each line will be run Only needs one thing First line must be the ‘invocation’ of the shell #!/bin/bash

Simple Script What does this do? #!/bin/bash # this is a ‘comment’ and will not be run ls –alh > filelist.txt cp filelist.txt /tmp/ # ps –ef > /tmp/processlist

Own Study Folders – p81 Advanced Redirection – p135 Vi – Chapter 6, p159 Scripting – p284 (a bit inside Ch8)