How to Check Java Processes on Linux with The Jps Command in 2021

On Linux, there are commands to view processes running on your system. A process is spawned when you launch an application, but there are also many other processes running in the background of your computer, including programs to keep your system time accurate, to monitor for new filesystems, to index files, and more. They look at all processes on your computer so you can filter the list based on what you need to know.
 

#Java #linux 

What is GEEK

Buddha Community

How to Check Java Processes on Linux with The Jps Command in 2021
Tyrique  Littel

Tyrique Littel

1600135200

How to Install OpenJDK 11 on CentOS 8

What is OpenJDK?

OpenJDk or Open Java Development Kit is a free, open-source framework of the Java Platform, Standard Edition (or Java SE). It contains the virtual machine, the Java Class Library, and the Java compiler. The difference between the Oracle OpenJDK and Oracle JDK is that OpenJDK is a source code reference point for the open-source model. Simultaneously, the Oracle JDK is a continuation or advanced model of the OpenJDK, which is not open source and requires a license to use.

In this article, we will be installing OpenJDK on Centos 8.

#tutorials #alternatives #centos #centos 8 #configuration #dnf #frameworks #java #java development kit #java ee #java environment variables #java framework #java jdk #java jre #java platform #java sdk #java se #jdk #jre #open java development kit #open source #openjdk #openjdk 11 #openjdk 8 #openjdk runtime environment

Rupert  Beatty

Rupert Beatty

1684207573

How to Check If The File Exists in Bash

Different types of files are used in Bash for different purposes. Many options are available in Bash to check if the particular file exists or not. The existence of the file can be checked using the file test operators with the “test” command or without the “test” command. The purposes of different types of file test operators to check the existence of the file are shown in this tutorial.

File Test Operators

Many file test operators exist in Bash to check if a particular file exists or not. Some of them are mentioned in the following:

OperatorPurpose
-fIt is used to check if the file exists and if it is a regular file.
-dIt is used to check if the file exists as a directory.
-eIt is used to check the existence of the file only.
-h or -LIt is used to check if the file exists as a symbolic link.
-rIt is used to check if the file exists as a readable file.
-wIt is used to check if the file exists as a writable file.
-xIt is used to check if the file exists as an executable file.
-sIt is used to check if the file exists and if the file is nonzero.
-bIt is used to check if the file exists as a block special file.
-cIt is used to check if the file exists as a special character file.

Different Examples to Check Whether the File Exists or Not

Many ways of checking the existence of the regular file are shown in this part of the tutorial.

Example 1: Check the Existence of the File Using the -F Operator with Single Third Brackets ([])

Create a Bash file with the following script that takes the filename from the user and check whether the file exists in the current location or not using the -f operator in the “if” condition with the single third brackets ([]).

#!/bin/bash

#Take the filename

echo -n "Enter the filename: "

read filename

#Check whether the file exists or not using the -f operator

if [ -f "$filename" ]; then

echo "File exists."

else

echo "File does not exist."

fi

The script is executed twice in the following script. The non-existence filename is given in the first execution. The existing filename is given in the second execution. The “ls” command is executed to check whether the file exists or not.

Example 2: Check the Existence of the File Using the -F Operator with Double Third Brackets ([[ ]])

Create a Bash file with the following script that takes the filename as a command-line argument and check whether the file exists in the current location or not using the -f operator in the “if” condition with the double third brackets ([[ ]]).

#!/bin/bash

#Take the filename from the command-line argument

filename=$1

#Check whether the argument is missing or not

if [ "$filename" != "" ]; then

#Check whether the file exists or not using the -f operator

if [[ -f "$filename" ]]; then

echo "File exists."

else

echo "File does not exist."

fi

else

echo "Argument is missing."

fi

The script is executed twice in the following script. No argument is given in the first execution. An existing filename is given as an argument in the second execution. The “ls” command is executed to check whether the file exists or not.

Example 3: Check the Existence of the File Using the -F Operator with the “Test” Command

Create a Bash file with the following script that takes the filename as a command-line argument and check whether the file exists in the current location or not using the -f operator with the “test” command in the “if” condition.

#!/bin/bash

#Take the filename from the command-line argument

filename=$1

#Check whether the argument is missing or not

