Found 2065 Articles for Operating System

How to suppress a binary file matching results in grep on Linux?

Mukul Latiyan
Updated on 31-Jul-2021 11:57:23

624 Views

The grep command in Linux is used to filter searches in a file for a particular pattern of characters. It is one of the most used Linux utility commands to display the lines that contain the pattern that we are trying to search.Normally, the pattern that we are trying to search in the file is referred to as the regular expression.Syntaxgrep [options] pattern [files]While there are plenty of different options available to us, some of the most used are −-c : It lists only a count of the lines that match a pattern -h : displays the matched lines only. ... Read More

How to substitute an environment variable using sed on Linux?

Mukul Latiyan
Updated on 31-Jul-2021 11:56:59

2K+ Views

An Environment variable is a dynamic-named value. Generally, these are variables are exported in a single terminal using a command shown belowexport $SOMEVARIABLE=valueor they are stored inside the bash files, so that they remain available in all the terminals once the file is sourced. If we want to change an environment variable we can simply change the above command’s value field and then source the file, but if we want to do that with the help of the sed command then we need to know a little bit about the sed command.Let’s explore the sed command, which is short for ... Read More

How to sort a file in-place in Linux?

Mukul Latiyan
Updated on 31-Jul-2021 11:56:41

1K+ Views

In order to be able to sort the contents of a file in Linux, we must first be aware of the sort command that Linux provides us with.The sort command is mainly used to sort the contents of a file. It arranges the records in a particular manner. By default, these records are sorted considering the fact that they are ASCII based values.Few key points to remember about the sort command are −SORT command does the sorting from one line to another, one line at a time.It prints the contents of the file when used on a file, in the ... Read More

How to simulate delayed and dropped packets on Linux?

Mukul Latiyan
Updated on 31-Jul-2021 11:56:01

503 Views

In order to simulate the packages that got delayed or dropped we can make use of the netem which provides us with a network emulation functionality that is helpful in testing protocols.The way netem works is that it tests the protocols by emulating the properties of wide area networks.There are different versions of netem and the current stable version allows us to emulate variable delay, loss, re-ordering and duplication of packets.There are two ways in which we can use the network emulator, the first is the most basic one where we can enable the netem kernel component by following the ... Read More

How to show all shared libraries used by executables in Linux?

Mukul Latiyan
Updated on 31-Jul-2021 11:55:39

1K+ Views

We know that a shared library is a library that can be linked to any program at runtime. In order to view all the shared libraries used by an executable we make use of the Linux command utility known as ldd. We can easily locate the shared libraries on a Linux machine, as they usually start with lib* prefix.Let’s first understand and see examples of how to make use of the ldd command that Linux provides us with.Ldd is a command utility that Linux provides us with and is mostly used in case we want to know the shared library ... Read More

How to set the GOPATH environment variable on Ubuntu?

Mukul Latiyan
Updated on 31-Jul-2021 11:55:07

8K+ Views

Before setting up GOPATH or GOROOT on the local environment of yours, we must check whether you have correctly installed Go or not.Just type the following command on any user of the machine, where you think you have installed Go −go versionIf it outputs nothing or something like go is not present, then instead of setting the GOPATH first I would recommend that you first download the go binary from this link and then install it on your local machine.Normally the output for the case that you have Go installed will look something like this −immukul@192 linux-questions-code % go version ... Read More

How to set the environmental variable LD_LIBRARY_PATH in Linux?

Mukul Latiyan
Updated on 30-Jul-2021 09:18:06

6K+ Views

There are plenty of ways in which we can set an environment variable in Linux and then make use of it later. Some ways provide us access to that variable in a particular window, in other cases, we can get access to those variables in every terminal window and in a permanent manner.Let’s explore setting a new environment variable on an Ubuntu machine and then we can talk about setting the LD_LIBRARY_PATH.In order to set a new environment variable, follow the commands shown below in sequence.Command 1Open your bash-profile with the command shown below −vi ~/.bashrcCommand 2Make use of the ... Read More

How to set a proxy for wget on Linux?

Mukul Latiyan
Updated on 30-Jul-2021 09:17:16

579 Views

Wget is a Linux command line utility that is used to retrieve files from World Wide Web(WWW) and makes use of protocols like HTTPS and FTP. It is a freely available package and can be downloaded and installed on any Linux supporting architecture.One of the key features of wget is its ability to automatically start downloading where it was left off in case there is a network issue. It should also be noted that it deletes files recursively and it will keep trying to download all the files until it has been retrieved completely.Installing wgetFor Ubuntu/Fedorasudo apt-get install wgetFor Mac ... Read More

How to see top processes sorted by actual memory usage on Linux?

Mukul Latiyan
Updated on 30-Jul-2021 09:16:08

316 Views

Linux provides the famous top command utility that provides us with all the information about the processes, their time, their respective IDs, how much CPU chunk they are consuming and much more. The only issue with that is the processes are not sorted in any order and the order changes frequently.There are certain cases where we would like the output to be in a sorted manner somehow, like sorted in the sense that the process which is using the most memory will be at the top.The most basic approach is to make use of the ps command that Linux provides ... Read More

How to search contents of multiple pdf files on Linux?

Mukul Latiyan
Updated on 30-Jul-2021 09:12:58

1K+ Views

The pdfgrep command in Linux is used to filter searches for a particular pattern of characters in a PDF or multiple PDFs. It is one of the most used Linux utility commands to display the lines that contain the pattern that we are trying to search.Normally, the pattern that we are trying to search in the file is referred to as the regular expression.Installing Pdf grepFor Ubuntu/Fedorasudo apt-get update -ysudo apt-get install -y pdfgrepFor CentOSyum install pdfgrepSyntaxpdfgrep [options...] pattern [files] While there are plenty of different options available to us, some of the most used are −-c : counts the ... Read More

Advertisements