Linux Administration 2021/2022
Linux Administration 2021/2022
Linux Administration 2021/2022
TP1
Linux administration
2021/2022
2. Ubuntu definition :
is a Debian-based GNU / Linux operating system. It is developed, marketed and
maintained for personal computers (desktop), servers (Server) and connected
objects (Core) by the company Canonical.
Ubuntu is available in two versions, one which changes every six months, and
an LTS version, for Long Term Support, which changes every two years. Ubuntu
defines itself as “an operating system used by millions of PCs around the
world” 6 and with a “simple, intuitive, and secure” interface. It is the most used
distribution to access websites according to the Alexa site, and the most used
operating system for computer servers .
3 .Execution of command :
- Login command
Login is used when signing onto a system. It can also be used to switch from
one user to another at any time
Syntax :
- Cal command
cal command is a calendar command in Linux which is used to see the calendar
of a specific month or a whole year.
Syntax :
- Passwd command :
- Whoami Command :
As its name suggests, the whoami command prints the user name of the
effective user ID. In other words, it displays the name of the currently logged-in
user.
Syntax :
- Users command :
users command in Linux system is used to show the user names of users
currently logged in to the current host.
Syntax :
- Who command :
The standard Unix command who displays a list of users who are currently
logged into the computer.
Syntax :
- W command :
The command w provides a quick summary of every user logged into a
computer.
Syntax :
init 0 :Powers off the system using predefined scripts to synchronize and
restarting it
The VI editor is the most popular and classic text editor in the Linux family.
Below, are some reasons which make it a widely used editor :
It is user-friendly. Hence, millions of Linux users love it and use it for their
editing needs
- Move in a file
- Control commands :
i
Inserts text before the current cursor location
Syntax :
l
Inserts text at the start of the current line
Syntax :
a
Inserts text after the current cursor location
Syntax :
A
Inserts text at the end of the current line
Syntax :
o
Creates a new line for entering text below the cursor location
Syntax :
O
Creates a new line for entering text above the cursor location
Syntax :
- Deleting characters :
x
Deletes the character under the cursor location
Syntax :
X
Deletes the character before the cursor location
Syntax :
dw
Remove from current cursor location to next word
Syntax :
d^
Remove from current cursor position to start of line
d$
Remove from current cursor position to end of line
D
Remove from cursor position to end of current line
Syntax :
dd
Delete the line where the cursor is located
Syntax :
- Edit command :
CC
Removes the contents of the row, leaving you in insert mode.
Syntax :
cw
Changes the word the cursor is on to the lowercase w end of the
word.
r
Replaces the character under the cursor. vi returns to command
mode after entering replacement.
Syntax :
R
Replaces multiple characters starting with the character currently
under the cursor. You must use Esc to stop overwriting.
Syntax :
s
Replaces the current character with the character you enter. Then
you are left in insert mode.
Syntax :
S
Removes the line the cursor is on and replaces it with the new
text. After entering new text, vi remains in insert mode.
- Copy and paste commands :
yy
Copy the current line.
Syntax :
yw
Copies the current word from the character on which the
lowercase w cursor is located, to the end of the word.
Syntax :
p
Places the copied text after the cursor.
Syntax :
P
Places dragged text before the cursor.
Syntax :
^
Search at the beginning of the line (Use at the beginning of a search
expression).
Syntax :
.
Matches a single character.
Syntax :
*
Matches zero or more of the previous character.
Syntax :
$
End of line (Use at the end of the search expression).
Syntax :
[
Starts a set of matching or non-matching expressions.
Syntax :
<
This is put in an escaped expression with the backslash to find the end or
the beginning of a word.
Syntax :
>
This allows you to see the description of the '<' character above.
Syntax :
- Define commands :
: set ic
Ignore case when searching
Syntax :
: set ai
Defines self-indentation
Syntax :
: set noai
Disable autoindentation
Syntax :
: naked set
Displays lines with line numbers on the left side
: set sw
Sets the width of a soft tab stop. For example, you would set an offset
width of 4 with this command -: set sw = 4
: set ws
If wrapscan is set and the word is not found at the bottom of the file, it
will try to search for it at the beginning
: set wm
If this option has a value greater than zero, the editor will automatically
perform a "word wrap". For example, to set the newline margin to two
characters, you would type this:: set wm = 2
Syntax :
: set ro
Change the file type to "read only"
Syntax :
: set term
Print terminal type
Syntax :
: set bf
Ignore input control characters
- Execute commands :
The substitution command (: s /)