User: Rhockens

From LibrePlanet
Jump to: navigation, search
(table test)
(Blanked the page)
Line 1: Line 1:
  
= OLD PAGE -- DON'T USE =
 
 
 
[[User:Rhockens#anchor|anchor]]
 
 
----
 
 
<br />
 
<br />
 
<br />
 
<br />
 
 
 
Table test
 
 
{| class="wikitable"
 
|+Authors and Topics
 
|-
 
|[[Ittcl#Astika_Nehra|Astika Nehra]]
 
|Apple
 
|-
 
|[[Ittcl#Patrick_Geahan|Patrick Geahan]]
 
|Pie
 
|-
 
|[[Ittcl#John_B_Wyatt_IV|John B. Wyatt IV]]
 
|Ice cream
 
|}
 
 
 
 
 
 
 
 
= Content Inventory of [[Ittcl|Introduction to the Command Line]] =
 
 
 
== Intro to the Command Line: TOC with Sections and Individual Chapters ==
 
 
'''Introduction'''<br />
 
: 1. Introduction<br />
 
: 2. About this Manual<br />
 
'''Basics'''<br />
 
: 3. Getting Started<br />
 
: 4. Beginning Syntax<br />
 
: 5. Moving Around<br />
 
'''Commands'''<br />
 
: 6. Basic Commands<br />
 
: 7. Standard Files<br />
 
: 8. Cut Down on Typing<br />
 
: 9. Superusers<br />
 
: 10. Redirection<br />
 
'''Advanced-ish'''<br />
 
: 11. Multiple Files<br />
 
: 12. Searching for Files<br />
 
: 13. Piping<br />
 
: 14. Processes<br />
 
: 15. File Structure<br />
 
: 16. Command History<br />
 
'''Advanced'''<br />
 
: 17. Permissions<br />
 
: 18. Interactive Editing<br />
 
: 19. Checking Exit<br />
 
: 20. Sub Commands<br />
 
: 21. Moving Again<br />
 
: 22. Customization<br />
 
: 23. Parameter Substitution<br />
 
: 24. GNU Screen<br />
 
: 25. SSH<br />
 
: 26. Git<br />
 
: 27. Installing Software<br />
 
: 28. Making Your Own Interpreter<br />
 
'''Text Editors'''<br />
 
: 29. Text Editors [''removed vim, emacs, kedit, gedit'']<br />
 
: 30. Nano<br />
 
'''Scripting'''<br />
 
: 31. Scripting<br />
 
: 32. Maintaining Scripts<br />
 
: 33. Other Languages<br />
 
: 34. Sed<br />
 
: 35. Awk<br />
 
: 36. Regular Expressions<br />
 
'''Scripting Languages''' [''removed perl, ruby, GNU Octave'']<br />
 
: 37. Python<br />
 
'''Appendices'''<br />
 
: 38. Glossary<br />
 
: 39. Command Quick<br />
 
: 40. Outline<br />
 
: 41. Credits<br />
 
 
<span id="anchor"></span>
 
 
== Content Inventory (Formatted) ==
 
 
1. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#introduction Introduction]'''<br />
 
: 1.1. Put Yourself in Command [''comparison of GUI and command line for same task'']<br />
 
: 1.2. Advantages of Using Commands<br />
 
:: 1.2.1. Flexibility<br />
 
:: 1.2.2. Reliability<br />
 
:: 1.2.3. Speed<br />
 
:: 1.2.4. Experience [''learning experience'']<br />
 
:: 1.2.5. Fun<br />
 
: 1.3. The Value of Scripting<br />
 
: 1.4. Is my Computer Sick? [''get hardware and software info from command line'']<br />
 
: 1.5. Spanning the Network [''execute commands on remote computer using command line'']<br />
 
: 1.6. Even Graphical Programs are Commands [''examining GUI program behavior via command line'']<br />
 
 
: Terms: command line, command line interface, command line program, commands, GNU/Linux, graphical user interface, program, scripting, script, text file
 
 
2. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#about-this-manual About this Manual]''' [''origin of book and ways to contribute'']<br />
 
 
3. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#getting-started Getting Started]'''<br />
 
: 3.1. Getting Started<br />
 
:: <code>$date</code>
 
: 3.2. The Command Line Can do Much Better [''beyond simple commands without options'']<br />
 
: 3.3. What Do We Mean By a Command? [''command is executable file; mentions builtins'']<br />
 
: 3.4. Ways to Enter Commands<br />
 
: 3.5. Finding a Terminal<br />
 
: 3.6. Running an Individual Command<br />
 
: 3.7. How We Show Commands and Output in This Book<br />
 
 
: Terms: shell, terminal, desktop environment<br />
 
: Commmands: date<br />
 
 
4. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#beginning-syntax Beginning Syntax]'''<br />
 
: 4.1. Arguments [''examples of args using echo'']<br />
 
:: <code>$echo foo</code>
 
: 4.2. Options [''examples of options using date'']<br />
 
:: <code>$date --utc</code>
 
: 4.3. Repeating and editing commands [''keyboard up arrow for previous commands (no mention of''  history''); right, left arrow to edit'']<br />
 
 
: Terms: argument, white space, quoting, option<br />
 
: Commands: echo, date<br />
 
 
5. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#moving-around Moving Around]''' [''navigating file system'']<br />
 
: 5.1. Absolute and relative paths
 
:: <code>$pwd</code>
 
:: <code>$cd</code>
 
: 5.2. Good to be back home [''introduces home directory; two ways to return to it'']
 
:: <code>$cd</code>
 
:: <code>$cd ~</code>
 
: 5.3 The . and .. directories<br />
 
 
: Terms: folders, directories, filesystem, root directory, absolute path, relative path, parent directory (..), current directory (.)<br />
 
: Commands: pwd, cd<br />
 
 
6. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#basic-commands Basic Commands]'''<br />
 
: 6.1. ls<br />
 
:: <code>$ls</code>
 
:: <code>$ls --color</code>
 
: 6.2. man, info & apropos<br />
 
:: <code>$man ls</code>
 
:: <code>$info ls</code>
 
:: <code>$emacs -f info-standalone</code> [''view info main menu in Emacs'']<br />
 
:: <code>$apropos rename</code>
 
:: <code>$apropos -s 1 rename</code> [''brief into to manual page sections'']<br />
 
: 6.3. mv<br />
 
:: <code>$mv oldname newname</code>
 
:: <code>$mv -i oldname newname</code>
 
:: <code>$mv one_file another_file a_third_file ~/stuff</code>
 
: 6.4. mkdir<br />
 
:: <code>$mkdir ~/stuff</code>
 
:: <code>$rmdir ~/stuff</code>
 
: 6.5. rm & rmdir<br />
 
: 6.6. cat & less<br />
 
 
: Terms: subdirectory, manual page, Emacs, globbing, recursive<br />
 
: Commands: apropos, cat, cp, info, less, ls, man, mkdir, rmdir<br />
 
 
7. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#standard-files Standard Files]''' [''section introduces'' stdin, stdout, stderr; ''introduces redirection operator'' > ''(but not'' >>'') and pipe; file descriptors; ''exec]<br />
 
: 7.1. More about redirection<br />
 
:: <code>$ls *.bak > listfile</code>
 
:: <code>$ls *.bak | more</code>
 
:: <code>$ls -lR / | tee > allMyFiles</code>
 
: 7.2. Redirecting stderr<br />
 
:: <code>$ls /nosuchplace > /dev/null</code>
 
:: <code>$ls /nosuchplace 2>/tmp/errors</code>
 
:: <code>$ls *.bak > listfile 2>&1</code>
 
: 7.3. Adding more descriptors<br />
 
:: <code>$exec 3>/tmp/thirdfile</code>
 
:: <code>$exec 4>/tmp/fourthfile</code>
 
:: <code>$echo drib >&3</code>
 
:: <code>$ echo drab >&4</code>
 
:: <code>$ echo another drib >&3</code>
 
:: <code>$ echo another drab >&4</code>
 
:: <code>$ exec 3>&-</code>
 
:: <code>$ exec 4>&-</code>
 
 
 
8. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#cut-down-on-typing Cut Down on Typing]'''<br />
 
: 8.1. All That Typing... [''short intro'']<br />
 
: 8.2. Autocompleting [''autocompletion using tab'']<br />
 
: 8.3. Copy and Paste [''copy and paste into command line using GUI and mouse'']<br />
 
: 8.4. History [''using keyboard up, down arrow to navigate history'']<br />
 
 
 
9. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#superusers Superusers]'''<br />
 
: 9.1. The Superuser (Root) [''narrative intro to root, superuser'']<br />
 
: 9.2. The sudo Command [''brief into to'' sudo ''and'' su]<br />
 
:: <code>$sudo rm -r /junk_directory</code>
 
 
 
10. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#redirection Redirection]''' [''introduces'' >>''; redirection to'' /dev/null''; background process; job control not mentioned prior'']
 
: 10.1. Redirection
 
:: <code>$ls > my-file-list</code> [''introduces'' >> ''in narrative'']
 
:: <code>$bigprogram > /dev/null</code> [''brief intro to'' /dev/null]
 
:: <code>$mail joe < myfile.txt</code>
 
:: <code>$ogg123 *.ogg &</code>
 
:: <code>$ogg123 *.ogg >/dev/null 2>music_err &</code>
 
 
 
11. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#multiple-files Multiple Files]'''<br />
 
: 11.1. Multiple Files [''introductory text'']<br />
 
: 11.2. Globbing<br />
 
:: 11.2.1. The "*" Wildcard<br />
 
::: <code>$rm -- *</code> [''text says: When you use just an asterisk ("*") with rm, and basically any other command, it is always a good idea to put an option terminator ("--") before the wildcard like this:'']
 
:: 11.2.2. The "?" Wildcard<br />
 
:: 11.2.3. The "[ ]" Wildcards<br />
 
:: 11.2.4. Brace Expansion [''first mention of bash'']<br />
 
: 11.3. Globbing When No File Matches<br />
 
: 11.4. Disabling A Wildcard<br />
 
 
 
12. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#searching-for-files Searching for Files]'''<br />
 
: 12.1. Wildcards with Find<br />
 
:: <code>$find . -name 'some*' -print</code>
 
: 12.2. Trimming The Search Path<br />
 
:: <code>$find . -maxdepth 1 -name 'some*' -print</code>
 
: 12.3. Using Criteria<br />
 
:: <code>$find ~ -mtime -3 -print</code>
 
: 12.4. Using Find To Run a Command on Multiple Files [''introduces'' exec ''option to'' find]<br />
 
:: <code>$find directory_to_backup  -mtime +30  -size +500k -print \</code>
 
:::<code>-exec rm {} \;</code>
 
:: <code>$find . -name 'file*' -exec cp {} {}.backup \;</code>
 
 
 
13. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#piping Piping]''' [''introduces'' cat, cut, sort, uniq, ''and'' grep ''to illustrate the use of pipes'']<br />
 
: 13.1 Piping Hot Commands [''illustrating use of pipes'']
 
:: <code>$cat books</code>
 
:: <code>$sort books</code>
 
:: <code>$cut -d: -f1 books</code>
 
:: <code>$sort books | cut -d: -f1</code>
 
:: <code>$sort books | cut -d: -f2</code>
 
:: <code>$cut -d: -f2 books | sort</code>
 
:: <code>$cut -d: -f1 books | sort | grep "John"</code>
 
:: <code>$cut -d: -f1 books | sort | grep ", John"</code>
 
:: <code>$cut -d: -f1 books | sort | grep ", John" | uniq -c</code>
 
:: <code>$cut -d: -f1 books | sort | grep ", John" | uniq -c | sort -nr</code>
 
 
 
14. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#processes Processes]''' <br />
 
: 14.1. Processes [''briefly introduces concept of a process'']<br />
 
: 14.2. Interrupting (Ctrl-C) [''introduces'' SIGINT ''as raised on CTRL-C; first mention of kernel''] <br />
 
: 14.3. ps and kill [''introduces'' top; ''mentions'' tty]<br />
 
:: <code>$ps</code>
 
:: <code>$tty</code>
 
:: <code>$ps -e</code>
 
:: <code>$kill 3941</code> [''doesn't explain where pid in example comes from; mentions'' kill ''and option'' 9, ''introduces'' SIGKILL, ''and'' $kill -s SIGKILL (pid)]
 
: 14.4. Processes and jobs (background) [''starting process in background with'' &, ''introduces'' fg, bg, ''and Ctrl-Z, and'' jobs]
 
:: <code>$firefox &</code>
 
:: <code>$fg 3694</code>
 
:: <code>$fg %1</code>
 
:: <code>$jobs</code>
 
 
 
15. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#file-structure File Structure]'''<br />
 
: 15.1. Files and Directories [''introduces GNU/Linux directory structure; introduces concept of hidden file'' (~/.sugar/default/logs), ''suggests referring to'' heir ''man page'']<br />
 
 
 
16. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#command-history Command History]'''<br />
 
: 16.1. Command History Shortcuts [''brief first mention of'' cron; ''reiterates keyboard arrow up, down to navigate history]<br />
 
: 16.2. Recalling a command by a string [''introduces'' !, !''command'':p, !!]<br />
 
:: <code>$!mv</code>
 
:: <code>$!mv:p</code>
 
:: <code>$!?log?</code> [Rhockens: ''I can't figure out how this works'']
 
:: <code>$sudo !!</code> [''after mentioning'' !! ''in text'']
 
: 16.3. Recalling a command by number<br />
 
:: <code>$history</code>
 
:: <code>$!504</code>
 
:: <code>$!-4</code>
 
: 16.4. Repeating arguments [''introduces'' !*, !^, ''and'' !$, :number, ''and'' :number ''range'']
 
:: [''code samples below in pairs showing original command and command using recall operator'']
 
<br />
 
:: <code>$emasc /home/fred/mywork.java /tmp/testme.java # FAILS</code>
 
:: <code>$emacs !* # fixed command name and recalled all arguments with !*</code>
 
<br />
 
:: <code>$emacs /home/fred/mywork.java /tmp/testme.java</code>
 
:: <code>$svn commit !^    # equivalent to: svn commit /home/fred/mywork.java</code>
 
<br />
 
:: <code>$mv /home/fred/downloads/sample_screen_config /home/fred/.screenrc</code>
 
:: <code>$emacs !$    # equivalent to: emacs /home/fred/.screenrc</code>
 
<br />
 
:: <code>$sudo cp /etc/apache2/sites-available/siteconfig /home/fred/siteconfig.bak</code>
 
:: <code>$echo !^ !!:2  # equivalent to echo cp /etc/apache2/sites-available/siteconfig</code>
 
<br />
 
: 16.5. Editing Arguments [introduces editing recalled arguments with s/foo/bar]
 
:: <code>$wc file1</code>
 
:: <code>$rm !$:s/1/2/ [expands to "rm file2"]</code>
 
<br />
 
:: <code>$wc file1</code>
 
:: <code>$^1^2</code> [Expands to "wc file2"; RH: Check on Arch]
 
: 16.6. Searching through the Command History [Ctrl-R for "reverse-i-search"]
 
: 16.7. Sharing Bash History [''update'' ~/.bashrc; ''hidden files and text editing have not yet been introduced; don't believe bash has been formally introduced'']
 
:: <code>shopt -s histappend</code>
 
:: <code>PROMPT_COMMAND='history -a'</code>
 
 
 
17. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#premissions Permissions]'''<br />
 
: 17.1. What can I do? What can others do? [''introduces files types''; r, w, x ''permissions''; ''users and groups''; whoami; ''root'']<br />
 
: 17.2. Setting through chmod [introduces two ways to change permissions]
 
:: <code>$chmod u=rw,g=,o= motd</code>
 
:: <code>$chmod 0660 issue</code>
 
 
 
18. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#interactive-editing Interactive Editing]''' [''introduces concept of key bindings; shows how to set vim or emacs; detailed discussion of emacs keybindings; suggests exploring vim on own; prior to discussion of vim in book'']<br />
 
 
 
19. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#checking-exit Checking Exit]'''<br />
 
: 19.1. Exit Status [''introduces exit status''; 0 success; $?]<br />
 
:: <code>$echo $?</code>
 
: 19.2. if/then [''introduces compound command'']<br />
 
: 19.3. && and ||<br />
 
: 19.4. What does an exit status mean?<br />
 
 
 
20. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#sub-commands Sub Commands]''' <br />
 
: 20.1. Command Substitution [''introduces commmand substitution; breifly introduces adding alias to .bashrc; hidden files, text editing not yet introduced'']<br />
 
:: <code>$grep `date +%b` apache_error_log</code>
 
:: <code>.bashrc: alias monthlog="grep `date +%b` apache_error_log"</code>
 
:: <code>$grep $(date +%b) apache_error_log</code>
 
 
 
21. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#moving-again Moving Again]''' [''introduces directory stack; dirs; pushd dir; pushd; pushd +/- number; popd; illustrates state of state after various example commands'']<br />
 
 
 
22. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#customisation Customization]'''<br />
 
: 22.1. Useful customizations [''intro text'']<br />
 
:: 22.2. Variables [''assigning, unassigning variables'']<br />
 
::: <code>$p=/home/jsmith/projects/foo/confoobulator</code>
 
::: <code>$cd $p</code>
 
::: <code>$VAR=""</code>
 
::: <code>$unset VAR</code>
 
: 22.3. Ordinary Variables and Environment Variables<br />
 
:: <code>$export p</code>
 
: 22.4. Shell Variables [''describes several variables''; SHELL, USER, PATH, ''etc''.]<br />
 
:: <code>$echo $HOME</code>
 
:: <code>$env</code>
 
: 22.5. Controlling Variable Expansion <br />
 
:: <code>$curr=myfile</code>
 
:: <code>$rm $curr1.jpeg # doesn't work</code>
 
:: <code>$rm ${curr}1.jpeg # works</code>
 
: 22.6. The Search Path [''brief into to search path; introduction of'' which]<br />
 
: 22.7. Configuration Files [''introduction to hidden files; .bashrc; reference to text editor chapter'']<br />
 
 
 
23. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#parameter-substitution Parameter Substitution]'''<br />
 
: 23.1. Parameter Substitution<br />
 
:: <code>$curr=myfile</code>
 
:: <code>$rm ${curr}.jpeg</code>
 
:: <code>$rm ${curr/file/picture}.jpeg # to change file to picture and rm mypicture.jpg</code>
 
: 23.2. Playing Safe With Variables That Don't Exist [introduces :- and :=]<br />
 
:: <code>$cat "${VARIABLE_FILE_NAME:-/home/user/file}"</code>
 
:: <code>$cat "${VARIABLE_FILE_NAME:=/home/user/file}"</code>
 
: 23.3. Cutting Corners With Variable Expansion<br />
 
:: <code>$export ALT_LS='--color=always -b -h --filetype'</code>
 
:: <code>$ls $ALT_LS</code>
 
 
 
24. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#gnuscreen GNU Screen]''' [''introduces'' screen ''and key combinations for: splitting, copy and paste, detaching, quitting'']<br />
 
 
 
25. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#ssh SSH]''' [''intro to'' ssh, scp, rsync; ''discourages'' telnet; ''detached remote session using'' screen]<br />
 
: 25.1. SSH<br />
 
:: <code>$ssh othermachine.domain.org</code>
 
:: <code>$ssh -l remoteusername othermachine.domain.org</code>
 
:: <code>$ssh remoteusername@othermachine.domain.org</code>
 
:: <code>$ssh remoteusername@othermachine.domain.org 'mkdir /home/myname/newdir'</code>
 
: 25.2. scp: file copying<br />
 
:: <code>$scp myprog.py me@othermachine.domain.org:stuff</code>
 
:: <code>$scp me@othermachine.domain.org:docs/interview.txt yesterday-interview.txt</code>
 
:: <code>$scp user1@host1:file1 user2@host2:otherdir</code>
 
:: <code>$scp -r user1@host1:dir1 user2@host2:dir2</code>
 
: 25.3. rsync: automated bulk transfers and backups<br />
 
:: <code>$rsync -e ssh -a /home/myname/docs me@quantum.example.edu:backup/</code>
 
: 25.4. Making life easier when you use SSH often [''editing'' .ssh/config]<br />
 
 
 
26. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#git Git]''' [''list of basic git commands'': clone, commit, revert; ''chapter appears incomplete'']<br />
 
 
 
27. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#installing-software Installing Software]''' [''basic commands for'' apt-get ''and'' yum; ''brief overview of compiling from source'']<br />
 
: 27.1. Dependencies [introduction to topic]<br />
 
: 27.2. Unpack the archive<br />
 
:: <code>$tar zxvf packagename.tar.gz</code>
 
: 27.3. Run the configure script<br />
 
:: <code>$./configure</code>
 
:: <code>$./configure --prefix ~/bin/myprogs</code>
 
: 27.4. Compile the software<br />
 
:: <code>$make</code>
 
:: <code>$make -j3</code>
 
: 27.5. Install the software<br />
 
:: <code>$sudo make install</code>
 
 
 
28. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#making-your-own-interpreter Making Your Own Interpreter]''' [''source code for'' bdc; ''compiling; usage'']<br />
 
 
 
29. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#text-editors Text Editors]''' [including nano; omitting vim, emacs, kedit, gedit]<br />
 
: 29.1. Text Editors [intro]<br />
 
:: 29.1.1. Word Processing vs Text Editing<br />
 
:: 29.1.2. Why do you need a text editor?<br />
 
:: 29.1.3. Why are most text editors command-line programs?<br />
 
: 29.2. Setting a default text editor<br />
 
:: <code>$export EDITOR=emacs</code>
 
 
 
30. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#nano Nano]''' [''brief intro; basic use; start, save, exit'']<br />
 
 
 
31. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#scripting Scripting]'''<br />
 
: 31.1. Scripting [''intro; sample script'']<br />
 
: 31.2. Making scripts executable<br />
 
:: <code>$chmod +x make_thumbnails.sh</code>
 
:: <code>$./make_thumbnails.sh</code>
 
:: <code>$bash make_thumbnails.sh</code>
 
: 31.3. More Control [''examples of'' if, while, etc.]<br />
 
:: 31.3.1. if<br />
 
:: 31.3.2. while (and until)<br />
 
:: 31.3.3. case<br />
 
:: 31.3.4. for<br />
 
:: 31.3.5. parallel<br />
 
 
32. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#maintaining-scripts Maintaining Scripts]''' [''guidelines for maintainable, robust scripts; e.g., "Use descriptive names for your scripts"'']<br />
 
 
33. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#other-languages Other Languages]''' [''introduction; introduces awk, sed, python; other languages omitted'']<br />
 
 
34. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#sed Sed]'''<br />
 
: 34.1. The Sed Text Processor<br />
 
:: <code>$wc -c * | sort -n | sed ...</code>
 
: 34.2. Basic Syntax and Substitution<br />
 
:: <code>$sed "s/foo/bar/g" inputfile > outputfile</code>
 
: 34.3. Sed Expressions Explained [''introduces'' $, ^, *, []]<br />
 
: 34.4. Deletion<br />
 
:: <code>$sed "/^$/d" inputfile > outputfile</code>
 
: 34.5. Controlling Printing<br />
 
:: <code>$sed -n "s/Mrs\./Ms/p" testfile</code>
 
: 34.6. Multiple Patterns<br />
 
:: <code>$echo Gnus eat grass | sed -e "s/Gnus/Penguins/" -e "s/grass/fish/"</code>
 
: 34.7. Controlling Edits With Patterns<br />
 
:: <code>$sed "/one/ s/number/1/" testfile > testchangedfile</code>
 
: 34.8. Controlling Edits With Line Numbers<br />
 
:: <code>$sed "2,3 s/number/1/" < testfile > testchangedfile</code>
 
: 34.9. Scripting SED commands<br />
 
:: <code>$sed -f sedcommands < inputfile > outputfile</code>
 
 
 
35. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#awk Awk]''' [''basic intro to awk'']<br />
 
 
36. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#regular-expressions Regular Expressions]''' [''basic intro to regular expressions; operators, ranges, groups, anchoring, etc.'']<br />
 
 
37. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#python Python]''' [''new chapter TK'']<br />
 
 
38. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#glossary Glossary]''' [''update for second edition'']<br />
 
 
39. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#command-quickie Command Quickie]''' [''to be revised for second edition'']<br />
 
 
40. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#outline Outline]''' [''proposed outline for a future edition'']<br />
 
 
41. '''[https://en.flossmanuals.net/introduction-to-the-command-line/_full/#credits Credits]'''<br />
 
 
== Content Inventory (Plain text) ==
 
 
<nowiki>
 
Introduction
 
1. Introduction
 
2. About this Manual
 
Basics
 
3. Getting Started
 
4. Beginning Syntax
 
5. Moving Around
 
Commands
 
6. Basic Commands
 
7. Standard Files
 
8. Cut Down on Typing
 
9. Superusers
 
10. Redirection
 
Advanced-ish
 
11. Multiple Files
 
12. Searching for Files
 
13. Piping
 
14. Processes
 
15. File Structure
 
16. Command History
 
Advanced
 
17. Permissions
 
18. Interactive Editing
 
19. Checking Exit
 
20. Sub Commands
 
21. Moving Again
 
22. Customization
 
23. Parameter Substitution
 
24. GNU Screen
 
25. SSH
 
26. Git
 
27. Installing Software
 
28. Making Your Own Interpreter
 
Text Editors
 
29. Text Editors [removed vim, emacs, kedit, gedit]
 
30. Nano
 
Scripting
 
31. Scripting
 
32. Maintaining Scripts
 
33. Other Languages
 
34. Sed
 
35. Awk
 
36. Regular Expressions
 
Scripting Languages [removed perl, ruby, GNU Octave]
 
37. Python
 
Appendices
 
38. Glossary
 
39. Command Quick
 
40. Outline
 
41. Credits
 
 
 
 
 
1. Introduction
 
1.1. Put Yourself in Command [comparison of GUI and command line for same task]
 
1.2. Advantages of Using Commands
 
1.2.1. Flexibility
 
1.2.2. Reliability
 
1.2.3. Speed
 
1.2.4. Experience [learning experience]
 
1.2.5. Fun
 
1.3. The Value of Scripting
 
1.4. Is my Computer Sick? [gather info on your computer's hardware and software from command line]
 
1.5. Spanning the Network [executing commands on remote computers using command line]
 
1.6. Even Graphical Programs are Commands [examining GUI program behavior via command line]
 
 
2. About this Manual [origin of book and ways to contribute]
 
 
3. Getting Started
 
3.1. Getting Started
 
$date
 
3.2. The Command Line Can do Much Better [beyond simple commands without options]
 
3.3. What Do We Mean By a Command? [command is executable file; mentions builtins]
 
3.4. Ways to Enter Commands
 
3.5. Finding a Terminal
 
3.6. Running an Individual Command
 
3.7. How We Show Commands and Output in This Book
 
 
4. Beginning Syntax
 
4.1. Arguments [examples of args using echo]
 
$echo foo
 
4.2. Options [examples of options using date]
 
$date --utc
 
4.3. Repeating and editing commands [keyboard up arrow for previous commands (no mention of history); right, left arrow to edit]
 
 
5. Moving Around [navigating file system]
 
5.1. Absolute and relative paths
 
$pwd
 
$cd
 
5.2. Good to be back home [introduces home directory; two ways to return to it]
 
$cd
 
$cd ~
 
5.3 The . and .. directories
 
 
6. Basic Commands
 
6.1. ls
 
$ls
 
$ls --color
 
6.2. man, info & apropos
 
$man ls
 
$info ls
 
$emacs -f info-standalone [view info main menu in Emacs]
 
$apropos rename
 
$apropos -s 1 rename [brief into to manual page sections]
 
6.3. mv
 
$mv oldname newname
 
$mv -i oldname newname
 
$mv one_file another_file a_third_file ~/stuff
 
6.4. mkdir
 
$mkdir ~/stuff
 
$rmdir ~/stuff
 
6.5. rm & rmdir
 
6.6. cat & less
 
 
7. Standard Files [section introduces stdin, stdout, stderr; introduces redirection operator > (but not >>) and pipe; file descriptors; exec]
 
7.1. More about redirection
 
$ls *.bak > listfile
 
$ls *.bak | more
 
$ls -lR / | tee > allMyFiles
 
7.1. Redirecting stderr
 
$ls /nosuchplace > /dev/null
 
$ls /nosuchplace 2>/tmp/errors
 
$ls *.bak > listfile 2>&1
 
7.2. Adding more descriptors
 
$exec 3>/tmp/thirdfile
 
$ exec 4>/tmp/fourthfile
 
$ echo drib >&3
 
$ echo drab >&4
 
$ echo another drib >&3
 
$ echo another drab >&4
 
$ exec 3>&-
 
$ exec 4>&-
 
 
8. Cut Down on Typing
 
8.1. All That Typing... [short intro]
 
8.2. Autocompleting [autocompletion using tab]
 
8.3. Copy and Paste [copy and paste into command line using GUI and mouse]
 
8.4. History [using keyboard up and down arrow to access history]
 
 
9. Superusers
 
9.1. The Superuser (Root) [narrative intro to root/superuser]
 
9.2. The sudo Command [brief into to sudo and su]
 
$sudo rm -r /junk_directory
 
 
10. Redirection [introduces >>; redirection to /dev/null; background process; job control not mentioned prior]
 
10.1. Redirection
 
$ls > my-file-list [introduces >> in narrative]
 
$bigprogram > /dev/null [brief intro to /dev/null]
 
$mail joe < myfile.txt
 
$ogg123 *.ogg &
 
$ogg123 *.ogg >/dev/null 2>music_err &
 
 
 
11. Multiple Files
 
11.1. Multiple Files [introductory text]
 
11.2. Globbing
 
11.2.1. The "*" Wildcard
 
$rm -- *
 
11.2.2. The "?" Wildcard
 
11.2.3. The "[ ]" Wildcards
 
11.2.4. Brace Expansion [first mention of bash]
 
11.3. Globbing When No File Matches
 
11.4. Disabling A Wildcard
 
 
12. Searching for Files
 
12.1. Wildcards with Find
 
$find . -name 'some*' -print
 
12.2. Trimming The Search Path
 
$find . -maxdepth 1 -name 'some*' -print
 
12.3. Using Criteria
 
$find ~ -mtime -3 -print
 
12.4. Using Find To Run a Command on Multiple Files [introduces exec option to find]
 
$find directory_to_backup  -mtime +30  -size +500k -print \
 
              -exec rm {} \;
 
$find . -name 'file*' -exec cp {} {}.backup \;
 
 
13. Piping [introduces cat, cut, sort, uniq, and grep to illustrate the use of pipes]
 
13.1 Piping Hot Commands
 
$cat books
 
$sort books
 
$cut -d: -f1 books
 
$sort books | cut -d: -f1
 
$sort books | cut -d: -f2
 
$cut -d: -f2 books | sort
 
$cut -d: -f1 books | sort | grep "John"
 
$cut -d: -f1 books | sort | grep ", John"
 
$cut -d: -f1 books | sort | grep ", John" | uniq -c
 
$cut -d: -f1 books | sort | grep ", John" | uniq -c | sort -nr
 
 
 
14. Processes
 
14.1. Processes [briefly introduces concept of a process]
 
14.2. Interrupting (Ctrl-C) [introduces SIGINT as raised on CTRL-C; mentions kernel]
 
14.3. ps and kill [introduces top but doesn't demonstrate, mentions tty]
 
$ps
 
$tty
 
$ps -e
 
$kill 3941 [doesn't explain where pid in example comes from; mentions kill option 9, SIGKILL, and $kill -s SIGKILL (pid)]
 
14.4. Processes and jobs (background) [starting process in background with &, introduces fg, bg, and Ctrl-Z, and jobs]
 
$firefox &
 
$fg 3694
 
$fg %1
 
$jobs
 
 
15. File Structure
 
15.1. Files and Directories [introduces GNU/Linux directory structure, introduces concept of hidden file (~/.sugar/default/logs), suggests referring to heir man page]
 
 
16. Command History
 
16.1. Command History Shortcuts [brief first mention of cron; reiterates keyboard arrow up, down to navigate]
 
16.2. Recalling a command by a string [introduces !, !command:p, !!]
 
$!mv
 
$!mv:p
 
$!?log? [RH: not sure what this is doing]
 
$sudo !! [after mentioning !! in text]
 
16.3. Recalling a command by number
 
$history
 
$!504
 
$!-4
 
16.4. Repeating arguments [introduces !*, !^, and !$, :number, and :number range]
 
[code samples are pairs showing original command and command using recall operator]
 
 
$emasc /home/fred/mywork.java /tmp/testme.java # FAILS
 
$emacs !* # FIXED COMMAND NAME, RECALLED ALL ARGUMENTS
 
 
$emacs /home/fred/mywork.java /tmp/testme.java
 
$svn commit !^    # equivalent to: svn commit /home/fred/mywork.java
 
 
$mv /home/fred/downloads/sample_screen_config /home/fred/.screenrc
 
$emacs !$    # equivalent to: emacs /home/fred/.screenrc
 
 
$sudo cp /etc/apache2/sites-available/siteconfig /home/fred/siteconfig.bak
 
$echo !^ !!:2  # equivalent to echo cp /etc/apache2/sites-available/siteconfig
 
 
16.5. Editing Arguments [introduces editing recalled arguments with s/foo/bar]
 
$wc file1
 
$rm !$:s/1/2/ [expands to "rm file2"]
 
 
$wc file1
 
$^1^2 [Expands to "wc file2"; RH: Check on Arch]
 
16.6. Searching through the Command History [Ctrl-R for "reverse-i-search"]
 
16.7. Sharing Bash History [update ~/.bashrc; hidden files and text editing have not yet been introduced; don't believe bash has been formally introduced]
 
shopt -s histappend
 
PROMPT_COMMAND='history -a'
 
 
17. Permissions
 
17.1. What can I do? What can others do? [introduces files types; r, w, x permissions; users and groups; whoami; root]
 
17.2. Setting through chmod [introduces two ways to change permissions]
 
$chmod u=rw,g=,o= motd
 
$chmod 0660 issue
 
 
18. Interactive Editing [introduces concept of key bindings; shows how to set vim or emacs; detailed discussion of emacs keybindings; suggests explore vim on own; prior to discussion of vim in book]
 
 
19. Checking Exit
 
19.1. Exit Status [introduces exit status; 0 success; $?]
 
$echo $?
 
19.2. if/then [introduces compound command]
 
19.3. && and ||
 
19.4. What does an exit status mean?
 
 
20. Sub Commands
 
20.1. Command Substitution [introduces command substitution; briefly introduces adding alias to .bashrc; hidden files, text editing not yet introduced]
 
$grep `date +%b` apache_error_log
 
.bashrc: alias monthlog="grep `date +%b` apache_error_log"
 
$grep $(date +%b) apache_error_log
 
 
21. Moving Again [introduces directory stack; dirs; pushd dir; pushd; pushd +/- number; popd; illustrates state of state after various example commands]
 
 
22. Customizations
 
22.1. Useful customizations [intro text]
 
22.2. Variables [assigning, unassigning variables]
 
$p=/home/jsmith/projects/foo/confoobulator
 
$cd $p
 
$VAR=""
 
$unset VAR
 
22.3. Ordinary Variables and Environment Variables
 
$export p
 
22.4. Shell Variables [describes severeal variables; SHELL, USER, PATH, etc.]
 
$echo $HOME
 
$env
 
22.5. Controlling Variable Expansion
 
$curr=myfile
 
$rm $curr1.jpeg # doesn't work
 
$rm ${curr}1.jpeg # works
 
22.6. The Search Path [brief into to search path; introduction of which]
 
22.7. Configuration Files [introduction to hidden files; .bashrc; reference to text editor chapter]
 
 
23. Parameter Substitution
 
23.1. Parameter Substitution
 
$curr=myfile
 
$rm ${curr}.jpeg
 
$rm ${curr/file/picture}.jpeg # to change file to picture and rm mypicture.jpg
 
23.2. Playing Safe With Variables That Don't Exist [introduces :- and :=]
 
$cat "${VARIABLE_FILE_NAME:-/home/user/file}"
 
$cat "${VARIABLE_FILE_NAME:=/home/user/file}"
 
23.3. Cutting Corners With Variable Expansion
 
$export ALT_LS='--color=always -b -h --filetype'
 
$ls $ALT_LS
 
 
24. GNU Screen [introduces screen and key combinations for: splitting, copy and paste, detaching, quitting]
 
 
 
25. SSH [intro to ssh, scp, rsync; discourages telnet; detached remoted session using screen]
 
25.1. SSH
 
$ssh othermachine.domain.org
 
$ssh -l remoteusername othermachine.domain.org
 
$ssh remoteusername@othermachine.domain.org
 
$ssh remoteusername@othermachine.domain.org 'mkdir /home/myname/newdir'
 
25.2. scp: file copying
 
$scp myprog.py me@othermachine.domain.org:stuff
 
$scp me@othermachine.domain.org:docs/interview.txt yesterday-interview.txt
 
$scp user1@host1:file1 user2@host2:otherdir
 
$scp -r user1@host1:dir1 user2@host2:dir2
 
25.3. rsync: automated bulk transfers and backups
 
$rsync -e ssh -a /home/myname/docs me@quantum.example.edu:backup/
 
25.4. Making life easier when you use SSH often [editing .ssh/config]
 
 
26. Git [list of basic git commands: clone, commit, revert; chapter appears incomplete]
 
 
27. Installing Software [basic commands for apt-get and yum; brief overview of compling from source]
 
27.1. Dependencies [introduction to topic]
 
27.2. Unpack the archive
 
$tar zxvf packagename.tar.gz
 
27.3. Run the configure script
 
$./configure
 
$./configure --prefix ~/bin/myprogs
 
27.4. Compile the software
 
$make
 
$make -j3
 
27.5. Install the software
 
$sudo make install
 
 
28. Making Your Own Interpreter [source code for bdc; compiling; usage]
 
 
29. Text Editors [including nano; omitting vim, emacs, kedit, gedit]
 
29.1. Text Editors [intro]
 
29.1.1. Word Processing vs Text Editing
 
29.1.2. Why do you need a text editor?
 
29.1.3. Why are most text editors command-line programs?
 
29.2. Setting a default text editor
 
$export EDITOR=emacs
 
 
30. Nano [brief intro nano; basic use; start, save, exit]
 
 
31. Scripting
 
31.1. Scripting [intro; sample script]
 
31.2. Making scripts executable
 
$chmod +x make_thumbnails.sh
 
$./make_thumbnails.sh
 
$bash make_thumbnails.sh
 
31.3. More Control [examples of if, while, etc.]
 
31.3.1. if
 
31.3.2. while (and until)
 
31.3.3. case
 
31.3.4. for
 
31.3.5. parallel
 
 
32. Maintaining Scripts [guidelines for maintainable, robust scripts; e.g., "Use descriptive names for your scripts"]
 
 
33. Other Languages [introduction; introduces awk, sed, python; other languages omitted]
 
 
34. Sed
 
34.1. The Sed Text Processor
 
$wc -c * | sort -n | sed ...
 
34.2. Basic Syntax and Substitution
 
$sed "s/foo/bar/g" inputfile > outputfile
 
34.3. Sed Experessions Explained [introduces $, ^, *, []]
 
34.4. Deletion
 
$sed "/^$/d" inputfile > outputfile
 
34.5. Controlling Printing
 
$sed -n "s/Mrs\./Ms/p" testfile
 
34.6. Multiple Patterns
 
$echo Gnus eat grass | sed -e "s/Gnus/Penguins/" -e "s/grass/fish/"
 
34.7. Controlling Edits With Patterns
 
$sed "/one/ s/number/1/" testfile > testchangedfile
 
34.8. Controlling Edits With Line Numbers
 
$sed "2,3 s/number/1/" < testfile > testchangedfile
 
34.9. Scripting SED commands
 
$sed -f sedcommands < inputfile > outputfile
 
 
35. Awk [basic intro to awk]
 
 
36. Regular Expressions [basic intro to regular expressions; operators, ranges, groups, anchoring, etc.]
 
 
37. Python [new chapter]
 
 
38. Glossary [update for second editing]
 
 
39. Command Quickie [to be revised]
 
 
40. Outline [proposed outline for a future edition]
 
 
41. Credits
 
 
</nowiki>
 

Revision as of 17:31, 2 June 2019