Find Find basics. find ~ -name myfile –print find directory criteria This will search the home directory (~) looking for files.

Slides:



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

การใช้ระบบปฏิบัติการ UNIX พื้นฐาน บทที่ 4 File Manipulation วิบูลย์ วราสิทธิชัย นักวิชาการคอมพิวเตอร์ ศูนย์คอมพิวเตอร์ ม. สงขลานครินทร์ เวอร์ชั่น 1 วันที่
LINUX System : Lecture 3 (English-Only Lecture) Bong-Soo Sohn Assistant Professor School of Computer Science and Engineering Chung-Ang University Acknowledgement.
The Unix File System. What are the three parts of every file on a Unix filesystem? And where is each stored? Filename - stored in directories Inode -
1.1 File System Implementation A possible file system layout.
ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Jan. 27 th, 2009 Essential Unix Commands.
Unix Tutorial CSU480. Outline  Getting Started  System Resources  Shells  Special Unix Features  Text Processing  Other Useful Commands.
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.
File security and Permissions A file is owned by the user who created it That user can then specify who can read, write and execute that file A file when.
Linux+ Guide to Linux Certification, Second Edition
CS 497C – Introduction to UNIX Lecture 16: - File Attributes Chin-Chih Chang
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.
UNIX. find command ● The find command is used to locate files on a Unix or Linux system. find will search any set of directories you specify for files.
2 $ command Command Line Options ls –a –l hello hi Command Arguments.
Linux Commands LINUX COMMANDS.
L INUX C OMMAND L INE I NTERFACE G UNAANBAN.G
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
MCB Lecture #3 Sept 2/14 Intro to UNIX terminal.
Brief introduction to UNIX A. Emerson CINECA, High Performance Systems.
Help session: Unix basics Keith 9/9/2011. Login in Unix lab  User name: ug0xx Password: ece321 (initial)  The password will not be displayed on the.
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”
Offline File Storage. Module 12 Offline File Storage ♦ Introduction Backup is usually done by first collecting all the data in a single archive file,
CHAPTER 1 UNIX FOR NONPROGRAMMERS By U ğ ur Halıcı.
1 Intro to Linux - getting around HPC systems Himanshu Chhetri.
CIS 90 - Lesson 15 Lesson Module Status Slides – draft Properties - done Flash cards – 1 st Minute quiz – NA Web calendar summary – done Web book pages.
CIS 90 - Lesson 14 Lesson Module Status Slides – Properties - Flash cards – No-stress quiz – Web calendar summary – Web book pages – Commands – Lab – done.
Lesson 11-Locating, Printing, and Archiving User Files.
Basic unix commands that everyone should know (Even if you have a mac) Slightly more advanced:
Linux+ Guide to Linux Certification, Second Edition
Carnegie Mellon Linux Boot Camp Jenna MacCarley, Peter Pearson, Shashank Goyal 9/19/2015.
CIS 90 - Lesson 15 Lesson Module Status Slides – Properties - Flash cards – No-stress quiz – Web calendar summary – Web book pages – Commands – Lab – done.
Workbook 5 - Part 2 The Linux Filesystem RH030 Linux Computing Essentials.
Additional UNIX Commands. 222 Lecture Overview  Multiple commands and job control  More useful UNIX utilities.
UNIX Commands. Why UNIX Commands Are Noninteractive Command may take input from the output of another command (filters). May be scheduled to run at specific.
Linux file system "On a UNIX system, everything is a file; if something is not a file, it is a process." Sorts of files (on a Linux system) Directories:
L&T Infotech1 UNIX – Getting Started - Aneesh Ramani.
Log-in to the Unix Server A successful log-in allows access to the server through the Secure Shell. SSH, also known as Secure Shocket Shell, is a Unix.
Basic Unix Commands CGS 3460, Lecture 6 Jan 23, 2006 Zhen Yang.
Unix Commands PowerPoint Presentation developed for LS 560 Information Technology online class - University of Alabama by Debey Sklenar TENacious Cohort.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: whereis, which, whoami, finger, passwd, cal, date Working with Files: cat, more, less.
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
Introduction to Programming Using C An Introduction to Operating Systems.
Λειτουργικά Συστήματα – Lab2 Γιάννης Πετράκης. Directory Navigation and Control  The Unix file system is set up like a tree branching out from the root.
Linux Commands C151 Multi-User Operating Systems.
2 Manual & Filestore Mauro Jaskelioff. Introduction Using the manual The UNIX filestore File permissions.
ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Feb 3 rd, 2009 Essential Unix Commands …the second half.
Lecture 02 File and File system. Topics Describe the layout of a Linux file system Display and set paths Describe the most important files, including.
Chapter Linux Basics. Acknowledgements This presentation was prepared by – Banyat Settapanich – Bahran Madaen This presentation will be updated later.
 Last lesson, the Windows Operating System was discussed along with the Windows command shell  Unix is a computer operating system, that similarly manages.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
