Getting Started. Logging In and Out. Adapted from Practical Unix and Programming Hunter College

Similar documents
What is UNIX? A Little Bit about UNIX and User Interfaces. Adapted from Practical Unix and Programming Hunter College

Overview of the UNIX File System

Lecture # 2 Introduction to UNIX (Part 2)

CENG 334 Computer Networks. Laboratory I Linux Tutorial

Assignment 3, Due October 4

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

Getting Started With UNIX Lab Exercises

Lab 1: Accessing the Linux Operating System Spring 2009

Overview of the UNIX File System. Navigating and Viewing Directories

Assignment 2. Summary. Some Important bash Instructions. CSci132 Practical UNIX and Programming Assignment 2, Fall Prof.

Systems Programming/ C and UNIX

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

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

This lab exercise is to be submitted at the end of the lab session! passwd [That is the command to change your current password to a new one]

The Unix Shell & Shell Scripts

Scripting. More Shell Scripts. Adapted from Practical Unix and Programming Hunter College

Scripting. Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers

Week 5 Lesson 5 02/28/18

The Online Unix Manual

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

Fall Lecture 5. Operating Systems: Configuration & Use CIS345. The Linux Utilities. Mostafa Z. Ali.

Part I. UNIX Workshop Series: Quick-Start

Linux Tutorial #1. Introduction. Login to a remote Linux machine. Using vim to create and edit C++ programs

COMP 4/6262: Programming UNIX

WinSCP. Author A.Kishore/Sachin

This is Lab Worksheet 13 - not an Assignment. Boot Process and GRUB

5/20/2007. Touring Essential Programs

Physics REU Unix Tutorial

CST8207: GNU/Linux Operating Systems I Lab Ten Boot Process and GRUB. Boot Process and GRUB

Using the Command-Line Interface

Configuring Security with Passwords, Privileges, and Logins

1. Open VirtualBox and start your linux VM. Boot the machine and log in with the user account you created in Lab #1. Open the Terminal application.

STAT 213: R/RStudio Intro

9.2 Linux Essentials Exam Objectives

Encrypting Removable Media

Exploring UNIX: Session 5 (optional)

Introduction: What is Unix?

CISC 220 fall 2011, set 1: Linux basics

Essentials for Scientific Computing: Bash Shell Scripting Day 3

find starting-directory -name filename -user username

A Big Step. Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers

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

Unix Tutorial Haverford Astronomy 2014/2015

Text Editing in UNIX. A short introduction to vi, pico, and gedit

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

INSE Lab 1 Introduction to UNIX Fall 2017

BIF713. Operating Systems & Project Management. Instructor: Murray Saul Webpage: murraysaul.wordpress.

EKT332 COMPUTER NETWORK

Greenville CSD Parent Guide to SchoolTool

Session 1: Accessing MUGrid and Command Line Basics

Users and Groups. his chapter is devoted to the Users and Groups module, which allows you to create and manage UNIX user accounts and UNIX groups.

Remote Access to Unix Machines

Using Tcl. Learning Objectives

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.

The UNIX operating system is a set of programs that act as a link between the computer and the user.

Fundamentals of Programming Session 4

Practical Session 0 Introduction to Linux

STAT 113: R/RStudio Intro

Unix Shells and Other Basic Concepts

Unix. Examples: OS X and Ubuntu

Exercise Sheet 2. (Classifications of Operating Systems)

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

Linux Survival Guide

Scripting Languages Course 1. Diana Trandabăț

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

Solving TWS Windows Job Run Issues

Pattern Matching. An Introduction to File Globs and Regular Expressions. Adapted from Practical Unix and Programming Hunter College

BIOINFORMATICS POST-DIPLOMA PROGRAM SUBJECT OUTLINE Subject Title: OPERATING SYSTEMS AND PROJECT MANAGEMENT Subject Code: BIF713 Subject Description:

