Found 2003 Articles for Operating System

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

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

2K+ 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

9K+ 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

755 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

434 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

How to run a crontab job every week on Sunday?

Mukul Latiyan
Updated on 30-Jul-2021 09:11:47

881 Views

In order to create a crontab job to run every Sunday, we first need to explore and understand what a crontab job is.A crontab is nothing but a list of commands that we can run during a cron job. A cron job is a utility that schedules automatic execution of commands at specific times.We can start a cron job with the help of bash script by following the commands shown below −crontab -eThis will open a file which you can edit, insert the cron job shell script in the above file and then close that file.Just insert the code shown ... Read More

How to resume a partially transferred file over ssh on Linux?

Mukul Latiyan
Updated on 30-Jul-2021 09:10:50

874 Views

There is always a scenario where we sometimes encounter the transfer of files to be broken because of some reason. The reasons could be different, unless it is not that you explicitly closed the particular connection or process, it can be recovered.It should also be noted that the scp command doesn’t have a resume option, and the only option is to simply start copying the files from the beginning and overwrite the existing files. The process of doing this again and again because of the ssh disconnection can be very annoying and time consuming.Linux does provide us with a command ... Read More

How to replace spaces in file names using bash script on Linux?

Mukul Latiyan
Updated on 30-Jul-2021 09:09:51

591 Views

Consider a case in which one directory on my local machine looks something like this −immukul@192 dir1 % ls -ltr total 0 -rw-r--r-- 1 immukul staff 0 Jul 3 20:44 sample code.txt -rw-r--r-- 1 immukul staff 0 Jul 3 20:44 sample code with love.txtIn the above directory named dir1, there are two .txt files present and both these files have spaces in between the words in their name, and we need to replace these spaces using a bash script on Linux.In order to achieve what we want, we must first be aware of the fact that we can traverse the ... Read More

How to quickly sum all the numbers in a file on Linux?

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

6K+ Views

Consider that we have a file named bar that contains different numbers inside it. The bar file looks something like thisimmukul@192 linux-questions-code % cat bar 11 12 13We need to get the sum of all the numbers present in the above file.There are plenty of approaches and solutions that we can consider that involve different commands and keywords. Let’s consider some of these possible solutions one by one.The most basic approach is to open the file and read the contents and then calculate the sum of all the numbers by making use of the do while loop.Bash Scriptsum=0 while read ... Read More

Advertisements