if [ $# -lt 1 ]; then

echo "No argument is given."

exit 1

fi

#Check whether the file exists or not using the -f operator

if test -f "$filename"; then

echo "File exists."

else

echo "File does not exist."

fi

The script is executed twice in the following script. No argument is given in the first execution. An existing filename is given in the second execution.

Example 4: Check the Existence of the File with the Path

Create a Bash file with the following script that checks whether the file path exists or not using the -f operator with the “test” command in the “if” condition.

#!/bin/bash

#Set the filename with the directory location

filename='temp/courses.txt'

#Check whether the file exists or not using the -f operator

if test -f "$filename"; then

echo "File exists."

else

echo "File does not exist."

fi

The following output appears after executing the script:

Conclusion

The methods of checking whether a regular file exists or not in the current location or the particular location are shown in this tutorial using multiple examples.

Original article source at: https://linuxhint.com/

#bash #file 

Harry Patel

Harry Patel

1614145832

A Complete Process to Create an App in 2021

It’s 2021, everything is getting replaced by a technologically emerged ecosystem, and mobile apps are one of the best examples to convey this message.

Though bypassing times, the development structure of mobile app has also been changed, but if you still follow the same process to create a mobile app for your business, then you are losing a ton of opportunities by not giving top-notch mobile experience to your users, which your competitors are doing.

You are about to lose potential existing customers you have, so what’s the ideal solution to build a successful mobile app in 2021?

This article will discuss how to build a mobile app in 2021 to help out many small businesses, startups & entrepreneurs by simplifying the mobile app development process for their business.

The first thing is to EVALUATE your mobile app IDEA means how your mobile app will change your target audience’s life and why your mobile app only can be the solution to their problem.

Now you have proposed a solution to a specific audience group, now start to think about the mobile app functionalities, the features would be in it, and simple to understand user interface with impressive UI designs.

From designing to development, everything is covered at this point; now, focus on a prelaunch marketing plan to create hype for your mobile app’s targeted audience, which will help you score initial downloads.

Boom, you are about to cross a particular download to generate a specific revenue through your mobile app.

#create an app in 2021 #process to create an app in 2021 #a complete process to create an app in 2021 #complete process to create an app in 2021 #process to create an app #complete process to create an app

Как проверить, существует ли файл в Bash

Различные типы файлов используются в Bash для разных целей. В Bash доступно множество опций, позволяющих проверить, существует ли конкретный файл или нет. Существование файла можно проверить с помощью операторов проверки файлов с командой «test» или без команды «test». В этом руководстве показаны цели различных типов операторов проверки файлов для проверки существования файла.

Операторы проверки файлов

В Bash существует множество операторов проверки файлов, чтобы проверить, существует ли конкретный файл или нет. Некоторые из них упоминаются в следующем:

ОператорЦель
-fОн используется для проверки того, существует ли файл и является ли он обычным файлом.
Он используется для проверки существования файла в виде каталога.
Он используется только для проверки существования файла.
-ч или -лОн используется для проверки существования файла в виде символической ссылки.
Он используется для проверки того, существует ли файл как читаемый файл.
-wОн используется для проверки того, существует ли файл как файл, доступный для записи.
-ИксОн используется для проверки того, существует ли файл как исполняемый файл.
Он используется для проверки того, существует ли файл и не равен ли он нулю.
Он используется для проверки того, существует ли файл в виде специального блочного файла.
Он используется для проверки того, существует ли файл как файл со специальными символами.

Различные примеры проверки существования файла

В этой части руководства показано множество способов проверки существования обычного файла.

Пример 1. Проверка существования файла с помощью оператора -F с одиночными третьими скобками ([])

Создайте файл Bash со следующим сценарием, который берет имя файла от пользователя и проверяет, существует ли файл в текущем местоположении или нет, используя оператор -f в условии «если» с одной третьей скобкой ([]).

#!/bin/bash

#Take the filename

echo -n "Enter the filename: "

read filename

#Check whether the file exists or not using the -f operator

if [ -f "$filename" ]; then

echo "File exists."

else

echo "File does not exist."

fi

Сценарий выполняется дважды в следующем сценарии. Несуществующее имя файла дается при первом выполнении. Существующее имя файла дается во втором исполнении. Команда «ls» выполняется, чтобы проверить, существует ли файл или нет.

Пример 2. Проверка существования файла с помощью оператора -F с двойными третьими скобками ([[ ]])

Создайте файл Bash со следующим сценарием, который принимает имя файла в качестве аргумента командной строки и проверяет, существует ли файл в текущем местоположении или нет, используя оператор -f в условии «если» с двойными третьими скобками ([[] ]).

#!/bin/bash

#Take the filename from the command-line argument

filename=$1

#Check whether the argument is missing or not

if [ "$filename" != "" ]; then

#Check whether the file exists or not using the -f operator

if [[ -f "$filename" ]]; then

echo "File exists."

else

echo "File does not exist."

fi

else

echo "Argument is missing."

fi

Сценарий выполняется дважды в следующем сценарии. При первом выполнении аргумент не передается. Существующее имя файла задается в качестве аргумента при втором выполнении. Команда «ls» выполняется, чтобы проверить, существует ли файл или нет.

Пример 3: Проверка существования файла с помощью оператора -F с командой «Тест»

Создайте файл Bash со следующим сценарием, который принимает имя файла в качестве аргумента командной строки и проверяет, существует ли файл в текущем местоположении или нет, используя оператор -f с командой «test» в условии «if».

#!/bin/bash

#Take the filename from the command-line argument

filename=$1

#Check whether the argument is missing or not

if [ $# -lt 1 ]; then

echo "No argument is given."

exit 1

fi

#Check whether the file exists or not using the -f operator

if test -f "$filename"; then

echo "File exists."

else

echo "File does not exist."

fi

Сценарий выполняется дважды в следующем сценарии. При первом выполнении аргумент не передается. Существующее имя файла дается во втором исполнении.

Пример 4. Проверка существования файла с указанием пути

Создайте файл Bash со следующим скриптом, который проверяет, существует ли путь к файлу или нет, используя оператор -f с командой «test» в условии «if».

#!/bin/bash

#Set the filename with the directory location

filename='temp/courses.txt'

#Check whether the file exists or not using the -f operator

if test -f "$filename"; then

echo "File exists."

else

echo "File does not exist."

fi

После выполнения скрипта появляется следующий вывод:

Заключение

Методы проверки того, существует ли обычный файл в текущем местоположении или в конкретном месте, показаны в этом руководстве с использованием нескольких примеров.

Оригинальный источник статьи: https://linuxhint.com/

#bash #file 

如何在 Bash 中检查文件是否存在

Bash 中出于不同的目的使用不同类型的文件。Bash 中有许多选项可用于检查特定文件是否存在。可以使用带有“test”命令或不带有“test”命令的文件测试操作符来检查文件是否存在。本教程显示了不同类型的文件测试操作符检查文件是否存在的目的。

文件测试操作员

Bash 中存在许多文件测试运算符来检查特定文件是否存在。下面提到了其中一些:

操作员目的
-F它用于检查文件是否存在以及它是否是常规文件。
-d它用于检查文件是否作为目录存在。
-e它仅用于检查文件是否存在。
-h 或 -L它用于检查文件是否作为符号链接存在。
-r它用于检查文件是否作为可读文件存在。
-w它用于检查文件是否作为可写文件存在。
-X它用于检查文件是否作为可执行文件存在。
-s它用于检查文件是否存在以及文件是否为非零。
-b它用于检查文件是否作为块特殊文件存在。
-C它用于检查文件是否作为特殊字符文件存在。

检查文件是否存在的不同示例

本教程的这一部分显示了许多检查常规文件是否存在的方法。

示例 1:使用带有单个三分括号 ([]) 的 -F 运算符检查文件是否存在

使用以下脚本创建一个 Bash 文件,该脚本从用户那里获取文件名,并在“if”条件中使用带有第三个括号 ([]) 的 -f 运算符检查文件是否存在于当前位置。

#!/bin/bash

#Take the filename

echo -n "Enter the filename: "

read filename

#Check whether the file exists or not using the -f operator

if [ -f "$filename" ]; then

echo "File exists."

else

echo "File does not exist."

fi

该脚本在以下脚本中执行了两次。不存在的文件名在第一次执行时给出。现有文件名在第二次执行时给出。执行“ls”命令来检查文件是否存在。

示例 2:使用带有双三分括号 ([[ ]]) 的 -F 运算符检查文件是否存在

使用以下脚本创建一个 Bash 文件,该脚本将文件名作为命令行参数,并在“if”条件中使用 -f 运算符和双第三括号 ([[ ] ]).

#!/bin/bash

#Take the filename from the command-line argument

filename=$1

#Check whether the argument is missing or not

if [ "$filename" != "" ]; then

#Check whether the file exists or not using the -f operator

if [[ -f "$filename" ]]; then

echo "File exists."

else

echo "File does not exist."

fi

else

echo "Argument is missing."

fi

该脚本在以下脚本中执行了两次。第一次执行时不给出参数。在第二次执行中,将现有文件名作为参数给出。执行“ls”命令来检查文件是否存在。

示例 3:使用带有“测试”命令的 -F 运算符检查文件是否存在

使用以下将文件名作为命令行参数的脚本创建 Bash 文件,并在“if”条件下使用 -f 运算符和“test”命令检查文件是否存在于当前位置。

#!/bin/bash

#Take the filename from the command-line argument

filename=$1

#Check whether the argument is missing or not

if [ $# -lt 1 ]; then

echo "No argument is given."

exit 1

fi

#Check whether the file exists or not using the -f operator

if test -f "$filename"; then

echo "File exists."

else

echo "File does not exist."

fi

该脚本在以下脚本中执行了两次。第一次执行时不给出参数。第二次执行时给出一个现有的文件名。

示例 4:使用路径检查文件是否存在

使用以下脚本创建 Bash 文件,在“if”条件下使用 -f 运算符和“test”命令检查文件路径是否存在。

#!/bin/bash

#Set the filename with the directory location

filename='temp/courses.txt'

#Check whether the file exists or not using the -f operator

if test -f "$filename"; then

echo "File exists."

else

echo "File does not exist."

fi

执行脚本后出现如下输出:

结论

本教程通过多个示例展示了检查当前位置或特定位置是否存在常规文件的方法。

文章原文出处:https: //linuxhint.com/

#bash #file