1 Day 3 Directories Files Moving & Copying. 2 Case Sensitive First thing to learn about UNIX is that everything is case sensitive. Thus the files: –enda.

Slides:



Advertisements
Similar presentations
Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Advertisements

Cosc 4750 Getting Started in UNIX Don’t be afraid of the prompt, in linux it can be your best friend. In some cases, the only way to do certain things.
UNIX file systems Learning Objectives: 1. To understand the basics of file systems 2. To understand the hierarchical structure in Unix file system 3. To.
CS 497C – Introduction to UNIX Lecture 12: - The File System Chin-Chih Chang
Unix Basics. Systems Programming: Unix Basics 2 Unix Basics  Unix directories  Important Unix file commands  File and Directory Access Rights through.
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
Systems Programming Concepts
Learning basic Unix command IT 325 operating system.
COMP1070/2002/lec4/H.Melikian COMP1070 Lecture #5  Files and directories in UNIX  Various types of files  File attributes  Notion of pathname  Commands.
1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID COSC 513 Operating System.
Unix Primer. Unix Shell The shell is a command programming language that provides an interface to the UNIX operating system. The shell is a “regular”
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
Introducing UNIX EMBnet slide 1 Introducing the UNIX Operating System.
Chapter 9 Part II Linux Command Line Access to Linux Authenticated login using a Linux account is required to access a Linux system. The Linux prompt will.
Nick Geoghegan1 Introduction to Linux Workshop. Nick Geoghegan2 Getting Started Download the following files:
Linux Directory Navigation. File & Directory Commands This is a minimal list of Unix commands that you must know for file management: ls (list) mkdir.
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
Essential Unix at ACEnet Joey Bernard, Computational Research Consultant.
Unix Basics Chapter 4.
Basic unix commands that everyone should know (Even if you have a mac) Slightly more advanced:
Interacting with a UNIX computer: Navigating through the directory tree.
1 Day 5 Additional Unix Commands. 2 Important vs. Not Often in Unix there are multiple ways to do something. –In this class, we will learn the important.
Operating Systems and Using Linux CMSC 104, Lecture 3 John Y. Park 1.
1 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Reading None.
Introduction to Unix – CS 21 Lecture 4. Lecture Overview * cp, mv, and rm Looking into files The file command head and tail cat and more What we’ve seen.
BIF713 Basic Unix/Linux Commands Getting Help with Commands.
Introduction to UNIX Geraint Vaughan. What is UNIX? Command-line operating system (not point- and click) Designed for ‘experts’ Lots of different variants.
Chapter 1 : The Linux System Part 2 Lecture 2 11/14/
A Genomics View of Unix. General Unix Tips To use the command line start X11 and type commands into the “xterm” window A few things about unix commands:
Unix Commands PowerPoint Presentation developed for LS 560 Information Technology online class - University of Alabama by Debey Sklenar TENacious Cohort.
Introduction To UNIX. FAQReferencesSummaryInfo Resources Introduction Learning Objectives Log on User Interface Commands List of Commands Useful Info.
Linux and Java Basics. What is Linux? Operating system by Linus Torvalds that was a clone of Unix (thus Linux) Free and open source – this is the reason.
1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 2a – A Unix Command Sampler (Courtesy of David Notkin, CSE 303)
File and Folder CLI Commands 12/24/ Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.
Basic DOS How to get some work done. It’s all a file Everything is a file: OS files, Application files, Data files and Game files Files have 8.3 names:
More Unix Naomi Altman. Directories Directory = folder mkdir - makes a new directory rmdir - removes an empty directory cd mydirectory - moves you into.
PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Workshop III - Part B Shell Commands Professional Training.
UNIX filesystem CS 2204 Class meeting 2 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
The Unix File sytem. Introduction Tree structure …
Unix Fundamentals CS 127. File navigation cd - change directory cd /var/log cd /etc/apache2 cd ~/Desktop ~ is a shortcut for the home directory.
Basic Unix Commands. Listing files and directories ● ls:command is used to list the files and ● directories in present working directory ● ls command.
Learning basic Unix command It 325 operating system.
File Management commands cat Cat command cat cal.txt cat command displays the contents of a file here cal.txt on screen (or standard out).
Linux Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
CMSC 104, Version 8/061L03OperatingSystems.ppt Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux.
CS 120 Extra: The CS1 Server Tarik Booker CS 120.
Learning Unix/Linux Based on slides from: Eric Bishop.
CMSC 104, Version 9/011 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Reading None.
CS1010: Intro Workshop.
Department of Computer Engineering
Commands Basic syntax of shell commands UNIX or shell commands have a basic structure command -options target command comes first (such as cd or ls) any.
Viewing and Changing the Filing System
Some Linux Commands.
The Command Prompt Commands are the way to “do things” in Unix
Useful Linux Commands.
Operating Systems and Using Linux
Operating Systems and Using Linux
Operating Systems and Using Linux
The Unix File System.
Operating Systems and Using Linux
UNIX/LINUX Commands Using BASH Copyright © 2017 – Curt Hill.
Operating Systems and Using Linux
Operating Systems and Using Linux
Operating Systems and Using Linux
Module 6 Working with Files and Directories
Lab 2: Terminal Basics.
January 26th, 2004 Class Meeting 2
Presentation transcript:

1 Day 3 Directories Files Moving & Copying

2 Case Sensitive First thing to learn about UNIX is that everything is case sensitive. Thus the files: –enda –Enda –ENDA Are all different files. Be careful to type the right one. –This applies to commands also.

