Yesterday I attended the ITP Skills Workshop which took place in the computer lab room 6418. The workshop was led by Ph.D. student Kathryn Mercier. The goal of the workshop was to give general computer users a more in-dept understanding of how their operating system interacts with commands in a shell as opposed to a graphical user interface. Most users interact with their operating systems through GUI (graphical user interface), which is the outer most layer. Users may give commands through the interface by clicking, dragging, scrolling with their computer mouse, by pressing a combination of keys on their keyboard, typing in a search bar, and now by speaking directly to their OS. However, going through the workshop, I now have a better understanding of how to use my computer’s command line interface to accomplish the same goal. The command line interface is essentially a backdoor to tell your computer what to do without interacting directly with the objects you want to work with. You don’t have to click on a file to delete it. You don’t have to open a document to find out how many words it has.
Over the course of two hours, we worked through a 4-part exercise with a file we downloaded. We initially opened Terminal which is the command line interface for iOS, and we located ourselves in the directory using the command; [pwd]. [pwd] is a command which works with Unix operating systems which include iOS LinuX and Git. It unfortunately does not work with Windows so I had to complete my work on a borrowed Mac laptop computer. We then used commands such as [cd directory-name, cd .., cd~], all commands that help users change directory or get to the home directory. Once we are in the desired directory, we can use the command [ls] to list the files. We did a lot of work locating files using those commands using alternating methods such a writing the file path directly [ cd Desktop/Directory/filename].
Once we understood how to move around the directories, we created new directories and edited existing files using commands such as [mkdir directory-name]. We use text editor nano to write the file. Then we repeatedly used [ls] to list the updated directory to check if the file was created and saved. We used the command [mv] to rename files and move files from one directory to another and [cp] to copy the files.
We did a bit of text analysis using the [cat] [grep] commands and arguments such as [-w] for word [-l] for line [-n] for number [-i] for all cases, and [*] for a wildcard. We ended up writing lines such as
[Grep -w n “The” haiku.txt]. This command returns all lines containing the word “The” and the line number.
Or [ls p*.pdb] this command lists all .pdb files starting with the letter p.
We can do even more analysis by getting the word count for each file using the command [wc], which also returns the number of lines and number of characters as a dataframe. We can save that file separately. we can rearrange our numerical data by order of greatest to least using the [sort] command. Just like a dataframe, we can print the head of the tail by using [head][tail] command.
Overall, this workshop was a great resource to me. Although I had learned a similar concept when I completed The Introduction to GitHub assignment in DataCamp. I felt a lot more comfortable going through this exercise. Perhaps the prior knowledge gave me a boost. However, the in person instruction was helpful and will I be using my command line shell a lot more moving forward.
This is an example of what I did in my Windows ‘s command shell as a demo.