Viewing and Changing the Filing System

Slides:



Advertisements
Similar presentations
By: Tony Andrews.  Linux directory ordering system  Navigating and creating directories ◦ Listing directories and files ◦ Creating directories ◦ Changing.
Advertisements

Introducing the Command Line CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
Linux+ Guide to Linux Certification, Second Edition
UNIX Chapter 00 A “ Quick Start ” into UNIX Operating System Mr. Mohammad Smirat.
T UTORIAL OF U NIX C OMMAND & SHELL SCRIPT S 5027 Professor: Dr. Shu-Ching Chen TA: Samira Pouyanfar Spring 2015.
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
Learning basic Unix command IT 325 operating system.
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.
1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID COSC 513 Operating System.
The file structure and related utilities CS240 Computer Science II.
© Crown copyright Met Office An Introduction to Linux PRECIS Workshop, University of Reading, 23rd – 27th April 2012.
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
CHAPTER 1 UNIX FOR NONPROGRAMMERS By U ğ ur Halıcı.
Linux Directory Navigation. File & Directory Commands This is a minimal list of Unix commands that you must know for file management: ls (list) mkdir.
Working with Files Chapter 5. Display a Calendar Display a calendar for a specific month – cal Display a calendar for a specific year – cal 2000.
1 Lecture 2 Working with Files and Directories COP 3344 Introduction to UNIX.
Command Line Unix for Information Professionals In web administration or information management work, I may be called upon, as an Information Professional,
Basic unix commands that everyone should know (Even if you have a mac) Slightly more advanced:
Linux+ Guide to Linux Certification, Second Edition
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
Lesson 9-Setting and Using Permissions. Overview Describing file permissions. Using execute permissions with a file. Changing file permissions using mnemonics.
Managing Files. Module 5 Managing Files ♦ Introduction “On a Linux system, everything is a file; if something is not a file, it is a process.” ♦ Topics.
BIF713 Basic Unix/Linux Commands Getting Help with Commands.
Chapter Two Exploring the UNIX File System and File Security.
Chapter 1 : The Linux System Part 2 Lecture 2 11/14/
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: whereis, which, whoami, finger, passwd, cal, date Working with Files: cat, more, less.
Lecture One. Objective: Provide description of the Command-Line Editor of Linux operating system. Enable students to understand the practical side of.
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
Λειτουργικά Συστήματα – Lab2 Γιάννης Πετράκης. Directory Navigation and Control  The Unix file system is set up like a tree branching out from the root.
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Workshop III - Part B Shell Commands Professional Training.
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.
EMT 2390L Lecture 3 Dr. Reyes Reference: The Linux Command Line, W.E. Shotts.
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).
Chapter 2: Exploring the UNIX File System (For Tuesday Section) File and File Systems.
Linux Filesystem Management
UNIX Basics Matt Hayward October 18, 2016 LS560 – Information Technology for information professionals.
UNIX To do work for the class, you will be using the Unix operating system. Once connected to the system, you will be presented with a login screen. Once.
Tutorial of Unix Command & shell scriptS 5027
File permissions Operating systems I800
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.
Linux Commands Workout 1
Linux Commands Help HANDS ON TRAINING Author: Muhammad Laique
Lecture 2 Working with Files and Directories
Some Linux Commands.
The Command Prompt Commands are the way to “do things” in Unix
Useful Linux Commands.
CS314 – Section 5 Recitation 1
Eric Shook Department of Geography Kent State University
Ubuntu Working in Terminal
UNIX Basics Internet Technology.
Tutorial of Unix Command & shell scriptS 5027
Tutorial of Unix Command & shell scriptS 5027
Using Linux Commands Lab 3.
Exploring the UNIX File System and File Security
Operating Systems and Using Linux
Web Programming Essentials:
Tutorial of Unix Command & shell scriptS 5027
The Unix File System.
Chapter Four UNIX File Processing.
Tutorial Unix Command & Makefile CIS 5027
The Linux Command Line Chapter 4
Module 6 Working with Files and Directories
Lab 2: Terminal Basics.
BASIC FILE ATTRIBUTES.
January 26th, 2004 Class Meeting 2
The Linux Command Line Chapter 4
Presentation transcript:

Viewing and Changing the Filing System

Ls –a, ls –l, ls –t Type ls – to list what files and directories you see in the working directory. We should have seen: action  comedy  drama  genres.txt Type ls -a – This option lists the files and directories starting with a dot (.). Files starting with a dot are hidden, and do not appear when using ls on its own. There is one additional file in this directory that is hidden: .  ..  .preferences  action  comedy  drama  genres.txt 

Ls –a, ls –l, ls –t When you add the –a to the ls command it is an option command. The –a in our case displays all the content in the working directory. There are other command, -l and –t -a - lists all contents, including hidden files and directories -l - lists all contents of a directory in long format -t - order files and directories by the time they were last modified

Ls –a, ls –l, ls –t Type ls –l – this will generate the following: total 12                                                                                         drwxr-xr-x 4 ccuser ccuser 4096 Jul  8  2015 action                                              drwxr-xr-x 4 ccuser ccuser 4096 Jul  8  2015 comedy                                           drwxr-xr-x 4 ccuser ccuser 4096 Jul  8  2015 drama                                               rw-r--r-- 1 ccuser ccuser    0 Jul  8  2015 genres.txt   

