Monday 21 November 2022

Understanding Differences in Behavior of Process.join() in Windows 10 and Ubuntu 18.04 in Python 3.6

When it comes to multi-processing in Python, developers often run into differences in behavior between different operating systems. One such difference is in how Windows 10 and Ubuntu 18.04 handle the Process.join() function. In this article, we will explore this difference in behavior and understand what accounts for it.

Read more »

Labels: , ,

Sunday 21 November 2021

How to Run R Programs in Linux or Unix or Ubuntu

R is a popular programming language for statistical computing and data analysis, and Ubuntu is a popular operating system based on the Linux kernel. There are several ways to run R programs in Ubuntu, including using the R interpreter, a text editor such as Vim or Nano, or an integrated development environment (IDE) such as RStudio. Each method has its advantages and disadvantages, and the choice depends on your preference and workflow. 

In this discussion, we have provided step-by-step instructions for each method to help you get started with running R programs in Ubuntu.

Open the Terminal by pressing Ctrl + Alt + T or searching for "Terminal" in the Activities menu.

Install R by running the following command:

sudo apt-get install r-base


This will install R and any necessary dependencies.
Read more »

Labels: , ,

10 ways to kill a process in linux complete guide

Linux is a powerful operating system that offers users multiple options for controlling and managing running processes. However, there may be instances when a process needs to be terminated for various reasons. In this article, we will explore different methods that can be used to kill a process in Linux. We will also provide code examples to demonstrate each of the methods discussed.

Method 1: Using the "kill" command

The "kill" command is one of the most commonly used methods for terminating a process in Linux. This command sends a signal to the process, indicating that it should be terminated. By default, the signal sent by the kill command is SIGTERM, which allows the process to perform a graceful shutdown. If the process does not respond to SIGTERM, the user can send a more forceful signal using the SIGKILL option.

Read more »

Labels: , ,

Tuesday 2 March 2021

Top 10 Example of lsof commands in Linux and UNIX

In a Linux or UNIX operating system, there are many processes running simultaneously. These processes use files, sockets, and other resources that are managed by the operating system. To get information about these resources, we can use the "lsof" (list open files) command. Lsof is a powerful tool that can help us understand the system's state, monitor and debug applications, and troubleshoot issues. In this article, we will look at ten examples of using the lsof command in Linux and UNIX.

List all open files:

To list all the open files in the system, we can simply run the lsof command without any arguments. This will give us a comprehensive list of all the files and their corresponding processes.

lsof

Read more »

Labels: , ,

Monday 21 December 2020

Top 10 example of sort command in UNIX or Linux

Sorting is an essential task when working with data, especially large datasets. In Unix and Linux systems, the 'sort' command is used to sort files or data streams. In this blog article, we will explore ten examples of the 'sort' command that are frequently used in Unix and Linux systems.

Example 1: Sort a File Alphabetically

To sort a file alphabetically, you can use the following command:

sort file.txt

This command will sort the contents of 'file.txt' in alphabetical order and print the result on the console.

Read more »

Labels: , , ,

Tuesday 21 April 2020

Top 10 example of using Vim or VI editor in UNIX and Linux

Vim or VI is a popular text editor used in UNIX and Linux systems. It is a powerful tool that allows users to edit and manipulate text files efficiently. In this article, we will discuss 10 examples of using Vim or VI editor in UNIX and Linux.

1. Opening a file

To open a file in Vim or VI editor, we can use the following command:

vim filename.txt

This command will open the file named filename.txt in Vim or VI editor.

Read more »

Labels: , ,

Sunday 29 March 2020

Linux User Management - Granting/Revoking sudo access

we will learn how to manage user accounts and grant or revoke sudo access on a Linux system. We will be using Ubuntu as our operating system for this project.

Requirements:

    • Ubuntu installed on a machine

    • Sudo access

    • Basic understanding of Linux commands

Read more »

Labels: , , , ,

Tuesday 21 January 2020

Important Examples of CURL command in UNIX and Linux

CURL is a command-line tool that is used to transfer data from or to a server using different protocols like HTTP, FTP, SMTP, and more. It is a popular tool in Unix and Linux environments that allows users to send and receive data over the internet. In this article, we will explore 10 examples of cURL command in UNIX and Linux with code examples.

Fetching a Web Page