Copyright. Trademarks Attachmate Corporation. All rights reserved. USA Patents Pending. WRQ ReflectionVisual Basic User Guide

I/O and Shell Scripting

Introduction to Linux

UNIX / LINUX - GETTING STARTED

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.

Projects and Environment Introduction

Chapter 1 An Introduction to C++, Unix, SSH and Komodo Edit

Practical 5. Linux Commands: Working with Files

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

Operating System Interaction via bash

PESIT Bangalore South Campus

Perl Basics. Structure, Style, and Documentation

CSE II-Sem)

Please note that CNE 216 is a brand new course that has never been taught on the George campus; it will be taught for the first time in the fall of

COMS 6100 Class Notes 3

15-122: Principles of Imperative Computation

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

CSCE 212H, Spring 2008, Matthews Lab Assignment 1: Representation of Integers Assigned: January 17 Due: January 22

Using the Command-Line Interface

CS1600 Lab Assignment 1 Spring 2016 Due: Feb. 2, 2016 POINTS: 10

Overview of the Cisco NCS Command-Line Interface

Part I. Introduction to Linux

Basic Shell Commands. Bok, Jong Soon

Author A.Kishore/Sachin WinSCP

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

This is Worksheet and Assignment 12. Disks, Partitions, and File Systems

Review of Fundamentals

UoW HPC Quick Start. Information Technology Services University of Wollongong. ( Last updated on October 10, 2011)

CMPSCI 120 Fall 2013 Lab #2 Professor William T. Verts

Chapter 2: Configure a Network Operating System. Every computer requires an operating system to function, including computerbased

Lab Router Configuration Using Setup Instructor Version 2500

Temple University Computer Science Programming Under the Linux Operating System January 2017

Transcription:

Getting Started Logging In and Out Adapted from Practical Unix and Programming Hunter College Copyright 2006 Stewart Weiss

Getting started: logging in and out Every user in UNIX has a username (also called login name or account name) and a password. Logging in requires that you enter your username and password. Your username and initial password are given to you by the system administrator. 2 Comp 190 Scripting Languages

Logging in from a terminal window (1) You have to identify yourself by typing your username at the login prompt: login: and then your password at the password prompt: login: stewart Password: When you type the password, you won't see the cursor move until you press the Enter key. 3 Comp 190 Scripting Languages

Logging in from a terminal window (2) If you enter either your username or password incorrectly, you will see this message: login incorrect login: and you will have to repeat the previous steps. Usernames are case-sensitive!! You have to type them exactly as they are given to you. 4 Comp 190 Scripting Languages

Logging in from a terminal window (3) If you are successful, you will see a message like this: Last login: Mon Jun 26 21:32:48 You have new mail. $ The '$' is called the shell prompt. It is the indication by UNIX that it is waiting for you to enter a command. 5 Comp 190 Scripting Languages

Changing your password (1) When you login for the first time, you must change your password. No exceptions. Type the command 'passwd' at the prompt. Note that it is 'password' without the 'or'. You will be asked to enter the current password and then asked for the new password, twice. If you make any mistakes, the password will not be changed. 6 Comp 190 Scripting Languages

Changing your password (2) The session will look something like this: $ passwd Changing password for user sweiss. (current) UNIX password: you type here New UNIX password: you type here Retype new UNIX password: you type here passwd: password has been changed. $ 7 Comp 190 Scripting Languages

