Unix Tools / Command Line

Similar documents
Chapter-3. Introduction to Unix: Fundamental Commands

Computer Systems and Architecture

Introduction to Unix: Fundamental Commands

Computer Systems and Architecture

Introduction to Linux

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

Unix L555. Dept. of Linguistics, Indiana University Fall Unix. Unix. Directories. Files. Useful Commands. Permissions. tar.

Practical Session 0 Introduction to Linux

Introduction To Linux. Rob Thomas - ACRC

Exercise 1: Basic Tools

Unix as a Platform Exercises + Solutions. Course Code: OS 01 UNXPLAT

Unix as a Platform Exercises. Course Code: OS-01-UNXPLAT

Unix/Linux Operating System. Introduction to Computational Statistics STAT 598G, Fall 2011

CS 460 Linux Tutorial

Some useful UNIX Commands written down by Razor for newbies to get a start in UNIX

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

Introduction to Supercomputing

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Introduction to the Linux Command Line

Introduction to UNIX command-line II

Introduction to Linux Organizing Files

Basic Linux (Bash) Commands

GNU/Linux 101. Casey McLaughlin. Research Computing Center Spring Workshop Series 2018

Shell Programming Systems Skills in C and Unix

IMPORTANT: Logging Off LOGGING IN

On successful completion of the course, the students will be able to attain CO: Experiment linked. 2 to 4. 5 to 8. 9 to 12.

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.

Linux Shell Script. J. K. Mandal

Using the Unix system. UNIX Introduction

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

Introduction to remote command line Linux. Research Computing Team University of Birmingham

2) clear :- It clears the terminal screen. Syntax :- clear

Operating Systems. Copyleft 2005, Binnur Kurt

Intro to Linux. this will open up a new terminal window for you is super convenient on the computers in the lab

Operating Systems 3. Operating Systems. Content. What is an Operating System? What is an Operating System? Resource Abstraction and Sharing

Laboratory 1 Semester 1 11/12

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

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

Linux at the Command Line Don Johnson of BU IS&T

Getting your department account

CENG 334 Computer Networks. Laboratory I Linux Tutorial

Introduction to Linux

for more :-

*nix Crash Course. Presented by: Virginia Tech Linux / Unix Users Group VTLUUG

COL100 Lab 2. I semester Week 2, Open the web-browser and visit the page and visit the COL100 course page.

Reading and manipulating files

UNIX Basics. UNIX Basics CIS 218 Oakton Community College

acmteam/unix.pdf How to manage your account (user ID, password, shell); How to compile C, C++, and Java programs;

Introduction to UNIX Command Line

UNIX. Basic UNIX Command

unix intro Documentation

Lecture 5. Additional useful commands. COP 3353 Introduction to UNIX

FREEENGINEER.ORG. 1 of 6 11/5/15 8:31 PM. Learn UNIX in 10 minutes. Version 1.3. Preface

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

Unix Essentials. BaRC Hot Topics Bioinformatics and Research Computing Whitehead Institute October 12 th

Basic Linux Commands. Srihari Kalgi M.Tech, CSE (KReSIT), IIT Bombay. May 5, 2009

Linux Nuts and Bolts

The Unix Shell. Pipes and Filters

A Brief Introduction to the Linux Shell for Data Science

Introduction: What is Unix?

UNIX COMMANDS AND SHELLS. UNIX Programming 2015 Fall by Euiseong Seo

Unix Workshop Aug 2014

LAB 8 (Aug 4/5) Unix Utilities

Useful Unix Commands Cheat Sheet

Welcome to getting started with Ubuntu Server. This System Administrator Manual. guide to be simple to follow, with step by step instructions

Crash Course in Unix. For more info check out the Unix man pages -orhttp:// -or- Unix in a Nutshell (an O Reilly book).

Introduction to UNIX. Introduction EECS l UNIX is an operating system (OS). l Our goals:

CS197U: A Hands on Introduction to Unix

UNIX File Hierarchy: Structure and Commands

Chapter 1 - Introduction. September 8, 2016

Unit 10. Linux Operating System

CSC UNIX System, Spring 2015

Introduction to the shell Part II

Where can UNIX be used? Getting to the terminal. Where are you? most important/useful commands & examples. Real Unix computers

Contents. xxvii. Preface

5/8/2012. Exploring Utilities Chapter 5

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.

3/8/2017. Unix/Linux Introduction. In this part, we introduce. What does an OS do? Examples

CSE 390a Lecture 2. Exploring Shell Commands, Streams, and Redirection

Files

Unit 13. Linux Operating System Debugging Programs

System Administration

Introduction to Linux

LAB 8 (Aug 4/5) Unix Utilities

Shell Programming Overview

Introduction. File System. Note. Achtung!

Introduction to UNIX. Introduction. Processes. ps command. The File System. Directory Structure. UNIX is an operating system (OS).

