Working with users and Networking Commands

Networking Commands for Linux Top Linux Network Commands in 2023 (mindmajix.com) 

Nslookup: This stands for “Name server Lookup”. This is a tool for checking DNS hostname to Ip or Ip to Hostname. This is very helpful while troubleshooting. 

Ifconfig: This is used to configure the kernel-resident network interfaces. 

Ping This command will ping a host and check if it is responding. 

dig www.google.com display servers associated with DNS

traceroute google.com 

The output indicates network delays. The asterisks shown in the output indicates a potential problem in reaching that host. They indicate packet loss during communication to the network. 

Commands for System Status Check in Lunix 

Free: This command displays the total amount of free space available along with the amount of memory used and swap memory in the system, and also the buffers used by the kernel. 

 Lsof: It is used to display a list of all the open files on a Linux system. 

Df (disk free) command will have an account of available disk space, used by file system.  Check file and directory sizes

Du (disk usage) command reports the size of directory tree including all the content. Check file and directory sizes

top: This command is used to monitor the system’s resources and processes that are running in real time. 

Ps: We use ps command to check the unique id behind every process.

Kill: This command is used to terminate processes manually. This command basically, will send a signal that terminates it. 

 TNC: This is “Test Network Connection” command. Mostly used command while troubleshooting. It displays diagnostic information for a connection.

 Command: tnc <server_name> -port <port>

User Management

 Linux stores it in the /etc/passwd file

useradd <username>  create new user. 

-c add comment

-d home directory path

-e expiration date

usermod <username> Modify part of user

cat /etc/sudoers

sudo usermod -aG  wheel minal

userdel <username> delete user

-r also deletes home directory of the user

passwd <username> defines password for the user

su <username> to switch user

sudo command to run a command with one-time root permissions.

 ID <username>: This is used to find out user and group names and numeric ID’s (UID or group ID) of the current user or any other user in the server. 

 /etc/group

groupadd Creates a new group 

groupmod Modifies an existing group 

groupdel Deletes an existing group

sudo usermod -aG  wheel minal  == Add User to a group

 chown USER:GROUP FILE  This command is used to change the file Owner or group.

Chmod: This command is used to change the access permissions of files and directories.

For example: Following “chmod” command will give the user permission to read, write and execute a file.


Installing packages in Linux OS

A Guide to Yum and Apt | Baeldung on Linux 

YUM:

YUM is a package management utility for RPM-based distributions. RPM (Red Hat Package Manager) is the package manager that systems like RHEL and CentOS are based on. 


APT, on the other side, is a collection of different tools used for managing software in DPKG-based distributions.

DPKG means Debian PacKaGe and is the package manager at the core of systems like Debian and Ubuntu.


# List installed and available packages from repositories:

yum list all

# List only installed packages:

yum list installed

# List only available packages:

yum list available

# List installed and available kernel packages:

yum list kernel 

# Update the package index and every package:

yum update

# Update only the package MY_PACKAGE:

yum update MY_PACKAGE

# Apply security-related package updates:

yum update --security 

Two popular utilities—wget and curl—are commonly used to download files to a server. Both support the HTTP, HTTPS, and File Transfer Protocol (FTP) protocols and provide additional capabilities of their own.

Curl: Curl is a tool used for transferring data to or from a server, using various protocols, such as HTTP, HTTPS, FTP, and more. Basic example: 

curl -o  to store output in a file

curl https://www.example.com/mySoftware.zip 

sudo systemctl start/stop/status httpd

systemctl enable httpd