Most Popular
1500 questions
191
votes
9 answers
Why would someone choose FreeBSD over Linux?
Why would someone choose FreeBSD over Linux? What are the advantages of FreeBSD compared to Linux? (My shared hosting provider uses FreeBSD.)
ilhan
- 2,233
- 4
- 16
- 14
191
votes
3 answers
Easily unpack DEB, edit postinst, and repack DEB
I'm attempting to install Intel's OpenCL SDK but the DEB files are buggy conversions from RPM (see here for the curious). I need to edit the postinst script in the DEB they provide.
How can I take an existing DEB, extract the contents (including…
John Jumper
- 2,015
- 2
- 12
- 6
190
votes
12 answers
How to find out from the logs what caused system shutdown?
E.g. I'm seeing this in /var/log/messages:
Mar 01 23:12:34 hostname shutdown: shutting down for system halt
Is there a way to find out what caused the shutdown? E.g. was it run from console, or someone hit power button, etc.?
alex
- 7,093
- 6
- 28
- 30
190
votes
6 answers
how can I add (subtract, etc.) two numbers with bash?
I can read the numbers and operation in with:
echo "First number please"
read num1
echo "Second number please"
read num2
echo "Operation?"
read op
but then all my attempts to add the numbers fail:
case "$op" in
"+")
echo num1+num2;;
"-")
…
Michael Durrant
- 41,213
- 69
- 165
- 232
190
votes
5 answers
How to uppercase the command line argument?
I searched SO and found that to uppercase a string following would work
str="Some string"
echo ${str^^}
But I tried to do a similar thing on a command-line argument, which gave me the following error
Tried
#!/bin/bash
## Output
echo…
mtk
- 26,802
- 35
- 91
- 130
190
votes
6 answers
How do I grep recursively through .gz files?
I am using a script to regularly download my gmail messages that compresses the raw .eml into .gz files. The script creates a folder for each day, and then compresses every message into its own file.
I would like a way to search through this archive…
Kendor
- 2,001
- 2
- 12
- 5
189
votes
12 answers
What are the pros/cons of deb vs. rpm?
For whatever reasons, I've always used RPM based distributions (Fedora, Centos and currently openSUSE). I have often heard it stated that deb is better than rpm, but when asked why, have never been able to get a coherent answer (usually get some…
Evan
- 2,041
- 2
- 13
- 8
189
votes
8 answers
cat line X to line Y on a huge file
Say I have a huge text file (>2GB) and I just want to cat the lines X to Y (e.g. 57890000 to 57890010).
From what I understand I can do this by piping head into tail or viceversa, i.e.
head -A /path/to/file | tail -B
or alternatively
tail -C…
Amelio Vazquez-Reina
- 40,169
- 77
- 197
- 294
189
votes
5 answers
Is there a way to redirect nohup output to a log file other than nohup.out?
I frequently use the program nohup so that my processes are immune to hangups. So if I want to make the program program immune to hangups, I use the command
nohup program &
where & puts the process in the background.
When starting, nohup gives me…
Andrew
- 16,315
- 34
- 73
- 77
189
votes
9 answers
How to redirect output of wget as input to unzip?
I have to download a file from this link. The file download is a zip file which I will have to unzip in the current folder.
Normally, I would download it first, then run the unzip command.
wget…
Andrew-Dufresne
- 5,663
- 7
- 25
- 19
188
votes
4 answers
What is the difference between /tmp and /var/tmp?
On most FHS systems, there is a /tmp folder as well as a /var/tmp folder. What is the functional difference between the two?
Wesley
- 13,963
- 12
- 35
- 49
188
votes
14 answers
How to uncompress zlib data in UNIX?
I have created zlib-compressed data in Python, like this:
import zlib
s = '...'
z = zlib.compress(s)
with open('/tmp/data', 'w') as f:
f.write(z)
(or one-liner in shell: echo -n '...' | python2 -c 'import sys,zlib;…
mykhal
- 3,061
- 2
- 18
- 16
188
votes
5 answers
Renumbering windows in tmux
I frequently end up with more than ten windows in tmux. Later on, I close some of my older ones. Is there a way to renumber, say window 15, to window 3 (which doesn't exist anymore)? Or to pack them all up again, so that there are no empty slots?…
dogbane
- 29,087
- 16
- 80
- 60
188
votes
6 answers
Too many levels of symbolic links
I created this file structure:
test/src
test/firefox
When I run this command:
ln -s test/src test/firefox
I would expect a symbolic link test/firefox/src to be created pointing to test/src, however I get this error instead:
-bash: cd: src: Too…
David Zorychta
- 1,993
- 2
- 12
- 6
187
votes
4 answers
How can I check if swap is active from the command line?
How can I check if swap is active, and which swap devices are set up, on the command line?
ptrcao
- 5,455
- 11
- 36
- 44