228,119
questions
7570
votes
56
answers
11.4m
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 '...
3047
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?
2803
votes
34
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?
2467
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 ...
2250
votes
18
answers
2.4m
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-...
2240
votes
49
answers
1.9m
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'
2205
votes
27
answers
2.4m
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.3m
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 ...
2166
votes
20
answers
730k
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?
2150
votes
15
answers
2.9m
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: ...
1895
votes
40
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?
1810
votes
5
answers
204k
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 ...
1635
votes
12
answers
1.2m
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 ...
1587
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 ...
1505
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-...