Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
1 views2 pages

Task

Uploaded by

Omar Farooq
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)
1 views2 pages

Task

Uploaded by

Omar Farooq
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/ 2

Services Management

Start a service: sudo systemctl start <service_name>


Stop a service sudo systemctl stop <service_name>
Enable a service to start on boot sudo systemctl enable <service_name>
Disable a service from starting on boot sudo systemctl disable <service_name>
Check the status of a service sudo systemctl status <service_name>
Restart a service sudo systemctl restart <service_name>

Change Hostname
View current hostname hostnamectl
Set a new hostname sudo hostnamectl set-hostname <new_hostname>

Change IP of Network Adapter


Edit the network interface file sudo nano /etc/sysconfig/network-scripts/ifcfg-<interface_name>

Example for ens33:

BOOTPROTO=static
IPADDR=192.168.1.100
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=8.8.8.8

Restart the network service sudo systemctl restart network

Add User and Group


Add a user sudo useradd <username>
sudo passwd <username>
Add a group sudo groupadd <groupname>
Add user to a group sudo usermod -aG <groupname> <username>
Delete a user sudo userdel <username>
Delete a group sudo groupdel <groupname>
Change Permissions
Change file ownership sudo chown <user>:<group> <file_or_directory>
Change file permissions sudo chmod 755 <file_or_directory>

Common examples:
- 755: Owner has full permissions, group and others have read
and execute.
- 644: Owner has read/write, group and others have read-only.

File Manipulation
Create a file touch <filename>
Edit a file nano <filename>
Copy a file cp <source> <destination>
Move or rename a file mv <source> <destination>
Delete a file rm <filename>
List files in a directory ls -l

Firewall Management
Check firewall status sudo firewall-cmd --state
Start the firewall sudo systemctl start firewalld
Stop the firewall sudo systemctl stop firewalld
Enable the firewall on boot sudo systemctl enable firewalld
Add a service to the firewall sudo firewall-cmd --permanent --add-service=<service_name>
sudo firewall-cmd --reload
Block/Remove a service sudo firewall-cmd --permanent --remove-service=<service_name>
sudo firewall-cmd –reload
Open a specific port sudo firewall-cmd --permanent --add-port=<port_number>/tcp
sudo firewall-cmd --reload
Block/Remove a specific port sudo firewall-cmd --permanent --remove- port=<port_number>/tcp
sudo firewall-cmd –reload

You might also like