Linux - Module 6: Working with files and directories

The rm command is used to delete files File deletion is permanent! Use -i to avoid accidental deletion when using globs Delete directories with the –r option or rmdir if the directory is completely empty

pptx18 trang | Chia sẻ: nguyenlam99 | Lượt xem: 884 | Lượt tải: 0download
Bạn đang xem nội dung tài liệu Linux - Module 6: Working with files and directories, để tải tài liệu về máy bạn click vào nút DOWNLOAD ở trên
Module 6 Working with Files and DirectoriesExam Objective 2.3 Using Directories and Listing FilesObjective SummaryUnderstanding Files and Directories including those that are hiddenHome DirectoryProperly utilizing absolute and relative pathsUnderstanding DirectoriesFiles and Directories File contain data (text, graphics, etc) Directories store filenamesTop level directory: / (AKA, root directory)Example directory structure:Directory pathDirections to a specific file or directoryDirections given from / directory are called “absolute” pathsDirections given from the current directory are called “relative” pathsThe home directoryEach user has a home directoryTypically /home/bob for a user named bobPlace to store your own filesNormally users can’t access the home directory of other usersThe ~ character symbolizes the home directoryThe current directoryThe directory that your shell is currently inCan be displayed with the pwd commandMight also be displayed in your promptChanging directoriesUse the cd commandWith no arguments, takes you to your home directory~bob would refer to bob’s home directoryAbsolute vs relative pathnamesAbsolute pathnames always provide directions from the root directory (/)Relative pathnames always provide directions from the current directory.To refer to one directory above current directory, use the .. charactersTo refer to the current directory, use the . characterManipulating FilesExam Objective 2.4 Creating, Moving and Deleting FilesObjective SummaryCase sensitivitySimply globbing and quotingListing files in a directoryList files with the ls commandDifferent file types may be highlighted by colored filenames:plain file A file that isn't a special file typedirectory A directory file (contains other files)executable A file that can be run like a programsymbolic link A file that points to another fileDisplay of filenames in color is the result of the --color optionCommon ls optionsMany options to the ls command, including:-a – display all files, including hidden files-l – long display listing-h – Give file sizes in human readable sizes-R – Recursive listing-S – Sort output based on file size-t – Sort output based on modification time-d – Don’t display directory contentsCopying filesThe cp command copies files:cp [source] [destination]Use –v option to display copy processUse –i to prompt overwritesUse –n to avoid overwritesUse –r to copy directory structuresMoving filesThe mv command copies files:mv [source] [destination]The mv command also is used to rename filesSupported options that work the same as the cp command: -i, -n and –vCreating filesEditors can be used to create files (discussed later in this course)Use the touch command to create an empty fileThe touch command also updates the modification timestamp of a fileRemoving filesThe rm command is used to delete filesFile deletion is permanent!Use -i to avoid accidental deletion when using globsDelete directories with the –r option or rmdir if the directory is completely emptyMaking directoriesUse the mkdir command to create directories

Các file đính kèm theo tài liệu này:

  • pptxle_module_06_9268.pptx