Blog
- Home
- Blog
This article covers all you need to know about the w command in Linux. In fact, The w command is a built-in tool that allows administrators to view information about users that are currently logged in. This includes their username, where they are logged in from, and what they are currently doing.
w Command in Linux Syntax
The Linux w command is a system utility that displays information about currently logged-in users. It uses the following syntax:
$ w [options] [username]
Where:
The w command uses the following options:
This article covers how to use the if else statement in Python. In fact, An if else Python statement evaluates whether an expression is true or false. If a condition is true, the "if" statement executes. Otherwise, the "else" statement executes. Python if else statements help coders control the flow of their programs.
Python Conditions and If statements
Python supports the usual logical conditions from mathematics:
Python Nested if statements
We can have a if...elif...else statement inside another if...elif...else statement. This is called nesting in computer programming.
Any number of these statements can be nested inside one another. Indentation is the only way to figure out the level of nesting. They can get confusing, so they must be avoided unless necessary.
Python Nested if Example
'''In this program, we input a number
check if the number is positive or
negative or zero and display
an appropriate message
This time we use nested if statement'''
num = float(input("Enter a number: "))
if num >= 0:
if num == 0:
print("Zero")
else:
print("Positive number")
else:
print("Negative number")
Output 1 will give:
Enter a number: 5
Positive number
Output 2 will give:
Enter a number: -1
Negative number
Output 3 will give:
Enter a number: 0
Zero
This article covers how to use Array in Python. In fact, An array is a special variable, which can hold more than one value at a time.
In Python, we can treat lists as arrays. However, we cannot constrain the type of elements stored in a list.
For example:
# elements of different types
a = [1, 3.5, "Hello"]
If you create arrays using the array module, all elements of the array must be of the same numeric type.
import array as arr
# Error
a = arr.array('d', [1, 3.5, "Hello"])
Output will give:
Traceback (most recent call last):
File "<string>", line 3, in <module>
a = arr.array('d', [1, 3.5, "Hello"])
TypeError: must be real number, not str
This article covers how to monitor user activity with the acct tool on Ubuntu 20.04. In fact, Acct can monitor the user activity & getting the information about the user performance. It provides the information about last commands executed by users, user logins / logouts details in hours by day-wise, system activity information,& individuals user information.
How to install acct on ubuntu ?
1. Update the System:
$ apt-get update
2. Install the psacct or acct on system:
$ apt-get install acct
3. Check the acct version:
$ ac --version
This article covers how to install and configure the Grafana monitoring tool on CentOS 8 system via the command line. In fact, Grafana is a popular open-source visualization and analytics monitoring software which renders graphs, charts, and alerts when connected to supported data sources. Now, you can use the grafana monitoring dashboard on CentOS 8 system.
This article covers the complete installation procedure of GNU Octave on the Ubuntu machine via different methods. In fact, Octave is a scientific application that uses a Matlab-like interpreted high-level language for numerical computations and simulations. Octave offers functions to solve linear and nonlinear problems, can plot the results as graphics and offers capabilities for data manipulation and visualization. Also it provides an interactive command line interface and a GUI interface but can also be used in noninteractive scripts for data processing.