EECS 183 Discussion 2 Milind Furia

Total Page:16

File Type:pdf, Size:1020Kb

EECS 183 Discussion 2 Milind Furia EECS 183 Discussion 2 Milind Furia Adapted from: Anna Wasewicz Using a VM • a virtual machine (VM) is a fake computer running as a program. • It can be used as a playground to test things out and work without risking anything on your day-to-day machine. • It can also be used for development if you don’t have a Unix based system (ex. Windows) VM Caen Linux • http://caenfaq.engin.umich.edu/12374-Linux- Login-Service/how-do-i-connect-to-a-caen- linux-computer-remotely The command line • a tool into which you can type text commands to perform specific tasks Instead of using the gui with your mouse to click on things to accomplish tasks • A lot of things can be automated using the command line Some simple commands • ls (list space) • -l to the end of my ls command, I'll see a detailed listing • -t will sort the results by file time • -S will sort by file size • -r will reverse the sorting • –a lets you see hidden files there are two entries for "." and ".." at the beginning of the list. "." is the current folder. “..” is the parent folder cd (change directory) • Lets you navigate which folder you are in • You can navigate to either full or relative paths. • If you're in /path/to/ and you want to navigate to the folder stuff inside that folder, you can simply type: cd stuff pwd (list working directory) • tells you which directory you are in Creating and removing folders • To create a new folder, use the mkdir <foldername> command • Remove any folder with the rmdir <foldername> • If the folder is not empty, this command will not let you delete the folder. If you want to remove the folder and all it’s contents you can use rm –rf <foldername> be careful with this! the –f flag stands for force the –r flag stands for recursive Creating and removing files • use the touch <filename> command to create a new, blank file • use the rm <filename> command to delete files Kleene Star ( * ) • means match everything • if you're in a folder and want to delete every file inside that folder, just type: rm * • Delete every instance of a matching filename pattern from the current directory and below: rm –rf filename.* Edit files using command line • The command that you use to edit text files will be different based on the platform you're using • Linux has the nano editor to quickly edit files, which might be more suitable for beginners. • nano /path/to/file • I recommend vim or vi or gvim grep command • utility for searching plain-text data sets for lines matching a regular expression • used to quickly find text within files, even searching through subdirectories. • if you wanted to search through all files in the current directory and below it for "text string", you could use this command: grep –ir "text string" * Shortcuts • Ctrl + U: Clears the line from the cursor point back to the beginning. • Ctrl + A: Moves the cursor to the beginning of the line. • Ctrl + E: Moves the cursor to the end of the line. • Ctrl + R: Allows you to search through the previous commands. Quiz Questions!! On the spot Regex • What the * is this? [0-9]{3}[-. \)\(]*[0-9]{3}[-. \\\)\(]*[0-9]{4} Regexes • is a sequence of characters that define a search pattern, mainly for use in pattern matching with strings • can be used for find and replace tasks • grep is what you can use on the command line to match regular expressions A Regular Expression contains one or more of the following: • A character set: characters retaining their literal meaning • An anchor: These designate (anchor) the position in the line of text that the RE is to match. For example, ^, and $ are anchors. • Modifiers: These expand or narrow (modify) the range of text the RE is to match. Modifiers include the asterisk, brackets, and the backslash..
Recommended publications
  • Your Performance Task Summary Explanation
    Lab Report: 11.2.5 Manage Files Your Performance Your Score: 0 of 3 (0%) Pass Status: Not Passed Elapsed Time: 6 seconds Required Score: 100% Task Summary Actions you were required to perform: In Compress the D:\Graphics folderHide Details Set the Compressed attribute Apply the changes to all folders and files In Hide the D:\Finances folder In Set Read-only on filesHide Details Set read-only on 2017report.xlsx Set read-only on 2018report.xlsx Do not set read-only for the 2019report.xlsx file Explanation In this lab, your task is to complete the following: Compress the D:\Graphics folder and all of its contents. Hide the D:\Finances folder. Make the following files Read-only: D:\Finances\2017report.xlsx D:\Finances\2018report.xlsx Complete this lab as follows: 1. Compress a folder as follows: a. From the taskbar, open File Explorer. b. Maximize the window for easier viewing. c. In the left pane, expand This PC. d. Select Data (D:). e. Right-click Graphics and select Properties. f. On the General tab, select Advanced. g. Select Compress contents to save disk space. h. Click OK. i. Click OK. j. Make sure Apply changes to this folder, subfolders and files is selected. k. Click OK. 2. Hide a folder as follows: a. Right-click Finances and select Properties. b. Select Hidden. c. Click OK. 3. Set files to Read-only as follows: a. Double-click Finances to view its contents. b. Right-click 2017report.xlsx and select Properties. c. Select Read-only. d. Click OK. e.
    [Show full text]
  • Powerview Command Reference
    PowerView Command Reference TRACE32 Online Help TRACE32 Directory TRACE32 Index TRACE32 Documents ...................................................................................................................... PowerView User Interface ............................................................................................................ PowerView Command Reference .............................................................................................1 History ...................................................................................................................................... 12 ABORT ...................................................................................................................................... 13 ABORT Abort driver program 13 AREA ........................................................................................................................................ 14 AREA Message windows 14 AREA.CLEAR Clear area 15 AREA.CLOSE Close output file 15 AREA.Create Create or modify message area 16 AREA.Delete Delete message area 17 AREA.List Display a detailed list off all message areas 18 AREA.OPEN Open output file 20 AREA.PIPE Redirect area to stdout 21 AREA.RESet Reset areas 21 AREA.SAVE Save AREA window contents to file 21 AREA.Select Select area 22 AREA.STDERR Redirect area to stderr 23 AREA.STDOUT Redirect area to stdout 23 AREA.view Display message area in AREA window 24 AutoSTOre ..............................................................................................................................
    [Show full text]
  • Doing More in UNIX HORT 59000 Lab 3 Instructor: Kranthi Varala Today’S Pairs
    Doing more in UNIX HORT 59000 Lab 3 Instructor: Kranthi Varala Today’s pairs Pair #1 Pair #2 Pair #3 Pair #4 Pair #5 Pair #6 Pair #7 Pair #8 Aishwarya, Habte, Chancellor, Rachel F., Rachel H., Michelle, Raquel, Katherine, Shawna Xiaojin Thiti Sara AuditorX Jay Courtney Hannah If your partner is missing, let me know and we’ll adjust the pairs based on availability. Quiz 2 • Open-book policy: You are free to look at all the slides from previous Lectures and labs. • No internet searches for answers. • No talking to others. • You have 20 minutes to complete the quiz. Creating pipelines from commands • The STDIN and STDOUT of each command can be redirected to combine programs together. • For example, the STDOUT of one program can be sent to the STDIN of another program. • STDIN and STDOUT streams can be redirected using the following symbols: 1. > 2. < 3. | Writing vs. Appending to a file $ cat Pasture.txt > Poems.txt Send the contents of Pasture.txt to a new file called Poems.txt. If Poems.txt exists, its contents are over- written. $ cat WoodPile.txt >> Poems.txt Add the contents of WoodPile.txt to the end of the existing file Poems.txt. If Poems.txt does not exist, it will be created. Exercises UNIX commands wget and nano • Search NCBI’s GEO website for the experiment GSE49418. • Find the FTP link for the series matrix file. • Copy the link to the GSE49418_series_matrix.txt.gz file. • Use wget to download the matrix file to a new directory in your scratch folder.
    [Show full text]
  • UNIX X Command Tips and Tricks David B
    SESUG Paper 122-2019 UNIX X Command Tips and Tricks David B. Horvath, MS, CCP ABSTRACT SAS® provides the ability to execute operating system level commands from within your SAS code – generically known as the “X Command”. This session explores the various commands, the advantages and disadvantages of each, and their alternatives. The focus is on UNIX/Linux but much of the same applies to Windows as well. Under SAS EG, any issued commands execute on the SAS engine, not necessarily on the PC. X %sysexec Call system Systask command Filename pipe &SYSRC Waitfor Alternatives will also be addressed – how to handle when NOXCMD is the default for your installation, saving results, and error checking. INTRODUCTION In this paper I will be covering some of the basics of the functionality within SAS that allows you to execute operating system commands from within your program. There are multiple ways you can do so – external to data steps, within data steps, and within macros. All of these, along with error checking, will be covered. RELEVANT OPTIONS Execution of any of the SAS System command execution commands depends on one option's setting: XCMD Enables the X command in SAS. Which can only be set at startup: options xcmd; ____ 30 WARNING 30-12: SAS option XCMD is valid only at startup of the SAS System. The SAS option is ignored. Unfortunately, ff NOXCMD is set at startup time, you're out of luck. Sorry! You might want to have a conversation with your system administrators to determine why and if you can get it changed.
    [Show full text]
  • Unix Programming
    P.G DEPARTMENT OF COMPUTER APPLICATIONS 18PMC532 UNIX PROGRAMMING K1 QUESTIONS WITH ANSWERS UNIT- 1 1) Define unix. Unix was originally written in assembler, but it was rewritten in 1973 in c, which was principally authored by Dennis Ritchie ( c is based on the b language developed by kenThompson. 2) Discuss the Communication. Excellent communication with users, network User can easily exchange mail,dta,pgms in the network 3) Discuss Security Login Names Passwords Access Rights File Level (R W X) File Encryption 4) Define PORTABILITY UNIX run on any type of Hardware and configuration Flexibility credits goes to Dennis Ritchie( c pgms) Ported with IBM PC to GRAY 2 5) Define OPEN SYSTEM Everything in unix is treated as file(source pgm, Floppy disk,printer, terminal etc., Modification of the system is easy because the Source code is always available 6) The file system breaks the disk in to four segements The boot block The super block The Inode table Data block 7) Command used to find out the block size on your file $cmchk BSIZE=1024 8) Define Boot Block Generally the first block number 0 is called the BOOT BLOCK. It consists of Hardware specific boot program that loads the file known as kernal of the system. 9) Define super block It describes the state of the file system ie how large it is and how many maximum Files can it accommodate This is the 2nd block and is number 1 used to control the allocation of disk blocks 10) Define inode table The third segment includes block number 2 to n of the file system is called Inode Table.
    [Show full text]
  • Useful Commands in Linux and Other Tools for Quality Control
    Useful commands in Linux and other tools for quality control Ignacio Aguilar INIA Uruguay 05-2018 Unix Basic Commands pwd show working directory ls list files in working directory ll as before but with more information mkdir d make a directory d cd d change to directory d Copy and moving commands To copy file cp /home/user/is . To copy file directory cp –r /home/folder . to move file aa into bb in folder test mv aa ./test/bb To delete rm yy delete the file yy rm –r xx delete the folder xx Redirections & pipe Redirection useful to read/write from file !! aa < bb program aa reads from file bb blupf90 < in aa > bb program aa write in file bb blupf90 < in > log Redirections & pipe “|” similar to redirection but instead to write to a file, passes content as input to other command tee copy standard input to standard output and save in a file echo copy stream to standard output Example: program blupf90 reads name of parameter file and writes output in terminal and in file log echo par.b90 | blupf90 | tee blup.log Other popular commands head file print first 10 lines list file page-by-page tail file print last 10 lines less file list file line-by-line or page-by-page wc –l file count lines grep text file find lines that contains text cat file1 fiel2 concatenate files sort sort file cut cuts specific columns join join lines of two files on specific columns paste paste lines of two file expand replace TAB with spaces uniq retain unique lines on a sorted file head / tail $ head pedigree.txt 1 0 0 2 0 0 3 0 0 4 0 0 5 0 0 6 0 0 7 0 0 8 0 0 9 0 0 10
    [Show full text]
  • User Commands GZIP ( 1 ) Gzip, Gunzip, Gzcat – Compress Or Expand Files Gzip [ –Acdfhllnnrtvv19 ] [–S Suffix] [ Name ... ]
    User Commands GZIP ( 1 ) NAME gzip, gunzip, gzcat – compress or expand files SYNOPSIS gzip [–acdfhlLnNrtvV19 ] [– S suffix] [ name ... ] gunzip [–acfhlLnNrtvV ] [– S suffix] [ name ... ] gzcat [–fhLV ] [ name ... ] DESCRIPTION Gzip reduces the size of the named files using Lempel-Ziv coding (LZ77). Whenever possible, each file is replaced by one with the extension .gz, while keeping the same ownership modes, access and modification times. (The default extension is – gz for VMS, z for MSDOS, OS/2 FAT, Windows NT FAT and Atari.) If no files are specified, or if a file name is "-", the standard input is compressed to the standard output. Gzip will only attempt to compress regular files. In particular, it will ignore symbolic links. If the compressed file name is too long for its file system, gzip truncates it. Gzip attempts to truncate only the parts of the file name longer than 3 characters. (A part is delimited by dots.) If the name con- sists of small parts only, the longest parts are truncated. For example, if file names are limited to 14 characters, gzip.msdos.exe is compressed to gzi.msd.exe.gz. Names are not truncated on systems which do not have a limit on file name length. By default, gzip keeps the original file name and timestamp in the compressed file. These are used when decompressing the file with the – N option. This is useful when the compressed file name was truncated or when the time stamp was not preserved after a file transfer. Compressed files can be restored to their original form using gzip -d or gunzip or gzcat.
    [Show full text]
  • PS TEXT EDIT Reference Manual Is Designed to Give You a Complete Is About Overview of TEDIT
    Information Management Technology Library PS TEXT EDIT™ Reference Manual Abstract This manual describes PS TEXT EDIT, a multi-screen block mode text editor. It provides a complete overview of the product and instructions for using each command. Part Number 058059 Tandem Computers Incorporated Document History Edition Part Number Product Version OS Version Date First Edition 82550 A00 TEDIT B20 GUARDIAN 90 B20 October 1985 (Preliminary) Second Edition 82550 B00 TEDIT B30 GUARDIAN 90 B30 April 1986 Update 1 82242 TEDIT C00 GUARDIAN 90 C00 November 1987 Third Edition 058059 TEDIT C00 GUARDIAN 90 C00 July 1991 Note The second edition of this manual was reformatted in July 1991; no changes were made to the manual’s content at that time. New editions incorporate any updates issued since the previous edition. Copyright All rights reserved. No part of this document may be reproduced in any form, including photocopying or translation to another language, without the prior written consent of Tandem Computers Incorporated. Copyright 1991 Tandem Computers Incorporated. Contents What This Book Is About xvii Who Should Use This Book xvii How to Use This Book xvii Where to Go for More Information xix What’s New in This Update xx Section 1 Introduction to TEDIT What Is PS TEXT EDIT? 1-1 TEDIT Features 1-1 TEDIT Commands 1-2 Using TEDIT Commands 1-3 Terminals and TEDIT 1-3 Starting TEDIT 1-4 Section 2 TEDIT Topics Overview 2-1 Understanding Syntax 2-2 Note About the Examples in This Book 2-3 BALANCED-EXPRESSION 2-5 CHARACTER 2-9 058059 Tandem Computers
    [Show full text]
  • Standard TECO (Text Editor and Corrector)
    Standard TECO TextEditor and Corrector for the VAX, PDP-11, PDP-10, and PDP-8 May 1990 This manual was updated for the online version only in May 1990. User’s Guide and Language Reference Manual TECO-32 Version 40 TECO-11 Version 40 TECO-10 Version 3 TECO-8 Version 7 This manual describes the TECO Text Editor and COrrector. It includes a description for the novice user and an in-depth discussion of all available commands for more advanced users. General permission to copy or modify, but not for profit, is hereby granted, provided that the copyright notice is included and reference made to the fact that reproduction privileges were granted by the TECO SIG. © Digital Equipment Corporation 1979, 1985, 1990 TECO SIG. All Rights Reserved. This document was prepared using DECdocument, Version 3.3-1b. Contents Preface ............................................................ xvii Introduction ........................................................ xix Preface to the May 1985 edition ...................................... xxiii Preface to the May 1990 edition ...................................... xxv 1 Basics of TECO 1.1 Using TECO ................................................ 1–1 1.2 Data Structure Fundamentals . ................................ 1–2 1.3 File Selection Commands ...................................... 1–3 1.3.1 Simplified File Selection .................................... 1–3 1.3.2 Input File Specification (ER command) . ....................... 1–4 1.3.3 Output File Specification (EW command) ...................... 1–4 1.3.4 Closing Files (EX command) ................................ 1–5 1.4 Input and Output Commands . ................................ 1–5 1.5 Pointer Positioning Commands . ................................ 1–5 1.6 Type-Out Commands . ........................................ 1–6 1.6.1 Immediate Inspection Commands [not in TECO-10] .............. 1–7 1.7 Text Modification Commands . ................................ 1–7 1.8 Search Commands .
    [Show full text]
  • Project Summaries Manual
    Project Summaries Guidance Manual Version 3.0 May 2020 TABLE OF CONTENTS I. Purpose ................................................................................................................................................. 5 II. Format .................................................................................................................................................. 9 III. Content ........................................................................................................................................... 11 IV. Detailed Information for Street Projects ........................................................................................ 17 1. Project Summary Workflow ......................................................................................................................... 17 2. Information Gathering ................................................................................................................................. 17 3. Project Type Specific Content ...................................................................................................................... 18 4. Preparation for Photo Taking ....................................................................................................................... 19 5. Photographing the Sites ............................................................................................................................... 19 6. Rendering Development .............................................................................................................................
    [Show full text]
  • Installing Adabas Manager on UNIX Installing Adabas Manager on UNIX
    Installing Adabas Manager on UNIX Installing Adabas Manager on UNIX Installing Adabas Manager on UNIX This section provides you with the information necessary to install and to configure Adabas Manager on UNIX platforms. The following main topics are described: Installing Adabas Manager After the Installation Uninstalling Adabas Manager under UNIX Installing Adabas Manager This section describes the prerequisites for installing Adabas Manager and how to perform the Adabas Manager installation on UNIX. This section contains the following topics: Before You Start the Installation Installing the Product Batch Installation Before You Start the Installation Before you start installing Adabas Manager make sure that you meet the prerequisites for your environment as described below. 1 Installing Adabas Manager on UNIX Before You Start the Installation Hardware and Software Prerequisites for Linux For the installation of Adabas Manager, the following hardware requirements apply: Hardware Prerequisites for Linux Processor: x86, EM64T and AMD64 (at least Intel Pentium III 300 MHz) RAM: 1GB Disk space: Installing Adabas Manager requires approximately 85MB. CD-ROM drive: A CD-ROM drive to install the software. For the installation of Adabas Manager, the following software requirements apply: Software Prerequisites for Linux Operating System: SUSE Linux Enterprise Server 10 (x86, EM64T, AMD64). Red Hat Enterprise Linux 4 and 5 AS (x86, EM64T, AMD64). 1. Please ensure that your host name is correctly configured. Issue the following command hostname or uname -u If these commands return a fully-qualified domain name (FQDN), everything is OK. If, however, they return only the node name (other than localhost), you should look in the file /etc/hosts and ensure that the node name is not an alias for localhost.
    [Show full text]
  • Bourne-Again Shell and Linux
    $IFS – Internal field separator. List of chars, that delimiter words ^= |= >>= <<=; relations: < <= > >= sed -e 'script' – stream editor, script y/ABC/abc/ replaces A, B, C Bourne-AgainBourne-Again SHell SHell and and Linux Linux CLI CLI from input, usually space, tabulator $' t' and new line $' n'. factor n – factorize into primes for a, b, c; s/regexp/substitution/ Floating point operations: echo "scale=10; 22/7" | bc tr a b – replace char a for b © 2013 Martin Bruchanov, [email protected] •4. Script command line parameters • tr '[a-z]' '[A-Z]' < file.txt – change lowercase to uppercase $0, ${0} – name of script \ \ •8. Screen output 푛 Set interpreter: #!/bin/bash Remarks: # this is comment awk '/pattern/ {action }' file – process lines containing pattern $1 to $9, ${1} to ${255} – positional command line parameters • • echo "text" – print text, echo * print all files in current dir cut -d delimiter -f field – print column(s) 1. Interactive control $# – number of command line parameters (argc) echo -e "text" – interpret escape-sequences (\t tab., a beep, \f • • cmp file1 file2 – compare files and print first difference Action set -o vi set -o emacs $* – expand all parameters, "$*" = "$1 $2 $3 " new page, \n new line), -n, \c suppressing \n, \xHH hex-byte, nnn • • • diff, diff3, sdiff, vimdiff – compare whole files vi-command mode (C) Esc — $@ – expand all parameters, "$@" = "$1" "$2" "$3" oct. byte, u03B1 „ “ (U+03B1) in UTF-8 • Previous/next command in Ctrl+p / Ctrl+n • • \ dd if=in of=out bs=k count=n – read blocks of bytes jC / kC $_ – last
    [Show full text]