HFS
Root File Structure
- bin – binary executables
- home – users home directory
- proc – processes
- dev – devices
- lib – 32 bit libraries (shared files aka dll)
- lib64 – 64 bit libraries (shared files aka dll)
- opt – optional software
- etc – configuration files
~ (Tilda) Home Directory
. (dot) Current Directory
.. (dot dot) Previous Directory
* (Asterisks) Wildcard
cd – change directory
cp – copy
mv – move files, or rename stuff
pwd show working directory, gives you the absolute path
ls and options – list
- -l : long list
- -a : hidden directories
what the columns in -l are
- r : Read
- w : Write
- x :File: Execute
- – file
- l – link
- d – directory
- 1st 3 rwx : Owner
- 2nd 3 rwx : Group
- 3rd 3 rwx : Others
tar – tape archive
- -t : table of contents
- -x : extract
- -c : create
gzip – gunzip – compression algorithm
bzip2 – bunzip2 – compression algorithm
xz – compression algorithm
absolute path – start at the top, always begins with a forward slash
relative path – relative to where you are, you have to know where you are
mkdir – make directory
touch – makes an empty file
rm and options – remove file (-r recursive, -f force)
rmdir – remove directory
wc – word count, prints a count of new lines, words, and bytes for each input file
command history – recall edit and rerun previous commands
man pages – software documentation, compressed to save space
redirection
- > Creates a new file containing standard output. If the speci- fied file exists, it’s overwritten.
- >> Appends standard output to the existing file. If the specified file doesn’t exist, it’s created.
- 2> Creates a new file containing standard error. If the specified file exists, it’s overwritten.
- 2>> Appends standard error to the existing file. If the specified file doesn’t exist, it’s created.
pipes | – another type of redirection output, the standard output from one program is redirected as the standard input to a second program. Vertical bar (|) which is usually a shifted character above the enter key.
grep – searches for files that contain a specified string and returns the name of the file and (if it’s a text file) a line of context for that string.
head <filename>- View the top few lines of a file
- <lines> – Displays the first <lines> number of lines of a file
tail <filename> – View the bottom few lines of a file
- <lines> – Displays the last <lines> number of lines of a file
- -f : continually watch for any additions at the end of the file
- -f –pid=PID – continually display any additions until process with PID terminates
- -f -s <sec> – continually display any additions at intervals of <sec> seconds
cat <filename> – View the whole file
- -n : line-numbered output
- -b : line-numbered output with no line numbers for blank lines
- -s : multiple blank lines compressed into a single blank line
more <filename> – View the whole file, one screenful at a time.
- spacebar : View next screen
- b : View previous screen
- d : View next half-screen
- Enter : View next line
- = : Current line number in file
- v : Start vi editor on current line
- /string : Search for string in file
- n : Go to next occurrence of string
- ‘ : Go to first occurrence of string
less <filename>- Same as more, but with many more features. Displays the portion of the file without waiting for the entire file to be read by it. Accepts most of the more commands.
- Pg Dn : View next screen
- Pg Up : View previous screen
- Up arrow : View previous line
- Down arrow : View next line