cd
cd it244
cd ex
mkdir ex5
cd ex5
cat on the syllabus page from the class web site
cat /home/ghoffman/public_html/it244_html/syllabus_it244.htmlScroll back up in your terminal session to see the beginning of the file.
more on the same file
more /home/ghoffman/public_html/it244_html/syllabus_it244.html
Space
more help section
h
Control L
Enter Enter Enter
more.less /home/ghoffman/public_html/it244_html/syllabus_it244.html
less help sectionh
q
q
mkdir test
cd test
touch foo foobar foobletch bletch
ls
ls on bletch
ls ble[Tab][Enter][Tab] and [Enter] are not words you type on the command line.
ls foo[Tab][Tab]After the first Tab, you should hear a beep. After the second, all files beginning with "foo" should be displayed.
ls on foobletch
ls foobl[Tab][Enter]As you supply more letters in the filename, the completion mechanism narrows down the possibilities.
echoecho with a string argument
echo foo bar bletch
echo to display a system variable
echo SHELL: $SHELL
echo SHELL: SHELL
hostnamehostname
hostname -i
grepcd /home/ghoffman/course_files/it244_files
cat foo.txt
grep foo foo.txt
grep bar foo.txtNow try the same search with -i
grep -i bar foo.txtNotice that
grep now prints a new line with the word "Bar" in it.
grep with the -r option
grep, when used with the -r option, looks in all subdirectories of the directory
given to it as its second argument
grep -r foo .
The . means the current directory.
grep -v to remove unwanted linesgrep come from
files with the string "svn" in their file names.
grep twice, using a pipe, |, to feed the output of the first invocation
of grep into the input of the second
grep -r foo . | grep -v svn
Notice that all the entries in the subversion files have been removed.
headcat red_sox.txt
head red_sox.txt
head -1 red_sox.txt
tailtail red_sox.txt
tail -2 red_sox.txt
sortcat fruit.txt
sort on this file
sort fruit.txt
sort -r fruit.txt
cat numbers_jumbled.txt
sort on this file without any options
sort numbers_jumbled.txtSince the numbers from 10 to 19 begin with a 1 they appear before 2
sort -n numbers_jumbled.txt
sort -nr numbers_jumbled.txtNote that
sort allows you to combine options after the dash.
cd
cd it244
cd ex
cd ex5
nano ex5.sh
echo. echo section up to and
including the section called sort
into this script file.
more or less commands inside ex5.sh
~ghoffman/it244_test/ex05.shWhen the script asks if you are ready for more, hit Return or Enter.