I’m not sure why I remember some things so well (Charlie Chaplain died on December 25, 1977) and others just don’t stick (Memorial Day and Labor Day, which one is in Spring and which one is in Fall?). At some point, I should start recording things I remember easily and things I do not and see if I can find a pattern.
For now, I’m leaving myself these notes online for the command line commands that I use often but not often enough to remember ( these are all for Mac / *nix machines ).
tmux
Open existing session named “main” if it exists, otherwise create it.
tmux a -t main || tmux new -s main
Find
find /path -name 'filename_w_wildcards'
(see Command Line Find)
DNS Lookup
dig www.example.com @b.iana-servers.net A
(lookup A record for www.example.com on name server b.iana-servers.net)
See more details about using dig for DNS Lookups
Find Local IP Address on Wireless Network
ipconfig getifaddr en1
See more details about finding your local IP address
Search All Files in the Current ( and sub ) Directories
grep -i -r 'needle' ./
Search and Replace Over Multiple Files ( Current and Sub Directories )
find . -name "*.php" -type f -exec perl -p -i -e "s/Plugin_Name/Html_On_Cpt/g" {} \;
Find all files in the current ( and sub ) directories that end in .php and replace “Plugin_Name” with “My_Plugin_Name”
Change Directory to Previous Directory
cd -
Run the Last Command Again ( but now as root )
sudo !!
Moving Around on the Command Line
CTRL+a
Move to beginning of line
CTRL+e
Move to end of line
ESC,f
Move forward one word
ESC,b
Move backward one word
List all subfolders with formatted output
ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'
From: http://reviews.cnet.com/8301-13727_7-10402034-263.html
To Add
curl
wget
Leave a Reply