Survival Command Line

Total Page:16

File Type:pdf, Size:1020Kb

Survival Command Line ABSTRACT Survival This short workshop will provide hands-on overview of commands in a text Terminal. We'll review the handful of commands that are most useful. command line JEAN-YVES SGRO for Text Terminal workshops :14 The Biochemistry Computational Research Facility (BCRF) provides access to a computational computer cluster and hands-on tutorials Image credits: Wingding font icons Workbook – © 2019 – All Rights Reserved Corresponding author: Jean-Yves Sgro - [email protected] - All rights reserved. Instructor: Jean-Yves Sgro, Ph.D Distinguished & Data Scientist II. Biotechnology Center & Biochemistry Dept. Biochemistry Office: 433 Babcock Drive, room 201 Madison WI 53706 Email: [email protected] Survival command-line for Biologists Jean-Yves Sgro December 03,2019 INTRODUCTION ....................................................................................................................................................................... 3 Learning objectives: ............................................................................................................................................................................... 3 TERMINAL AND SHELL .......................................................................................................................................................... 5 Text terminal ............................................................................................................................................................................................ 5 The shell ...................................................................................................................................................................................................... 5 Shells ............................................................................................................................................................................................................. 6 SET-UP ........................................................................................................................................................................................ 7 WORKING IN TERMINAL ...................................................................................................................................................... 8 Username .................................................................................................................................................................................................... 8 Home ............................................................................................................................................................................................................. 8 Prompt ......................................................................................................................................................................................................... 9 Preferences, $ and Variables .............................................................................................................................................................. 9 Home anD username revisiteD ........................................................................................................................................................ 10 Who am I .................................................................................................................................................................................................. 10 Where am I looKing ............................................................................................................................................................................. 11 HARD DRIVE: WHERE THINGS ARE ............................................................................................................................... 12 Summary so far: .................................................................................................................................................................................... 13 DIRECTORIES ........................................................................................................................................................................ 15 New Directories ..................................................................................................................................................................................... 15 Path ............................................................................................................................................................................................................ 18 Home again ............................................................................................................................................................................................. 18 FILES ........................................................................................................................................................................................ 19 Exploring file contents ....................................................................................................................................................................... 19 File editing .............................................................................................................................................................................................. 21 CompresseD web files .......................................................................................................................................................................... 22 Section summary: ................................................................................................................................................................................. 24 STREAMS AND PIPES: KEY CONCEPTS .......................................................................................................................... 25 StanDard input anD output .............................................................................................................................................................. 25 Data stream and pipes ....................................................................................................................................................................... 26 Redirection .............................................................................................................................................................................................. 27 Pipes ........................................................................................................................................................................................................... 28 REMOTE CONNECTION ....................................................................................................................................................... 30 SUMMARY ............................................................................................................................................................................... 31 Concepts ................................................................................................................................................................................................... 31 Symbols ..................................................................................................................................................................................................... 31 1 CommanDs learneD or mentioneD: ............................................................................................................................................... 32 RESOURCES .................................................................................................................................................................................................. 33 REFERENCES .......................................................................................................................................................................... 34 2 Introduction This short tutorial/workshop is meant to review and understand basic command-line as they are typed on a text terminal. This specific workshop will focus on Macintosh Terminal, but most commands would also work on all Unix-style operating system (Linux, or Windows with added software.) The goal is to review the most useful commands in order to operate the terminal for later workshops including those focused on Docker. Learning objectives: The main objective is to become at ease with the command-line to perform routine tasks: • Open a Terminal • Understand the computer organization (file structure and “path”) • Create, delete and navigate directories • Create, delete, explore and edit text files • Download Internet data files • Apply key concepts (standards and streams) to tasks 3 digital VT100 text terminal DEC VT100 terminal at the Living Computer Museum (apparently connected to the museum's DEC PDP- 11/70). Introduced in August 1978 by Digital Equipment Corporation (DEC) Jason Scott - Flickr: IMG_9976 CC BY 2.0 Source: https://commons.wikimedia.org/wiki/File:DEC_VT100_terminal.jpg 4 Terminal and Shell Text terminal In the early 1990’s “dumb terminals” were still used to access a remote, shared computer. The terminal was called “dumb” because it did not contain any operating system. The digital VT100 (“VT100” 2019) was a very popular terminal: In contrast, a “personal
Recommended publications
  • Cisco Telepresence Codec SX20 API Reference Guide
    Cisco TelePresence SX20 Codec API Reference Guide Software version TC6.1 April 2013 Application Programmer Interface (API) Reference Guide Cisco TelePresence SX20 Codec D14949.03 SX20 Codec API Reference Guide TC6.1, April 2013. 1 Copyright © 2013 Cisco Systems, Inc. All rights reserved. Cisco TelePresence SX20 Codec API Reference Guide What’s in this guide? Table of Contents Introduction Using HTTP ....................................................................... 20 Getting status and configurations ................................. 20 TA - ToC - Hidden About this guide .................................................................. 4 The top menu bar and the entries in the Table of Sending commands and configurations ........................ 20 text anchor User documentation ........................................................ 4 Contents are all hyperlinks, just click on them to Using HTTP POST ......................................................... 20 go to the topic. About the API Feedback from codec over HTTP ......................................21 Registering for feedback ................................................21 API fundamentals ................................................................ 9 Translating from terminal mode to XML ......................... 22 We recommend you visit our web site regularly for Connecting to the API ..................................................... 9 updated versions of the user documentation. Go to: Password ........................................................................
    [Show full text]
  • Introduction to Linux – Part 1
    Introduction to Linux – Part 1 Brett Milash and Wim Cardoen Center for High Performance Computing May 22, 2018 ssh Login or Interactive Node kingspeak.chpc.utah.edu Batch queue system … kp001 kp002 …. kpxxx FastX ● https://www.chpc.utah.edu/documentation/software/fastx2.php ● Remote graphical sessions in much more efficient and effective way than simple X forwarding ● Persistence - can be disconnected from without closing the session, allowing users to resume their sessions from other devices. ● Licensed by CHPC ● Desktop clients exist for windows, mac, and linux ● Web based client option ● Server installed on all CHPC interactive nodes and the frisco nodes. Windows – alternatives to FastX ● Need ssh client - PuTTY ● http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html - XShell ● http://www.netsarang.com/download/down_xsh.html ● For X applications also need X-forwarding tool - Xming (use Mesa version as needed for some apps) ● http://www.straightrunning.com/XmingNotes/ - Make sure X forwarding enabled in your ssh client Linux or Mac Desktop ● Just need to open up a terminal or console ● When running applications with graphical interfaces, use ssh –Y or ssh –X Getting Started - Login ● Download and install FastX if you like (required on windows unless you already have PuTTY or Xshell installed) ● If you have a CHPC account: - ssh [email protected] ● If not get a username and password: - ssh [email protected] Shell Basics q A Shell is a program that is the interface between you and the operating system
    [Show full text]
  • Windows Command Prompt Cheatsheet
    Windows Command Prompt Cheatsheet - Command line interface (as opposed to a GUI - graphical user interface) - Used to execute programs - Commands are small programs that do something useful - There are many commands already included with Windows, but we will use a few. - A filepath is where you are in the filesystem • C: is the C drive • C:\user\Documents is the Documents folder • C:\user\Documents\hello.c is a file in the Documents folder Command What it Does Usage dir Displays a list of a folder’s files dir (shows current folder) and subfolders dir myfolder cd Displays the name of the current cd filepath chdir directory or changes the current chdir filepath folder. cd .. (goes one directory up) md Creates a folder (directory) md folder-name mkdir mkdir folder-name rm Deletes a folder (directory) rm folder-name rmdir rmdir folder-name rm /s folder-name rmdir /s folder-name Note: if the folder isn’t empty, you must add the /s. copy Copies a file from one location to copy filepath-from filepath-to another move Moves file from one folder to move folder1\file.txt folder2\ another ren Changes the name of a file ren file1 file2 rename del Deletes one or more files del filename exit Exits batch script or current exit command control echo Used to display a message or to echo message turn off/on messages in batch scripts type Displays contents of a text file type myfile.txt fc Compares two files and displays fc file1 file2 the difference between them cls Clears the screen cls help Provides more details about help (lists all commands) DOS/Command Prompt help command commands Source: https://technet.microsoft.com/en-us/library/cc754340.aspx.
    [Show full text]
  • Editores, Compilación Y Ejecución)
    Guía práctica de estudio 06: Entorno de C (editores, compilación y ejecución) Elaborado por: Ing. Laura Sandoval Montaño Juan Francisco De reza Trujillo Guía práctica de estudio 06: Entorno de C (editores, compilación y ejecución) Objetivo: Conocer y usar los ambientes y herramientas para el desarrollo y ejecución de programas en Lenguaje C, como editores y compiladores en diversos sistemas operativos. Actividades: . Utilizando un editor de GNU/Linux, crear un archivo de texto . Modificar/actualizar un archivo ya existente con un editor GNU/Linux. Crear, compilar y ejecutar un programa simple escrito en C en GNU/Linux . En algún entorno de desarrollo de Windows, crear, compilar y ejecutar un programa simple escrito en C. Introducción Un lenguaje de programación permite expresar una serie de instrucciones que podrán ser realizadas por una computadora. Unos de los lenguajes de programación mayormente difundidos es el lenguaje C. Éste es muy utilizado ya que la forma de dar instrucciones es muy cercana a lo que un humano podría abstraer, es decir, las instrucciones no son tal cual las que una computadora podría entender, para ello se necesitaría conocer a fondo el microprocesador, el sistema operativo entre otros aspectos. Por esta razón, C es conocido como un lenguaje de alto nivel, esto significa a que las instrucciones podrían ser entendidas fácilmente por un humano. En contraparte, un lenguaje de bajo nivel, son instrucciones que son cercanas a lo que la máquina puede entender y difícilmente pueden ser comprendidas por una persona que no tenga conocimientos de la máquina en que operarán. Algunos autores consideran al lenguaje C como un lenguaje de mediano nivel, ya que no es totalmente transparente sino tiene elementos que tienen que ver con la arquitectura de la máquina a la hora de programar.
    [Show full text]
  • Lab Exercise – Ipv4
    Lab Exercise – IPv4 Objective To learn about the details of IP (Internet Protocol). IP is the network layer protocol used throughout the Internet. We will examine IP version 4, since it is ubiquitously deployed, while the IP version 6 is partly deployed. The trace is here: https://kevincurran.org/com320/labs/wireshark/trace-ipv4.pcap The text file is here: https://kevincurran.org/com320/labs/wireshark/trace-ipv4.txt Requirements Wireshark: This lab uses the Wireshark software tool to capture and examine a packet trace. A packet trace is a record of traffic at a location on the network, as if a snapshot was taken of all the bits that passed across a particular wire. The packet trace records a timestamp for each packet, along with the bits that make up the packet, from the lower-layer headers to the higher-layer contents. Wireshark runs on most operating systems, including Windows, Mac and Linux. It provides a graphical UI that shows the sequence of packets and the meaning of the bits when interpreted as protocol headers and data. It col- or-codes packets by their type, and has various ways to filter and analyze packets to let you investigate the behavior of network protocols. Wireshark is widely used to troubleshoot networks. You can down- load it from www.wireshark.org if it is not already installed on your computer. We highly recommend that you watch the short, 5 minute video “Introduction to Wireshark” that is on the site. wget / curl: This lab uses wget (Linux and Windows) and curl (Mac) to fetch web resources.
    [Show full text]
  • Introduction to UNIX at MSI June 23, 2015 Presented by Nancy Rowe
    Introduction to UNIX at MSI June 23, 2015 Presented by Nancy Rowe The Minnesota Supercomputing Institute for Advanced Computational Research www.msi.umn.edu/tutorial/ © 2015 Regents of the University of Minnesota. All rights reserved. Supercomputing Institute for Advanced Computational Research Overview • UNIX Overview • Logging into MSI © 2015 Regents of the University of Minnesota. All rights reserved. Supercomputing Institute for Advanced Computational Research Frequently Asked Questions msi.umn.edu > Resources> FAQ Website will be updated soon © 2015 Regents of the University of Minnesota. All rights reserved. Supercomputing Institute for Advanced Computational Research What’s the difference between Linux and UNIX? The terms can be used interchangeably © 2015 Regents of the University of Minnesota. All rights reserved. Supercomputing Institute for Advanced Computational Research UNIX • UNIX is the operating system of choice for engineering and scientific workstations • Originally developed in the late 1960s • Unix is flexible, secure and based on open standards • Programs are often designed “to do one simple thing right” • Unix provides ways for interconnecting these simple programs to work together and perform more complex tasks © 2015 Regents of the University of Minnesota. All rights reserved. Supercomputing Institute for Advanced Computational Research Getting Started • MSI account • Service Units required to access MSI HPC systems • Open a terminal while sitting at the machine • A shell provides an interface for the user to interact with the operating system • BASH is the default shell at MSI © 2015 Regents of the University of Minnesota. All rights reserved. Supercomputing Institute for Advanced Computational Research Bastion Host • login.msi.umn.edu • Connect to bastion host before connecting to HPC systems • Cannot run software on bastion host (login.msi.umn.edu) © 2015 Regents of the University of Minnesota.
    [Show full text]
  • K30503041: Creating a Virtual Server with ARP And/Or ICMP Disabled at Creation
    K30503041: Creating a virtual server with ARP and/or ICMP disabled at creation Non-Diagnostic Original Publication Date: Apr 16, 2020 Update Date: Apr 16, 2020 Topic You should consider using this procedure under the following condition: You want to create a new virtual server with the Address Resolution Protocol (ARP) and/or the Internet Control Message Protocol (ICMP) disabled at creation. Description In some network environments, you may want to create virtual servers that have ARP and/or ICMP disabled. When creating a new virtual server (one that does not use an IP address of an existing virtual server), you can enable or disable the virtual server. However, you cannot set the IP address of the virtual server with ARP and/or ICMP to 'disabled' when creating the virtual server. You can only enable or disable ARP or ICMP by modifying the virtual address that is automatically created when you create the virtual server. In this scenario, you create the virtual address with ARP and ICMP enabled at the time of creation. You can work around this scenario by creating the virtual address for the virtual server in advance with ARP and/or ICMP disabled. After creating the virtual address, you can then create the virtual server that references the same IP address of the virtual address as the destination IP address of the virtual server. Prerequisites You must meet the following prerequisite to use this procedure: Administrative access to the BIG-IP Configuration utility or the TMOS Shell (tmsh). Note: You cannot create a virtual address using the Configuration utility.
    [Show full text]
  • Linux Fundamentals (GL120) U8583S This Is a Challenging Course That Focuses on the Fundamental Tools and Concepts of Linux and Unix
    Course data sheet Linux Fundamentals (GL120) U8583S This is a challenging course that focuses on the fundamental tools and concepts of Linux and Unix. Students gain HPE course number U8583S proficiency using the command line. Beginners develop a Course length 5 days solid foundation in Unix, while advanced users discover Delivery mode ILT, vILT patterns and fill in gaps in their knowledge. The course View schedule, local material is designed to provide extensive hands-on View now pricing, and register experience. Topics include basic file manipulation; basic and View related courses View now advanced filesystem features; I/O redirection and pipes; text manipulation and regular expressions; managing jobs and processes; vi, the standard Unix editor; automating tasks with Why HPE Education Services? shell scripts; managing software; secure remote • IDC MarketScape leader 5 years running for IT education and training* administration; and more. • Recognized by IDC for leading with global coverage, unmatched technical Prerequisites Supported distributions expertise, and targeted education consulting services* Students should be comfortable with • Red Hat Enterprise Linux 7 • Key partnerships with industry leaders computers. No familiarity with Linux or other OpenStack®, VMware®, Linux®, Microsoft®, • SUSE Linux Enterprise 12 ITIL, PMI, CSA, and SUSE Unix operating systems is required. • Complete continuum of training delivery • Ubuntu 16.04 LTS options—self-paced eLearning, custom education consulting, traditional classroom, video on-demand
    [Show full text]
  • Openssh-Ldap-Pubkey Documentation Release 0.3.0
    openssh-ldap-pubkey Documentation Release 0.3.0 Kouhei Maeda May 18, 2020 Contents 1 openssh-ldap-pubkey 3 1.1 Status...................................................3 1.2 Requirements...............................................3 1.3 See also..................................................3 2 How to setup LDAP server for openssh-lpk5 2.1 Precondition...............................................5 2.2 Requirements...............................................5 2.3 Install...................................................5 3 How to setup OpenSSH server9 3.1 Precondition...............................................9 3.2 Requirements...............................................9 3.3 Install with nslcd (recommend).....................................9 3.4 Install without nslcd........................................... 11 4 History 13 4.1 0.3.0 (2020-05-18)............................................ 13 4.2 0.2.0 (2018-09-30)............................................ 13 4.3 0.1.3 (2018-08-18)............................................ 13 4.4 0.1.2 (2017-11-25)............................................ 13 4.5 0.1.1 (2015-10-16)............................................ 14 4.6 0.1.0 (2015-10-16)............................................ 14 5 Contributors 15 6 Indices and tables 17 i ii openssh-ldap-pubkey Documentation, Release 0.3.0 Contents: Contents 1 openssh-ldap-pubkey Documentation, Release 0.3.0 2 Contents CHAPTER 1 openssh-ldap-pubkey 1.1 Status 1.2 Requirements 1.2.1 LDAP server • Add openssh-lpk schema. • Add an objectClass ldapPublicKey to user entry. • Add one or more sshPublicKey attribute to user entry. 1.2.2 OpenSSH server • OpenSSH over 6.2. • Installing this utility. • Setup AuthorozedKeysCommand and AuthorizedKeysCommandUser in sshd_config. 1.3 See also • OpenSSH 6.2 release 3 openssh-ldap-pubkey Documentation, Release 0.3.0 • openssh-lpk 4 Chapter 1. openssh-ldap-pubkey CHAPTER 2 How to setup LDAP server for openssh-lpk 2.1 Precondition This article restricts OpenLDAP with slapd_config on Debian systems only.
    [Show full text]
  • Curl User Survey 2019 Analysis
    curl user survey 2019 analysis “there are so many useful features” summary and analysis by Daniel Stenberg version 1 - June 4, 2019 Table of Contents About curl.............................................................................................................................................3 Survey Background..........................................................................................................................3 Number of responses............................................................................................................................4 Returning respondents?........................................................................................................................5 Users living where?..............................................................................................................................6 What kind of users?..............................................................................................................................7 What protocols......................................................................................................................................8 Multiple platforms..............................................................................................................................10 What platforms...................................................................................................................................11 Which Windows versions...................................................................................................................13
    [Show full text]
  • Chapter 10 Streams Streams Text Files and Binary Files
    Streams Chapter 10 • A stream is an object that enables the flow of File I/O data between a ppgrogram and some I/O device or file – If the data flows into a program, then the stream is called an input stream – If the dtdata flows out of a program, then the stream is called an output stream Copyright © 2012 Pearson Addison‐Wesley. All rights reserved. 10‐2 Streams Text Files and Binary Files • Input streams can flow from the kbkeyboar d or from a • Files that are designed to be read by human beings, file and that can be read or written with an editor are – StSystem. in is an itinput stream tha t connects to the called text files keyboard – Scanner keyy(y);board = new Scanner(System.in); Text files can also be called ASCII files because the data they contain uses an ASCII encoding scheme • Output streams can flow to a screen or to a file – An advantage of text files is that the are usually the same – System.out is an output stream that connects to the screen on all computers, so tha t they can move from one System.out.println("Output stream"); computer to another Copyright © 2012 Pearson Addison‐Wesley. All rights reserved. 10‐3 Copyright © 2012 Pearson Addison‐Wesley. All rights reserved. 10‐4 Text Files and Binary Files Writing to a Text File • Files tha t are didesigne d to be read by programs and • The class PrintWriter is a stream class that consist of a sequence of binary digits are called binary files that can be used to write to a text file – Binary files are designed to be read on the same type of – An object of the class PrintWriter has the computer and with the same programming language as the computer that created the file methods print and println – An advantage of binary files is that they are more efficient – These are similar to the System.out methods to process than text files of the same names, but are used for text file – Unlike most binary files, Java binary files have the advantage of being platform independent also output, not screen output Copyright © 2012 Pearson Addison‐Wesley.
    [Show full text]
  • Shell Variables
    Shell Using the command line Orna Agmon ladypine at vipe.technion.ac.il Haifux Shell – p. 1/55 TOC Various shells Customizing the shell getting help and information Combining simple and useful commands output redirection lists of commands job control environment variables Remote shell textual editors textual clients references Shell – p. 2/55 What is the shell? The shell is the wrapper around the system: a communication means between the user and the system The shell is the manner in which the user can interact with the system through the terminal. The shell is also a script interpreter. The simplest script is a bunch of shell commands. Shell scripts are used in order to boot the system. The user can also write and execute shell scripts. Shell – p. 3/55 Shell - which shell? There are several kinds of shells. For example, bash (Bourne Again Shell), csh, tcsh, zsh, ksh (Korn Shell). The most important shell is bash, since it is available on almost every free Unix system. The Linux system scripts use bash. The default shell for the user is set in the /etc/passwd file. Here is a line out of this file for example: dana:x:500:500:Dana,,,:/home/dana:/bin/bash This line means that user dana uses bash (located on the system at /bin/bash) as her default shell. Shell – p. 4/55 Starting to work in another shell If Dana wishes to temporarily use another shell, she can simply call this shell from the command line: [dana@granada ˜]$ bash dana@granada:˜$ #In bash now dana@granada:˜$ exit [dana@granada ˜]$ bash dana@granada:˜$ #In bash now, going to hit ctrl D dana@granada:˜$ exit [dana@granada ˜]$ #In original shell now Shell – p.
    [Show full text]