Hello there, welcome to this video! Let's see very quickly how to use
Linux starting from a very beginner level!
Make sure to visit our official YouTube channel and our website to get
extras, tutorials and new fresh tips completely free!
Linux is a common and free operative system that is chosen over Windows
and MacOS for server management (thanks to its deep stability against crashes)
and in general for its excellent security against viruses, being every
action always executed after a user approval. Linux is also Open Source,
from which several distributions have been derived including Ubuntu,
Fedora, Red Hat and more, chosen according to their performance, resource
distribution or your hardware age. In this video we will use Ubuntu
version 20.
To interact with Linux you can either use its graphic interface or the
most common Bash terminal, such as a textual interface where to type
several commands and use the Enter key to get them executed. You can also
open new terminals using CTRL+ALT+T, also using multiple ones at the same
time if you need.
All the commands are written on the command line, showing on the left the
Linux username logged in, at, and the computer identification. Then the
current directory path follows under a different color followed by a
sign, which is a dollar in case you are working as a user and as a hashtag
if you are working as a superuser (or root).
By default you are at your Home directory (or tilde), which is your
default personal directory. If you type 'pwd' and apply with the Enter key
you will get the full directory path you are on, showing the Home
directory.
To check the content of the current directory use 'ls'. All the
subdirectories are shown in a bold blue color whereas all files are shown
in white. These colors can change depending on the Linux version you use.
You can use 'ls -l' to get more information including file permissions, the
author name and group, the size in bytes and the last modification date.
This username and group name (here with the same name) are useful to
manage the permissions on each item, as shown on the extreme left.
The first character specifies if the current item is a directory (showing
a 'd') or a file (showing a minus sign). The following letters are read
taking groups of three characters: the first one sets the author
permissions; the second one the group permissions and the third one any
external user, outside the specified group. The granted permissions are
shown as 'r' for reading, 'w' for editing and 'x' for execution. In this
case the text.txt file can be read by anyone but it can be modified just
by the specified username or group name.
To change these permissions you can type 'chmod' followed by options and
file name interested. For example the 'u-x' option removes the execute 'x'
permission from the author user 'u'. Whereas with 'u+wx' you will add
editing and execute permissions to the author 'u'. You can also use 'g' or
'o' instead of 'u' to manage permissions for groups and external users
respectively. Consider that the chmod command works only in case you are
the original author of the file or the administrator. Other users can't
change permissions.
You can use 'cd' to enter into directories, specifying the directory name
(use the Tab key to auto-complete the name). You can also use 'cd ..' to
return to the previous level: the double dot sign always indicates the
upper level in the directory path. Whereas 'cd .' does not perform any
action, since the single dot represents the current directory path
you are on.
To create a new directory type 'mkdir' and the name of the new directory,
that will be completely empty. Whereas use 'touch' plus name to create a
new empty file. All these files are intended as textual files, which are
the most used ones on Linux. We won't see any other kinds of files in this
beginner tutorial.
By specifying the file or directory name after the command, you always
intend the current directory you are on. You can also type an entire
directory path to place or pick any item placed in such subdirectory. This
works with the 'touch', 'mkdir' commands and for any other we will see.
Use 'mv' to move files into any folder or directory path, without changing
its content. Type the file name and the destination path, using './' or no
characters to start from the current directory. In this case the new file
is no more present in the current folder but inside the Sub folder.
You can also specify a new name after the destination path to rename the
file as you move it.
Whereas use 'cp' to make copies of any file, typing the file name and its
destination path. In respect to 'mv' this keeps the original file as well.
To copy an entire folder with all its content inside use 'cp -r'. For
example 'cp -r Green White' copies the Green folder and its content into
the White folder, keeping the original Green folder where it is.
To remove any file use 'rm' with the file name. This won't work on a
directory, since this has other items inside. To remove a directory you
have to type 'rm -r'. Pay attention that the removal is permanent.
With 'cat' you can get a quick preview of any file content, without opening
it in a new window. Whereas send 'history' to get the full list of all
the commands executed so far, in order. Use 'clear' to clear the whole
terminal instead.
To execute any file (for example this .sh Bash script) type its name and
use the Enter key. These scripts group several commands in a unique file:
we won't see these in this video.
On Linux you can also make shortcuts, very useful if you don't want to
specify the full directory path of the file everytime. If you use 'ln -s'
with the full path of the file you create a symbolic link in a blue color.
With this link you can read, edit and run the file by typing its symbolic
name instead of its whole path.
To look for any file simply type 'find' and the keyword to search, followed
by an asterisk. This special character is often used to include any kind
of character after the ones you have specified.
Now let's see how to edit files. To open and edit these you can either use
the graphic interface or directly the Bash terminal with the most common
'vi' command. When sending 'vi' and the file name, the terminal shows its
entire textual content, indicating all the empty lines with tilde
characters.
To start editing use the I key to enter into INSERT mode, typing and
interacting with the text content, moving with your Up and Down arrow keys.
Use the Escape key to come back to the COMMAND mode, in order to interact
with text with several keyboard commands. For example you can use 'yy' to
copy the entire current line and, if you place your cursor on another line
and use 'p', you also paste the entire line that you have copied. Use the
U key to undo if you need.
You can also type '/' plus any keyword to search through the document,
starting from the beginning. Use '?' to search from the end of it.
To save, use ':w'. To exit from the file type ':q'.
Now let's see how to check your current status on Linux. The 'df' command
shows the current status of all your disks, such as Used & Available kBs
and used percentage. Use 'df -h' to check all in an easier way.
Whereas 'ps aux' shows all the applications in progress, launched by the
users and the superuser (root).
In addition, you can easily install and update your system from trustful
resources with the aptitude tool. By default this is not installed yet,
so you will have to run 'apt-get install', followed by 'aptitude'. All
installations and upgrades on Linux can be performed by the root user only,
so you may need to log in as administrator by using the 'sudo' command,
followed by its password.
Once the aptitude tool is installed you can simply use 'sudo aptitude
upgrade' to upgrade your existing packages and 'aptitude install' to
install new ones, typing the package name. If you receive prompts, use 'y'
to apply and 'n' to deny.
Whereas use 'aptitude search' with keywords to search through the full list
of Linux packages, showing an i letter in case the package is installed
already.
This is all you need to start with Linux! Remember to launch 'man' plus
any command name to get tips on all the possible operations you can make
with such command, using 'u' to exit. Alternatively you can use the command
name followed by '--help'.
Thank you for watching this video! Please leave any comment or feedback to
improve our next tutorials dedicated to Linux!