Skip to content

Latest commit

 

History

History
88 lines (43 loc) · 1.35 KB

notes.md

File metadata and controls

88 lines (43 loc) · 1.35 KB

Basic Commands

Navigation

hostname : computer's network name

pwd : print working directory

mkdir : make directory

cd : change directory

cd .. : return to previous directory

ls : list directory

rmdir : remove directory

rm -rf : remove non-empty directory

touch : create new file

rm : remove file


Useful commands / Shortcuts

python -m SimpleHTTPServer : create localhost

tab : auto completion

ctrl + i : search previous commands

ctrl + l : clear window


Reading Files

| (pipe) : running multiple commands

CAT

cat : print out content of file

HEAD

head : print out first 10 lines

head -n number : print out a certian number of lines

head > : send output to a new file

head >> : append output to file

TAIL

tail : print out last 10 lines

tail -n number :

GREP

grep "searchterm"

-i : case insensitive

-w : exact word

-r : recurring

" * " (Asterisk) : within every file

-A number : print out line with match and 4 lines after

-B number : print out line with match and 4 lines before

-C number : print out line with match and 4 lines before and 4 lines after

-l : print out filenames that match search

-n: show line numbers along matching lines