Learn Enough Command Line To Be Dangerous
Learn Enough Command Line To Be Dangerous
===========================================
1 BASICS
--------------
echo <string> = print text within shell (can be with/without quotes or double
quotes)
man <command> = print manual for named command
sleep <seconds> = make terminal sleep for named amount of time
help <command> = built in help facility
type <command> = shows type of command
2 MANIPULATING FILES
----------------------
3 INSPECTING FILES
---------------------
4 DIRECTORIES
-----------------------
~ = /Users/<user>
sudo = substitute user do (not superuser) Root access
mkdir = make folder
mkdir -p = make intermediate directories in single command
mv <file> <folder> = move file(s) to folder
ls <directory> = shows contents
ls -d <directory> = shows just the directory
ls -ld <directory> = shows directory in long form
cd = change directory
cd .. = move up one directory level
cd . = current directory
cd / cd ~ = change directory to home folder
cd - = change to previous directory
pwd = print working directory
cp = copy file
cp <filename> . = copy file to current directory
cp -r <directory> = copies all files from current directory into named directory
rmdir <directory> = remove directory
rm -rf = remove recursive force = removes all directories, files (CAUTION)
grep -ri <string> <directory> = search for keyword within files (multiple
directories, case insensitive)
; = use multiple commands in single command
-----
pushd <directory> - takes your current directory and pushes it into a list for
later, then it changes to another directory. E.g Save where I am, then go here.
pushd - with no arguments - will switch between current dir and the last one
pushed. e.g quick switch
popd - takes last dir you pushed and pops if off, taking you back there.