basic unix commands file system the file
play

Basic Unix Commands - File System The File UNIX treats everything - PowerPoint PPT Presentation

Basic Unix Commands - File System The File UNIX treats everything as a le... Directories and devices like the hard disk, DVD-ROM, and printer are les to UNIX. Three types of les 1. Ordinary le Also known as a regular le,


  1. Basic Unix Commands - File System

  2. The File UNIX treats everything as a �le... Directories and devices like the hard disk, DVD-ROM, and printer are �les to UNIX. Three types of �les 1. Ordinary �le Also known as a regular �le, contains only data as a stream of characters. 2. Directory �le A folder containing the names of other �les and subdirectories. 3. Device �le Represents a device or peripheral.

  3. The File System Hierarchy UNIX �les are organized in a hierarchical (an inverted tree) structure, starting with root ( / ) Image Source: S. Das. Your UNIX/Linux: The Ultimate Guide. Third. McGraw-Hill, Inc.,

  4. Relative Pathnames Relative path shortcuts . (a single dot) represents the current directory .. (two dots) represents the parent directory Example > pwd /home > ls . john george > cd john $ pwd /home/john > cd .. > pwd /home

  5. Making and removing directories Making directories >mkdir myDir (UNIX is case sensitive by-the-way) creates a directory myDir in the current directory >mkdir myDir1 myDir2 Creates multiple directories in one command >mkdir myDir1/myDir2 creates myDir2 inside of myDir1 (must exist) Removing directories rmdir myDir Only works for empty directories. (No other �les/directories inside) rm -R myDir Use will caution! You CANNOT recover from rm

  6. Copy and Move cp -- copy >cp file1 file2 Copies file1 to file2 >cp -R myDir1 myDir2 -R option copies recursively, meaning all subdirectories will be copied as well mv - move >mv file1 file2 When used this way it’s basically a rename utility >mv file1 file2 myDir Moves file1 and file2 into the directory myDir

  7. Deleting �les >rm file1 file2 >rm file* * is a wildcard, meaning anything, the command will remove all patterns that match �le with anything following. Can be dangerous. With the right permissions rm -Rf /* would remove most of the �les on your hard drive without warning. Protect yourself rm -i

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend