Most Popular
1500 questions
77
votes
2 answers
Slash and backslash in sed
I want to use sed to change a slash into a backslash and a slash, i.e. / -> \/. But it does not work. Here a small example:
#!/bin/bash
TEST=/etc/hallo
echo $TEST
echo $TEST | sed "s/hallo/bello/g"
echo $TEST | sed "s/\//\\\//g"
The output of the…
devopsfun
- 1,377
- 6
- 16
- 24
77
votes
8 answers
How to disable SSLv3 in Apache?
Everybody seems to be talking about the POODLE vulnerability today. And everybody recommends disabling SSLv3 in Apache using the following configuration directive:
SSLProtocol All -SSLv2 -SSLv3
instead of the default
SSLProtocol All -SSLv2
I've…
Bogdan Stăncescu
- 911
- 1
- 6
- 9
77
votes
7 answers
How to dump a man page?
How can I 'cat' a man page like I would 'cat' a file to get just a dump of the contents?
LanceBaynes
- 39,295
- 97
- 250
- 349
77
votes
7 answers
Parenthesis in expr arithmetic: 3 * (2 + 1)
expr does not seem to like parenthesis (used in mathematics to explicit operator priority):
expr 3 * (2 + 1)
bash: syntax error near unexpected token `('
How to express operator priority in bash?
Nicolas Raoul
- 7,945
- 14
- 43
- 55
77
votes
7 answers
Can overwritten files be recovered?
I am not talking about recovering deleted files, but overwritten files. Namely by the following methods:
# move
mv new_file old_file
# copy
cp new_file old_file
# edit
vi existing_file
> D
> i new_content
> :x
Is it possible to retrieve anything…
Question Overflow
- 4,568
- 19
- 57
- 84
77
votes
12 answers
Copy-paste for vim is not working when mouse (:set mouse=a) is on?
I was trying to copy paste something from vim to another application and also, from that application to vim using right click with mouse and then copy and paste (or with Ctrl+v and Ctrl+c and also tried the Command version for mac OSX, obviously.).…
Charlie Parker
- 1,497
- 3
- 16
- 28
77
votes
2 answers
Getting "Not found" message when running a 32-bit binary on a 64-bit system
I have currently a strange problem on debian (wheezy/amd64).
I have created a chroot to install a server (i can't give any more detail about it, sorry). Let's call its path /chr_path/.
To make things easy, I have initialized this chroot with a…
Elenaher
- 949
- 1
- 7
- 8
77
votes
5 answers
Pass shell variable as a /pattern/ to awk
Having the following in one of my shell functions:
function _process () {
awk -v l="$line" '
BEGIN {p=0}
/'"$1"'/ {p=1}
END{ if(p) print l >> "outfile.txt" }
'
}
, so when called as _process $arg, $arg gets passed as $1, and used as a…
branquito
- 1,017
- 1
- 9
- 17
77
votes
4 answers
echo bytes to a file
I'm trying to connect my rasberry Pi to some display using the i2c bus.
To get started I wanted to manually write stuff, bytes in particular to a file.
How do you write specific bytes to a file?
I already read that one and I figured my problem…
Mark
- 1,149
- 3
- 9
- 18
77
votes
4 answers
How can I test the encoding of a text file... Is it valid, and what is it?
I have several .htm files which open in Gedit without any warning/error, but when I open these same files in Jedit, it warns me of invalid UTF-8 encoding...
The HTML meta tag states "charset=ISO-8859-1". Jedit allows a List of fallback encodings and…
Peter.O
- 32,426
- 28
- 115
- 163
77
votes
1 answer
How do I force remove a package in Arch with pacman?
How do I force remove a package in Arch with pacman while other packages still depend upon it.
pacman -R perl-libwww
checking dependencies...
error: failed to prepare transaction (could…
xenoterracide
- 57,918
- 74
- 184
- 250
76
votes
6 answers
How to check if Bash can print colors
I want to know if there's any way to check if my program can output terminal output using colors or not.
Running commands like less and looking at the output from a program that outputs using colors, the output is displayed incorrectly, like…
Angelo Vargas
- 873
- 1
- 7
- 11
76
votes
6 answers
Unzip file contents, but without creating archive folder
I have a file myarchive.zip that contains many directories, files, etc. Let's say this myarchive.zip file lives in a directory called "b". Well, when I use the "unzip myarchive.zip" command, the system creates a directory by default called…
ScoobaSteve
- 861
- 1
- 6
- 4
76
votes
2 answers
What does the 'd' mean in ls -al results and what is that slot called?
In Linux, what does the d mean in the first position of drwxr-xr-x? And what are all of the possible letters that could be there, and what do they mean?
I'm trying to learn more about the Linux file permissions system, and I'd like to see a list of…
Eric Leschinski
- 3,011
- 1
- 23
- 21
76
votes
2 answers
How do I perform a reverse history search in ZSH's vi-mode?
I use vim for essentially all my editing needs, so I decided to once again try vi-mode for my shell (currently ZSH w/ oh-my-zsh on OS X), but I find myself trying (and failing) to use Ctrl-R constantly. What's the equivalent key-binding? And for…
Hank Gay
- 3,489
- 4
- 24
- 27