Difference between revisions of "Rwlove cli"

From FreekiWiki
Jump to navigation Jump to search
 
Line 39: Line 39:
 
  * Question: Can you list the contents of the root/var directory? A: 'ls /var'
 
  * Question: Can you list the contents of the root/var directory? A: 'ls /var'
 
  * Question: Can you list the contents of the root/var/log directory? A: 'ls /var/log', this is where the system log files exist
 
  * Question: Can you list the contents of the root/var/log directory? A: 'ls /var/log', this is where the system log files exist
*
 
  
 
7) Options and paths
 
7) Options and paths
 +
* Q: Can you list the contents of the root directory in the long format? A: 'ls -l /'
 +
* Option and path ordering often doesn't matter
 +
* Q: Can you list the contents of the root/var directory in the long human readable format? A: 'ls -lh /var'
 +
* Q: Can you list the contents of the root/var/log/messages, quoting the file names? A: 'ls -Q /var/log/messages'
 +
 +
8) Tips and Tricks (tab-completion)
 +
* Explain efficiency on the command line, many ways to do one thing, best way is most abbreviated
 +
* first time you hit tab it will try to complete, if success good, if fail a second tab will show all possiblilities
 +
* ls /<tab><tab>
 +
* ls /e<tab><tab>
 +
* ls /ex<tab> will result in /examples
 +
* annoying need to <tab> again to get the trailing slash
 +
* ls /examples/<tab> will result in /examples/dir
 +
* it will only complete as much of it as it can, it will never make a choice
 +
* practical use is to never type an entire directory name, just a few letters and bang on <tab> with my pinky, if it completes great, if it shows possibilities then I know I need to add another letter or two, if it doesn't show anything then I know I've made a typo in the first few letters or the file doesn't exist.
 +
* tab-completion also works for commands
 +
* ls<tab>
 +
* a<tab>
 +
* <tab>, these are all of the commands available to you. Don't be intimidated, just realize that we've come a long way from running 'ls' without any options, there are a lot of commands with a lot of options.
 +
 +
9) Tips and Tricks (up-arrow)
 +
* Type the 'history' command, but don't type all of history, just the first few letters.
 +
* The output is the history of our session
 +
* hit the up arrow and see the last command, hit up again and see the second to last command, now hit up and down as much as you'd like
 +
* Most useful for fixing mistakes, don't re-type your broken command, recall it and fix it.
 +
* cursor can be anywhere on the line when you execute the command

Latest revision as of 12:29, 3 December 2011

1) Intro

* Myself- qualification, only volunteer
* System - network boot, command line basics (user,host,pwd)

2) Basic Options

* ls
* ls -l
* go over columns in long output, permissions if the class is savvy
* explain hidden files, they're not malicious
* ls -a
* see the hidden files
* how to know what options are available, man ls
* man man question

3) Manual pages

* navigation - up, down, pgup, pgdown, home, end, q, right, left, don't get lost over to the right!
* SYNOPSIS - bracketed items, non bracketed items, ...
* DESCRIPTION - short and long style options, show '-a' see it describes the behavior we saw
* q, to quit
* ls --all, see it's the same as '-a'

4) Advanced Options

* ..., meant more than one option, do 'ls -l -a'
* why do '--all' when you can get away with '-a' 5 vs 2 keystrokes
* multiple options, 'ls -la'
* cannot do this with long style options
* can do short-condensed and long-not-condensed
* add more options, 'ls -lah', 'ls -lahQ'

5) Paths

* paths describe how to get from one directory to a directory or file
* example, pwd
* explain root basics, it's the bottom most directory
* explain, home is in root, disklessXXX is in home
* explain root fully, do with hands or board to illustrate directory heirarchy

6) Look around a bit

* Question: Can you list the contents of the root directory? A: 'ls /'
* Question: Can you list the contents of the root/var directory? A: 'ls /var'
* Question: Can you list the contents of the root/var/log directory? A: 'ls /var/log', this is where the system log files exist

7) Options and paths

* Q: Can you list the contents of the root directory in the long format? A: 'ls -l /'
* Option and path ordering often doesn't matter
* Q: Can you list the contents of the root/var directory in the long human readable format? A: 'ls -lh /var'
* Q: Can you list the contents of the root/var/log/messages, quoting the file names? A: 'ls -Q /var/log/messages'

8) Tips and Tricks (tab-completion)

* Explain efficiency on the command line, many ways to do one thing, best way is most abbreviated
* first time you hit tab it will try to complete, if success good, if fail a second tab will show all possiblilities
* ls /<tab><tab>
* ls /e<tab><tab>
* ls /ex<tab> will result in /examples
* annoying need to <tab> again to get the trailing slash
* ls /examples/<tab> will result in /examples/dir
* it will only complete as much of it as it can, it will never make a choice
* practical use is to never type an entire directory name, just a few letters and bang on <tab> with my pinky, if it completes great, if it shows possibilities then I know I need to add another letter or two, if it doesn't show anything then I know I've made a typo in the first few letters or the file doesn't exist.
* tab-completion also works for commands
* ls<tab>
* a<tab>
* <tab>, these are all of the commands available to you. Don't be intimidated, just realize that we've come a long way from running 'ls' without any options, there are a lot of commands with a lot of options.

9) Tips and Tricks (up-arrow)

* Type the 'history' command, but don't type all of history, just the first few letters.
* The output is the history of our session
* hit the up arrow and see the last command, hit up again and see the second to last command, now hit up and down as much as you'd like
* Most useful for fixing mistakes, don't re-type your broken command, recall it and fix it.
* cursor can be anywhere on the line when you execute the command