3 What is a Directory There must be some way to organize a bunch of files. Perhaps we would want them sorted into folders. In windows “My Computer” has the “C Drive” in it. In there, you can see many folders. In UNIX, a similar organizational structure exists.

4 What directory am I in? In windows you can tell which directory you are in by looking at the directory tree at the left You might say that this user is in the Directory: C:\Documents and Settings\enda\Desktop

5 Unix Directories To find out which directory you are in you can type: –pwd This will return something like: –/home/enda Notice that in UNIX directories are separated by / where as in dos they are separated by \ –Also note that no drive “C:\” appears in the directory listing. Everything in unix starts at /

6 Moving around To move into another directory you type: –cd bob This would move you into a directory called bob which is under the current directory –cd.. This would move you back one directory from where you are now –cd / This will take you all the way to the top of the file system

7 Example: > pwd /home/enda > cd html > pwd /home/enda/html > cd.. > pwd /home/enda >cd / >pwd /

8 How do you know what’s here? How did I know “html” was a directory? Type: –ls In any directory this will give you a LIST of all files and directories which are in the your current directory –On this particular telnet client, with this particular setup, directories will show up in blue. We will see more reliable ways to tell if something is a directory later.

9 Exercise Move around a little using, pwd and cd Attempt to get into the directory: /usr/bin/games See if you can get there in one command from anywhere. See if you can get there bit by bit from wherever you are.

10 Phone Home If you just type: –cd No matter where you were, it will take you home. You can also type: –cd ~enda The weird ~ is called tilde and is typically located above the ` character on your keyboard. –In general the ~ means “home directory of the person mentioned next”

11 Directory Permissions Sometimes you will try to cd somewhere, and you will be told “Permission Denied” –e.g. Try to type this: cd /etc/rc.d –This is because the person who owns this directory has chosen not to let people into it. You can configure the permissions on your files. We’ll look at that in a few days.

12 Viewing a file So now that you can get to any directory, how do you read a file in that directory? –more –e.g. more readme More will show you the contents of the file, one page at a time on the screen. –You hit the space bar to move to the next page. –You can hit q to quit.

13 Exercise You should have a file in your directory called “readme” View what is in that file.

14 File and Directory Names On a UNIX system, names should not contain spaces. –It is possible to have spaces, however it makes life more complicated. We’ll look at that in a few weeks. There is no special file ending you should use like DOS or Windows. –In DOS.exe means it’s a program..txt means it’s a text file. –In unix the ending is unimportant. You don’t even have to have one.

15 Renaming Lets imagine you don’t like the name “readme” for the file you just looked at. How would you change it to “helpful.information” –mv readme helpful.information mv stands for “move”. Notice that the new file name has a dot in it, which doesn’t mean anything here. You could call it: –help.full.information.for.me

16 Moving a file into a directory Lets imagine we are currently in the directory: –/home/enda In here there is a directory called: –html And a file called: –new.stuff How do we get new.stuff into the directory html: –mv new.stuff html We can use ls and cd to verify that.

17 Oops…get it back How do we get that file back in the directory it started? –cd html –mv new.stuff.. OR –mv html/new.stuff ~enda OR –mv html/new.stuff /home/enda OR –mv html/new.stuff.

18 Dots…dots…dots So, a single dot means. “The directory I am currently in” –So what does this do: mv stuff. A double dot (..) means “The directory just above where I am now”. –You could have more than one like this: mv stuff../../.. This would move “stuff” back 3 directories towards /

19 Copying What if you don’t want to actually remove the original file, instead you just want your own copy. –cp e.g. Let’s imagine you want a copy of my readme –cp ~enda/readme. –This does not remove the file from my directory, but does give you a copy of it.

20 Moving/Coping directories Moving –Works exactly the same as if it were a single file Copying –If you wish to copy the directory AND ALL files in it: cp –R ~enda

21 Making new directories You can make a new directory with the command: –mkdir newdirectory –This will create a new directory under the current directory.

22 Wild cards What if you want to copy all files which start with an “s” in this directory: –cp s* destination Or perhaps all files which end with “x” –cp *x destination Or, files which start with “s” AND end with “x” –cp s*x destination Or all FILES in this directory –cp * destination –Note you don’t have to do *.* like in DOS.

23 Exercise Make the following directory structure in your home directory: –MyFiles 1601 –Homeworks –Quizzes 2611 –Homeworks –Quizzes Put a copy of the readme file in my directory (~enda) into each of your Homeworks directories

24 Exercises Copy all of the “How-to” files which start with the letter V into your 1601/Quizzes directory. –The how-to’s are located in /usr/doc/howto/en When you have completed that, move any of them which have the letter “q” in their file name into the 1601/Homework directory –Don’t do this by hand, have the computer figure it out with the right command.

25 Exercise We have decided to quit 2611, move all files from the 2611 directory into the 1601 directory. –Be sure the Homeworks end up in the Homeworks directory –Be sure the Quizzes end up in the Quizzes directory.

26 Deleting Be careful what you delete –There is no recycle bin, once its gone, its gone. To remove a file type: –rm readme To remove a directory: –rmdir html –However the directory must be empty first, first cd into it, rm *, and then cd.., now you can remove it.

27 Exercise Delete all files which start with VM in your 1601/Quizzes directory

28 Remember man is your friend If you can’t remember how to do something, man can probably tell you how: –man ls –man cd –man more –man mv –man cp Many of these commands have interesting options which can do special things. The man page will tell you.