0% found this document useful (0 votes)
9 views11 pages

Lec 2

Uploaded by

bnhatm216
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views11 pages

Lec 2

Uploaded by

bnhatm216
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Administrative Commands

vim editor: vim (Vi IMproved) is an advanced text editor based on the old vim editor,
which is specially designed for efficient text editing in Unix-like operating systems. Vim is
widely used by developers and system administrators, including for creating and editing
scripts, such as settings or code. It is distinguished by its efficiency, computing features and
speed.

Open a file using vim: To open a file using vim, you can use the following command:

 If the file exists, it will open.


 If it does not exist, it will be created automatically.

Types of working modes in vim:

Normal Mode: The default mode when you open vim, in which you can navigate and
execute commands.

Insert Mode: You can write or edit texts.

Command Mode: To execute commands such as save or exit.

Basic commands:

Job commands Description

Save and exit :wq Save modifications and exit.

Exit without saving :q! Discard the edits and exit.

Go to input mode i To start writing text.

Undo modifications u Cancel last modification.

Copy the current line yy Copy the current text.

Paste text p Paste the copied text.

Types of text that can be edited with vim:

 Code files.
 LaTeX files.
 System log files.
 SQL files.
 Plain Text files.

Delete texts:

Job command
Delete an entire line dd

Delete a word dw

Delete from the cursor to the end d$

Search inside the file:

Job The command

Search for a word /The word

Search and switch between results n and N

Navigate within the file:

 Move to beginning of line:0


 Move to end of line:$
 Move to line number :X

. Basic system commands

File and network management commands in Kali Linux, Red Hat, and Windows:

1. Commands for displaying files and folders


Job Kali Linux Red Hat Windows

View files ls ls dir

View files with details ls -l ls -l dir /Q

Show hidden files ls -a ls -a dir /A:H

Display files with size ls -lh ls -lh dir /S

2. Create files and folders


Job Kali Linux Red Hat Windows

Create a new file touch filename touch filename echo > filename
Job Kali Linux Red Hat Windows

Create a new folder mkdir foldername mkdir foldername mkdir foldername

3. Copy and move files


Job Kali Linux Red Hat Windows

Copy a file cp source target cp source target copy source target

File transfer mv source target mv source target move source target

4. Delete files and folders


Job Kali Linux Red Hat Windows

Delete a file rm filename rm filename del filename

Delete a folder rm -r foldername rm -r foldername rmdir /S foldername

Second: Network management


1. View network information
Job Kali Linux Red Hat Windows

View IP address ip addr ip addr ipconfig

View network nmcli dev


ifconfig ipconfig /all
configuration show

View network nmcli device nmcli device netsh interface show


interfaces status status interface
2. Test the connection
jop Kali Linux Red Hat Windows
Test the connection ping IP ping IP ping IP
‫ا‬job Kali Linux Red Hat Windows
View open connections netstat -tulpn netstat -tulpn netstat -ano
job Kali Linux Red Hat Windows
Check the
firewall-cmd --
condition of the sudo ufw status netsh advfirewall show allprofiles
state
wall
netsh advfirewall firewall add rule
firewall-cmd --
sudo ufw allow name="AllowPort80" dir=in
Allow port add-port=80/tcp
80/tcp action=allow protocol=TCP
--permanent
localport=80
User management
job Kali Linux Red Hat Windows
sudo adduser sudo useradd net user username password
Add new user username username /add
sudo deluser sudo userdel
Delete user net user username /delete
username username
Change user password passwd username passwd username net user username newpassword
Verify file integrity
Job Kali Linux Red Hat Windows

Calculate the hash of sha256sum sha256sum certutil -hashfile file


the file file file SHA256
Firewall management
Job Kali Linux Red Hat Windows

Blocking a specific firewall-cmd --add- netsh advfirewall


IP rich-rule='rule firewall add rule
sudo ufw deny
family="ipv4" source name="BlockIP" dir=in
from IP
address="IP" drop' -- action=block
permanent remoteip=IP

Open a specific netsh advfirewall


port firewall add rule
sudo ufw firewall-cmd --add-
name="Allow8080" dir=in
allow port=8080/tcp --
action=allow
8080/tcp permanent
protocol=TCP
localport=8080

You might also like