Clearing the screen
The tput clear
terminal command can be used to clear the current command-line session. You could type tput clear
all the time, but wouldn't just cls
be nicer?
Here's a simple script that clears the current screen:
Chapter 4 - Script 1
#!/bin/sh # # 5/8/2017 # tput clear
Notice that this was so simple I didn't even bother to include a Usage
message or return code. Remember, to make this a command on your system do this:
cd $HOME/bin
- create/edit a file named
cls
- copy and paste the preceding code into this file
- save the file
- run
chmod 755 cls
You can now type cls
from any terminal (under that user) and your screen will clear. Try it.