Introduction to UNIX. CSE 2031 Fall November 5, 2012

hash Remember the full pathname of a name argument head Output the first part of file(s) history Command History hostname Print or set system name

Carnegie Mellon. Linux Boot Camp. Jack, Matthew, Nishad, Stanley 6 Sep 2016

Table of contents. Our goal. Notes. Notes. Notes. Summer June 29, Our goal is to see how we can use Unix as a tool for developing programs

Introduction to Unix CHAPTER 6. File Systems. Permissions

Set 1 MCQ Which command is used to sort the lines of data in a file in reverse order A) sort B) sh C) st D) sort -r

Introduction to Linux Environment. Yun-Wen Chen

Introduction to UNIX command-line

Perl and R Scripting for Biologists

Linux Command Line Primer. By: Scott Marshall

Quick Start Guide. by Burak Himmetoglu. Supercomputing Consultant. Enterprise Technology Services & Center for Scientific Computing

The Linux Command Line & Shell Scripting

CSE 15L Winter Midterm :) Review

Transcription:

Unix Tools / Command Line An Intro 1

Basic Commands / Utilities I expect you already know most of these: ls list directories common options: -l, -F, -a mkdir, rmdir make or remove a directory mv move/rename a file rm remove a file Common option: -f cd, pwd change / print the current working directory cat concatenate files more (or less) display a large file, one screen at a time. man look up manual pages common options: -k -a gcc compile a C program. Common options: -o -O -g -std= -Wall 2

globbing An asterisk matches any string (even zero length): ls *.c A question mark matches any single character. ls?.c Square brackets can specify a character class or a range: ls [abcd].c ls [a-d].c Caret at the beginning negates the selection in the class: ls [^a-za-z]* Matches any file name beginning with something other than a letter Use of quotes prevents globbing ls?.c Only matches the file [oddly] named?.c 3

I/O redirection To standard output ls > outputfile # replaces outputfile ls >> outputfile # appends to outputfile Standard error myprogram 2> errorfile Standard output AND standard error to the same file? Might try: myprogram 2> afile > afile myprogram > afile 2> afile Actually, those don t work. Correct way is either: myprogram > afile 2>&1 myprogram &> afile Standard input mail jsterling@poly.edu < Jabberwocky.txt mail jsterling@poly.edu << blah this is the stuff before blah blah 4

Piping Piping allows the output of one process to be fed into another. In the shell, the vertical bar is used. Examples If a command has a lot of output, feed it to more (or less). dmesg less Getting a count of lines: ps ax wc l Spell checker: tr -d '.,;:"\!\[]()?' tr ' ' ' ' \ tr ' ' '\n' tr '[A-Z]' '[a-z]' \ sort uniq comm -23 - /usr/dict/words 5

find Figure out where you put your files find start options find. -name pattern print Lists all files that match the pattern in the current directory and any subdirectories. The pattern should be in quotes to prevent the shell from using globbing in the current directory. -print is a default action so it can be omitted if there is no other action. find. -name *.exe print delete Remember the quotes if you are using globbing. Lists and deletes all files ending in.exe in the current directory and subdirectores. Avoid using find on the root directory on a shared machine. 6

Archiving Most common command is tar Create a tar file Command: tar -cvf the_tar_file files The dash is generally optional. The option c means create The option v means verbose The option f says the next file is the tar file to create. Untar. Use option x tar xvf the_tar_file Check the contents of a tar file. Use option t tar tvf the_tar_file Also compress/uncompress with gzip. Use option z. tar -cvzf the_tar_file files tar xvzf the_tar_file 7

Viewing a binary file hexdump hexdump C somefile Outputs file in both hex and ascii text. There are lots of options but the C option provides a commonly convenient view of the file. bless A popular hex editor for Linux Emacs To enter: M-x hexl-mode To exit: C-c C-c 8

Where am I logged in? And to what? uname prints system information With no parameters prints the kernel s name To get everything us the a option uname a On pdc-amd01 prints: Linux pdc-amd01 2.6.24-28-generic #1 SMP Wed Nov 24 09:00:20 UTC 2010 x86_64 GNU/Linux On my cygwin prints CYGWIN_NT-5.1 Gandalf 1.5.19(0.150/4/2) 2006-01-20 13:28 i686 Cygwin Can also use hostname, which just tells you the hostname. Ok, it also lets you change it 9

If you don t know who you are If you don t know who you are then you ve got a problem But you can solve it with the command: whoami You can also find out your uid, guid and groups with id 10

Other Common Utilities chmod change the permissions on a file cmp compare sorted files (what's in one, the other, both) diff line by line difference between two files df disk space free du disk space used gdb debugger grep find lines that match a regular expression Common option: -r head, tail print the first or last lines of a file make run the commands in a Makefile (covered in C slides) pushd, popd, dirs keep a stack of current directories sort sort a file tr translate characters uniq remove duplicates umask change / print the user file-creation mask 11