155 Answered Questions for the topic Linux
05/28/19
mysql_config not found when installing mysqldb python interface?
I am trying to get a Python script to run on the linux server I'm connected to via ssh. The script uses mysqldb. I have all the other components I need, but when I try to install mySQLdb via...
more
05/27/19
Use Matlab Raspberry PI Support Package function in Simulink as Matlab Function Block?
I'm new to Matlab and Simulink and I need to get a simulation run on the Raspberry PI. For interaction I use the Raspberry PI Support Package of Matlab. I use the following code to open the...
more
In Unix, can I run 'make' in a directory without cd'ing to that directory first?
In Unix, can I run 'make' in a directory without cd'ing to that directory first?
05/26/19
How to assign name for a screen?
I'm using the `screen` multiplexer tool on the command shell and open a lot of screens. I then forget which process ID associates with which task.
I would like to set a name for a screen but can't...
more
05/26/19
Why does the C preprocessor interpret the word "linux" as the constant "1"?
Why does the C preprocessor in GCC interpret the word `linux` (small letters) as the constant `1`?
test.c:
#include <stdio.h>
int main(void)
{
int linux = 5;
return 0;
}
Result of...
more
usr/bin/ld: cannot find -l<nameOfTheLibrary>?
I'm trying to compile my program and it returns this error :
usr/bin/ld: cannot find -l<nameOfTheLibrary>
in my makefile I use the command `g++` and link to my library which is a symbolic...
more
05/22/19
What does "opt" mean (as in the "opt" directory)? Is it an abbreviation?
What does "opt" mean (as in the "opt" directory)? I commonly see this directory in Unix systems with development tools inside.
Is it an abbreviation?
How to convert DOS/Windows newline (CRLF) to Unix newline (LF) in a Bash script?
How can I programmatically (i.e., not using `vi`) convert DOS/Windows newlines to Unix?
The `dos2unix` and `unix2dos` commands are not available on certain systems. How can I emulate these with...
more
Is there a way for non-root processes to bind to "privileged" ports on Linux?
It's very annoying to have this limitation on my development box, when there won't ever be any users other than me.
I'm aware of [the standard workarounds][1], but none of them do exactly what I...
more
05/20/19
How to determine whether a given Linux is 32 bit or 64 bit?
When I type `uname -a`, it gives the following output.
Linux mars 2.6.9-67.0.15.ELsmp #1 SMP Tue Apr 22 13:50:33 EDT 2008 i686 i686 i386 GNU/Linux
How can I know from this that the given OS is...
more
05/17/19
Kill detached screen session?
I learned from somewhere a detached screen can be killed by
> screen -X -S [session # you want to kill] kill
where [session # you want to kill] can be gotten from
> screen -ls
.
But this...
more
Linux Command Line
05/17/19
Linux command to print directory structure in the form of a tree?
Is there any linux command that I can call from a Bash script that will print the directory structure in the form of a tree, e.g.,
folder1
a.txt
b.txt
folder2
folder3
How to redirect output to a file and stdout?
In bash, calling `foo` would display any output from that command on the stdout.
Calling `foo > output` would redirect any output from that command to the file specified (in this case...
more
Linux Cp
05/16/19
How do I copy folder with files to another folder in Unix/Linux?
I am having some issues to copy a folder with files in that folder into another folder. Command `cp -r` doesn't copy files in the folder.
Linux Unix
05/16/19
How to list all users in a Linux group?
How do I list all members of a group in Linux (and possibly other unices)?
How can I recall the argument of the previous bash command?
Is there a way in Bash to recall the argument of the previous command?
I usually do `vi file.c` followed by `gcc file.c`.
Is there a way in Bash to recall the argument of the previous command?
Linux Microsoft Word
05/14/19
How to extract images from Word Document from Linux?
Is there a (Linux) command-line tool to extract all the images from a MS Word document, (preferably one that could handle the .docx format)?
C fopen vs open?
Is there any reason (other than syntactic ones) that you'd want to use FILE *fdopen(int fd, const char *mode);or FILE *fopen(const char *path, const char *mode);instead of int open(const...
more
Remove a symlink to a directory?
I have a symlink to an important directory. I want to get rid of that symlink, while keeping the directory behind it.
I tried `rm` and get back `rm: cannot remove 'foo'`.
I tried `rmdir` and got...
more
How can I exclude directories from grep -R?
I want to traverse all subdirectories, except the "node_modules" directory.
Replacing some characters in a string with another character?
I have a string like
<!-- language: lang-none -->
AxxBCyyyDEFzzLMN
I want to replace all `x` and `y` and `z` with `_` so that the output is
A_BC_DEF_LMN
How to do that?
I know a...
more
05/11/19
What does the number in parentheses shown after Unix command names in manpages mean?
For example: man(1), find(3), updatedb(2)? What do the numbers in parentheses (Brit. "brackets") mean?
05/09/19
How to change the output color of echo in Linux?
I am trying to print a text in the terminal using echo command.
I want to print the text in a red color. How can I do that?
How do I prompt for Yes/No/Cancel input in a Linux shell script?
I want to pause input in a shell script, and prompt the user for choices. The standard 'Yes, No, or Cancel' type question. How do I accomplish this in a typical bash prompt?
05/06/19
How to force cp to overwrite without confirmation?
I'm trying to use the `cp` command and force an overwrite.
I have tried `cp -rf /foo/* /bar`, but I am still prompted to confirm each overwrite.
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.