Most Popular
1500 questions
83
votes
2 answers
What does dead.letter files do
I find dead.letter files from time to time in my $HOME directory. What they are for?
Maciej Piechotka
- 16,578
- 11
- 57
- 93
83
votes
7 answers
How are the GPG usage flags defined in the key details listing?
When I list the details of a key I get output like this:
$ gpg --edit-key SOMEID
pub [..] created: [..] expires: [..] usage:SC
[..]
sub [..] created: [..] expires: [..] usage: E
Or even usage: SCA on another key (the master-key part).
What does…
maxschlepzig
- 56,316
- 50
- 205
- 279
83
votes
1 answer
What is the purpose of the "do" keyword in Bash for loops?
What is the purpose of the do keyword in Bash for loop syntax? To me, it feels redundant.
for i in `seq 1 2`; do echo "hi"; done
Why isn't the syntax like this?
for i in `seq 1 2`; echo "hi"; done
I'm sure that it does fill a purpose. I just want…
Fredrik Johansson
- 973
- 1
- 6
- 11
83
votes
6 answers
How can I run a specific command for each find result?
How would one run a specific command for each file that was found by using the find command? For the purpose of the question lets say that I would simply like to delete each file found by find.
FailedDev
- 933
- 1
- 6
- 6
83
votes
8 answers
Makefile include env file
I'm trying to include some env vars into a Makefile. The env file looks like:
FOO=bar
BAZ=quux
Note there's no leading export to each env var. If I add the leading export and just include the env file in the Makefile, everything works as it should.…
Michael Irwin
- 933
- 1
- 6
- 5
83
votes
4 answers
Copy file to xclip and paste to Firefox
I'm coping file to xclip
cat file.txt | xclip
I'm pasting without problem with
xclip -o
When I want to paste it to Firefox with Ctrl+V it pastes old text (that shouldn't already be in the clipboard).
When I go back to terminal and run xclip -o it…
xralf
- 16,149
- 29
- 101
- 149
83
votes
2 answers
When is dd suitable for copying data? (or, when are read() and write() partial)
Short version: In what circumstances is dd safe to use for copying data, safe meaning that there is no risk of corruption due to a partial read or write?
Long version — preamble: dd is often used to copy data, especially from or to a device…
Gilles 'SO- stop being evil'
- 807,993
- 194
- 1,674
- 2,175
83
votes
8 answers
get first X characters from the cat command?
I have a text file I'm outputting to a variable in my shell script. I only need the first 50 characters however.
I've tried using cat ${filename} cut -c1-50 but I'm getting far more than the first 50 characters? That may be due to cut looking for…
jkj2000
- 1,109
- 2
- 9
- 9
83
votes
5 answers
How do I start all shell sessions in a directory other than $HOME?
When I open my non-login shell in Ubuntu, my present working directory is /home/user_name (my $HOME environment variable), but I want to change this such that when I start my terminal I am in some other directory.
I have read that when I start my…
user3091069
- 931
- 1
- 6
- 3
83
votes
2 answers
Discovering metadata about a PDF
Suppose I have a PDF and I want to obtain whatever metadata is available for that PDF. What utility should I use?
I find the piece of information I am usually most interested in knowing is the paper size, something that PDF viewers usually don't…
Faheem Mitha
- 34,649
- 32
- 119
- 183
83
votes
1 answer
How to list files in a zip without extra information in command line
In my bash command line, when I use unzip -l test.zip I get the output like this:
Archive: test.zip
Length Date Time Name
--------- ---------- ----- ----
810000 05-07-2014 15:09 file1.txt
810000 05-07-2014 15:09 …
рüффп
- 1,677
- 4
- 27
- 35
83
votes
4 answers
How can I get the tac command on OS X?
I like to use tac to reverse the output of cat. However, it's not available in the Mavericks terminal. I tried to find it on MacPorts and again it's not available. Can anyone please show me how to get tac? It's very helpful for reading log files.
polarise
- 1,021
- 1
- 7
- 9
83
votes
9 answers
crontab's @reboot only works for root?
man 5 crontab is pretty clear on how to use crontab to run a script on boot:
These special time specification "nicknames" are supported, which replace the 5 initial time and date
fields, and are prefixed by the `@` character:
@reboot : …
Withheld
- 933
- 1
- 6
- 6
83
votes
7 answers
What directories do I need to back up?
What are the directories one should back up, in order to have a backup of all user-generated files?
From a vanilla debian install, I can do enough apt to get the packages that I want. So if I don't want to backup the entire system, where all in the…
user394
- 14,194
- 21
- 66
- 93
82
votes
4 answers
Default exit code when process is terminated?
When a process is killed with a handle-able signal like SIGINT or SIGTERM but it does not handle the signal, what will be the exit code of the process?
What about for unhandle-able signals like SIGKILL?
From what I can tell, killing a process with…
Cory Klein
- 18,391
- 26
- 81
- 93