Questions tagged [linux]
NOTICE: All Linux questions must be related to programming; those that aren't will be closed. Use this tag only if your question relates to programming using Linux APIs or Linux-specific behavior, not just because you happen to run your code on Linux. If you need Linux support, you can try https://unix.stackexchange.com or the specific Linux distribution's Stack Exchange site like https://askubuntu.com or https://elementaryos.stackexchange.com/
linux
227,880
questions
7541
votes
56
answers
11.2m
views
Find all files containing a specific text (string) on Linux?
How do I find all files containing a specific string of text within their file contents?
The following doesn't work. It seems to display every single file in the system.
find / -type f -exec grep -H '...
3034
votes
19
answers
4.7m
views
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?
2783
votes
33
answers
2.0m
views
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?
2432
votes
7
answers
1.7m
views
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 ...
2235
votes
18
answers
2.3m
views
How can I symlink a file in Linux? [closed]
I want to create a symbolic link in Linux. I have written this Bash command where the first path is the folder I want to link, and the second path is the compiled source.
ln -s '+basebuild+'/IpDome-...
2223
votes
49
answers
1.8m
views
How do I exclude a directory when using `find`?
How do I exclude a specific directory when searching for *.js files using find?
find . -name '*.js'
2193
votes
27
answers
2.3m
views
How do I recursively grep all directories and subdirectories?
How do I recursively grep all directories and subdirectories?
find . | xargs grep "texthere" *
2177
votes
19
answers
5.2m
views
How do I change permissions for a folder and its subfolders/files? [closed]
How do I change the permissions of a folder and all its subfolders and files?
This only applies to the /opt/lampp/htdocs folder, not its contents:
chmod 775 /opt/lampp/htdocs
How do I set chmod 755 ...
2155
votes
20
answers
724k
views
How do I profile C++ code running on Linux?
How do I find areas of my code that run slowly in a C++ application running on Linux?
2132
votes
16
answers
2.8m
views
Looping through the content of a file in Bash
How do I iterate through each line of a text file with Bash?
With this script:
echo "Start!"
for p in (peptides.txt)
do
echo "${p}"
done
I get this output on the screen:
Start!
./runPep.sh: ...
1889
votes
39
answers
1.4m
views
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?
1809
votes
5
answers
203k
views
What is ':-!!' in C?
I bumped into this strange macro code in /usr/include/linux/kernel.h:
/* Force a compilation error if condition is true, but also produce a
result (of value 0 and type size_t), so the expression ...
1619
votes
12
answers
1.1m
views
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 'output').
Is ...
1571
votes
23
answers
1.2m
views
Merge / convert multiple PDF files into one PDF [closed]
How could I merge / convert multiple PDF files into one large PDF file?
I tried the following, but the content of the target file was not as expected:
convert file1.pdf file2.pdf merged.pdf
I need ...
1495
votes
3
answers
1.1m
views
How can I use grep to show just filenames on Linux? [closed]
How can I use grep to show just file-names (no in-line matches) on Linux?
I am usually using something like:
find . -iname "*php" -exec grep -H myString {} \;
How can I just get the file-...