cd
cd it244
cd ex
mkdir ex5
cd ex5
cat on the syllabus page from the class web site
cat /home/tsoro/public_html/teaching/IT244_html/syllabus_it244.html
Scroll back up in your terminal session to see the beginning of the file.more on the same file
more /home/tsoro/public_html/teaching/IT244_html/syllabus_it244.html
Space
more help section
h
Control L
Enter
Enter
Enter
more.
less /home/tsoro/public_html/teaching/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
hostname
hostname
hostname -i
grep
cd /home/tsoro/course_files/it244_files
cat foo.txt
grep foo foo.txt
grep bar foo.txt
Now try the same search with -i
grep -i bar foo.txt
Notice that grep now prints a new line with the word "Bar" in it.
grep with the -r optiongrep, 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.
head
cat red_sox.txt
head red_sox.txt
head -1 red_sox.txt
tail
tail red_sox.txt
tail -2 red_sox.txt
sort
cat fruit.txt
sort on this file
sort fruit.txt
sort -r fruit.txt
cat numbers.txt
sort on this file without any options
sort numbers.txt
Since the numbers from 10 to 19 begin with a 1 they appear before 2
sort -n numbers.txt
sort -nr numbers.txt
Note 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
echo Step commands in scripts for the Class Exercise.
~tsoro/it244_test/ex05.shWhen the script asks if you are ready for more, hit Return or Enter.