One of the most common uses of cURL is to fetch web pages from the internet. The following command will fetch the web page and print it to the console.

curl https://www.example.com


Read more »

Labels: , ,

Sunday 12 January 2020

Top 10 examples of grep command in UNIX and Linux

The grep command is a powerful tool for searching and filtering text files in UNIX and Linux systems. It allows users to search for a specific pattern in a file or a set of files and display the lines that match that pattern. This command is incredibly versatile and can be used for a variety of tasks, including log analysis, system administration, and programming.

In this blog post, we'll explore 10 examples of the grep command in UNIX and Linux, with code examples to illustrate each use case. By the end of this post, you'll have a better understanding of how to use this command and how it can help you in your day-to-day tasks.

Example 1: Basic Search

The most basic use case for the grep command is to search for a specific pattern in a file. To do this, simply enter the following command:

The most basic use case for the grep command is to search for a specific pattern in a file. To do this, simply enter the following command:

grep apple fruits.txt

For example, to search for the word "apple" in the file "fruits.txt", enter the following command:

This will display all lines in the file that contain the word "apple".

Example 2: Case-Insensitive Search

By default, the grep command is case-sensitive, which means that it will only match patterns that are identical in case to the search term. However, you can use the -i option to perform a case-insensitive search. For example:

grep -i apple fruits.txt


This will match lines that contain "apple", "Apple", or "APPLE".

Example 3: Search Multiple Files

You can also use the grep command to search multiple files at once. To do this, simply specify the filenames separated by spaces. For example:

grep apple fruits.txt vegetables.txt


This will search for the word "apple" in both the "fruits.txt" and "vegetables.txt" files.

Example 4: Search All Files in a Directory

To search all files in a directory, you can use the wildcard character "*". For example:

grep apple *


This will search for the word "apple" in all files in the current directory.

Example 5: Inverse Search

By default, the grep command displays all lines that match the search pattern. However, you can use the -v option to display all lines that do not match the pattern. For example:

grep -v apple fruits.txt


This will display all lines in the "fruits.txt" file that do not contain the word "apple".

Example 6: Search for Whole Words Only

By default, the grep command will match any occurrence of the search pattern, even if it's part of a larger word. For example, the search term "the" will match words like "there", "theme", and "other". To search for whole words only, use the -w option. For example:

grep -w the story.txt


This will only match the word "the", and not words that contain it as a substring.

Example 7: Recursive Search

If you want to search for a pattern in all files in a directory and its subdirectories, use the -r option. For example:

grep -r apple /home/user/documents


This will search for the word "apple" in all files in the "documents" directory and its subdirectories.

Example 8: Count Matches

If you just want to know how many times a pattern appears in a file, use the -c option. For example:

grep -c apple fruits.txt


Example 9:  Do not Matches

Search for lines that do not contain the word "example" in a file "file.txt"

grep -v "example" file.txt



Example 10: Exclude Matches in File

Search for a word "example" in all files except those with a ".txt" extension

grep "example" --exclude=*.txt *


Labels: , ,

Saturday 30 March 2019

How to monitor user and group activity in Linux

Comprehensive explanation of how to monitor user and group activity in Linux using the tools and utilities mentioned Below:

ps command:

The "ps" command (short for process status) displays a snapshot of running processes on a Linux system. To view the processes running under a specific user, you can use the "-u" option followed by the username. For example, to see all the processes running under the user "john," you can use the following command:

ps -u john


This will display a list of all the processes running under the user "john" along with their process ID (PID), CPU usage, memory usage, and other relevant information.

Read more »

Labels: , ,

Thursday 21 March 2019

How to Remove CTRL-M characters From a File in UNIX and Linux? Example

If you're working with text files in a UNIX or Linux environment, you may encounter the issue of unwanted control-M characters, which can cause problems with formatting and readability. These characters are also known as carriage return characters, and they can be removed using a few simple commands in the terminal. In this article, we'll go over how to identify and remove control-M characters from your files using UNIX and Linux.

Identifying Control-M Characters

Before we can remove control-M characters from our files, we need to be able to identify them. One way to do this is by using the cat command with the -v option, which displays non-printing characters in a file.

cat -v file.txt


This command will display the contents of the file.txt, showing control-M characters as "^M" in the output. If you see these characters in your file, you'll need to remove them.
Read more »

Labels: , ,