7
Chapter 4: Exploring Linux Filesystems

Chapter 4: Exploring Linux Filesystems

Embed Size (px)

DESCRIPTION

Chapter 4: Exploring Linux Filesystems. Directory Structure. Similar to Windows structure but there is no drive name It uses forward slash instead of backward one Home directory Remember the difference between # and $ Command commands {pwd, cd, etc.} - PowerPoint PPT Presentation

Citation preview

Page 1: Chapter 4: Exploring Linux Filesystems

Chapter 4: Exploring Linux Filesystems

Page 2: Chapter 4: Exploring Linux Filesystems

2

Directory Structure• Similar to Windows structure but there is no drive

name• It uses forward slash instead of backward one• Home directory• Remember the difference between # and $• Command commands {pwd, cd, etc.}• Use of cd without argument or with ~ to change to

home• Relative versus absolute paths• The . and ..• Tab-completion feature and history

Page 3: Chapter 4: Exploring Linux Filesystems

3

Files• File types (text, binary, executable, directory,

linked, special device, named pipes, and socket)• Name convention (up to 255, alpha, _, -, .)• Hidden files (use .)• Listing files (ls or dir)• Parameters to ls (-F, -l, -a) also ll• The eight components in the long listing• The file command• Wild characters (*, ?, [abcde], [a-e], [!a-e])

Page 4: Chapter 4: Exploring Linux Filesystems

4

Viewing File Contents• Common commands:

– cat– tac– head– tail– more– less – Using redirection | with more and less– strings – od

Page 5: Chapter 4: Exploring Linux Filesystems

5

Searching for Text• Regular expression versus wild characters

Page 6: Chapter 4: Exploring Linux Filesystems

6

Searching for Text (cont.)• The grep (Global Regular Expression Print) command• Syntax: grep regexp filename• It is a case sensitive. To ignore case use the –i

modifier• To reverse the action of the grep command use the –v• To match whole word(s), you need to use spaces

before and after• egrep for extended regexp while fgrep ignores regexp• Do sample Demo

Page 7: Chapter 4: Exploring Linux Filesystems

7

Text Editors• Most common: vi, vim, or emacs• Important for vi:

– Modes (command and insert)– How to switch– Reading, writing, exiting, etc.– Insert date :r !date– Replace texts :1,$ s/word/WORD/g– Show/hide line numbers :set number / :set nonumber

• Other editors: for instance emacs uses CTRL + ch to perform various functions

• GUI-based editors: e.g. Xemacs, gedit, and kedit• Demo