Unix 201 Slides

Total Page:16

File Type:pdf, Size:1020Kb

Unix 201 Slides Unix 201 Purdue University - ITaP Gladys Andino Dan Dietz Jieyu Gao Lev Gorenstein Erik Gough Stephen Harrell Randy Herban Steve Kelley Boyu Zhang Xiao Zhu [email protected] February 6th and 8th, 2018 Slides available: https://www.rcac.purdue.edu/training/unix201/ Acknowledgments Acknowledgments Logging In Text Manipulation Regular Expressions Advanced Text Acknowledgments Manipulation Redirects and Loops Bash Programming Conditionals and Loops 2 / 143 Acknowledgments Acknowledgments Logging In A few additional acknowledgments to the many people who Text have helped make this workshop possible. Manipulation Regular • The material in this workshop was prepared by the Purdue Expressions University ITaP Research Computing team. Advanced Text • Special thanks to Eric Adams and Megan Dale for Manipulation organizing the workshop sessions. Redirects and Loops • We have drawn from documentation provided by the Bash Programming Purdue Bioinformatics Core used in the UNIX for Conditionals Biologists workshop and Next-generation Transcriptome and Loops Analysis Workshop Manual provided by Professor Michael Gribskov and Professor Esperanza Torres. 3 / 143 Logging In Acknowledgments Logging In Windows Mac Activity Files Text Manipulation Logging In Regular Expressions Windows Advanced Mac Text Manipulation Activity Files Redirects and Loops Bash Programming Conditionals and Loops 4 / 143 Logging In Acknowledgments Logging In We will be using the Radon cluster: Windows Mac • www.rcac.purdue.edu/compute/radon/ Activity Files Text • Everyone has been given an account on the cluster for the Manipulation duration of the workshop Regular Expressions • If you wish to continue using Radon or other cluster after Advanced Text the workshop concludes, please make a request under your Manipulation advisor or PI's name: Redirects and Loops https://www.rcac.purdue.edu/account/request/ Bash Programming Conditionals and Loops 5 / 143 Logging In Windows Acknowledgments Logging In Many clients are available for Windows: Windows Mac • We will use the PuTTY SSH client Activity Files Text • Download PuTTY, no install required Manipulation Regular • http://www.chiark.greenend.org.uk/ sgtatham/putty/- Expressions download.html Advanced Text (or Google search putty) Manipulation • Download putty.exe for Intel x86 to your desktop Redirects and Loops Bash Programming Conditionals and Loops 6 / 143 Logging In Windows Acknowledgments Logging In Host Name for Radon is radon.rcac.purdue.edu Windows Mac Activity Files Text Manipulation Regular Expressions Advanced Text Manipulation Redirects and Loops Bash Programming Conditionals and Loops 7 / 143 Logging In Windows Acknowledgments Logging In One tweak: enable system colors in Appearance ! Colours Windows Mac Activity Files Text Manipulation Regular Expressions Advanced Text Manipulation Redirects and Loops Bash Programming Conditionals and Loops 8 / 143 Logging In Mac Acknowledgments Logging In Connect using: Windows Mac ssh [email protected] Activity Files Text Manipulation Regular Expressions Advanced Text Manipulation Redirects and Loops Bash Programming Conditionals and Loops 9 / 143 Logging In Mac Acknowledgments Logging In Linux also has a built in terminal client, similar to Mac: Windows Mac ssh [email protected] Activity Files Text Manipulation Regular Expressions Advanced Text Manipulation Redirects and Loops Bash Programming Conditionals and Loops 10 / 143 Logging In Activity Files Acknowledgments Logging In We'll need a few files for some of the hands-on activities Windows Mac cd Activity Files $ $ cp -r /depot/itap/unix101 . Text Manipulation Regular Expressions Advanced Text Manipulation Redirects and Loops Bash Programming Conditionals and Loops 11 / 143 Text Manipulation Acknowledgments Logging In Text Manipulation wc cut sort Text Manipulation uniq Exercises wc Regular cut Expressions sort Advanced Text uniq Manipulation Exercises Redirects and Loops Bash Programming Conditionals and Loops 12 / 143 Text Manipulation wc Acknowledgments Logging In The wc (word count) command simply counts the number of Text lines, words, and characters. Manipulation wc cut sort General syntax: uniq Exercises wc [OPTIONS] FILENAME Regular Expressions include: Advanced OPTIONS Text Manipulation • -l count lines only Redirects and • -w count words only Loops Bash • -c count characters only Programming Conditionals and Loops 13 / 143 Text Manipulation wc Acknowledgments Logging In Try this: Text Manipulation $ cd ~/unix101/Shakespeare wc $ cat wcdemo.txt cut This is just a very simple sort uniq text file that we'll use Exercises to demonstrate wc Regular Expressions $ wc wcdemo.txt Advanced 3 14 70 wcdemo.txt Text Manipulation This tells us that the file wcdemo.txt has: Redirects and Loops • 3 lines Bash Programming • 14 words Conditionals and Loops • 70 characters The we'll in the file looks like one word to Unix text processing commands. 14 / 143 Text Manipulation cut Acknowledgments Logging In The cut command is used to select sections of each line of a Text file or files. Manipulation wc cut sort General syntax: uniq Exercises cut [OPTIONS] FILENAME Regular Expressions include: Advanced OPTIONS Text Manipulation • -d specify a character instead of TAB for field delimiter Redirects and • -f select only these fields; also print any line that contains Loops Bash no delimiter character Programming Conditionals and Loops 15 / 143 Text Manipulation cut Acknowledgments Logging In Try this: Text Manipulation $ cd ~/unix101/protein wc cut $ head -n 5 1UBQ.pdb sort uniq HEADER CHROMOSOMAL PROTEIN 02-JAN-87 1UBQ Exercises TITLE STRUCTURE OF UBIQUITIN REFINED AT 1.8 ANGSTROMS RESOLUTION Regular COMPND MOL_ID: 1; Expressions COMPND 2 MOLECULE: UBIQUITIN; Advanced COMPND 3 CHAIN: A; Text Manipulation $ cut -f1 -d' ' 1UBQ.pdb | head -n 5 Redirects and HEADER Loops TITLE Bash COMPND Programming COMPND Conditionals COMPND and Loops 16 / 143 Text Manipulation sort Acknowledgments Logging In The sort command is used to sort lines of a text file. Text Manipulation wc General syntax: cut sort sort [OPTIONS] FILENAME uniq Exercises Regular OPTIONS include: Expressions Advanced • -n compare according to numerical value. Text Manipulation • -r reverse the result of comparisons. Redirects and Loops • -u return only unique lines. Bash Notes: Programming Conditionals • By default, lines are sorted alphabetically. and Loops • By default, lines starting with numbers are not sorted numerically. For example, "8 9 10 11" would be sorted as "10 11 8 9". 17 / 143 Text Manipulation sort Acknowledgments Logging In Try sort on words and num.txt: Text cd ~/unix101/Shakespeare Manipulation $ wc $ sort words_and_num.txt cut sort sort sort -n sort -r uniq $ $ $ Exercises 1 ana zoo Regular 11 MAX MAX Expressions 23 zoo ana Advanced 3 1 7 Text 5 3 5 Manipulation 7 5 3 Redirects and ana 7 23 Loops MAX 11 11 Bash zoo 23 1 Programming Count unique values in first column: Conditionals and Loops $ cd ~/unix101/protein $ cut -f1 -d'' 1UBQ.pdb | sort -u | wc -l 27 18 / 143 Text Manipulation uniq Acknowledgments Logging In The uniq command simply takes a sorted file and outputs the Text unique lines in it. The input must be sorted first. Manipulation wc cut sort General syntax: uniq Exercises uniq [OPTIONS] INPUT Regular Expressions include: Advanced OPTIONS Text Manipulation • -c count how many times each line occurred. Redirects and • -d only print duplicated lines. Loops Bash Programming Conditionals and Loops 19 / 143 Text Manipulation uniq Acknowledgments Logging In Try this: Text Manipulation $ cd ~/unix101/Shakespeare wc cut $ sort HamletWords.txt | uniq -c | head -n 5 sort uniq 36 1 Exercises 12 2 Regular 531 a Expressions 3 'a Advanced 1 abate Text $ sort HamletWords.txt | uniq -c | head -n 5 | sort -n Manipulation 1 abate Redirects and 3 'a Loops 12 2 Bash 36 1 Programming 531 a Conditionals and Loops 20 / 143 Text Manipulation uniq Acknowledgments Logging In Try this: Text Manipulation $ cd ~/unix101/Shakespeare wc cut $ sort HamletWords.txt | uniq -u | head -n 5 sort uniq abate Exercises abatements Regular abhorred Expressions ability Advanced Able Text $ sort HamletWords.txt | uniq -u > uniques Manipulation $ cat uniques Redirects and $ sort HamletWords.txt | uniq -u | wc -l Loops 3145 Bash Programming Conditionals and Loops 21 / 143 Text Manipulation Exercises Acknowledgments Logging In Try the following command sequence: Text 1. Change directory to Manipulation ~/unix101/data wc cut 2. Using a single line command, "ls" all the files in this sort uniq directory and sort alphabetically then "ls -l" and sort Exercises Regular 3. Find out how many times "TAIR00" and "TAIR10" Expressions appear in the file at genes.txt Advanced Text 4. Using a single line command find out how many unique Manipulation descriptions appear for column 3 in the "at genes.txt", Redirects and Loops please perform the search in a numerical order Bash Programming 5. Display 1st, 4th and 5th column of the "at genes.txt" Conditionals file, sorted in ascending order according to second field and Loops 22 / 143 Text Manipulation Exercises Acknowledgments Logging In Answers: Text 1. Change directory to ~/unix101/data Manipulation wc cut $ cd ~/unix101/data sort $ pwd uniq /home/gandino/unix101/data Exercises Regular Expressions 2. Using a single line command, "ls" all the files in this Advanced directory and sort alphabetically then "ls -l" and sort Text Manipulation $ ls | sort Redirects and at_genes.txt Loops awkdata.txt Bash grepdata.txt Programming Conditionals
Recommended publications
  • UNIX Cheat Sheet – Sarah Medland Help on Any Unix Command List a Directory Change to Directory Make a New Directory Remove A
    THE 2013 INTERNATIONAL WORKSHOP ON STATISTICAL METHODOLOGY FOR HUMAN GENOMIC STUDIES UNIX cheat sheet – Sarah Medland Help on any Unix command man {command} Type man ls to read the manual for the ls command. which {command} Find out where a program is installed whatis {command} Give short description of command. List a directory ls {path} ls -l {path} Long listing, with date, size and permisions. ls -R {path} Recursive listing, with all subdirs. Change to directory cd {dirname} There must be a space between. cd ~ Go back to home directory, useful if you're lost. cd .. Go back one directory. Make a new directory mkdir {dirname} Remove a directory/file rmdir {dirname} Only works if {dirname} is empty. rm {filespec} ? and * wildcards work like DOS should. "?" is any character; "*" is any string of characters. Print working directory pwd Show where you are as full path. Copy a file or directory cp {file1} {file2} cp -r {dir1} {dir2} Recursive, copy directory and all subdirs. cat {newfile} >> {oldfile} Append newfile to end of oldfile. Move (or rename) a file mv {oldfile} {newfile} Moving a file and renaming it are the same thing. View a text file more {filename} View file one screen at a time. less {filename} Like more , with extra features. cat {filename} View file, but it scrolls. page {filename} Very handy with ncftp . nano {filename} Use text editor. head {filename} show first 10 lines tail {filename} show last 10 lines Compare two files diff {file1} {file2} Show the differences. sdiff {file1} {file2} Show files side by side. Other text commands grep '{pattern}' {file} Find regular expression in file.
    [Show full text]
  • What Is UNIX? the Directory Structure Basic Commands Find
    What is UNIX? UNIX is an operating system like Windows on our computers. By operating system, we mean the suite of programs which make the computer work. It is a stable, multi-user, multi-tasking system for servers, desktops and laptops. The Directory Structure All the files are grouped together in the directory structure. The file-system is arranged in a hierarchical structure, like an inverted tree. The top of the hierarchy is traditionally called root (written as a slash / ) Basic commands When you first login, your current working directory is your home directory. In UNIX (.) means the current directory and (..) means the parent of the current directory. find command The find command is used to locate files on a Unix or Linux system. find will search any set of directories you specify for files that match the supplied search criteria. The syntax looks like this: find where-to-look criteria what-to-do All arguments to find are optional, and there are defaults for all parts. where-to-look defaults to . (that is, the current working directory), criteria defaults to none (that is, select all files), and what-to-do (known as the find action) defaults to ‑print (that is, display the names of found files to standard output). Examples: find . –name *.txt (finds all the files ending with txt in current directory and subdirectories) find . -mtime 1 (find all the files modified exact 1 day) find . -mtime -1 (find all the files modified less than 1 day) find . -mtime +1 (find all the files modified more than 1 day) find .
    [Show full text]
  • Application of Ethernet Networking Devices Used for Protection and Control Applications in Electric Power Substations
    Application of Ethernet Networking Devices Used for Protection and Control Applications in Electric Power Substations Report of Working Group P6 of the Power System Communications and Cybersecurity Committee of the Power and Energy Society of IEEE September 12, 2017 1 IEEE PES Power System Communications and Cybersecurity Committee (PSCCC) Working Group P6, Configuring Ethernet Communications Equipment for Substation Protection and Control Applications, has existed during the course of report development as Working Group H12 of the IEEE PES Power System Relaying Committee (PSRC). The WG designation changed as a result of a recent IEEE PES Technical Committee reorganization. The membership of H12 and P6 at time of approval voting is as follows: Eric A. Udren, Chair Benton Vandiver, Vice Chair Jay Anderson Galina Antonova Alex Apostolov Philip Beaumont Robert Beresh Christoph Brunner Fernando Calero Christopher Chelmecki Thomas Dahlin Bill Dickerson Michael Dood Herbert Falk Didier Giarratano Roman Graf Christopher Huntley Anthony Johnson Marc LaCroix Deepak Maragal Aaron Martin Roger E. Ray Veselin Skendzic Charles Sufana John T. Tengdin 2 IEEE PES PSCCC P6 Report, September 2017 Application of Ethernet Networking Devices Used for Protection and Control Applications in Electric Power Substations Table of Contents 1. Introduction ...................................................................................... 10 2. Ethernet for protection and control .................................................. 10 3. Overview of Ethernet message
    [Show full text]
  • Linux Networking 101
    The Gorilla ® Guide to… Linux Networking 101 Inside this Guide: • Discover how Linux continues its march toward world domination • Learn basic Linux administration tips • See how easy it can be to build your entire network on a Linux foundation • Find out how Cumulus Linux is your ticket to networking freedom David M. Davis ActualTech Media Helping You Navigate The Technology Jungle! In Partnership With www.actualtechmedia.com The Gorilla Guide To… Linux Networking 101 Author David M. Davis, ActualTech Media Editors Hilary Kirchner, Dream Write Creative, LLC Christina Guthrie, Guthrie Writing & Editorial, LLC Madison Emery, Cumulus Networks Layout and Design Scott D. Lowe, ActualTech Media Copyright © 2017 by ActualTech Media. All rights reserved. No portion of this book may be reproduced or used in any manner without the express written permission of the publisher except for the use of brief quotations. The information provided within this eBook is for general informational purposes only. While we try to keep the information up- to-date and correct, there are no representations or warranties, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the information, products, services, or related graphics contained in this book for any purpose. Any use of this information is at your own risk. ActualTech Media Okatie Village Ste 103-157 Bluffton, SC 29909 www.actualtechmedia.com Entering the Jungle Introduction: Six Reasons You Need to Learn Linux ....................................................... 7 1. Linux is the future ........................................................................ 9 2. Linux is on everything .................................................................. 9 3. Linux is adaptable ....................................................................... 10 4. Linux has a strong community and ecosystem ........................... 10 5.
    [Show full text]
  • How to Build a Search-Engine with Common Unix-Tools
    The Tenth International Conference on Advances in Databases, Knowledge, and Data Applications Mai 20 - 24, 2018 - Nice/France How to build a Search-Engine with Common Unix-Tools Andreas Schmidt (1) (2) Department of Informatics and Institute for Automation and Applied Informatics Business Information Systems Karlsruhe Institute of Technologie University of Applied Sciences Karlsruhe Germany Germany Andreas Schmidt DBKDA - 2018 1/66 Resources available http://www.smiffy.de/dbkda-2018/ 1 • Slideset • Exercises • Command refcard 1. all materials copyright, 2018 by andreas schmidt Andreas Schmidt DBKDA - 2018 2/66 Outlook • General Architecture of an IR-System • Naive Search + 2 hands on exercices • Boolean Search • Text analytics • Vector Space Model • Building an Inverted Index & • Inverted Index Query processing • Query Processing • Overview of useful Unix Tools • Implementation Aspects • Summary Andreas Schmidt DBKDA - 2018 3/66 What is Information Retrieval ? Information Retrieval (IR) is finding material (usually documents) of an unstructured nature (usually text) that satisfies an informa- tion need (usually a query) from within large collections (usually stored on computers). [Manning et al., 2008] Andreas Schmidt DBKDA - 2018 4/66 What is Information Retrieval ? need for query information representation how to match? document document collection representation Andreas Schmidt DBKDA - 2018 5/66 Keyword Search • Given: • Number of Keywords • Document collection • Result: • All documents in the collection, cotaining the keywords • (ranked by relevance) Andreas Schmidt DBKDA - 2018 6/66 Naive Approach • Iterate over all documents d in document collection • For each document d, iterate all words w and check, if all the given keywords appear in this document • if yes, add document to result set • Output result set • Extensions/Variants • Ranking see examples later ...
    [Show full text]
  • Introduction to Linux Quick Reference Guide Page 2 of 7
    Birmingham Environment for Academic Research Introduction to Linux Quick Reference Guide Research Computing Team V1.0 Contents The Basics ............................................................................................................................................ 4 Directory / File Permissions ................................................................................................................ 5 Process Management ......................................................................................................................... 6 Signals ................................................................................................................................................. 7 Looking for Processes ......................................................................................................................... 7 Introduction to Linux Quick Reference Guide Page 2 of 7 This guide assumes that PuTTY is setup and configured for BlueBear per the instructions found at ( https://intranet.birmingham.ac.uk/it/teams/infrastructure/research/bear/bluebear/accessing- bluebear-using-putty-and-exceed.aspx#ConfiguringPuTTY ) Double-click on the icon on your desktop, or go to the Start button in Windows¦ All Programs ¦ PuTTY ¦ click once on PuTTY to start the program. Double-click on bluebear to start the program or click once on bluebear and click Open. Introduction to Linux Quick Reference Guide Page 3 of 7 Log in using your user ID and password. The Basics Command What it means Example ls Displays a list
    [Show full text]
  • Midterm Test #1 − 10% Ian! D
    45 M/C Questions -1- 45 minutes 45 M/C Questions -2- 45 minutes 6. [66/167] If mt is an empty sub-directory,what is true after this: PRINT Name: LAB Section: touch bar ; mkdir foo ; mv bar mt/foo Test Version: ___ One-Answer Multiple Choice 45 Questions − 10 of 10% a. the directory foo nowcontains a file named bar the directory mt nowcontains a file named foo ☞ b. Read all the words of these instructions and both sides (back and front) of all pages. c. the directory mt nowcontains a file named bar ☞ Manage your time. Answer questions you know, first. One Answer per question. d. the command fails because mt/foo is not a directory ☞ Put your Name and Lab on this Question Sheet. Youmay write or drawonthis sheet. e. the directory mt is still empty ☞ Use your full, unabbreviated name on the mark-sense form. Do not abbreviate your name. ☞ Put the three-digit Test Version above into NO. OF QUESTIONS and NO. OF STUDENTS 7. [67/168] What is the output of this in an empty directory: ☞ Fill in the bubbles with pencil only,nopen. Enter your NAME, Test Version, and answers. touch 1 13 .13 2 213 3 30 31 .31 ; echo [13]* ☞ Taip The answer to the last question about reading/doing all these test instructions is: a. 13 b. an error message from echo saying [13]* does not exist c. [13]* 1. [49/169] If file foo contains 8 lines, and file bar contains 9 lines, then how manylines are output on your screen by this: cat bar | echo foo d.
    [Show full text]
  • Software Release Notes for 5.0
    Software Release Notes for 5.0 Jeffery A. Triggs, Sho Nakagama, & Isaiah Beard August 17, 2009 1 Introduction This document supersedes relevant sections of the one entitled “Software Release Procedures for 1.1” dated February 8, 2006. It reflects our our migration to a new platform, including Fedora 3.0, PHP 5, and MySQL 5. The following sections describe: 1) the base software platform, which should already be in place before any release of the project software; 2) the different projects to be released along with their functions. 2 Basic Software Platform Requirements This section deals with the underlying software platforms necessary for the 5.0 release. The software is developed on Linux at the SCC and released on Solaris at Library Systems. The basic software packages are compiled and loaded separately on each of these platforms, and should remain stable throughout the 5.x release cycle. 2.1 amberfish 1.6.4 2.1.1 xerces 2.7 2.2 Apache Server version: Apache/2.0.59 Server compiled with.... -D APACHE_MPM_DIR="server/mpm/prefork" Software Release Notes for 5.0 2 -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_SYSVSEM_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D HTTPD_ROOT="/usr/local/apache2" -D SUEXEC_BIN="/usr/local/apache2/bin/suexec" -D DEFAULT_PIDLOG="logs/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_LOCKFILE="logs/accept.lock" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="conf/mime.types" -D SERVER_CONFIG_FILE="conf/httpd.conf" ./configure --enable-ssl --enable-so --with-mpm=prefork --enable-mods-shared=most --with-openssl=/usr 2.3 CNRI Handles The CNRI handle client is run typically on ingest.
    [Show full text]
  • Command Line Basics
    Education Outreach and Training Tutorials Introduction to Linux: Command Line Basics September 26th, 2017 (10:00AM-12:00PM PST) Phillip A Richmond Copyright Information The material is open source, and in this presentation no previous external work was utilized. Welcome! ● Welcome to the Introduction to Linux Command Line ● In this tutorial we will explore the command line interface for the WestGrid High Performance Compute resource (available for free to academic Canadian researchers) ● If you can, follow along with me. But if I move too fast (and I will for some people), just listen and take notes. ● This presentation will be recorded and the slides will remain available indefinitely ● DO THE PROBLEM SET AT THE END!!! Interactive Experience We hope this is an interactive experience for all of you. Questions/Problems can be posted to the etherpad: https://etherpad.openstack.org/p/EOT_Tutorial_IntroToLinuxCommandLine We have 4 TAs to assist in answering questions and solving problems, at the end of the session I can address unresolved questions Your own cheat sheet Copy paste commands from the github gist: Github Gist (https://gist.github.com/Phillip-a-richmond/a22f4e967c1fd56235f77fbe1c7936f8) Each command is broken down as follows: # What it does (name_of_command) ## Basic/advanced usage ### template example Actual Command Line Session Learning Goals ● Basics of computing with high performance computers ● Learn about the filesystem hierarchy ● Master basic linux commands for navigating filesystem ○ cd, ls, pwd, mkdir ● Utilize basic linux commands for file handling ○ mv, cp, rm, grep, more, less, head, tail, cat ● Use the manual command (man) to get more details on linux command line options ● Download and decompress files from the internet ○ wget, gunzip, gzip ● Edit files using nano ○ nano The things learned today will be quickly forgotten without practice and repetition.
    [Show full text]
  • Gnu Coreutils Core GNU Utilities for Version 6.9, 22 March 2007
    gnu Coreutils Core GNU utilities for version 6.9, 22 March 2007 David MacKenzie et al. This manual documents version 6.9 of the gnu core utilities, including the standard pro- grams for text and file manipulation. Copyright c 1994, 1995, 1996, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled \GNU Free Documentation License". Chapter 1: Introduction 1 1 Introduction This manual is a work in progress: many sections make no attempt to explain basic concepts in a way suitable for novices. Thus, if you are interested, please get involved in improving this manual. The entire gnu community will benefit. The gnu utilities documented here are mostly compatible with the POSIX standard. Please report bugs to [email protected]. Remember to include the version number, machine architecture, input files, and any other information needed to reproduce the bug: your input, what you expected, what you got, and why it is wrong. Diffs are welcome, but please include a description of the problem as well, since this is sometimes difficult to infer. See section \Bugs" in Using and Porting GNU CC. This manual was originally derived from the Unix man pages in the distributions, which were written by David MacKenzie and updated by Jim Meyering.
    [Show full text]
  • Simple Filters
    SIMPLE FILTERS Filters are the commands which accept data from standard input manipulate it and write the results to standard output. Filters are the central tools of the UNIX tool kit, and each filter performs a simple function. Some commands use delimiter, pipe (|) or colon (:). Many filters work well with delimited fields, and some simply won’t work without them. The piping mechanism allows the standard output of one filter serve as standard input of another. The filters can read data from standard input when used without a filename as argument, and from the file otherwise The Simple Database Several UNIX commands are provided for text editing and shell programming. (emp.lst) - each line of this file has six fields separated by five delimiters. The details of an employee are stored in one single line. This text file designed in fixed format and containing a personnel database. There are 15 lines, where each field is separated by the delimiter |. $ cat emp.lst 2233 | a.k.shukla | g.m | sales | 12/12/52 | 6000 9876 | jai sharma | director | production | 12/03/50 | 7000 5678 | sumit chakrobarty | d.g.m. | marketing | 19/04/43 | 6000 2365 | barun sengupta | director | personnel | 11/05/47 | 7800 5423 | n.k.gupta | chairman | admin | 30/08/56 | 5400 1006 | chanchal singhvi | director | sales | 03/09/38 | 6700 6213 | karuna ganguly | g.m. | accounts | 05/06/62 | 6300 1265 | s.n. dasgupta | manager | sales | 12/09/63 | 5600 4290 | jayant choudhury | executive | production | 07/09/50 | 6000 2476 | anil aggarwal | manager | sales | 01/05/59 | 5000 6521 | lalit chowdury | directir | marketing | 26/09/45 | 8200 3212 | shyam saksena | d.g.m.
    [Show full text]
  • Basic Unix Command
    Basic Unix Command 1 Navigation commands ls list the content of a directory cd dirname change directory, e.g., cd /usr/local/doc cd .. move one directory up cd (without arguments) move to the home directory pwd prints the working directory (where you are!) mkdir dirname create an empty directory named "dirname" rmdir dirname delete an empty directory named "dirname" rm filename1 filename2 delete files ”filename1” and ”filename2” rm -r dirname delete a directory and its content mv filename dirname move the file to a different directory mv oldfilename newfilename rename a file, from ”oldfilename” to ”newfilename” cp filename dirname copy the file to a directory cp -r dirname newpath copy a directory to a new path 2 Looking into files cat filename shows the content of a file cat filename1 filename2 > concatenate the content of two file and write it into a new file outputfile ”outputfile” shows the content of the file starting from the top (use arrows to less filename navigate into the file and hit "q" to exit from the program) head filename shows the content of the first 10 lines of the file head -n 20 filename shows the content of the first 20 lines of the file tail filename shows the content of the last 10 lines of the file tail -n 20 filename shows the content of the last 20 lines of the file 3 File processing extract lines that contain the string "something" (case sensitive; grep "something" filename add "-i" parameter for case insensitive) extract lines that do NOT contain the string "something" (case grep -v "something" filename sensitive; add "-i" parameter for case insensitive) wc filename print characters, words and lines in the file wc -c filename prints characters in the file wc -w filename prints words in the file wc -l filename prints lines in the file cut -f 3,7 filename prints 3rd and 7th columns of a tab-separeted file cut -d, -f 3,7 filename prints 3rd and 7th columns of a comma-separeted file 1 4 Command line tips history Shows all the command executed in the shell.
    [Show full text]