The Linux Terminal is a very powerful application and can be used to achieve just about anything.
I am going to run through some of the basic commands that you need to know, to get setup using Linux and on your way to becoming a command line master.
An important point to mention before we go any further with terminal commands is the use of ‘sudo’ or ‘root’ privileges. Sudo or root is required to run commands using elevated privileges.
The Terminal has a manual built into it with entries for all commands. This includes a description of what the command does and how it can be used.
The manual page can be accessed by typing ‘man <name of command>’. So, to see the manual page for ‘sudo’, we would type, ‘man sudo’.
For security reasons, it is important that your computer is regularly kept up to date with the latest updates. Now, we could do this through the Graphical User Interface (GUI) that can be accessed through ‘Ubuntu Software’, navigating across to the ‘Updates’ tab and installing all available updates. However, that is boring and slow.
Instead, let’s use the command ‘sudo apt-get update && sudo apt-get upgrade’. The ‘&&’ operator combines the two commands together and runs them one after the other. After running the command, the terminal will prompt for a password, and then require either a Y/N to confirm or deny the updates.
Updates have now been completed. Now, I need to see which folders are in the Home Directory. To do this, we need to type ‘dir’, followed by pressing the Enter key on the keyboard.
Folder and files are case sensitive in Linux, so if we are searching for something specific, we need to ensure it is spelt exactly the same or it will ignore it.
I want to create a file in the ‘Documents’ folder. This can be done by typing ‘CD Documents’.
Using the ‘CD Documents’ command has opened that directory, however, I’m not sure if the file that I’m looking for is saved here or not. To find this out, I’m going to need to list everything that is in the Documents folder. Type the command ‘ls’. Short for ‘list’, this will show whether the file I’m looking for is there or not.
I was looking for the Python file labelled ‘file.py’, it was saved in this folder after all.
Now that the file has been found, I can continue working on it. By using the command ‘vim file.py’, I can work on the file in the terminal.
To work on the file, press ‘I’ to put Vim into ‘insert’ mode, allowing changes to be made to the file. After making the changes to the document that needed to be made. Its time to save and exit. To exit Vim type, :wq!
This will save and quit Vim taking us back to the terminal window. Now that we have finished working in the terminal, type ‘exit’ to quit.