Skip to content

the five terminal commands that every Ubuntu user should know

27 mayo, 2021

We return to our family of basic Linux step-by-step tutorials, where we have been trying to teach users who want to get started in GNU / Linux, and more specifically in Ubuntu For being one of the most popular and simple distros, some essential tricks such as installing Ubuntu together with Windows update the Kernel.

One of the biggest advantages that I see for GNU / Linux over other operating systems is its terminal. At first it can be intimidating, but it is a good tool to easily perform certain operations without having to navigate through the menus of the graphical interface. To learn how to take our first steps through it, today we are going to explain what they are the five essential commands for the terminal that every Ubuntu user should know.

Linus Torvalds wishes there was a single standardized desktop for all Linux distros

10 MOST DANGEROUS COMMANDS for Windows, Mac, Linux

Sudo, essential for advanced actions

Sudo

Sweat comes from super user do or the super user does, and is possibly the most important command from the list, since it is with which we will have to accompany all those other commands with which we want to do any kind of sensible change in the systemFrom managing packages to editing files.

Due to the security of Linux we will not be able to make these changes unless we are super users or administrators, so the first time we compose a command that contains it we will have to write our password administrator. Here is a list of command examples in which we will need to put the term sudo:

  • sudo apt-get update – Resynchronize the sources of the packages.
  • sudo edit /usr/share/applications/aplicacion.formato – Edit the application application.format.
  • All the rest of the actions that we can perform with this command are listed by Canonical itself on this page of the Ubuntu manuals.

Apt-Get, for package management

Apt, which stands for Advanced Packaging Tool, is another of the essential commands that we will face when using the Ubuntu terminal. Both go hand in hand, so regardless of how much or how little you use the distro’s graphical interface, sooner or later you will end up having to use it.

In Ubuntu 16.04 Canonical has wanted to simplify the command by reducing it to apt, although at the moment apt-get also still works. This is the command you are going to use to install applications with the terminal, remove them, update your operating system and perform different actions with the packages. Here are some example commands:

  • sudo apt install appname – Install application.
  • sudo apt-get remove appname – Delete application.
  • sudo apt-get update – Resynchronize the sources of the packages.
  • sudo apt-get upgrade – Update installed applications and packages to their latest version.
  • On this page of the Ubuntu manuals you have the complete list of all commands which you can use with apt-get.

cd, navigating between our folders

CD

If we want to perform different actions using our Ubuntu terminal, such as installing an application or editing a file that we have hosted in a specific folder, it will be basic and essential that we know how to use the command cd or change directory in order to navigate between the directories of our system.

Its use is very similar to what was done with the same command in Microsoft’s MSDOS operating system a few decades ago. Of course, we have to bear in mind that when we are going to start using it the system will interpret that our starting point is the Hom foldere, so we will have to start navigating from there. Here are some examples of its use:

  • cd Downloads – Access the Downloads folder when we start from Home.
  • cd ..: Goes back to the previous directory.
  • cd / home / user / Downloads – Access the Downloads folder from any other directory.
  • CD – Go back to the Home folder.
  • cd / – We go straight to the root of the system.
  • As always, the rest of the commands with which we can conjugate cd are explained to us by Canonical in a section of the Ubuntu manuals.

Cat, looking in the files safely

Whether we end up trusting an executable program or if we don’t want to waste time opening a text document to read it, from the terminal we have the option to show us the content of each file without having to execute anything else. All we have to do is use the command cat.

  • cat document.txt – To view the content of the file in the terminal.
  • cat -n document.txt – To see the same file, but showing a certain number of lines on the screen.
  • You can see some more examples of the different possible combinations at this link.

ls, listing files and folders

Ls

If we are looking for a certain file in a folder through the terminal it is quite important to first know if it is where we are looking for it. And that’s precisely where the ls oo list command comes into play, with which a list with the directories and files will be shown of the folder in which we are. Here are some examples:

  • ls – List the folders and files within the directory you are in.
  • ls -a – Includes hidden files and directories.
  • ls -l – Shows all the information about each file.
  • ls -R – Includes the subdirectories of each directory listed.
  • You can combine the three terms with ls -laR.
  • There are several other combinations that can be made with the command ls, and are listed in this document.

Mark Shuttleworth believes that without fragmentation Linux could have succeeded on the desktop, but then it would not be Linux

Other essential commands to keep in mind

Clear

These have been the five commands that we have considered most essential for any new user who wants to enter the world of the Ubuntu terminal, but they are not the only ones that we will have to take into account if we want to have a basic domain. Therefore, we will end the article with a small list of other quite important commands.

  • touch file.txt: Touch create an empty file. In the example you will create one with the name file.txt or update the modification time of the one with the same name.
  • mkdir Torrents: mkdir create a new directory, such as a directory Torrents.
  • cp /home/archivo.txt /home/Documentos/archivo.txt: cp copy a specific file and paste it into another directory of your choice.
  • mv /home/file.txt /home/Documents/file.txt: mv moves a specific file and takes it to a directory of our choice, eliminating it from where we had it before.
  • rm /home/file.txt: rm delete the file we want.
  • clear: Cleans the terminal by deleting all the text that has been written so far.
  • pwd: Displays the current directory we are in.
  • history: Shows the history of all the commands you have used.
  • df: Shows the free space on the hard disk.
  • top: Shows the processes that are consuming the most CPU in real time.

As always, we appreciate that you use the comments to share your knowledge in this article, and that you suggest more commands for the Ubuntu terminal that you think we should have included. We also accept your suggestions for upcoming Linux installments step by step.