Open Source Articles

Page 100 of 123

How to check if a File Type Exists in a Directory?

Kunal Verma
Kunal Verma
Updated on 19-Dec-2022 1K+ Views

Abstract There are times when we need to determine whether a particular file type is present in a directory or not. For instance, we might want to check if a directory contains python files. Therefore, there are a few approaches such as ls, find, etc which we can use to determine whether there are python files in the directory. In this tutorial, we will review several approaches to check whether particular file types exist in a directory or not. ls command One of the most used commands in Linux is called "ls". It is used to display a list of ...

Read More

Diff a Directory for Only Files of a Specific Type on Linux

Kunal Verma
Kunal Verma
Updated on 19-Dec-2022 773 Views

In this article, we are going to learn how to Diff a directory for only files of a specific type in Linux. Abstract In Linux, a frequently used operation is used for comparing files and identifying their differences. It is very helpful while comparing complicated code or in the configuration of files. Linux has a powerful built-in tool called diff that is used to compare directories It is error-free and also saves time. Here are a few examples that will help us learn how to apply these intriguing and adaptable commands, Diff command Using the Diff command, we can compare ...

Read More

How to read a Specific Line From a File in Linux?

Satish Kumar
Satish Kumar
Updated on 01-Dec-2022 15K+ Views

When working with the Linux shell, reading text files is often an important operation. Sometimes, we may be interested in reading a specific line from a file. We’ll take a look at different ways to get a specific piece of text out of a file. The actual Problem Let’s take a look at an example. let's say we have a file called "test.txt" − $ nl test.txt 1 This is line 1, I don't have any interesting data. 2 This is line 2, I don't have any interesting data. 3 This is line 3, I don't have any interesting data. ...

Read More

How to find total physical memory (RAM) size on Linux?

Satish Kumar
Satish Kumar
Updated on 01-Dec-2022 3K+ Views

We can often get away without checking for total memory usage on servers running Linux. However, sometimes we may want to know the total memory available on our servers. Luckily, there are various ways to accomplish this task. In this tutorial, I’ll show you some of them. Using free Command free is the simplest among the various commands we'll encounter. It's used to display the current amount of physical and virtual RAM (RAM) being utilized by your system. By default, it outputs to standard out. You can run the free utility without any flags to get an idea about how ...

Read More

Difference Between sh and Bash in Linux?

Satish Kumar
Satish Kumar
Updated on 01-Dec-2022 15K+ Views

Bash is a BourNeSh (Bourne Again ShEl) which is an improved variant oF thE origiNal Bourne shEll.It is used to run programs in the Bash programming language, and is often referred to as "the default shell" for Linux distributions. Sh is a simple commandinterpreter for the UNIX System V Release 4.0. Both Bash and sh can be used to write scripts in various languages such as Perl, Python, Ruby, PHP, Java, C++, JavaScript, Tcl, SQL, and others. sh #!/bin/sh bash #!/bin/bash Note A shell is an interface between the end-users and the operating systems. sh implements the ...

Read More

How to replace string in a large one line, text file in Linux?

Satish Kumar
Satish Kumar
Updated on 01-Dec-2022 1K+ Views

Some software reads an entire input file into memory before processing it. If the input file contains a very long string, the software may crash if there isn't enough memory to hold the entire string. We’ll look at ways to change a single character in a very large one-liner file in Linux. Some applications cannot handle very large one-liners, so we’ll examine our options. Target File Some modern JavaScript frameworks compress all of the code onto a single statement. Let’s say we have a one-liner of JavaScript code called original.js with an error in it. It calls “fliter“ instead of ...

Read More

How to download a Tarball from GitHub on Linux?

Satish Kumar
Satish Kumar
Updated on 01-Dec-2022 3K+ Views

Github is an online source code repository and hosting service for open-source projects, which provides the ability to host, version control, review, fork, and submit changes to any project hosted there. The following steps will help you download a tarball of your choice from github.com − By using git clone Download Git repository as a tar or zip file You can use either the command line tool "Github" (which is installed by default) or the GUI client "SourceTree". However, if you don't have these tools, you can download the source code in tar format and extract its contents ...

Read More

How to Get the Path of a Linux Command?

Satish Kumar
Satish Kumar
Updated on 01-Dec-2022 5K+ Views

A Linux command that you run from a terminal window can be built-in (a part of the system), a function (an application that runs when you enter certain commands), an alias (another name for a command), or an external executable (a program that you download). You can use the which, command, whereis, whatis, and type tools to determine what each one is and where they are located. We will look at the which, command, types, and whereis commands as they are usually found in most Linux-Based OSs. So let’s explore how to get the path of a Linux command in ...

Read More

How to Merge PDF Files in Bash?

Vishesh Kumar
Vishesh Kumar
Updated on 21-Nov-2022 725 Views

Introduction On various occasions, we desired to combine PDF files to organise them, lessen clutter, or share them with others. Linux provides a variety of utilities for merging pdf files. Some of the most popular ones are listed below − pdfunite pdftk gs convert qpdf These application tools have a lot of functions, and for this article, we will concentrate on their file-merging functionality. Let's examine some of them individually. pdfunite "pdfunite" is the tool's name in the Poppler Utils package that merges PDF files. The use of pdfunite is rather easy. Use the DNF command below to ...

Read More

How to write Stdout to a file with colors?

Vishesh Kumar
Vishesh Kumar
Updated on 21-Nov-2022 980 Views

Introduction The tools we can use to send standard output to files while maintaining their colours will be covered in this post. This is especially helpful while troubleshooting because it makes it simpler to scan the output logs thanks to the coloured areas. By Using Grep A file can be searched for text patterns or strings using the grep command. Regular expressions are the names given to the patterns. Syntax The syntax for the grep command is as follows − $ grep [options] pattern [files] Example Let's make a example.txt file by using cat command. After that we will ...

Read More
Showing 991–1000 of 1,225 articles
« Prev 1 98 99 100 101 102 123 Next »
Advertisements