119 Answered Questions for the topic Linux

06/30/19

./configure : /bin/sh^M : bad interpreter?

I've been trying to install lpng142 on my fed 12 system. Seems like a problem to me. I get this error [root@localhost lpng142]# ./configure bash: ./configure: /bin/sh^M: bad interpreter: No such... more

Chmod 777 to a folder and all contents?

I have a web directory `/www` and a folder in that directory called `store`. Within `store` are several files and folders. I want to give the folder `store` and all files and folders within the... more
Linux Memory Process

06/28/19

How to measure actual memory usage of an application or process?

**This question is covered [here][1] in great detail.** How do you measure the memory usage of an application or process in Linux? From the blog article of [Understanding memory usage on... more
Linux Bash Shell

06/27/19

How do I test if a variable is a number in Bash?

I just can't figure out how do I make sure an argument passed to my script is a number or not. All I want to do is something like this: test *isnumber* $1 && VAR=$1 || echo "need a... more

06/27/19

How do I delete an exported environment variable?

Before installing gnuplot, I set the environment variable `GNUPLOT_DRIVER_DIR = /home/gnuplot/build/src`. During the installation, something went wrong. I want to remove the `GNUPLOT_DRIVER_DIR`... more

06/27/19

Quickly create a large file on a Linux system?

How can I **quickly** create a large file on a Linux ([Red Hat Linux][1]) system? [dd][2] will do the job, but reading from `/dev/zero` and writing to the drive can take a long time when you need... more

How do I use sudo to redirect output to a location I don't have permission to write to?

I've been given sudo access on one of our development RedHat linux boxes, and I seem to find myself quite often needing to redirect output to a location I don't normally have write access to. The... more
Linux Bash Shell

06/24/19

Defining a variable with or without export?

What is `export` for? What is the difference between: export name=value and name=value

06/21/19

How to recursively find and list the latest modified files in a directory with subdirectories and times?

- Operating system: Linux - Filesystem type: ext3 - Preferred solution: bash (script/oneliner), ruby, python I have several directories with several subdirectories and files in them. I need to... more

06/21/19

How to keep environment variables when using sudo?

When I use any command with sudo the environment variables are not there. For example after setting HTTP_PROXY the command `wget` works fine without `sudo`. However if I type `sudo wget` it says it... more
Linux Shell

06/20/19

How can I recursively find all files in current and subfolders based on wildcard matching?

How can I recursively find all files in current and subfolders based on wildcard matching?
Linux Bash Datetime

06/20/19

Get current time in seconds since the Epoch on Linux, Bash?

I need something simple like `date`, but in seconds since 1970 instead of the current date, hours, minutes, and seconds. `date` doesn't seem to offer that option. Is there an easy way?
Linux Shell

06/20/19

Why doesn't "cd" work in a shell script?

I'm trying to write a small script to change the current directory to my project directory: #!/bin/bash cd /home/tree/projects/java I saved this file as proj, added execute permission with... more
Linux Stream Pipe Bash

06/20/19

How can I redirect and append both stdout and stderr to a file with Bash?

To redirect *stdout* to a truncated file in Bash, I know to use: cmd > file.txt To redirect *stdout* in Bash, appending to a file, I know to use: cmd >> file.txt To redirect both... more
Linux Docker

06/19/19

Docker can't connect to docker daemon?

After I update my Docker version to `0.8.0`, I get an error message while entering `sudo docker version`: Client version: 0.8.0 Go version (client): go1.2 Git commit (client): cc3a8c8 ... more

06/19/19

Clear a terminal screen for real?

Using the `clear` command on the terminal only fools the user into thinking the screen has been cleared...you can still see output from the previous commands when you scroll using the mouse. This... more
Linux Ubuntu Shell File

06/18/19

How to append one file to another in Ubuntu Linux?

I have two files: `file1` and `file2`. How do I append the contents of `file2` to `file1` so that contents of `file1` persist the process?

06/13/19

What's the best way to send a signal to all members of a process group?

I want to kill a whole process tree. What is the best way to do this using any common scripting languages? I am looking for a simple solution.
Linux

06/12/19

Recursively counting files in a Linux directory?

How can I recursively count files in a Linux directory? I found this: find DIR_NAME -type f ¦ wc -l But when I run this it returns the following error. > find: paths must precede... more
Linux Bash Shell Sh

06/12/19

What does set -e mean in a bash script?

I'm studying the content of this **preinst** file that the script executes before that package is unpacked from its Debian archive (.deb) file. The script has the following code: #!/bin/bash ... more
Linux Bash Cp

06/12/19

How to have the cp command create any necessary folders for copying a file to a destination?

When copying a file using `cp` to a folder that may or may not exist, how do I get `cp` to create the folder if necessary? Here is what I have tried: <!-- language:none --> [root@file... more
Linux Bash Shell

06/11/19

Get program execution time in the shell?

I want to execute something in a linux shell under a few different conditions, and be able to output the execution time of each execution. I know I could write a perl or python script that would... more
Linux Php Php Ini

06/05/19

Where is my php.ini file located on the server?

A few years ago I installed Apache 2.2x and PHP 5.3.1 on a Linux server I maintain. I used .tar.gz's and built them as instructed (instead of rpms and what-have-you). And all was fine. Today I... more

06/05/19

How do I change permissions for a folder and all of its subfolders and files in one step in Linux?

I would like to change permissions of a folder and all its sub folders and files in one step (command) in Linux. I have already tried the below command but it works only for the mentioned... more
Linux Bash

06/05/19

Bash ignoring error for a particular command?

I am using following options set -o pipefail set -e In bash script to stop execution on error. I have 100 of script executing and I don't want to check return code of the script. But for a... more

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.