Linux Network & Process Management (October 25, 2023)
E02(Linux Network and Process Management)
Process;
- a running program that is being executed by the Linux kernel.
- each process has its own unique process ID(PID) and its own set of resources, such as memory and CPU time.
- PID is the unique identifier given to a process
Process state;
One of the following states is possible for a process in the system:
Running: The program is now being run.
Ready: It is prepared to operate but is awaiting CPU time.
Sleeping: It is briefly put on hold as it waits for an action or procedure to complete.
Stopped: It has been stopped, either by the user or the system.
Zombie: The process has finished running, but there is still a record in the process table.
Process management;
Ps - report the snapshot of the current process
- ps
- ps aux
- ps aux | grep username
- cat /proc/<PID>/status
top - display all the information about all the running processes
- top
- top -u root
- top -u username
gnome-system-monitor
Kill - used to stop the process
- kill <PID>
- kill -9 <PID>
Systemctl - make use of it when you have services installed in your system
- sudo systemctl status service_name
- sudo systemctl start service_name
- sudo systemctl stop service_name
Network Configuration;
- ifconfig, ip addr, and ip link - can be used to access the network interfaces
- ip route - can be used to access the routing information of the network that your device is connected to.
- /etc/netplan - can be used to access the configuration inside the folder.
YAML - will default configuration
NetworkManager - used by default to manage your network
- /etc/NetworkManager/system-connections/<connection-name> - can be used to get the configuration of the specific network you are connected to
- /etc/host.conf - contains the order in which hostnames are resolved
- /etc/hosts - map ip address to hostname/domain name /etc/hostname - contains the name of your system hostname which can be used to identify your system in the network.
- Some of the other files are /etc/hosts.deny and /etc/hosts. allow
Network Commands;
- netstat - used to display the various network informations
- ping - test host connection reachability
- tracerout - find the path b/w the source and the destination
- nslookup - get the mapping b/w ip address & the domain name and vice versa
- ssh - remote login using shell
Firewall Configuration;
ufw - bult-in command
- sudo ufw status
- sudo ufw enable
To block certain website
- sudo ufw deny out to <ip address>
- sudo ufw reload
To unblock the website
- sudo ufw delete deny out to <ip address>
To disable the firewall
- sudo ufw disable
Comments
Post a Comment