UNIX Tutorial One

Similar documents
The Directory Structure

1 Getting Started with Linux.

INSE Lab 1 Introduction to UNIX Fall 2017

UNIX Tutorial Two

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

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

Scripting Languages Course 1. Diana Trandabăț

Overview of the UNIX File System. Navigating and Viewing Directories

UNIX Tutorial Five

Overview of the UNIX File System

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

CSE115 Lab exercises for week 1 of recitations Spring 2011

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

Unix Tutorial Haverford Astronomy 2014/2015

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

You should see something like this, called the prompt :

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

Parts of this tutorial has been adapted from M. Stonebank s UNIX Tutorial for Beginners (

Tutorial 1: Unix Basics

A Short Introduction to UNIX Operating System

Commands are in black

Linux + Galaxy Server Tutorial

Some Linux (Unix) Commands that might help you in ENSC351

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

Physics REU Unix Tutorial

CSCI 2132 Software Development. Lecture 4: Files and Directories

Linux Pathnames and Directories

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

Introduction to Linux

6. Distributed File System

Unix Basics. Systems Programming Concepts

Introduction to Unix - Lab Exercise 0

Chapter 2 Text Processing with the Command Line Interface

Linux File System and Basic Commands

Mills HPC Tutorial Series. Linux Basics I

Oxford University Computing Services. Getting Started with Unix

Module 10: Unix Primer

Lab 1 Introduction to UNIX and C

Operating System Interaction via bash

CS Fundamentals of Programming II Fall Very Basic UNIX

Files

Computer Science 62 Lab 8

PDS Lab Section 16 Autumn Tutorial 1. Unix Commands pwd The pwd command displays the full pathname of the current directory.

Common UNIX Commands. Unix. User Interfaces. Unix Commands Winter COMP 1270 Computer Usage II 9-1. Using UNIX. Unix has a command line interface

CENG 334 Computer Networks. Laboratory I Linux Tutorial

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

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

Unix Filesystem. January 26 th, 2004 Class Meeting 2

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX

Introduction to the Linux Command Line

Using WestGrid from the desktop Oct on Access Grid

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering

Unix/Linux Primer. Taras V. Pogorelov and Mike Hallock School of Chemical Sciences, University of Illinois

Introduction to the UNIX command line

Essential Linux Shell Commands

Chapter-3. Introduction to Unix: Fundamental Commands

Files and Directories

$Id: asg4-shell-tree.mm,v :36: $

Using the Zoo Workstations

MINI-HOWTO backup and/or restore device or partition using zsplit/unzsplit

CpSc 1111 Lab 1 Introduction to Unix Systems, Editors, and C

CSCI 161: Introduction to Programming I Lab 1a: Programming Environment: Linux and Eclipse

Practical 4. Linux Commands: Working with Directories

CST Lab 2 Review #1

A Brief Introduction to the Command Line. Hautahi Kingi

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

Unix basics exercise MBV-INFX410

What to Do? Convert pathnames to common interface. Different ways to access files. Absolute pathname

15-122: Principles of Imperative Computation

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

Full file at

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

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.

The Command Shell. Fundamentals of Computer Science

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

UNIX Quick Reference

AN INTRODUCTION TO UNIX

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.

Introduction to Unix: Fundamental Commands

CS 2400 Laboratory Assignment #1: Exercises in Compilation and the UNIX Programming Environment (100 pts.)

TOP TEN MOST USEFUL UNIX COMMANDS

Operating Systems, Unix Files and Commands SEEM

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.

Unix File System. Class Meeting 2. * Notes adapted by Joy Mukherjee from previous work by other members of the CS faculty at Virginia Tech

Linux & Shell Programming 2014

Lecture 2: Tools & Concepts

UNIX Tutorial One. 1.1 Listing files and directories. ls (list) 1.2 Making Directories

UNIX File Hierarchy: Structure and Commands

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

An Introduction to Using the Command Line Interface (CLI) to Work with Files and Directories

COMP s1 Lecture 1

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

Filesystem and common commands

Getting Started with Command Prompts

Introduction to Linux

Find out where you currently are in the path Change directories to be at the root of your home directory (/home/username) cd ~

CMSC 104 Lecture 2 by S Lupoli adapted by C Grasso

Getting Started with UNIX

UNIT 9 Introduction to Linux and Ubuntu

Transcription:

1.1 Listing files and directories ls (list) When you first login, your current working directory is your home directory. Your home directory has the same name as your user-name, for example, ee91ab, and it is where your personal files and subdirectories are saved. To find out what is in your home directory, type % ls The ls command ( lowercase L and lowercase S ) lists the contents of your current working directory. There may be no files visible in your home directory, in which case, the UNIX prompt will be returned. Alternatively, there may already be some files inserted by the System Administrator when your account was created. ls does not, in fact, cause all the files in your home directory to be listed, but only those ones whose name does not begin with a dot (.) Files beginning with a dot (.) are known as hidden files and usually contain important program configuration information. They are hidden because you should not change them unless you are very familiar with UNIX!!! To list all files in your home directory including those whose names begin with a dot, type % ls -a As you can see, ls -a lists files that are normally hidden. 1 of 6 2016-09-11, 10:14 AM

ls is an example of a command which can take options: -a is an example of an option. The options change the behaviour of the command. There are online manual pages that tell you which options a particular command can take, and how each option modifies the behaviour of the command. (See later in this tutorial) 1.2 Making Directories mkdir (make directory) We will now make a subdirectory in your home directory to hold the files you will be creating and using in the course of this tutorial. To make a subdirectory called unixstuff in your current working directory type % mkdir unixstuff To see the directory you have just created, type % ls 1.3 Changing to a different directory cd (change directory) The command cd directory means change the current working directory to 'directory'. The current working directory may be thought of as the directory you are in, i.e. your current position in the file-system tree. To change to the directory you have just made, type % cd unixstuff 2 of 6 2016-09-11, 10:14 AM

Type ls to see the contents (which should be empty) Exercise 1a Make another directory inside the unixstuff directory called backups 1.4 The directories. and.. Still in the unixstuff directory, type % ls -a As you can see, in the unixstuff directory (and in all other directories), there are two special directories called (.) and (..) The current directory (.) In UNIX, (.) means the current directory, so typing % cd. NOTE: there is a space between cd and the dot means stay where you are (the unixstuff directory). This may not seem very useful at first, but using (.) as the name of the current directory will save a lot of typing, as we shall see later in the tutorial. The parent directory (..) (..) means the parent of the current directory, so typing % cd.. will take you one directory up the hierarchy (back to your home directory). Try it now. Note: typing cd with no argument always returns you to your home directory. This is very useful if you are lost in the file system. 1.5 Pathnames pwd (print working directory) Pathnames enable you to work out where you are in relation to the whole file-system. For example, to find 3 of 6 2016-09-11, 10:14 AM

out the absolute pathname of your home-directory, type cd to get back to your home-directory and then type % pwd The full pathname will look something like this - /home/its/ug1/ee51vn which means that ee51vn (your home directory) is in the sub-directory ug1 (the group directory),which in turn is located in the its sub-directory, which is in the home sub-directory, which is in the top-level root directory called " / ". Exercise 1b Use the commands cd, ls and pwd to explore the file system. (Remember, if you get lost, type cd by itself to return to your home-directory) 1.6 More about home directories and pathnames Understanding pathnames First type cd to get back to your home-directory, then type % ls unixstuff to list the conents of your unixstuff directory. 4 of 6 2016-09-11, 10:14 AM

Now type % ls backups You will get a message like this - backups: No such file or directory The reason is, backups is not in your current working directory. To use a command on a file (or directory) not in the current working directory (the directory you are currently in), you must either cd to the correct directory, or specify its full pathname. To list the contents of your backups directory, you must type % ls unixstuff/backups ~ (your home directory) Home directories can also be referred to by the tilde ~ character. It can be used to specify paths starting at your home directory. So typing % ls ~/unixstuff will list the contents of your unixstuff directory, no matter where you currently are in the file system. What do you think % ls ~ would list? What do you think % ls ~/.. would list? Summary ls Command ls -a Meaning list files and directories list all files and directories 5 of 6 2016-09-11, 10:14 AM

mkdir cd directory cd cd ~ cd.. pwd make a directory change to named directory change to home-directory change to home-directory change to parent directory display the path of the current directory M.Stonebank@surrey.ac.uk, 9th October 2000 6 of 6 2016-09-11, 10:14 AM