Most Popular
1500 questions
207
votes
4 answers
Where are Apache file access logs stored?
Does anyone know where file access logs are stored, so I can run a tail -f command in order to see who is accessing a particular file.
I have XAMPP, which is an Apache server installed on my machine, which automatically logs the accesses. It is…

AkshaiShah
- 3,629
206
votes
2 answers
In CentOS, what is the difference between yum update and yum upgrade?
What is the difference between yum update and yum upgrade, and when should I use one over the other?

Lester Peabody
- 2,399
206
votes
5 answers
grep returns "Binary file (standard input) matches" when trying to find a string pattern in file
I'm on Ubuntu and I typed cat .bash_history | grep git and it returned
Binary file (standard input) matches
My bash_history does exist and there are many lines in it that starts with git.
What caused it to display this error and how can I fix it?

answerSeeker
- 2,417
206
votes
9 answers
Split string by delimiter and get N-th element
I have a string:
one_two_three_four_five
I need to save in a variable A value two and in variable B value fourfrom the above string
I am using ksh.

Alex
- 2,325
206
votes
8 answers
What color codes can I use in my Bash PS1 prompt?
I used several colors in my bash PS1 prompt such as:
\033]01;31\] # pink
\033]00m\] # white
\033]01;36\] # bold green
\033]02;36\] # green
\033]01;34\] # blue
\033]01;33\] # bold yellow
Where can I find a list of the color codes I can use?
I…

Michael Durrant
- 42,013
206
votes
5 answers
do changes in /etc/security/limits.conf require a reboot?
Do changes in /etc/security/limits.conf require a reboot before taking effect?
For example, if I have a script that sets the following limits in /etc/security/limits.conf, does this require a system reboot before those limits will take effect?
*…

Alexej Magura
- 4,466
- 7
- 26
- 39
205
votes
2 answers
How to suspend and resume processes
In the bash terminal I can hit Control+Z to suspend any running process... then I can type fg to resume the process.
Is it possible to suspend a process if I only have it's PID? And if so, what command should I use?
I'm looking for something…

Stefan
- 25,300
204
votes
8 answers
Using the not equal operator for string comparison
I tried to check if the PHONE_TYPE variable contains one of three valid values.
if [ "$PHONE_TYPE" != "NORTEL" ] || [ "$PHONE_TYPE" != "NEC" ] ||
[ "$PHONE_TYPE" != "CISCO" ]
then
echo "Phone type must be nortel,cisco or nec"
exit
fi
The…

munish
- 7,987
204
votes
4 answers
What is the point of Ctrl-S?
Ctrl+S stops all output to the terminal which can be restarted with Ctrl+Q.
But, why does Ctrl+S exist in the first place? What problem was trying to be solved by putting that control sequence in place?

Jeff King
- 2,175
204
votes
13 answers
How to start tmux with attach if a session exists
If I use
tmux attach
I can attach to a running session but if there is no session running, I only get the error
no sessions
How can I automatically start a new session if there is none running? something like
tmux attach-or-create-new-session

rubo77
- 28,966
203
votes
5 answers
Is it possible to find out the hosts in the known_hosts file?
I would like to see what hosts are in my known_hosts file but it doesn't appear to be human readable. Is it possible to read it?
More specifically there is a host that I can connect to via several names and I want to find out what the fingerprint I…

Colin Newell
- 2,133
203
votes
3 answers
In Arch Linux how can I find out which package to install that will contain file X?
I'm looking for a package that provides a specific binary, so I can install it. how can I search to find out what packages provide this binary? (note: I know there's at least one tool that does this, but I have forgotten its name.)

xenoterracide
- 59,188
- 74
- 187
- 252
203
votes
3 answers
Quoting within $(command substitution) in Bash
In my Bash environment I use variables containing spaces, and I use these variables within command substitution.
What is the correct way to quote my variables? And how should I do it if these are nested?
DIRNAME=$(dirname "$FILE")
or do I quote…

CousinCocaine
- 2,195
203
votes
14 answers
Batch renaming files
I have a directory full of images:
image0001.png
image0002.png
image0003.png
...
And I would like a one-liner to rename them to (say).
0001.png
0002.png
0003.png
...
How do I do this?

Internet man
- 3,641
202
votes
20 answers
Is there an easy way to replace duplicate files with hardlinks?
I'm looking for an easy way (a command or series of commands, probably involving find) to find duplicate files in two directories, and replace the files in one directory with hardlinks of the files in the other directory.
Here's the situation: This…

Josh
- 8,449