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.

Similar documents
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.

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.

Read the relevant material in Sobell! If you want to follow along with the examples that follow, and you do, open a Linux terminal.

Computer Systems and Architecture

Chapter Two. Lesson A. Objectives. Exploring the UNIX File System and File Security. Understanding Files and Directories

Computer Systems and Architecture

Unix background. COMP9021, Session 2, Using the Terminal application, open an x-term window. You type your commands in an x-term window.

Virtual Machine. Linux flavor : Debian. Everything (except slides) preinstalled for you.

Introduction to UNIX command-line

Introduction to Linux

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

Operating Systems and Using Linux. Topics What is an Operating System? Linux Overview Frequently Used Linux Commands

CS 460 Linux Tutorial

Working with Basic Linux. Daniel Balagué

Linux Operating System Environment Computadors Grau en Ciència i Enginyeria de Dades Q2

Introduction to Unix: Fundamental Commands

Introduction to Linux. Roman Cheplyaka

EECS Software Tools. Lab 2 Tutorial: Introduction to UNIX/Linux. Tilemachos Pechlivanoglou

Basic Shell Commands

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

History. Terminology. Opening a Terminal. Introduction to the Unix command line GNOME

Chapter-3. Introduction to Unix: Fundamental Commands

INSE Lab 1 Introduction to UNIX Fall 2017

Unix Basics. Systems Programming Concepts

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

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

Scripting Languages Course 1. Diana Trandabăț

5/8/2012. Creating and Changing Directories Chapter 7

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

LOG ON TO LINUX AND LOG OFF

Basic Unix Commands. CGS 3460, Lecture 6 Jan 23, 2006 Zhen Yang

Introduction to Linux Organizing Files

Utilities. September 8, 2015

Chapter 4. Unix Tutorial. Unix Shell

Linux Essentials Objectives Topics:

The Directory Structure

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

Operating Systems. Copyleft 2005, Binnur Kurt

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

Linux & Shell Programming 2014

Lab Working with Linux Command Line

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

Using Linux as a Virtual Machine

Introduction to UNIX command-line II

CSC UNIX System, Spring 2015

Linux Training. for New Users of Cluster. Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala

Introduction to UNIX I: Command Line 1 / 21

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

COMS 6100 Class Notes 3

Introduction to Linux

This is Lab Worksheet 3 - not an Assignment

CSCI 2132 Software Development. Lecture 4: Files and Directories

CHEM5302 Fall 2015: Introduction to Maestro and the command line

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.

CS197U: A Hands on Introduction to Unix

Introduction. File System. Note. Achtung!

Basic Linux (Bash) Commands

Connecting to ICS Server, Shell, Vim CS238P Operating Systems fall 18

Physics REU Unix Tutorial

UNIX. Basic UNIX Command

Unix tutorial. Thanks to Michael Wood-Vasey (UPitt) and Beth Willman (Haverford) for providing Unix tutorials on which this is based.

Lecture # 2 Introduction to UNIX (Part 2)

Files

Essential Linux Shell Commands

Unix Tools / Command Line

Systems Programming and Computer Architecture ( ) Exercise Session 01 Data Lab

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

Unix Tutorial Haverford Astronomy 2014/2015

CSC 112 Lab 1: Introduction to Unix and C++ Fall 2009

Unix. 1 tblgrant projects 0 Jun 17 15:40 doc1.txt. documents]$ touch doc2.txt documents]$ ls -l total 0

Introduction to the UNIX command line

Linux command line basics II: downloading data and controlling files. Yanbin Yin

GNU/Linux Course Lesson 1. Puria Nafisi

SECTION -C. Getting Started with UNIX

Mills HPC Tutorial Series. Linux Basics I

Introduction of Linux

Introduction to Linux and Supercomputers

Unix File System. Learning command-line navigation of the file system is essential for efficient system usage

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

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

No Food or Drink in this room. Logon to Windows machine

Examples: Directory pathname: File pathname: /home/username/ics124/assignments/ /home/username/ops224/assignments/assn1.txt

Linux/Cygwin Practice Computer Architecture

Getting started with Hugs on Linux

Week Overview. Unix file system File types and file naming Basic file system commands: pwd,cd,ls,mkdir,rmdir,mv,cp,rm man pages

Practical 4. Linux Commands: Working with Directories

Basic Survival UNIX.

The Unix Shell & Shell Scripts

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

CS Fundamentals of Programming II Fall Very Basic UNIX

Introduction to Linux and Cluster Computing Environments for Bioinformatics

Introduction to Unix and Linux. Workshop 1: Directories and Files

Linux Command Line Primer. By: Scott Marshall

Getting started with Hugs on Linux

Introduction to Linux

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

Hitchhiker s Guide to VLSI Design with Cadence & Synopsys

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX

Introduction to Unix - Lab Exercise 0

1Z Oracle Linux Fundamentals (Oracle Partner Network) Exam Summary Syllabus Questions

Transcription:

