Today:
An alias is a way to make your own simple-to-use, personal (or shared) launchers for software. In essence, it is a way to make a short script to make something easier or automated.
Let’s start by creating an alias in bash in our own computer’s terminal that will make it easier to log into the server. This will also work exactly the same in the Macintosh terminal (the newer Macs actually use Zsh instead of Bash, but it works the same. No need to make a change).
alias socialsoftware='ssh <username>@147.182.164.95'
Make sure to replace
This alias sets the word socialsoftware to run the ssh (secure shell) command and send in your username to connect to the server at the specified address. When it connects, it will prompt you to enter your password.
You can use this socialsoftware
shortcut in the future to avoid having to type the full username and address each time.
On our server in addition to Bash I have added Fish. They both end in “sh” which indicates the “Shell,” another name for the command line interface on our computer.
Brian Fox built the foundations of Bash shell released in 1989. Fish is a more recent shell that adds in some nice-to-have defaults, such as syntax highlighting, autocomplete, search suggestions and additional helper features.
We can also make shortcut functions in addition to aliases. We can think of these as mini scripts that run when we type in their name.
function weather
ansiweather -l "Purchase,USA" -H true -u imperial -s true -i true
echo "for full forecast, run: forecast"
end
This will run the ansiweather program and specify some options, such as the location of Purchase, use of fahrenheit (“imperial”), use of unicode symbols for rain/sun/clouds, and to display the UV index for the day. In the future, you only have to run weather
instead of typing in that whole line ansiweather command.
For today’s main studio project, we broke into 4 self-selecting teams to build small scripts for our server or to work on the website:
Using all we’ve learned so far, as well as additional know-how and research online, students will collaboratively work in groups on social software and documentation for our server. We’ll be building on some of the principles of Linux’s design goals favoring small, modular tools.
Tetris on our server uses non-standard keys, doesn’t show a preview shape by default, and to correct this needs to launch arcane commands. This team will research the manual pages, do user testing, and build a function to launch tetris with simple, easy-to-use defaults.
ACCOMPLISHED. Run tetris
to get the new easy to launch version and compete for best score.
You can also try tetrisRighty
for an alternate key system.
Botany is a shared gardening game on the server, but it’s not clear what to do, or how to interact. This team will read the manual, read the source code, the built-in help, and the GitHub project repo to learn how the program works, then develop their own simple tutorial or documentation.
ACCOMPLISHED. This team created a text file on the server with a short text introduction and researched information. Then they created a function that prints out this text via the program cat. Run it by typing botanyhelp
.
This team’s goal was to design a simpler system to be able to tell if someone had a profile on finger, and as a bonus, to display the profile.
ACCOMPLISHED. This team built a text user interface-based software with several linux tools and programs that they fit together through pipes.
In Linux, a pipe is a special way to send the output of one program to the input of a another.
For example, we can pipe the output of the cowsay program (a fun program to display text spoken by a cow or another ascii image) into the input of the lolcat program. lolcat is a fun program that is similar to cat (prints out text in a file) but lolcat adds in a rainbow of colors.
The pipe command is this |
, right above the Enter key.
The output of the program on the left will be “piped” into the input of the program on the right.
For example, try running cowsay -f dragon-and-cow "😁" | lolcat
on the server to see cowsay`s dragon-and-cow ascii art image saying the smiley emoji piped into the lolcat program so it can be colored like a rainbow. Note: you’ll need to try this fullscreen to see the image properly.
This team’s goal was to:
finger
program.This team started by writing a bash script to search through in a loop all of the user home folders for either of those files. If the file existed, it prints out the username.
Lee had this team research the program fzf, which is a way to make text menu systems.
The team used their program that searched home folders for .plan and .project files, outputed a list of usernames with those files, then piped that output into fzf. Finally, using fzf, a user can select one username, and that name will be run by finger to display someone’s status.
When this big challenge was accomplished, we met as a class to decide what to call our new program. There was widespread discussion but no consensus. Example names for the program included thumb, bigtoe, fu, and many others.
Lee added thumb
to the server for everyone to use but then we did a mini activity where everyone could write their own alias or function to create an alternate name if they preferred.
This supergroup was challenged to build a landing page for the class website, as well as a link to every user’s homepage.
ACCOMPLISHED. This team worked primarily with HTML and CSS to build a truly eye-opening site for socialsoftware.
Complete your website with landing page, blog (themed!), and now page. Your site should be located at:
https://students.purchase.edu/firstname.lastname
It must link to your blog with blog entries and your now page, or the now page content should be located on your landing page.