Chapter 3: Linux Filesystems

Get Started. It's Free
or sign up with your email address
Rocket clouds
Chapter 3: Linux Filesystems by 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 file type characters b and c = special device files l = linked file d= directory n = named pipe s = socket - = all other file types (text, binary data files) permissions on file hard link count file owner group owner file size most recent modification 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 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) cat -n displays line number tac command desplays file lines in bacwards order 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 can have same data 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 * matches 0 or more occurrences of last character ? matches 0 or 1 + matches 1 or more . matches 1 of any type [1-1] matches one number specified in brackets [^1] matches on character NOT in brackets {0 matches a specific number or range of the previous character ^ matches following character if they are first on the line $ matchesif they are last on the line (_|_) matches either set of characters

4.1.3. match characters in text files

4.1.4. global regular expression print (grep) requires what to search for and the file to search in egrep or grep -E to display extended regular expressions fgrep or grep -F doesnt interpret any regexp so returns results faster 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 i into insert and curser before of current char a, into insert cursor after o, into insert opens a new line l, into insert cursor at begining of current line A, into insert end of current line O, into insert new line above

5.1.5. insert mode allows use of other inputs 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 a, moves cursor to beginning of line e, cursor to endo of line h, Displays emac documentation d, deletes current character k, deletes all between cursor and end of line x + c, exits editor x + s, saves document x + w, saves as x + u, undo