Show full path in finder
defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES
Restart Finder
killall Finder
Alter the bash profile
sudo nano ~/.bash_profile
Alter the terminal home marker [⌘ ~/]
export PS1='\e[0:35m⌘\e[m \e[0:36m\w/\e[m \e[0:33m
git branch 2> /dev/null | grep -e ^* | sed -E s/^\\*\ (.+)$/(\\\1)\ /\e[m'
Awesome Aliases
alias showhidden='defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder'
alias hideshown='defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder'
echo command
echo {{command/item/string}}
Suppress new line
-n
See the manual for a particular command - q to exit
man {command}
Move to the start and end of a line
CTRL A / CTRL E
Access command history
up down keys
Use tilde to go to the root of the system
~
Push the current directory to the directory stack
pushd {path/string}
Pop the last entry off the directory stack and step back one entry
popd
Show current directory stack
dirs
echo the system root
echo ~
Tab to print out the contents of a directory
/Users/{tab}
Up one directory
../
Current directory
./
or .
Clear the terminal
clear
Run last command (Handy to use with sudo)
!!
List the files in the current working directory
ls
ls -l
List all of the files, even hidden files
ls -a
ls -t
pwd
cd
ls file\ name
open {directory_or_filename}
open -a {application} {filename}
open -R {filename}
open {url}
touch {filename}
{editor: nano} {filename}
mkdir {directory_name}
touch {directory}/{filename}
cp {file} {newfile.bak}
cp -r {directory} {newdirectory}
mv {directory/filename} {directory/}
mv {directory/filename} {directory/newfile.ext}
Rename a file
mv {filename} {newfile.ext}
mv {word_to_match}* {directory}/
rm {filename}
rm -r {directory}
cat {filename}
ln -s {source-filename} {shortcut-filename}
ln {source-filename} {shortcut-filename}
find {directory} -type f
find {directory} -name "{filename}"
find {directory} - name "{filename_part}"
find {directory} -iname "{filename}"
find {directory} -size +{blocks}
find {directory} -mtime -1
find {directory} -atime +1
find {directory} -ctime -1
-or -and
-print -or -iname "{directory}" -prune
grep "{string}" {file}
grep -i "{string}" {file}
grep -il "{string}" {file}
search content all files, return the respective filename
grep -il "{string}" *
search content recursively, return the respective filename
grep -ilr "{string}" *
find by file type, name, and then by contents
find {directory} -name "*{filename_part}" -exec grep -il "{string}" {} ;
Show the manual for the given command
man {command}
Show the location of the binary for the given executable
which {executable}
Display the file type details of the given file
file {file}
Show the base name for the given argument
basename {File / directory}
Tidy the Terminal window (Maintains history)
clear
Clean out the Terminal window
CMD + K
Use back ticks to combine commands
file
which vim``
gzip a file
gzip {file}
Un-gzip a file
gzip -d {file.gz}
Zip files and folders
zip {archive.zip} {folders/files}
Un-zip an archive
unzip {archive.zip}
Tar Archive [c:create;v:show output; z:gzip; f:name it]
tar -cvzf {archive.tar.gz} {files/folders}
Un-tar and archive
tar -cvzf {archive.tar.gz}