About passwords Your password must be difficult to "crack". Some rules to follow: Must be at least 8 characters long Must contain a digit, an uppercase and lowercase letter Must contain punctuation (period, comma, hyphen, etc) Must not be a word in a dictionary or encyclopedia Should not be guessable (your birthday, ss#, etc) 8 Comp 190 Scripting Languages

Logging out Before going any further, try logging out. To logout, type "logout" at the shell prompt. This is the safest way to logout: $ logout You can also type "exit". They work the same in a login shell. (Soon you will learn what a login shell is.) 9 Comp 190 Scripting Languages

Logging in using SSH To login to a UNIX machine over a network, you usually have to use SSH. SSH is a protocol that encrypts what you type on your "local" computer, sends the encrypted text to the "remote" computer, and decrypts it there. The remote computer has a program called an SSH server. Your computer has an SSH client. SSH stands for "secure shell." 10 Comp 190 Scripting Languages

The SSH connection Conceptually it looks like this:: 11 Comp 190 Scripting Languages

SSH: step 1 You start up your SSH client and see a window something like the one on the right (which is what you see using the Windows SSH client.) 12 Comp 190 Scripting Languages

SSH: step 2 Find the button that connects to a server. It is usually called Connect or something similar. You must then enter the full name of the host (e.g. eniac.cs.hunter.cuny.edu ) and your login name. 13 Comp 190 Scripting Languages

SSH: step 3 If you enter the correct hostname and login name, you will then see a window in which you can enter your password. It might look like the one below. 14 Comp 190 Scripting Languages

SSH: step 4 If the password is correct, you will then be at the command prompt, as shown on the right. 15 Comp 190 Scripting Languages

Logging in at the console If you are sitting at a Unix machine, the login procedure will be slightly different. You will see a screen something like this one. 16 Comp 190 Scripting Languages

Logging in at the console (2) You just enter your login name, after which you will be prompted to enter your password. When you sit at the machine, the monitor is called a console. After you login, you will have a desktop environment like the one found in Windows and Macintosh computers. 17 Comp 190 Scripting Languages

Opening a Terminal Window If you are sitting at the console, to open a terminal window, you need to start a terminal application. On most versions of Linux, there will be an Applications menu, and within that menu, a sub-menu named System Tools. The System Tools menu usually has a Terminal application. Find it and start it up. Then you can continue with the next slide. 18 Comp 190 Scripting Languages

Getting help in UNIX UNIX provides a complete and extensive set of on-line documentation to help you find and understand the commands that you need. You only need to remember a three-letter command: man, which is short for "manual." The man pages are a collection of individual pages that describe all of the commands, system files, kernel functions, and library functions on your UNIX system. 19 Comp 190 Scripting Languages

The man command Within the terminal, the man command displays the manual page that you specify. For example, man passwd will display the passwd man page, which describes how to use the passwd command. man man displays the man page for the man command itself, and is the best place to start learning about UNIX. 20 Comp 190 Scripting Languages

Ambiguity Often, the same name is used for many purposes! For example, passwd is a shell command, but passwd is also the name of the file that contains user login data. Typing man passwd displays the man page for the passwd shell command. How can you see the man page for the passwd file? 21 Comp 190 Scripting Languages

Organization of manual pages The manual pages are arranged in at least 9 sections. These typically include User Commands Unix System Calls Library Functions I/O and Special Files File Formats and Miscellaneous Games and Demos Miscellaneous "useful information" System Administrative Commands 22 Comp 190 Scripting Languages

Discovering the section numbers The man page for man itself displays the section numbers of the various sections. In Fedora Linux, the first five sections are 1 User Commands 2 System Calls 3 C Library Functions 4 Devices and Special Files 5 File Formats and Conventions 23 Comp 190 Scripting Languages

More about man page organization Different systems have these sections in different orders. You can type man sectnum intro where sectnum is a number like 1, 2, 3, etc. This will display the intro page for that manual section. The intro page will also tell you what pages are stored in that section. On my system, man 5 intro shows that Section 5 is "Files and File Formats". 24 Comp 190 Scripting Languages

Finding the man page for the passwd file Knowing that Section 5 contains man pages about files, I can type man 5 passwd and this will give me the man page for the passwd file. (If you are wondering why we didn't need the section number to get the man page for the passwd command, it is because the sections are searched in a specific order; if we omit the section number, we get the man page that is found first, usually in section 1.) 25 Comp 190 Scripting Languages

How to use a man page Each man page consists of several parts, including: NAME SYNOPSIS DESCRIPTION OPTIONS SEE ALSO and several others. SYNOPSIS shows you how to use the command. DESCRIPTION is a summary. SEE ALSO refers you to other relevant man pages. 26 Comp 190 Scripting Languages

More about the man page The NAME section is a single line summary of the command, file or function that the page describes, as in: man - format and display the on-line manual pages The SYNOPSIS contains the precise rules for how the command can be used and can be much longer. The DESCRIPTION is a prose description of the use of the command, file, or function. 27 Comp 190 Scripting Languages

Searching for commands What if you don't know the name of the command you want? man k keyword will search through and list the all man page NAME lines to find those containing the keyword. Example: man k perl will list all man pages containing the word perl, which may number in the hundreds. 28 Comp 190 Scripting Languages

Man page options The "-k" is called a flag or an option to the man command. Almost all commands have options. The options part lists these. So does the synopsis, which lists them in two ways. Those that do not need an argument are grouped in square brackets [] like this: man [-acdffhkktww] Options can be grouped, or listed separately with preceding hyphens as in: man ack perl man a -c -k perl 29 Comp 190 Scripting Languages

Man page options (2) If an option has an optional or required argument, it is listed separately, as in man [ M pathlist] [-S sectionlist] I can invoke the man command using as many options as I need: man M /usr/share/man/pl:: S 1:4 vim combines two options with arguments. This will display the man page for the vim command in Polish! 30 Comp 190 Scripting Languages

Using grep to help searching Sometimes the output of man k is too large to examine easily. We can reduce its size usefully by piping its output through more or through grep. more is a command that displays a screen of data at a time. We'll explore it later. grep is a filter program; we give it a pattern as an argument, and the name of a file, and it displays lines in that file that match the pattern. An argument to a command is a word that alters the command's output. 31 Comp 190 Scripting Languages

More about grep For example: grep 'theory' classnotes will list every line in the file named classnotes that has the word theory in it. grep 'actg' file1 will list every line in file1 containing the pattern actg, anywhere in the line. theory and 'actg' are arguments to grep above. 32 Comp 190 Scripting Languages

Using grep to help searching grep can be used to filter the output of man, to show only those lines that match a second pattern: $ man k perl grep 'tutorial' perldebtut [](1)- Perl debugging tutorial... which will display the names of man pages that contain various tutorials about Perl. 33 Comp 190 Scripting Languages

Other ways to get help There are also special files called Info documents on certain UNIX systems. The info command can be used to read these documents. Learning how to use the info command, however, takes much more time than learning how to use man pages. Read the man page for info to learn more. 34 Comp 190 Scripting Languages

Exploring a command: who The who command displays information about who is currently logged in. For example: $ who nguyen pts/1 Jul 13 14:18 (lab1032) tbw pts/3 Jul 13 13:49 (blackwoods) sasa pts/4 Jul 14 15:43 (199.43.48.85) sweiss pts/5 Jul 14 22:27 (eniac) $ 35 Comp 190 Scripting Languages

More about who who outputs several items of information about each user. For now, notice that it includes the username, the time at which the user logged in, and the name of the host computer from which the user logged in. who has many options that can change what it displays. Research these and experiment with them. 36 Comp 190 Scripting Languages

Another form of who: w Yes, w is a one-letter command, short for "who", but it displays more than who: $ w 22:47:20 up 1 day, 9:01,3 users,load average: 0.00, 0.00, 0.00 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT nguyen pts/1 lab1032-1 Thu14 30:16m 0.45s 0.45s pine tbw pts/3 blackwoods Thu13 29:05m 0.14s 0.10s pine sweiss pts/6 eniac 22:33 0.00s 0.02s 0.00s w $ The last column shows what command the user is running at the moment. 37 Comp 190 Scripting Languages

Things to try Look up and try out these simple commands, none of which require any more knowledge of UNIX than you already have. echo, cat, hostname, logname, last 38 Comp 190 Scripting Languages