command line awesome, wordcamp grand rapids 2014
Post on 14-Dec-2014
541 Views
Preview:
DESCRIPTION
TRANSCRIPT
Hi, my name is TopherI’m a WordPress developer
from Grand Rapids MI
@topher1kenobe
Command Line AwesomeTopher DeRosia
@topher1kenobe
Command Line
AWESOME
Command Line AwesomeTopher DeRosia
@topher1kenobe
Learning the command line.
1. Concepts2. Basic commands3. Available Programs4. A little fun
Command Line AwesomeTopher DeRosia
@topher1kenobe
The Shell
When you open the terminal, you’re in a shell. Bash is the most common shell.
Others are Bourne, csh, zsh, kshCommand Line Awesome
Topher DeRosia@topher1kenobe
Your History
Every command you type is saved in a file called .bash_history
Command Line AwesomeTopher DeRosia
@topher1kenobe
Your History
Arrow up to see past commands. Ctrl-r and start typing to search your history.
Command Line AwesomeTopher DeRosia
@topher1kenobe
Moving Around
Ctrl-a takes you to the beginning of the line. Ctrl-e to the end.
Command Line AwesomeTopher DeRosia
@topher1kenobe
Other Keybindings
Bash uses the same keybindings as the emacs editor.
http://wttools.sourceforge.net/emacs-stuff/emacs-keybindings.html
Command Line AwesomeTopher DeRosia
@topher1kenobe
Documentation
“man” pages contain docs for commands. Ex: man cd
Command Line AwesomeTopher DeRosia
@topher1kenobe
Flags
Most commands accept modifiers called ‘flags’ like this:
ls -al
Command Line AwesomeTopher DeRosia
@topher1kenobe
Change Directories
cdcd path/cd ~/path/cd -Check out the man page.
Command Line AwesomeTopher DeRosia
@topher1kenobe
Where am I?
pwd == Present Working Directory
Man oh man.
Command Line AwesomeTopher DeRosia
@topher1kenobe
Make Directories
mkdir mycooldir
Check out the man page, -p is cool.
Command Line AwesomeTopher DeRosia
@topher1kenobe
List Files
lsls -alls -latr
LOTS of good stuff in the man page.
Command Line AwesomeTopher DeRosia
@topher1kenobe
Change Files
mv oldfile newfilecp (-R) oldfile newfilerm (-R) file-or-dir
Have I mentioned man pages?
Command Line AwesomeTopher DeRosia
@topher1kenobe
Examine Files
morelesscat
man man man man man...
Command Line AwesomeTopher DeRosia
@topher1kenobe
Edit Filesnano
VIMemacsjoe
Google knows Al ( ⅔ of All )
Command Line AwesomeTopher DeRosia
@topher1kenobe
Search Files
grep (-ir) keyword *ack keyword --php
/ lets you search inside man pages
Command Line AwesomeTopher DeRosia
@topher1kenobe
SSH
Encrypted connection to a remote shell
ssh topher@derosia.comscp (-r) files topher@derosia.com:~/path/
Oh look, there’s a man page.
Command Line AwesomeTopher DeRosia
@topher1kenobe
wget
Makes one http call and returns the result
wget http://derosia.com/parchment.jpg
Man, I wish there were docs.
Command Line AwesomeTopher DeRosia
@topher1kenobe
Network Programs
whoishosttracerouteping
Nothing clever, read the man pages.
Command Line AwesomeTopher DeRosia
@topher1kenobe
Heads and TailsTail shows the last 10 lines of a file.
Head shows the first 10 lines of a file.
Guess how to change the number. (man)
Command Line AwesomeTopher DeRosia
@topher1kenobe
Tail -f
-f updates the results as the file changes.
Use this to watch log files.
Ctrl-c quits.
Command Line AwesomeTopher DeRosia
@topher1kenobe
top
Shows processes, resource use, etc.
Homework: read about ‘load average’
Command Line AwesomeTopher DeRosia
@topher1kenobe
mysqlmysql -u username -p database
Puts you on a mysql command line, lets you run SQL queries.
$ man mysqlNo manual entry for mysql
Command Line AwesomeTopher DeRosia
@topher1kenobe
Fun stuffcal - shows a calendardate - Shows… the datebc - basic calculator (basic)sl - like ls, but… not
Man, the places you’ll go
Command Line AwesomeTopher DeRosia
@topher1kenobe
Voodooperl -pi -e ‘s#search#replace#g’ *
mysql -u user -p database < db_export.sql
tail -f ~/logs/error_log | grep -i exe
cat file | wc -l(counts lines)
Command Line AwesomeTopher DeRosia
@topher1kenobe
Homeworkchmodchownlocatekill
Google is your friend here.
Command Line AwesomeTopher DeRosia
@topher1kenobe
WP CLIhttp://wp-cli.org/
Interact with the WP admin UI from the command line
wp --help
Command Line AwesomeTopher DeRosia
@topher1kenobe
Resourceshttp://www.commandlinefu.com
http://www.commandlinefu.com/commands/by/topher1kenobe
http://cli.learncodethehardway.org/bash_cheat_sheet.pdf
Command Line AwesomeTopher DeRosia
@topher1kenobe
THANKS FOR
LISTENING
Command Line AwesomeTopher DeRosia
@topher1kenobe
http://derosia.com/Follow me @topher1kenobe
top related