Terminal is a very powerful tool that is designed to allow you to issue what are known as commands to your computer.Now, the idea is that the computer will obey these commands, we hope, and make stuff happen as a result.Now, in this article, we are going to learn how to issue your first basic beginners commands, which is very exciting.
Following are the basic beginner commands of Ubuntu
1. 'echo' displays the output
Let’s run a fun command called Echo.Now the Echo Command just prints out what you give it as an input. Ok, then press space and we’re going to type the word hello.Now, when I press ENTER, I’m going to say to the computer, actually run this command.And when I press enter, we say hello, come out of the computer.
That’s pretty cool.
2. 'cal' command displays current month calendar
Let’s try with another command called cal which is going to show up a calendar on the screen.So if we type cal just like that and press ENTER, you can see that we get a calendar for the current months, for the current month with the with today’s date also highlighted.
That’s awesome and we are going to extend this command with more option
2.1 'cal' command shows full year calendar
That’s just the default behaviour of the command.Now what makes Linux commands interesting is how you don’t have to stick with the default behaviour. You can actually customize the behavior of commands to exactly what you want them to do.So, for example, what if I wanted the calendar not just for the current month, but for the current year?
But what I could do, first of all, I could type cal then 2021 and I can press enter and it’s going to give me the entire calendar for 2021.And also it’s going to highlight the current date.
Following command can also be used to display the current year
3. 'date' command displays today's date and time
Ok,Let’s move on and take a look at another one.For example, you can see today’s date using the date command.So if we type date and press enter, we see that we get today’s date and time and time zone and year pop up.
Hurray, that’s sound pretty cool.
4. 'clear' command clears the text from the terminal
It’s quite a useful command, but at the moment you can see that we’ve got quite a lot of text in our terminal.Things are starting to get a bit messy.
We can clean that up a bit as well.So to do that, we can use the clear command if we type clear and press enter.It’s like we just cleaned up our workspace .We’ve removed all the text from the screen now because the clear command is used so often to clear the text visible on the terminal screen.
There’s a keyboard, shortcut for it, which is very fast process. You can use Control + L
5. 'history' command displays the previous run commands
So what if you wanted to enter a command that you’ve entered previously without having to type it out again? Maybe it was a particularly long command. We don’t know. We can look at the each commands using the command ‘history’
Alternatively, what you can do is you can hit the ‘up’ arrow key on your keyboard. So if I press the up key, Ok, we see previously executed command.
If I press up again, it’s going to two steps previous, so you can keep pressing up and cycling backwards through the commands that you’ve already run and you can come forward using the ‘down’ arrow key and keep pressing the ‘down’ arrow key will bring you to the last executed command and to the terminal
But you can also look at your whole command history using what’s called the history command.
You can also use the following command to directly execute the particular command in the history. Instead of going back to the previous executed command we can directly write the exclamation mark and press six and then press enter, it will execute the command numbered at 6 in history
‘exclamation mark twice’ ‘!!’ will execute the previously executed command
‘history -c’ will clear the history and remove all the commands history
6. 'exit' command will close the terminal
Now, finally, let’s say we want to close the terminal. OK, well, to do that, we could, of course, click the button ‘x’ at the top right over here. But you can also another way to close the terminal type the exit command and press enter we can see that the terminal has now closed.
And also you could, of course, use the Control d keyboard shortcuts if I press control and we can see that the terminal is also closed as well
That’s all the very basic beginner commands on Ubuntu Linux and I have many more pro commands, So in the next articles, I’m going to show you how commands are structured in Linux and what we’re going to cover next will serve as a critical foundation for pretty much everything that we’re going to learn. Ok folks, see you in next articles