Ls –a, ls –l, ls –t The ls-l generates our rows, with seven columns separated by spaces. Here's what each column means: Access rights. These are actions that are permitted on a file or directory. Number of hard links. This number counts the number of child directories and files. This number includes the parent directory link (..) and current directory link (.). The username of the file's owner. Here the username is cc. The name of the group that owns the file. Here the group name is eng. The size of the file in bytes. The date & time that the file was last modified. The name of the file or directory

Ls –a, ls –l, ls –t Lets navigate to the comedy/ directory Type cd comedy Type ls -alt The -t option orders files and directories by the time they were last modified. In addition to using each option separately, like ls -a or ls -l, multiple options can be used together, like ls -alt. Here, ls -alt lists all contents (-a), including hidden files and directories, in long format (-l), ordered by the date and time they were last modified (-t).

Copying and moving files or directories Type: ls to see where you are in the directory Type: cd drama/biopic Type: cp frida.txt lincoln.txt (we have just copied the frida.txt into the lincolong txt file) Navigate to the drama/ directory by typing cd .. And ls to verify the directory you are in. Once you are in the drama directory type cp biopic/cleopatra.txt historical/. You have just now placed the cleopatra file into the historical directory.

Copying and moving files or directories Navigate to the historical/ directory by typing cd historical. You should now see the cleopatra.txt file in the historical directory. Now we do not need to be in the working directory to place a file in another directory, we can do it another way. First, navigate up one directory by typing cd .. Then type cp biopic/ray.txt biopic/notorious.txt historical/ You will now see the ray.txt and the notorious.txt in the historical directory.

Copying and moving files or directories To copy a file into a directory, use cp with the source file as the first argument and the destination directory as the second argument. Here, we copy the file biopic/cleopatra.txt and place it in the historical/ directory. To copy multiple files into a directory, use cp with a list of source files as the first arguments, and the destination directory as the last argument. Here, we copy the files biopic/ray.txt andbiopic/notorious.txt into the historical/directory.

Copying and moving files or directories Now, navigate to the comedy directory Use the cd .. Command to move up the directory chain and the cd comedy command to enter the comedy directory. Create a new file named shrek.txt by typing: touch shrek.txt Next type: cp * satire/ Navigate to the satire directory by typing: cd satire, you should see the files the-office and shrek.txt in this directory Now navigate to the action directory by typing: cd ../ ../action/

WildCard Once in the action folder type: cp m*.txt scifi/ Now type cd scifi - you should see all the matrix.txt files in there.

Wildcard In addition to using filenames as arguments, we can use special characters like * to select groups of files. These special characters are called wildcards. Here, m*.txt selects all files in the working directory starting with "m" and ending with ".txt", and copies them to scifi/.

Moving Files Change to the action directory by typing cd .. Type ls to see what is in this directory. You will see a superman.txt and a superhero directory. We want to move the superman.txt to superhero directory by typing: mv superman.txt superhero/ Navigate to the superhero/ directory by typing: cd superhero Type ls to see the superman.txt that is now in the superhero directory.

Moving Files Type cd .. To move up one directory to action/ Move wonderwoman.txt and batma.txt to superhero/ by typing: mv wonderwoman.txt batman.txt superhero/ Navigate to the superhero directory (cd superhero) and type ls to see wonderwoman.txt and batman.txt in the directory.

A tricky Move – the rename Under the superhero directory you will see batman.txt, superman.txt and wonderwoman.txt. Type mv batman.txt spiderman.txt You should see that batman.txt has been renamed as spiderman.txt

move 1. my superman.txt superhero/ To move a file into a directory, use mv with the source file as the first argument and the destination directory as the second argument. Here we move superman.txt into superhero/. 2. mv wonderwoman.txt batman.txt superhero/  To move multiple files into a directory, use mvwith a list of source files as the first arguments, and the destination directory as the last argument. Here, we move wonderwoman.txt andbatman.txt into superhero/. 3. mv batman.txt spiderman.txt To rename a file, use mv with the old file as the first argument and the new file as the second argument. By moving batman.txt into spiderman.txt, we rename the file as spiderman.txt.

remove Return to the movies directory and move to the comedy/slapstick by typing in cd .. To get back to the movies directory and then type cd comedy/slapstick Type ls to see what is in the directory. Type rm waterboy.txt You will now see waterboy.txt is gone

Remove Navigate up one directory by typing cd .. to get to the comedy directory. Type ls to see what is in the directory Type rm –r slapstick Type ls and you should see that slapstick directory is now gone.

Remove The rm command deletes files and directories. Here we remove the file waterboy.txt from the filesystem. The -r is an option that modifies the behavior of the rm command. The -r stands for "recursive," and it's used to delete a directory and all of its child directories. Be careful when you use rm! It deletes files and directories permanently. There isn't an undelete command, so once you delete a file or directory with rm, it's gone !!

What have we learned Options modify the behavior of commands: ls -a lists all contents of a directory, including hidden files and directories ls -l lists all contents in long format ls -t orders files and directories by the time they were last modified Multiple options can be used together, like ls -alt

What we have learned so far From the command line, you can also copy, move, and remove files and directories: cp copies files mv moves and renames files rm removes files (rm –r can also remove files). rm -r removes directories (rmdir can also remove directories). Wildcards are useful for selecting groups of files and directories

Assignment Create the second filing system you created in the previous lesson. Create a new directory called “copied” in the blog directory (the one with your name) and copy files from the original directory to the newly created “copied” directory. Move the files and re-order them in the new copied directory, rename the new files and directories, make this filing system something that makes more sense to you. Ultimately, you just need to practice using the rm, mv, cp commands. Also, use the ls –l, ls –a, ls –t, to view and understand what you are looking at after using them.