Log in to pe15
- Run the ssh client
Use the values in the table below to connect to pe15.
ssh configuration parameter value protocol ssh ssh version 2 ssh port 22 host pe15.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
(When you are ready for me to check this exercise, please scroll back up to where you entered these commands!)
- Go to your ex directory
cd ~/it244/ex- Create an ex20 directory
mkdir ex20- Go to your ex20 directory
cd ex20Start Up a script Session
Execute the script command, using the --flush option
script --flushThe history mechanism
- Run history
historyThe list you see here is every one of your last 500 command lines.
- Display your last 10 command lines
history 10When you give history a numeric argument, it lists only that number of commands.
- Execute again some previous command using the event number
!EVENT_NUMBERwhere EVENT_NUMBER is a number you obtained from the history command.
Notice that the old command line appears first, and then the output that the command line produced.
- Execute again some previous command using the first letter of that command line
!hLook at the Values of the history Variables
- Display HISTFILE
echo $HISTFILEThis is the file that contains your history record.
- Examine the most recent contents of your history file
tail $HISTFILE- Display HISTFILESIZE
echo $HISTFILESIZEThis is the maximum number of command lines the history mechanism will record in ~/.bash_file when you quit
- Count the number of lines in your history file
wc -l $HISTFILEThe wc (word count) command with the -l option counts the number of lines in the file given to it as an argument.
The number this command returns should be less than our equal to the value of HISTFILE.
- Display HISTFILESIZE
echo $HISTSIZEThe value of this variable sets the maximum number of command lines saved by the history mechanism between individual terminal sessions.Exit Your script Session
Use the exit command
exitYou should see a confirmation message confirming that the script is finished, resulting in a file called typescriptfc
- Go to my home directory and execute pwd on the same line
cd ~ckelly ; pwd- Run fc
fcThe command line you just entered appears in an editing window.
- Edit the command line
Make it read like this:cd ~; pwd- Save changes and quit
Save these changes (Control O) and quit (control X), using the key combinations you see at the bottom of the editing window.
The command line you just edited should appear first, followed by the output of the edited command.
The edited command line has taken you to your home directory.
- Look at your last 16 command lines
fc -l- Edit some command line using its event number
fc EVENT_NUMBERMake some changes save and quit.
- Edit the last call to history
fc hChange the command to readhistory 5- Save these changes and quit
The edited command will now run.Checking Your Work
- Tell the instructor you have finished making changes to .bash_profile
There is no Bash script for this Class Exercise.