Giving the Command Line Interface Some Inner Grace

Sean
Geek Culture
Published in
5 min readJul 1, 2021

--

As a new software engineering student the command line is one of the first tools you reluctantly learn to love. It can be a daunting task to get up and running with what looks to be no more than alphabet soup and a blinking underscore waiting for you to break something.

In an age where graphical user interfaces(GUI’s) have taken over the traditional interfaces, it seems counterintuitive to type commands when you can just mouse over and click something... So why do we use it?

For developers looking for more control over the program files they work on terminal access is a necessity.

Once you get past the daunting starkness of the tool you begin to use it for speed and efficiency while manipulating large nested pieces of data, whether that be files, folders, programs, etc.

So with our goal being to get a better handle on using the CLI I thought it appropriate to start with customizing your command prompt.

Tip 1: Customization

Lets start with customization. Any would be hacker in Hollywood movies always seem to have some black background with green text to convey how l33t their skills are, right? Okay lets jump into our terminal and see how we can do this in about 30 seconds.

To open your terminal:
Windows:
- Windows + r will open the run box and from there just type in “cmd”

Mac:
- Command(⌘) + space opens spotlight and then just type in “terminal”

After opening your terminal you’re going to need to access your properties. This part of the tutorial is actually easier if done using the mouse. So to get started hover up to the CLI’s top tool bar and right click to open a drop down menu and then navigate into the “Properties” settings. From there you will navigate to the “Colors” tab. It should look something like the below:

In here we have some fun customizable features that we can experiment with, but for the sake of this topic we’re going to try and mimic the iconic “Matrix” setup. There are 2 ways to do this, so first we’ll try the manual way below:

  1. First toggle the radio button to Screen Background and set color to black.
  2. Second toggle the radio button to Screen Text and set it to green.

Now when we exit, it should update and refresh. You can try typing out some commands and seeing for yourself or changing some of the colors to your liking.

Sweet, but not quite the prototypical green falling alien language made famous in the movies. Here’s a quick trick using a package that will get us the desired result.

In your terminal type the following commands:

sudo apt-get install cmatrix

cmatrix

So next time you’re in a coffee shop and want to act like you’re “hacking the mainframe” you can throw this on your background and nonchalantly walk away to take a call.

Tip 2: Quick Keys

Now that we have the customization part of our terminal down lets move onto some useful bits of terminal lingo that will help us achieve a quicker and more powerful workflow.

Assuming we know the traditional commands as listed below

cd — change directory
dir/ls — list directory
pwd — print working directory
mkdir — make directory
rm — remove
mv — move or copy when followed by new filename

To add onto this base of knowledge we can add some hotkeys that are built into the working terminal. All the function keys at the top of the keyboard have utility. From F1 to F9:

  • F1: Tap or hold this key to retype your last command letter by letter.
  • F2: Copies the current command up to a specified character.
  • F3: Retypes the entire previous line
  • F4: Auto-deletes the current command up to a specified character.
  • F5: Similar to F3, but lets you cycle through previous commands.
  • F6: Enters the EOF indicator into CMD.
  • F7: Opens a list of previously entered commands.
  • F8: Similar to F5, but doesn’t stop at the end of your command history in the session. Instead, it goes all the way to the start.
  • F9: Enters a previous command by entering a number associated with that line

Using the up and down arrows can help cycle through your commands as well but these give more specific instruction based on the task you’re trying to accomplish.

Tip 3: Bonus Content

Find out your friends wi-fi password from their terminal:
*Requires admin access
1. Pop this into the command line

netsh wlan show profile

2. Take the user profile aka the wi-fi network name and rerun this command with the {Wifi} replaced with the network name:

netsh wlan show profile {Wifi} key=clear

Final tricks

Ascii Art RPG in The Windows Command Prompt
If you’d like a dose of nostalgia you can play an all ascii art role playing game called “New Worlds Ateraan”. This is done over telnet which from my understanding is an older protocol to link strictly text communication over the network. See for yourself, type this in the command line:

telnet ateraan.com 4002

Note: You need to turn on telnet connection access

Mac Programmers Never Sleep

Does your screen dim or screensaver go on without warning?

Try typing:

caffeinate

This will keep your screens brighter for a set period of time:

Add “-t xx” to specify a time for the wakefulness, “xx” being how long in seconds. So if you wanted an hour of wakefulness for example, you’d type “caffeinate -t 3600”.

I hope you’ve enjoyed the tips. Sit back and smell the coffee. Happy coding!

--

--