Objective
Through this chapter, I will teach you to be slight comfortable with Linux GUI and Terminal. I will cover basic command like ls, cp, mv, cd etc. show that you can draw parallel to GUI based action to command based action.
GNOME Desktop Environment(Linux)
Getting around in your GUI is very straight forward. You can click show apps to see installed apps. You get a lot of utilities while installing Ubuntu such as libre office, calculator etc. and if you need more apps, go to App Center and browse for apps. For example, if you require postman which is a tool for API testing and verification, you get the option to download it. You can choose to explore under different sections. Steam is also available for Ubuntu, if you are a gaming fan and the creator of Steam is Canonical, the company behind Ubuntu.
By clicking on the right top corner, you can get direct access to Wi-Fi, Bluetooth, screenshot etc. Click on settings to adjust your computer preference, for example, changing default apps.
The Terminal
While, GUI is good for regular desktop usage, the power of a Linux/Unix system comes from its terminal which offers extensive tools to take full advantage of the bare metal processors. To open a terminal in your Ubuntu System, you can either search for it or just type Ctrl+Alt+t ; which opens a gnome terminal in your system.
By default, you land into your home directory. You can verify that by running pwd command (type pwd in terminal and press enter). You can run ls command to list the directory. To change directory, you can use cd target_directory_name (eg. cd Documents). Whatever you type in the terminal is case sensitive, something to keep in mind. Additionally, you can use tab for auto completion, or tab tab for auto suggestion. Using cd as is, will always move you to your home directory.
Relative vs Absolute Path
Since we are just starting, I won’t burden you with the details of Linux file systems, but allow me to tell you just this much, everything starts from / (known as root directory). The output of pwd command is /home/alok, so in a way it is implying that inside root (/) there is home directory and inside home there is alok directory. If I do ls. I can see other directories like Downloads, Destop etc.
If I am present in my home directory (/home/alok) and I want to go to a subdirectory Desktop, I can do that in two ways:
- Using relative path: cd Desktop
- Using absolute path: cd /home/alok/Desktop
Once I am inside Desktop directory and I decided to move to Downloads directory, I can do that again in two ways:
- Using relative path: cd ../Downloads
- Using absolute path: cd /home/alok/Downloads
.. (Double dots) is a notation for parent directory while . (single dot) is the notation for current directory.
Absolute path should be easier to understand if you understand that every directory can be traced from the root.
To make sense of relative path you can try running ls ../.. and see what the output is.
If you feel lost, don’t forget to do pwd to check your current directory. You can get the same information in your prompt text if it set correctly.
Date with Who?
If you are in terminal and doesn’t have access to GUI (maybe because, you ssh into the machine or you are in multi-user.target), in order to keep track of the time, you can use date command. The output of the date command will be human readable date and time along with the time zone.
If you want to check the logged username, run whoami.
The output will be a simple print of username.
If you want to run something akin to Hello World program, then do
echo “Hello World” .
It’s a wrap
Alright then, in this blog I tried to make you familiar with your GNU/Linux laptop.
We started our long journey of Linux shell commands (what is shell? We shall know soon.)
Let me list the commands we have learned so far:
- pwd (Print the working direcory)
- ls (list the content of the working directory)
- cd (change to a directory )
- whoami (Prints the username)
- echo “Hello World” (Prints Hello World in the terminal)
In the next blog, I will go deeper into the known commands, and I will teach you how to get help and documentation, see you then.
Leave a Reply