Command Line Interface (CLI) CSCI N321 – System and Network Administration Copyright © 2000, 2011 by Scott Orr and the Trustees of Indiana University.

Slides:



Advertisements
Similar presentations
RH030 Linux Computing Essentials
Advertisements

Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
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.
ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Jan. 27 th, 2009 Essential Unix Commands.
Introducing the Command Line CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
Working Environment - - Linux - -.
T UTORIAL OF U NIX C OMMAND & SHELL SCRIPT S 5027 Professor: Dr. Shu-Ching Chen TA: Samira Pouyanfar Spring 2015.
Very Quick & Basic Unix Steven Newhouse Unix is user-friendly. It's just very selective about who its friends are.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE1 Unix Comp-145 C HAPTER 2.
Linux Shell. 2 Linux Command-Line Interface ■ Linux shells: A shell is a command interpreter that allows you to type commands from the keyboard to interact.
Linux Commands LINUX COMMANDS.
L INUX C OMMAND L INE I NTERFACE G UNAANBAN.G
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
1. This presentation covers :  User Interface Administration  Files System and Services Management 2.
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
Introduction to Linux Operating System Tutorial 1
Help session: Unix basics Keith 9/9/2011. Login in Unix lab  User name: ug0xx Password: ece321 (initial)  The password will not be displayed on the.
Unix Primer. Unix Shell The shell is a command programming language that provides an interface to the UNIX operating system. The shell is a “regular”
Chapter 9 Part II Linux Command Line Access to Linux Authenticated login using a Linux account is required to access a Linux system. The Linux prompt will.
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
Unix Basics Chapter 4.
Cmsc 312 Operating Systems. UNIX? DOS – PC? VAX/VMS - mainframe Unix – PC, workstation, mainframe 1970 bell Lab For computer scientist? Why popular? Free.
UNIX and Shell Programming (06CS36) Unit 1 Continued… Shrinivas R. Mangalwede Department of Computer Science and Engineering K.L.S. Gogte Institute of.
PROGRAMMING PROJECT POLICIES AND UNIX INTRO Sal LaMarca CSCI 1302, Fall 2009.
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
UNIX Commands. Why UNIX Commands Are Noninteractive Command may take input from the output of another command (filters). May be scheduled to run at specific.
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.
Second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands cal – will print a calendar.
Introduction to UNIX Road Map: 1. UNIX Structure 2. Components of UNIX 3. Process Structure 4. Shell & Utility Programs 5. Using Files & Directories 6.
BIF713 Basic Unix/Linux Commands Getting Help with Commands.
November 5, 2015CIS 118 Intro to UNIX What’s a Unix? Unix is an Operating System Designed for high-traffic usage Many variants –Linux, BSD: free versions.
Tera Term Brian Smith Chris Vasse Zaheemat Adetoro William Newton Tom Presgraves.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: whereis, which, whoami, finger, passwd, cal, date Working with Files: cat, more, less.
1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: which, passwd, date, ps / kill Working with Files: file, touch, cat, more, less, grep,
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 2a – A Unix Command Sampler (Courtesy of David Notkin, CSE 303)
Linux Commands C151 Multi-User Operating Systems.
CS 245 – Part 1 Using Operating Systems and Networks for Programmers Jiang Guo Dept. of Computer Science California State University Los Angeles.
UNIX filesystem CS 2204 Class meeting 2 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
Linux A practical introduction. 1)Background and Getting Started Linux is an operating system with multiple providers Red Hat/CentOS (our version) Ubuntu.
1 Introduction to Unix. 2 What is UNIX?  UNIX is an Operating System (OS).  An operating system is a control program that helps the user communicate.
A Brief Overview of Unix Brandon Bohrer. Topics What is Unix? – Quick introduction Documentation – Where to get it, how to use it Text Editors – Know.
The Unix File sytem. Introduction Tree structure …
Linux Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
Learning Unix/Linux Based on slides from: Eric Bishop.
UNIX Basics Matt Hayward October 18, 2016 LS560 – Information Technology for information professionals.
UNIX To do work for the class, you will be using the Unix operating system. Once connected to the system, you will be presented with a login screen. Once.
Tutorial of Unix Command & shell scriptS 5027
Getting started with CentOS Linux
Linux 101 Training Module Linux Basics.
Linux Commands Help HANDS ON TRAINING Author: Muhammad Laique
Andy Wang Object Oriented Programming in C++ COP 3330
Some Linux Commands.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands:
CSE 374 Programming Concepts & Tools
Tutorial of Unix Command & shell scriptS 5027
Tutorial of Unix Command & shell scriptS 5027
Tutorial of Unix Command & shell scriptS 5027
Getting started with CentOS Linux
Andy Wang Object Oriented Programming in C++ COP 3330
UNIX/LINUX Commands Using BASH Copyright © 2017 – Curt Hill.
Linux Shell Script Programming
Linux Commands LINUX COMMANDS.
January 26th, 2004 Class Meeting 2
Presentation transcript:

Command Line Interface (CLI) CSCI N321 – System and Network Administration Copyright © 2000, 2011 by Scott Orr and the Trustees of Indiana University

Section Overview X Windows Consoles and Terminals UNIX Commands UNIX Filesystem vi Editor

References CQU COIT13146 System Administration Course Chapter 4 Chapter 5

X Windows Familiar GUI interface Virtual screens Remote applications X-Terminal Windows Multiple concurrent session Scroll bars Cut, Copy & Paste

X Managers & Environments X Window Managers Very configurable A lot of variety GUI login mode X Window Environment Fully integrated environment Window manager runs within the environment

Why use the command line? Always available GUI not installed/working Remote sessions More efficient More powerful Better understanding of what is happening

