Tutorials

Quick guide to basic commands for ubuntu and linux

Table of contents:

Anonim

After you have a good understanding of the Linux directory structure and our help tutorial on linux commands , it is time to introduce you the quick guide to basic commands for Ubuntu . In it we will venture with some of the most used system commands. At first, it may seem silly, since nowadays almost all operations can be performed in the graphical environment of the system and many distributions provide wizards even for server configuration.

Quick guide to basic commands for Ubuntu

In addition, after getting used to using the system by this means, you realize the agility that the keyboard offers, mainly, by knowing shortcut keys, variables and other tricks allowed by the terminal. As if that were not enough, learning to work well with the commands in text mode is to understand a little the gears of Linux and what goes behind the graphic wizards that facilitate some system tasks.

In this list are ten of the basic and useful commands used not only by novice users, but also by experienced users from the Linux world.

Please note that the intent of this article is not to fully explain the use of each of the commands, but rather to provide the means for beginners to get to know them.

man:

The man command should be at the top of the entire list of important Linux commands. The reason is very simple: just run it to load a man page about the system commands, with definitions not only of the use of each tool, but also detailed descriptions of the numerous software parameters and examples of use..

Reading the man pages is very easy and you just have to run man followed by the name of the command you want to get help from. Don't forget to press the Enter key after typing the command, otherwise it won't run.

By running man cp , for example, you can read all the instructions for using the cp command. And before moving on to the next item in the list, two tips are worth: the first is that there is the man man command, in case of doubts about the use of the man itself. The second is that it is possible to translate the content of the man pages into Spanish, in case they are in English, by installing manpages-es through the Ubuntu Software Center.

ls:

To list the existing files in some directory, just use the ls command. If run without parameters, the contents of the directory you are in will be displayed. But you can indicate a path for ls , like ls / usr / bin for example. It is also possible to use the ls command to see the size and creation date of each file or folder. To do this, use the -lh parameter, as in the following example: ls -lh .

And if you also want to list the hidden files, which start with a period, use the -a ( ls -lha ) option .

CD:

Copying a file from the terminal is also a simple matter. It uses the cp command followed by the source and destination file, which can be either a new folder or a new file with a different name.

Example: cp file1.txt file2.txt or cp file1.txt pastanova / . To copy an entire directory, don't forget to enter the -r parameter. If you want to clone a folder, use cp -r book1 book2 , for example.

We recommend reading the Ubuntu 16.04 LTS analysis.

mv: move files and folders

To move files, there is the mv command that can be used both to transfer files and to rename them. If you want to send the file from one folder to another, just follow the example mv folder1 / file1 folder2 / . If you prefer to just rename it, use mv file1 file2 .

more: read text files

In case you need to read the contents of a text file, use the more command followed by the path and file name, as in more /home/user/file.txt .

All the content of the file will be displayed in the terminal, filling the screen with text. To continue reading, press the space bar and, in case you need to go back one or more pages, use the "b" key. If you want to exit before the end of the file, press "q".

WE RECOMMEND YOUIntel HD Graphics: the integrated graphics of Intel processors

df: check disk space

Do you want to know what is the total space and how many available GB are in each system partition? Use the command df -h . The option -h, by the way, means "human-readable", that is, readable by humans. If you run the command without this option, the information is displayed in kilobytes and will need to be mentally converted to other units.

sudo: special permissions

For security reasons, Linux works with the permissions of the users. Therefore, certain commands or files are accessible only by the owner or the administrator user (root). So that you do not have to change users at all times, there is the sudo command, which temporarily guarantees root user credentials, using the information of a password.

To take the test, try running the command ls / root . You will receive a permission denied notice. Then run sudo ls / root . After informing the password of your own user (in the case of Ubuntu), the command is executed normally, and the files in the root folder are displayed in the terminal.

grep: text searches

Imagine the following scenario: You have a text file with about 200 names of students from a certain school, but you are not sure if the name of a specific student is listed.

The grep command helps you search for that student and do much more with the help of regular expressions.

It is enough to execute the grep command "Student Name" file.txt so that the terminal searches for the name that appears within the relation. In case you are not sure if the student's name was written respecting capital letters, add the -i parameter so that grep will ignore this distinction during the search.

clear: clear the buffer

Finally, a command that helps organize a bit of the confusion of letters found in the terminal after hours of use. To clear the entire buffer, run the clear command. Then you just have to use the terminal again normally, as if nothing had happened.

Keep in mind that there are many advantages to using console mode or a terminal emulator. Linux text mode offers more freedom for the user, who can abuse the parameters of each command, executing highly customized actions.

How about our quick guide to the best basic commands for Ubuntu? As always we recommend reading our tutorials and if you have any questions, you can contact us.

Tutorials

Editor's choice

Back to top button