Pradeep Elance has Published 417 Articles

Python - Filter even values from a list

Pradeep Elance

Pradeep Elance

Updated on 07-Jan-2020 06:46:30

1K+ Views

As part of data analysis require to filter out values from a list meeting certain criteria. In this article we'll see how to filter out only the even values from a list.We have to go through each element of the list and divide it with 2 to check for the ... Read More

Multiplication of two Matrices in Single line using Numpy in Python

Pradeep Elance

Pradeep Elance

Updated on 07-Jan-2020 06:41:16

722 Views

Matrix multiplication is a lengthy process where each element from each row and column of the matrixes are to be multiplied and added in a certain way. For matrix multiplication, the number of columns in the first matrix must be equal to the number of rows in the second matrix. ... Read More

All possible permutations of N lists in Python

Pradeep Elance

Pradeep Elance

Updated on 07-Jan-2020 06:34:45

1K+ Views

If we have two lists and we need to combine each element of the first element with each element of the second list, then we have the below approaches.Using For LoopIn this straight forward approach we create a list of lists containing the permutation of elements from each list. we ... Read More

Why should eval be avoided in Bash, and what should I use instead?

Pradeep Elance

Pradeep Elance

Updated on 03-Jan-2020 07:23:05

2K+ Views

eval is a builtin command of the Bash shell which concatenates its arguments into a single string. Then it joins the arguments with spaces, then executes that string as a bash command. Below is an example of how it works.eval exampleIn the below example we take a string which has ... Read More

Looping through the content of a file in Bash

Pradeep Elance

Pradeep Elance

Updated on 03-Jan-2020 07:15:52

6K+ Views

Often it is a requirement to read each of the line from a file using a bash script. There are various approaches to read the lines form a file. In the below example we have first described how to create a sample file and then run a script reading that ... Read More

How to convert DOS/Windows newline (CRLF) to Unix newline (LF) in a Bash script?

Pradeep Elance

Pradeep Elance

Updated on 03-Jan-2020 07:12:22

2K+ Views

When we transfer files between Windows and Unix systems, often we come across with issue relating to the end of line character. This is because the EOL character in windows is not recognized as a EOL character in Unix. SO to fix this issue when a file is transferred from ... Read More

How to Search and Remove Directories Recursively on Linux?

Pradeep Elance

Pradeep Elance

Updated on 03-Jan-2020 07:02:23

457 Views

Removing directories is a regular process for anyone working on Unix systems.But sometimes we also need to find the directories first and then decide to delete it. One hurdle in deleting the files is to do a recursive deleting because by default Unix systems do not allow deleting of a ... Read More

How to Re-run Last Executed Commands in Linux?

Pradeep Elance

Pradeep Elance

Updated on 03-Jan-2020 06:59:07

297 Views

Re-running commands in the command line is a regular task which all of us go through when working on the Unix systems. In the below article we will see various ways how we can rerun the commands we have already executed this helps save time and it helps reasoning longer ... Read More

How to Force User to Change Password at Next Login in Linux?

Pradeep Elance

Pradeep Elance

Updated on 03-Jan-2020 06:57:07

657 Views

Because of security concerns, the users in a system are required to update their passwords regularly. In this article we will see how we can force an user to change their password when they login to the system next time.List the usersFirst lets have a look at the users available ... Read More

How to Find User Account Info and Login Details in Linux?

Pradeep Elance

Pradeep Elance

Updated on 03-Jan-2020 06:54:25

5K+ Views

For the sysadmins, it is routine to monitor user details like who are active and who are not, who logged in in last 2 days, which users belong to a given group etc etc. To help these requirements, Linux provides below list of commands which can be used to gather ... Read More

Advertisements