Log in to users
- Run the ssh client
Use the values in the table below to connect to users.
ssh configuration parameter value protocol ssh ssh version 2 ssh port 22 host users.cs.umb.edu user name your Unix username Authentication method password
- Enter your password
A dialog box will appear on the screen into which you must type the password for your Unix account.
Directory for this Exercise
- Make sure you are in your home directory
cd- Go to your it244 directory
cd it244- Go to your ex directory
cd ex- Create an ex08 directory
mkdir ex08- Go to your ex08 directory
cd ex08file
- Return to your home directory
cd- Run file on the contents of your home directory
file *- Look at the files in my it244_files directory
file /home/ckelly/course_files/it244_files/*Pipes
- Make sure you are in your home directory
cd- Go to your ex08 directory
cd it244/ex/ex08- Make sure you are in your ex08 directory
pwd- Copy red_sox.txt to your home directory
cp /home/ckelly/course_files/it244_files/red_sox.txt .Make sure you include the dot, . , or you will get an error message.
- Make sure the copy operation worked
ls- Find all Red Sox wins
grep Win red_sox.txt- Find all Red Sox wins at home
grep Win red_sox.txt | grep vsHere, the first instance of grep is the source, and the second is a filter.
- Find all Red Sox wins at home, sorted in reverse order by date
grep Win red_sox.txt | grep vs | sort -nrThis is a pipeline, with three separate processes, one for each command.
date
- Show today's date
date- Use the formatting options of date to show today's date using the format YYYY-MM_DD
date +"%Y-%m-%d"which
- Find the executable file for the Python interpreter
which python- Find the executable file for tar
which tarwhereis
- Find files associated with python
whereis pythonNote that whereis reveals many more files.
- Find files associated with tar
whereis tarlocate
- Find all files with "foot" in their name
locate footwho
- Find out who else is logged in to users
who- Look at the details of your current session
who am ifinger
- Use finger to see who else is connected to your current host
finger- Use finger on your own Unix username
finger YOUR_UNIX_USERNAMEIn place of YOUR_UNIX_USERNAME, you must put your Unix username.
- Run finger on the first name "Chris"
finger ChrisFilename Extensions
- Create the text file foo.txt with a text editor
nano foo.txt- Add some text
Save and quit.
- Run cat on the file
cat foo.txtcat prints the file to the terminal.
- Change the extension of foo.txt
mv foo.txt foo.xyz- Open the renamed file with nano
nano foo.xyznano opens the file without difficulty.
nano does not care about the extension.
- Change some text in the renamed file
Save and quit.
- Run cat on the renamed file
cat foo.xyzcat does not care about the extension.The Hierarchical Filesystem
- Find your current location
pwdYou should be in the ex08 directory inside your ex directory of your it244 directory.
- Go up one level to your parent directory
cd .... means the directory one level up.
- Look at your current location
pwdYou have moved up one level.
- Go to the root directory
cd /- Look at your current location
pwdYou are at the top of the filesystem.
- Look at the directories inside the root directory
lsNotice that the home and courses directories are subdirectories of the root directory.
- Return to your home directory
cd- Look at your current location
pwdYour home directory is inside the directory named home, which is, itself, under the root directory, /.
- Return to the ex08 directory inside your it244/ex directory
cd it244/ex/ex08- Check you current location
pwdFilenames
- Run stat to get some information about the Linux host
stat -f /home- Run stat with grep to learn the largest filename possible
stat -f /home | grep Namelen- Create a file with spaces in the name
touch 'hello there'If you did not put "hello there" in quotes, you would create 2 files, hello and there.
- List the contents of your current directory
lsIt looks like you have created two files.
- Perform a long listing on your current directory
ls -lNow you can see that there is only one file.
- Remove the file you just created
rm 'hello there'- Make sure the file is gone
lsCase Sensitivity
- Create the file foo.txt
touch foo.txt- Look at the contents of the directory
ls- Create another foo.txt file
touch foo.txt- Look at the contents of the directory
lsYou only have one foo.txt file since you can only have one file with a given name in any one directory.
- Create the file Foo.txt
touch Foo.txt- List the files in your current directory
lsYou have two files since, as far as Unix is concerned, foo.txt and Foo.txt are totally different file names.
- Create some new files
touch fOO.txt FOO.txt FOO.TXT- List the contents of your current directory
lsYou should see the files you just created since they have different capitalizations.- Remove all .txt files from your ex08 directory
rm *.txtBash Script for this Exercise
- Go to your ex08 directory
cd ~/it244/ex/ex08- Make sure you are in you ex08 directory
pwd- Create the script ex08.sh
nano ex08.sh- Add the following line, and then skip two empty lines:
# Exercise 8, First Portion- Write into this file all the commands from the sections above
Copy all the commands from the sections file to finger.
Do not call nano inside your script.
- Skip two empty lines, add the following line, and then skip two more empty lines:
# Exercise 8, Second Portion- Write into this file commands from the indicated sections above
Copy all the commands from the sections The hierarchical filesystem to Case sensitivity Skip the section Filename extensions.
- Save this file
Save and quit.
- Test the script
bash ex08.shFix any errors you find.
If you have trouble, see me.