We will use LINUX on the TS111 lab systems. The purpose of this lab is to become familiar with the basics of the UNIX shell.
The basics of how to access LINUX are described here.
Note: The "*"
means copy every file in the tdrive/erodd/files304
directory.
dfcommand. This shows the currently mounted filesystems. Which filesystem has all the space? Is your current directory on this filesystem?
cat xxxx 2> seiiiWhat do you see? How large is "seiii"? What is in "seiii"?
echo my datato see that echo simply writes to standard out. Use redirection of standard out
echo my data > fiiito create a file named fiii. Now use the "ls" command to make sure you created the file. Now erase this file with
rm fiii
grep A ss*This will show all lines in files starting with "ss" which have the string "A" in them.
grep -r string * # Search all files in the current directory, and
# all its subdirectories (-4) for "string"
grep -l string * # Search all files in the current directory for "string",
# but display just the filenames, not the lines
# containing the string.
grep "This Day" * # Notice the quotes. If a search string has blanks, or
# other special characters, it must be enclosed in ""
find. It was
designed when the ls command did not have an option to recurse
subdirectories. Still, find has useful function like finding files
with a modification date less (or more) than so many days old.
Also, find can execute a command against each file found.
Try the command: find /usr/local -name "sw*"which will display all files in the /usr/local directory and its subdirectories which start with the letter "sw".
find / -name "somefile"Two warnings:
find / -name "somefile" 2> /dev/null
sort < /tmp/abcwill put the sorted output to the console (STDOUT). To put the sorted output to a file, redirect the output. For example:
sort < /tmp/abc > /tmp/sortedfile
ls -l /usr/binNow use the more command:
ls -l /usr/bin | moreLINUX has a more powerful processor called
less
ls -l /usr/bin | lessThe
less command accepts normal vi
editor commands including PgUp and PgDn keys and the search
command (/string). To quit, type :q and press ENTER.
env
echo $PATHNote: In Windows, display an environment variable with:
echo %PATH%
your-name=valueNote that there CANNOT be blanks around the '=' sign!!
Now display your variable:
echo $your-name
Nothing. There is no grade on this lab. You will, however, be responsible to understand this lab on quizzes and exams.