Found 2003 Articles for Operating System

How to create a CPU spike with bash command on Linux?

Mukul Latiyan
Updated on 29-Jul-2021 11:51:59

1K+ Views

If you have been programming, then you might have observed certain cases and scenarios where the program gets stuck or the process is running in an infinite loop which in turn puts pressure on the core of that thread which is handling that process.There are many such cases where this is quite a possibility.We usually make use of different techniques to avoid such cases, like handling them in code logic itself or using third party tools to deal with them.Linux also provides us with a command that we can use to keep track of the different parameters of the CPU ... Read More

How to compare the files available in two directories using diff command in Linux?

Mukul Latiyan
Updated on 29-Jul-2021 11:47:26

967 Views

Let’s consider a case where we have two directories, say, d1 and d2 and both these directories contain some files, which may be the same or different. Now we want to compare the files that are present in both these directories and by comparison we need to print out what files are different, what files are the same and in what directory.In order to do that we must be familiar with either the diff command as the diff commands can be used to solve the above problem.Let’s first explore the diff command, which is short for difference. This command is ... Read More

How to check the syntax of a Bash script without running it in Linux?

Mukul Latiyan
Updated on 29-Jul-2021 11:44:39

398 Views

There are always chances that we will make some type of error whenever we are programming. Compilers and interpreters are always there to help us in these cases, but in order to use them we must run the program or some sort of an IDE that constantly checks for these errors and reminds us every time, so that we can correct them.What if we don’t want to write our code in a fancy IDE and also don’t want to run the program either, in that case we are left with very few options if any. In case you are writing ... Read More

How to check if a particular service is running on Ubuntu?

Mukul Latiyan
Updated on 29-Jul-2021 11:43:20

4K+ Views

We know that we can make use of the top command to print all the processes that are running in the background. Though the top command is used to print the list of processes or threads that are currently managed by the Linux kernel, it is still not a convenient way to check if a particular service is running in the background or not.In order to understand how to check whether a particular service is running or not, we first must understand what a service actually means in Linux. A service is basically a process or group of processes that ... Read More

How to change the root directory of an Apache server on Linux?

Mukul Latiyan
Updated on 29-Jul-2021 11:40:59

2K+ Views

Apache web server is one of the most used web servers across all the platforms even after including different Linux distributions and windows. Apache server is an open source HTTP server that is mainly used to deliver web content and can also be used to serve many queries at once.In this article, I will try to explain how to change the root directory for Apache web server.It is usually the case that to change the root directory we must first be aware of its exact location and in the case of the Apache server, the root directory which is also ... Read More

How to activate virtualenv on Linux?

Mukul Latiyan
Updated on 29-Jul-2021 11:39:29

1K+ Views

When we talk about keeping our dependencies in a separate location from our logic code we are indeed creating nothing but a virtual environment, which in python, we usually use the term venv to refer to as.So a venv is nothing but a virtual environment which is in turn a tool that allows us to keep our dependencies that are required by the project to be kept in a separate folder. These separate folders that we create are known as the python virtual environments.Python venv is one of the most widely used tools.Now we know what virtualenv is and what ... Read More

How should strace be used on Linux?

Mukul Latiyan
Updated on 29-Jul-2021 11:35:44

155 Views

Linux utility commands are what makes Linux such a powerful operating system, while there are plenty of commands that we can use to interact and get information about the signals and system calls, but the most used and preferred command when it comes to getting the information about the system calls and signals is the linux trace command.It can be used for getting a diagnosis of the system, for monitoring specific processes or instruction tools of Linux. It has variety of use cases and some of these use cases are −Print timestamp for each system callOutput line with clock timeTrace ... Read More

How to send a file as an email attachment using the Linux command line?

Mukul Latiyan
Updated on 29-Jul-2021 11:32:50

4K+ Views

In order to send a file as an attachment to an email using Linux, we either need to make use of a command line email client or the standard linux mail command.There are multiple command line email clients available to achieve the attachment task, but the most common and widely used is mutt.Mutt is a command line based email client that allows us to send and read emails from command line in Linux based systems. It also supports important protocols like IMAP and POP which broadens the use-cases and application of mutt.Some of the key features that Mutt has are ... Read More

How to list one filename per output line in Linux?

Mukul Latiyan
Updated on 29-Jul-2021 11:31:08

3K+ Views

There are plenty of Linux utility commands present to print the list of all the files and folders that are present in the current directory. Most commonly used are the ls and the find command.Let’s explore a simple example where we will make use of the ls command to list all the files and the folders present in a particular directory.CommandlsOutputapi cluster docs LICENSE Makefile.generated_files pkg staging vendor build cmd go.mod LICENSES _output pluginOn Ubuntu, we get the output in the above format, ... Read More

How to increase the scrollback buffer in a running screen session on Linux?

Mukul Latiyan
Updated on 29-Jul-2021 11:29:23

816 Views

Screen or sometimes also known as GNU Screen, is a terminal multiplexer. What it means is that it allows you the privilege to start a screen session and then open any number of windows inside that session.It might also be interesting to note that a process that is running in Screen will continue to run even when their window is not visible anymore.Installing Linux ScreenIn order to install the screen package if it is not already present on your linux distribution, you can run any of the suitable commands shown below for your machine.For Ubuntu and Debiansudo apt update sudo ... Read More

Advertisements