Chapter 3: Linux Filesystems

시작하기. 무료입니다
또는 회원 가입 e메일 주소
Chapter 3: Linux Filesystems 저자: Mind Map: Chapter 3: Linux Filesystems

1. filenames

1.1. file extensions (.exe) identify filetype, mostly windows

1.2. files starting with . are hidden files

1.3. files with metacharacters in the name may screw with commands

1.4. using (ls) is a good way to look at files

1.4.1. only displays files in the current directory

1.4.2. can link to an absolute directory to display files in that directory (ls /home/mike/games)

1.4.3. appending -F shows file types in list

1.4.4. capital letters at beginning of directory names insure they are first in list

1.4.5. ls -l provides long listing info for all files

1.4.5.1. file type characters

1.4.5.1.1. b and c = special device files

1.4.5.1.2. l = linked file

1.4.5.1.3. d= directory

1.4.5.1.4. n = named pipe

1.4.5.1.5. s = socket

1.4.5.1.6. - = all other file types (text, binary data files)

1.4.5.2. permissions on file

1.4.5.3. hard link count

1.4.5.4. file owner

1.4.5.5. group owner

1.4.5.6. file size

1.4.5.7. most recent modification

1.4.5.8. filename (shortcuts marked with -> )

1.4.6. ls -a shows hidden files

1.5. file command

1.5.1. displays file type of specified file (file dota2)

1.6. wildcard metacharacter

1.6.1. represents any character

1.6.2. can be used with many commands (ls, file, cd)

1.6.3. * 0 or more characters matched

1.6.4. ? matches 1 character

1.6.5. [aegh] matches 1 character if a, e, g, or h

1.6.6. [a-e] matches one character if a, b, c, d, or e

1.6.7. [!a-e] matches one character that is not a, b, c, d, or e

2. Directories

2.1. absolute path

2.1.1. /home/mike/games

2.1.2. root user home /root

2.2. relative path

2.3. commands

2.3.1. change directory (cd)

2.3.2. print working directory (pwd)

2.3.3. up one directory (..)

2.3.4. tab-completion featue

2.3.4.1. start typing then hit tab, shows directories with common letters

3. Files

3.1. text files

3.1.1. most common

3.1.2. contain config details

3.1.3. cat command opens to read (cat filename)

3.1.3.1. cat -n displays line number

3.1.3.2. tac command desplays file lines in bacwards order

3.1.3.3. more or less commands displays more or less text in terminal

3.2. binary data files

3.2.1. contain data for programs

3.2.2. strings command looks for text and outputs it into terminal

3.3. executables

3.3.1. how programs are stored as files

3.4. directory files

3.4.1. placeholder files to organize other files

3.5. linked files

3.5.1. associated files

3.5.1.1. can have same data

3.5.1.2. can point to other files

3.6. special device files

3.6.1. represent devices on the system

3.6.2. typically only in /dev

3.7. named pipes and sockets

3.7.1. pipes identify channels that pass processes to each other

3.7.2. sockets allows another computer to write to a file while the process reads from the file it created

4. searching for text within files

4.1. regular expressions

4.1.1. interpreted by text tool program

4.1.2. more metacharacters than wildcards

4.1.2.1. * matches 0 or more occurrences of last character

4.1.2.2. ? matches 0 or 1

4.1.2.3. + matches 1 or more

4.1.2.4. . matches 1 of any type

4.1.2.5. [1-1] matches one number specified in brackets

4.1.2.6. [^1] matches on character NOT in brackets

4.1.2.7. {0 matches a specific number or range of the previous character

4.1.2.8. ^ matches following character if they are first on the line

4.1.2.9. $ matchesif they are last on the line

4.1.2.10. (_|_) matches either set of characters

4.1.3. match characters in text files

4.1.4. global regular expression print (grep)

4.1.4.1. requires what to search for and the file to search in

4.1.4.2. egrep or grep -E to display extended regular expressions

4.1.4.3. fgrep or grep -F doesnt interpret any regexp so returns results faster

4.1.4.4. grep -v returns with lines not containing search parameters

5. Editing text files

5.1. vi editor

5.1.1. nearly identical across distributions

5.1.2. vi filename opens file with editor

5.1.3. new file is vi

5.1.4. command mode requires keyboard input

5.1.4.1. i into insert and curser before of current char

5.1.4.2. a, into insert cursor after

5.1.4.3. o, into insert opens a new line

5.1.4.4. l, into insert cursor at begining of current line

5.1.4.5. A, into insert end of current line

5.1.4.6. O, into insert new line above

5.1.5. insert mode allows use of other inputs

5.1.5.1. ESC back to command mode

5.2. GNU Emacs editor

5.2.1. run (yum install emacs) to install

5.2.2. uses ctrl and keys for functions

5.2.2.1. a, moves cursor to beginning of line

5.2.2.2. e, cursor to endo of line

5.2.2.3. h, Displays emac documentation

5.2.2.4. d, deletes current character

5.2.2.5. k, deletes all between cursor and end of line

5.2.2.6. x + c, exits editor

5.2.2.7. x + s, saves document

5.2.2.8. x + w, saves as

5.2.2.9. x + u, undo