Basic Administration

De Wiki de Sistemas Operativos
Revisión del 16:52 2 nov 2021 de Pneira (discusión | contribuciones) (Página creada con «To perform this practice we will use one of the virtual machines that we generated in the previous practice. In this practice we will learn how to use the command interpre...»)
(dif) ← Revisión anterior | Revisión actual (dif) | Revisión siguiente → (dif)
Saltar a: navegación, buscar

To perform this practice we will use one of the virtual machines that we generated in the previous practice.

In this practice we will learn how to use the command interpreter (also known as command line) and to learn basic notions of Linux system administration.

Step 0: Brief introduction to the Linux system == Basic structure of the file system

Basic structure of the file system

In a Linux system, all folders and files in the file system hang from the root folder which is represented by the /.

/
├── bin.
├── usr
│ ├─── local.
│ ├─── bin
│ └── ...
├── dev.
│ ├─── sda
│ ├─── sda1
│ └── ...
├─── home.
│ ├─── practice.
│ │ ├─── topic1.pdf
│ │ ├─── bulletin1.pdf.
│ │ └── ...
│ ├─── professor.
│ └── ...
└─── etc.
    ├─── firefox
    ├─── libvirt
    ├── ...
    └── ...

As you can see, the file system employs a tree structure.

Basic notions

-Applications with compound names: use hyphen between words.

-Names with blank spaces: write between double quotes.

-Blank spaces to separate commands (e.g.: install several packages )

General format of a command: command [-options] [arguments] -'important''''

-IMPORTANT': Difference between uppercase and lowercase.

Folders . and .

Every folder on a Linux system has two pseudofolders, the ''''' and the '''''':

  • The pseudofolder ''''''' refers to the parent folder that contains this folder.
  • The pseudofolder '''''''' refers to the current folder, it is therefore a self-reference.

In the case of the root folder, the pseudofolder '.' and '''' refer to the root folder itself, it is therefore an exception.

Current working directory and the command cd

Each command interpreter has a current working directory ('c'urrent working 'directory). The current working folder can be modified with the command cd (change directory, in English).

For example:

$ cd ..

It would place us in the parent folder, using a relative path.

If we retype from /home " cd .. " takes us to /$

To place us in the root, we can use an absolute path:

$ cd /

In case we want to get back to the user folder, it would be enough to invoke cd' without further or ' cd ~

$ cd

'VERY IMPORTANT': cd.. is not the same as cd ... ', the space after the cd is required.

Absolute paths, relative paths

Absolute or relative paths are used to refer to a file or folder.

Absolute paths always start with /, so they take the root folder (/) as a reference point. For example, an absolute path to the test folder that is stored in the user's ubuntu' folder is '/home/ubuntu/test/.

The relative path takes the current working folder as reference. To find out the current working folder we have the command pwd'.

$ pwd
/home/ubuntu

Based on the current working folder, using the pseudofolder ''''''', relative paths can be constructed. For example, to reference a file 'file.txt in the temporary folder, we can use the relative path ../../tmp/file.txt'.

Although it is probably more convenient to use an absolute path in this case, which would be /tmp/file.txt'.

Command interpreter

The shell is a textual application launcher that uses the keyboard as an input device. Using the keyboard, you type the name of the program you want to launch and when you press the enter key, the shell executes the program. By default, the command interpreter used by Ubuntu is bash'.

man: see the man page of a command

The man' command will be useful for viewing man pages.

Its basic structure is:

man <command>

Although it is also used with the option '' -a ' of All, which also displays entries beginning with '''':

man -a <command>

This program takes as input the name of the command you want to query its man page, for example:

man ls

It gives us man page information for the ls' command.

To exit the manual page, press the q' key (the first letter of the word quit', in English).

quit = exit

Usually, programs offer help options, such as --help'.

man --help

The compact version can also be used when specifying