UNIX Terminals Old Days Hardwired – serial connections Modems – remote connections Network – telnet Console Monitor/keyboard/mouse on system Boot/error messages display Headless servers

Virtual Consoles in Linux Multiple sessions on one console Special Consoles Console 1 – default console Console 7 – X Windows Toggling between consoles Text mode - X Windows - : Function Key (n = 1.. 7)

Basic Philosophy 10% of work solves 90% of problems Smaller is better Portability Solve at right level Be Creative!!!

Command Anatomy 101 command [-switches] [arg1] [arg2]… Command: Name of the program Switches: Modify command’s behavior Windows typically uses “/” instead of “-” Arg#: Arguments passed to command

Getting Help Online manual available Searchable Command/File name Type/Section Keyword Not always easy to understand

Man Page Sections LinuxContents 1User commands 2System calls 3Library calls 5File formats 7Misc. files and documents 6Games and demos 4Devices/Network protocols 8Administration commands 9Kernel specs/interfaces (?)

Using man man command Look up command man n intro Contents of section n man –k string Search short descriptions ( apropos ) man –K string Search all man pages for string

Account Related Commands login Start session passwd Change Password logout / exit Close session

File/Directory Commands Files cp – Copy mv – Move/Rename rm – Remove cat – View all more – View page less – View page Directories ls – List contents mv – Move/Rename cd – Change Dir pwd – Current Dir mkdir – Create rm/rmdir – Remove

Copies, moves, and renaming cp file1 file2|dir1 Copy file1 to file2 or into directory dir1 cp –r[p] dir1 dir2 Copy directory dir1 to dir2 mv file1 file2|dir1 Moves file1 to file2 or into directory dir1 Renames file1 to file2 if both in same directory

Viewing files cat file1 Display the contents of file1 to the screen more file1 Display the contents of file1 one screen at a time less file1 Same as more but more powerful

Removing files and directories rm file1 file2... Removes list of files rmdir dir1 Removes dir1 only (if it is empty) rm -r dir1 Removes dir1 and all subdirectories/files VERY Dangerous!!!

Other directory commands ls [-la] [file/dir list] Lists files in a directory mkdir dir1 Creates directory dir1 cd dir1 Makes dir1 the current directory pwd Displays the current directory path

Windows (MSDOS) File/Directory Commands Files copy – Copy move – Move rename - Rename del – Remove type – View all more – View page Directories dir – List contents xcopy – Copy move – Move rename - Rename cd – Change Dir md/mkdir – Create rmdir – Remove

Linux Filesystem Hierarchy / (root) binvardevlibusrrootbootetchomesbinscottbobalicen321public_htmlmailbinsbinlocaltmplibmanlibsrcsharebin

So many bins… / (root) binusrsbinbinsbinlocalsbinbin bin directories: User programs sbin directories: System programs /bin & /sbin – Needed at boot time /usr/bin & /usr/sbin – available when system fully operating

Windows Files/Directories UNIX/LinuxWindows /usr%SystemRoot% (C:\Windows) /bin & /usr/bin %SystemRoot%\System32 /dev%SystemRoot%\System32\Drivers /etc %SystemRoot%\System32\Config Windows Registry ( regedit ) /tmpC:\Temp /var/spool%SystemRoot%\System32\Spool Source: Principles of Network and System Administration by Mark Burgess

Windows Registry Hierarchical database of all system settings Regedit Organization Hives – Top level Keys – Individual settings within a hive HKEY_LOCAL_MACHINE HKEY_CLASSES_ROOT HKEY_CURRENT_CONFIG HKEY_CURRENT_USER HKEY_USERS

Relative & Absolute Paths Absolute Path Given from “root” directory Example:  /usr/local/bin (Linux)  c:\windows\system32 (Windows) Relative Path ‘.’ – Current Directory ‘..’ – Parent Directory ‘~’ – Home Directory Example: ~/.. = /home

Filter Commands cat – View all more – View page less – View page head – View first tail – View last wc – word count sort – Sort by field uniq – Remove dup cut – Get fields paste – Merge Files grep – Search text tr – Replace text

More or Less cat file Displays entire file to screen MSDOS - type more file Displays file one screen at a time Same in MSDOS less – replacement for more

Heads or Tails head -# file Displays the first # lines of file1 tail -# file Displays the last # lines of file1 wc [-cwl] file Counts number of characters, words, or lines in file

Sorting Lists the contents of a file based on order sort file Sorts file alphabetically by line sort -r file Sorts file in reverse order by line sort –t: -n –k 3 file Sorts file based on the 3 rd field –k 3) in numeric order ( -n ) with fields separated by ‘:’ ( -t:) MSDOS - find

Extracting info cut –f# [-d%] file Displays # fields separated by %in file awk is a more advanced replacement grep search-string file Displays all lines with search-string in file Can create very sophisticated search conditions MSDOS - find

Changing file contents paste file1 file2 Merge contents of file1 and file2 line by line tr c1 c2 < file Changes all occurrences of character c1 to c2 in file

Misc. Commands date Set system time/date View (formatted) system time/date cal Displays calendar echo Display strings & shell variables Same in MSDOS

Visual Editor ( vi ) Very Powerful 3 modes Command Insert ex (very similar to MSDOS edlin ) Can be frustrating to learn initially Important to have cheat sheet handy

emacs versus vi Georgy Georgy says… Slashdot (Asked by markhb): vi or emacs? Georgy: I'm so glad you asked!! Both. vi for quick editing, emacs (NOT xemacs) for coding projects. :q!:q!:q! Source: Slashdot.com, 8/20/2003Slashdot.com, 8/20/2003

Why vi ?!?!?! Because it is always there!!! ©