Using the command line
How to work with your computer via the command line
The most direct way to interact with a computer is via the “command line”. This is a simple text interface, but it can be used to powerful effect as there is no overhead of system resources (or programming work!) in generating a graphical user interface (GUI). You can also work quickly by keeping your fingers on the keyboard and avoiding reaching for the mouse! 🐭
Using the command line requires you to pay close attention to spacing and case (upper or lower) of text commands, as these modify the effect of the commands you type. There is no spell check in command line! If you type something wrong, insert or remove a space where there shouldn’t be, or put an uppercase letter where there should be a lower case one, the command won’t work. This can make the command line feel pretty unforgiving, but you’ll get used to it 😊. Most commands will have associated “help” files and there is always lots of examples and documentation on the internet.
We will be using the command line to install some programs, and communicate with our online repository which holds our documentation.
How to access your command online
We will be using a unix based command line, as this is consistently available across unix/linux systems (for example high performance computing clusters), Mac OS and Windows OS.
Mac users
On a Mac the program to access your command line is called “Terminal”. Access your terminal via the applications launcher, or press command (⌘) and space and start typing “terminal”.
Windows users
From Windows 10 onwards you can access a unix command line using the application “Powershell”. Search for Powershell in the applications directory from the start button.
Basic command line tutorial
Launch your command line application and have a go at completing Unix Tutorial 1 from the University of Surrey. Tutorial 2 (up to rmdir) will also be helpful for what we’re aiming to achieve.
After you have completed these tutorials, you should be able to do this via command line:
- Navigate to a directory;
- List the contents of that directory;
- Make a new folder called “test”;
- Go into the “test” folder and print the full path of that folder;
- Delete the “test” folder.
This will be 90% of what you need to make your documentation!