CSCI 330 UNIX and Network Programming Unit II Basic UNIX Usage: File 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).
Read the relevant material in Sobell!
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
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.
INTRODUCTION TO UNIX: The Shell Command Interface
Tutorial of Unix Command & shell scriptS 5027
Tutorial of Unix Command & shell scriptS 5027
Tutorial of Unix Command & shell scriptS 5027
Lecture 5 Additional useful commands COP 3353 Introduction to UNIX 1.
Introduction Paul Flynn
Tutorial Unix Command & Makefile CIS 5027
CIS 155 Lecture 10, Farewell to UNIX
Lab 2: Terminal Basics.
Linux Commands LINUX COMMANDS.
Lecture 5 Additional useful commands COP 3353 Introduction to UNIX 1.
Presentation transcript:

Find

Find basics. find ~ -name myfile –print find directory criteria This will search the home directory (~) looking for files whose name (-name) is myfile and displays them (-print) You need to say –print if you want to print out the names of files.

Finding Files find. -user root -exec wc {} \; executes wc on all files in cwd owned by user root {} is shorthand for the name of that file. the ; (must be escaped with a \) terminates the action to be taken.

Remove – with care find. -name "this*" -exec rm {} \; This will remove all the files matching “this*”, starting in the current directory (.) Be careful with this sort of command!

Pass find to my script. find. -name "myfile*" -exec myFileProcessor.sh {} \; I can pass what I want to myFileProcessor.sh echo file is $1 echo "I can do what I want to the file here“ file is./myfile I can do what I want to the file here file is./myfile2 I can do what I want to the file here

Arguments to Find Arguments are of 3 kinds options which affect behavior tests which specify which files are to be selected action specify what is to be done to the selected files.

Tests Used by Find -empty, file is empty -links n, file has n hard links -inum n, file's inode is n -name pattern, filename matches pattern -perm mode, file permissions are exactly mode -size n, file has size blocks of 512 bytes -type c, file is type c -user name, file owner is name

Do not forget this webpage There are lots of other good tutorial “out there” Find is one of the hardest commands to master.

Ssh – secure shell Other tools are rlogin, rsh, rcp – but these are not used because of security issues. Ssh is probably the most popular of these tools. A key is sent, so both machines can communicate with encrypted information.

Ssh example $ whoami zlizjw1 ssh It is a criminal offence to secure unauthorised access to any program or …… pat$ whoami jrw pat$

Example mailx pat$ mailx -s "hi from UK" how is Ningbo EOT pat$

To exit pat$ exit logout Connection to cs.nott.ac.uk closed. ~]$ whoami zlizjw1 ~]$

Non-interactive We can just send commands ssh –l login remote.machine.name command For example ssh -l jrw cs.nott.ac.uk mkdir SSHDIRJOHN There are lots more to this. This is just the basics.

Secure copy (scp) scp SourceFile scp A.TXT password: A.TXT 100% 0 0.0KB/s 00:00 pat$ cd SSHDIRJOHN/ pat$ ls A.TXT pat$

Gzip, gunzip, Compression gzip is short for GNU zip for the compress program used in early Unix systems, intended for use by the GNU ProjectcompressUnixGNU Project Compression is very important in computer science.

BEFORE ls -l -rwxr--r-- 1 zlizjw1 Domain U Mar 17 11:05 canonical.pdf -rw-r--r-- 1 zlizjw1 Domain U Mar 17 11:05 canonical.ps

AFTER gzip $ gzip canonical.p* $ ls -l total 744 -rwxr--r-- 1 zlizjw1 Domain U Mar 17 11:05 canonical.pdf.gz -rw-r--r-- 1 zlizjw1 Domain U Mar 17 11:05 canonical.ps.gz

AFTER gunzip gunzip canonical.p* ls -l total rwxr--r-- 1 zlizjw1 Domain U Mar 17 11:05 canonical.pdf -rw-r--r-- 1 zlizjw1 Domain U Mar 17 11:05 canonical.ps

Archive, tar tape archive standardized by POSIX and later POSIX POSIX it is now commonly used to collect many files into one larger file, for distribution or archiving, while preserving file system information such as user and group permissions, dates, and directory structures.distribution archivingfile systemdirectory.

A tar file or compressed tar file is commonly referred to as a tarball

Create a tar file tar cvf myTarfile files c for create v for verbose f to specify tarfile For example Tar cvf UST.tar * Will tar everything in your working directory into a file called tar

Extract from tar file To extract the contents from a tar file Tar xvf tarfile This extracts the files from the tarfile X is for extract T is to give a table of contents.