Warnings Linux Commands 1 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. Read the relevant material in Sobell! If you want to follow along with the examples that follow, and you do, open a Linux terminal. Second, most of the Linux commands have features that are enabled by using commandline switches; check the man pages for the commands for details!

Getting Started Linux Commands 2 The Linux terminal (or command shell) allows you to enter commands and execute programs. A terminal displays a prompt and a cursor indicating it s waiting for user input: The prompt itself is configurable; precisely how depends on the particular type of shell you are running. It is likely that by default you will run the bash shell.

What s Running? Linux Commands 3 The ps command displays information about processes the shell is currently running: We see that two processes are executing, bash and ps. Moreover, we see that: - each is assigned a unique numeric identifier called a process ID or PID - each is associated with a terminal (TTY) named pts/0 Try executing ps a second time you ll notice that the PID for bash is the same as before but the PID for ps has changed. Why? (That s two questions.)

More Information Try running ps with the l (that s ell) switch: Linux Commands 4 Don t worry about the meaning of all that just yet, but do notice that the results of the ps command were altered by the use of a switch on the command line. This is typical of Linux commands and many user programs.

One way to find out more Linux Commands 5 The man (manual) command can be used to obtain more information about Linux commands: The man pages are often the first resort for discovering options. Try running man man

The Linux Documentation Project Linux Commands 6

File System Basics Linux Commands 7 The file system is a set of data structures that organizes collections of files. Files are grouped into directories (although directories are themselves files). Here s one possible file system organization: root super-directory (parent) sub-directory (child) regular file

File Names Linux Commands 8 Each file and directory has a name: - names are case-sensitive - names within the same directory must be unique - the use of characters other than letters, digits, underscores and periods tends to cause extra work when using many commands File names are often of the form <name.ext>, such as BashTerminal.jpg. While file extensions are not mandatory, it is standard (and good) practice to employ them. It is bad practice to employ extensions incorrectly. Common ones include: - c C language source files - h C language header files - txt plain text files - gz file compressed with gzip - tar archive file created with tar - html hypertext markup language file

Absolute Pathnames Linux Commands 9 Each file (and directory) can be specified by a unique absolute pathname: / /etc /home/hls/bin/log

Home Directory Linux Commands 10 When you open a terminal, by default you will be in your home directory. Typically, this will be /home/<userid>, but you can check the path to your current directory by using the pwd command:

What s in here? Linux Commands 11 The ls command lists the files in the current directory:

Directory Tree Linux Commands 12 You can display a map of the directory tree rooted at your current directory:

Directory Navigation Linux Commands 13 You can use the cd command to change your current (or working) directory: Using cd with no destination moves you back to your home directory:

Relative Pathnames Linux Commands 14 You can also specify a pathname that s relative to the current (working) directory. Let s say you re in a directory at the top of the tree shown below: Public Documents/2505/examples

Relative Pathnames Linux Commands 15 There are two special directory names:. refers to the current directory.. refers to the parent of the current directory Suppose your working directory is Public:.. refers to williammcquain../documents/2104../documents/2505/examples../music

Making/Removing a Directory Linux Commands 16 You can create a new directory with the mkdir command: You can remove an empty directory with the rmdir command.

Copying Files: cp Linux Commands 17 You can create a copy of a file with the cp command. Assume we re in a directory containing a file named infloop.c: cp infloop.c infloop2.c makes a copy of infloop.c named infloop2.c in the same directory cp infloop.c.. makes a copy of infloop.c with the same name in the parent directory cp infloop.c../infloop2.c makes a copy of infloop.c, named infloop2.c, in the parent directory

Renaming/Moving Files: mv Linux Commands 18 As before, assume we re in a directory containing a file named infloop.c: mv infloop.c infiniteloop.c changes the name of the file infloop.c to infinitefloop.c mv infloop.c../attic moves the file infloop.c to the subdirectory of the parent named attic mv infloop.c../infiniteloop.c removes the file infloop.c from this directory, and creates a copy named infinitefloop.c in the parent directory

Viewing a File: cat and less Linux Commands 19 You can use the cat command to display the contents of a file to the terminal: You can use the less command to display the contents of a file to the terminal, one screenful at a time.

Viewing a File: head and tail Linux Commands 20 You can view the first few lines of a file by using the head command: You can control how many lines are shown; see the man page. There is an analogous tail command for viewing the last few lines of a file.

Searching File Contents: grep Linux Commands 21 The grep command can be used to display lines of a file that match a pattern: We will examine the grep command in considerably more detail in a future assignment.

Checking File Info: file Linux Commands 22 You can obtain information about a file with the file command:

Compressing Files: bzip2 Linux Commands 23 The bzip2 utility can frequently reduce the amount of space a file occupies:

Uncompressing a bzip2 d file: bunzip2 Linux Commands 24 You can uncompress a file created with bzip2 by using bunzip2:

Bundling Files into an Archive: tar Linux Commands 25 You can create a single file that contains a collection of files, including a directory structure with the tar utility: The following command would have created a compressed archive file (smaller) using the gzip utility: tar cvf 2505.tgz z 2104