Tests Call the API as a User Would

Our test will deal with the entire Mastery API. This whole book has been building up to this point. This test will not exercise our code as an interior function might, rather, it will test the whole…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Talking to your computer.

Everyone uses a computer. There were over 1.5 billion computers estimated to be in use in 2015, and we can definitely believe that number has risen 5 years later. However not many people interact with their computers to their full capabilities. Most of us really just use what is called the front end in the development world. Theres however a very powerful tool called command line that allows us to access the most powerful part of the computer; the terminal.

This is an example of what you see when you open the command line prompt using the mac OS. This called a shell, and it acts as a translator between us and the computer through the use of command prompts. Computers have their own language and if we tried to just speak one the way we communicate with each other we would get a lot of error messages.

Luckily though through the use of shells or other similar applications we have ways to talk to our computers in the terminal. The inputs that we give the shells range from simple and pretty self explanatory commands to more complex ones.

Here I run a few simple commands into my terminal and i’m able to have the computer tell me who i am, where am i in relation to the computer, make a new directory, and name it at the same time. Let’s run through it step by step.

The “Mansoors-Macbook-Air: ~cheyo$” signifies the name of the machine which in this case of course is my laptop, and the cheyo is the name of the current user.

The whoami command has the computer tell me which user I am.

Running the pwd command shows me which directory I’m currently working in.

These are just simple commands but as you explore working with your terminal you'll find you can do some cool things. Tired of your computer dimming the display or falling asleep? Instead of trying to navigate through your screen or battery performance settings; just type in the caffeinate command in your terminal. We can even get more specific and enter the number of seconds we want to have our mac juiced up on imaginary coffee by typing caffeinate -t 35000 (That’ll set it to 35000 seconds).

Let’s move on to less local commands. We can test our computer's connectivity to the internet by pinging a website and seeing the responses. Typing in the ping command followed by a website will show if your computer is connected with it and how long it takes to connect like shown below.

Lastly, we can see all the commands entered in our terminal provided it hasn't been wiped. This is great in case you made a mistake and need to backtrack or just want to see the progress you've made. Enter the history command to see everything or use history -c to clear all your entries.

Don’t be afraid of messing around with your terminal as it opens up a whole new level of access for you. Its not just something reserved for professional programmers or developers but for anyone willing to explore and learn the device they so regularly use.

Add a comment

Related posts:

Parameterized Types

Our industry is moving toward functional programming, but your object-oriented experience is still valuable. Scala combines the power of OO and functional programming, and Pragmatic Scala shows you how to work effectively with both. Updated to Scala 2.11, with in-depth coverage of new features such as Akka actors, parallel colle

Top 17 Corporate Wellness Programs and Companies for 2022

Throughout the past year WellSteps has been involved in the wellness vendor selection process in work sites in every state. We’ve kept track of the companies that provide comprehensive wellness…

The Gift of Space Without Isolation

There is no shortage of articles and opinions written about how the months of quarantine have left us all feeling. And now, as many of us move back into the world, there’s a whole new slew of…