1.1 Some New Commands

I didn’t go too in depth with this as you probably won’t be touching the command line anytime soon after week 1 (i.e., you’ll have your hands full with Python pretty soon)!

However, I still did introduce a few new commands that I think may come in handy if you ever have a need for the Linux command line in the future!

These are:

  1. echo

    If you have served your two years of National Service, you may have sang a verse that went something like this during a road march (apologies if I got any of this wrong - I didn’t march during my two years):

    Sergeant: “Echo after me lah!”

    Everybody else: “Echo after you lah!”

    (verses begin)

    – Every sergeant and his platoon (?)

    And this - in essence - is what echo does. It essentially repeats everything that comes after the echo. For instance, echo My name is Kevin would display My name is Kevin to the command line!

  2. sudo

    “sudo” is actually an acronym that stands for super user do. A super user is a computer user who has a wide range of capabilities (e.g., accessing system files, changing other users’ login credentials, assigning root privileges to other users, etc).

    The sudo command is used as a prefix of some command; it is used to run commands with root privileges. For instance - sudo gem install rails tells RubyGems (i.e., Ruby’s package manager) to install the rails gem off the rubygems repository. Here, I am using sudo as root privileges are required to install gems (i.e., packages) using gem install!

  3. mv

    mv is short for move. As its name suggests, mv is used to move files and directories from one location to another. One can do so as such: mv <file name here> <new location here>.

    Yet, mv can also be used to re-name items. To do so, one can do something along the lines of mv <old name here> <new name here> on the command line!

  4. help

    Unsurprisingly, Linux’s command line has a help function in case you ever forget what a command does. I forget stuff all the time, but if there’s one thing that I would recommend you to remember, it’s this command!

    To view the help files for a command, type help <command name here> on the command line.

  5. >

    This is called the redirection operator. It directs the output from the command on the left to the command on the right.

    If you remember, I typed something like echo Nothing > breakfast.txt during the tutorials. What was I doing?

    I first echoed “Nothing” (because I skept breakfast) and using the redirection operator, sent “Nothing” to a file called breakfast.txt. When you use >, your machine (or Colab rather) will create a new breakfast.txt if there isn’t already one. Otherwise, the previous breakfast.txt will be over-written!