Most Popular

1500 questions
108
votes
9 answers

Press space to continue

How do I stop a bash script until a user has pressed Space? I would like to have the question in my script Press space to continue or CTRL+C to exit and then the script should stop and wait until Space is pressed.
rubo77
  • 27,777
  • 43
  • 130
  • 199
108
votes
5 answers

If processes inherit the parent's environment, why do we need export?

I read here that the purpose of export in a shell is to make the variable available to sub-processes started from the shell. However, I have also read here and here that "Processes inherit their environment from their parent (the process which…
Amelio Vazquez-Reina
  • 40,169
  • 77
  • 197
  • 294
108
votes
2 answers

How can I restart the SSH daemon on Ubuntu?

When I type in service sshd restart I get a sshd: unrecognized service error. I do have, in /etc/ssh/ a file sshd_config that I use to set config. I can also putty into the Ubuntu box (it is remote). When I type in /etc/init.d/sshd restart I get No…
bharal
  • 1,423
  • 3
  • 10
  • 10
108
votes
8 answers

Show all the file up to the match

grep --before-context 5 shows 5 lines before the match. I want to show everything before the match. Doing grep --before-context 99999999 would work but it is not very... professional. How to show all the file up to the match?
Nicolas Raoul
  • 7,945
  • 14
  • 43
  • 55
108
votes
2 answers

What is the difference between -m conntrack --ctstate and -m state --state

I'm reading this howto, and there's something like this: We can allow established sessions to receive traffic: $ sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT The above rule has no spaces either side of the comma in…
Mikhail Morfikov
  • 10,309
  • 19
  • 69
  • 104
107
votes
6 answers

List subdirectories only n level deep

Festival stores voicepack data in the following example directory structure: /usr/share/festival/voices// What is the simplest one-liner (preferably using ls) to print out just the 's, in all the potentially…
user66001
  • 2,325
  • 4
  • 19
  • 27
107
votes
5 answers

Possible missing firmware /lib/firmware/i915/* for module i915

I am getting these warnings every time I update my initramfs image(-s) with update-initramfs on my Dell PowerEdge T20 server running GNU/Linux Debian Buster 10.0. Is there a fix? W: Possible missing firmware /lib/firmware/i915/bxt_dmc_ver1_07.bin…
Vlastimil Burián
  • 27,586
  • 56
  • 179
  • 309
107
votes
3 answers

Why can rm remove read-only files?

If I create a file and then change its permissions to 444 (read-only), how come rm can remove it? If I do this: echo test > test.txt chmod 444 test.txt rm test.txt ...rm will ask if I want to remove the write-protected file test.txt. I would have…
Magnus
  • 1,403
  • 3
  • 14
  • 14
107
votes
5 answers

ssh-add returns with: "Error connecting to agent: No such file or directory"

ssh-add alone is not working: Error connecting to agent: No such file or directory How should I use that tool?
Wong Jia Hau
  • 1,189
  • 2
  • 8
  • 6
107
votes
5 answers

Why are true and false so large?

After finding out that several common commands (such as read) are actually Bash builtins (and when running them at the prompt I'm actually running a two-line shell script which just forwards to the builtin), I was looking to see if the same is true…
Kidburla
  • 1,266
  • 2
  • 10
  • 16
107
votes
5 answers

Do progress reports/logging information belong on stderr or stdout?

Is there an official POSIX, GNU, or other guideline on where progress reports and logging information (things like "Doing foo; foo done") should be printed? Personally, I tend to write them to stderr so I can redirect stdout and get only the…
terdon
  • 234,489
  • 66
  • 447
  • 667
107
votes
4 answers

Save all the terminal output to a file

Is there some way of saving all the terminal output to a file with a command? I'm not talking about redirection command > file.txt Not the history history > file.txt, I need the full terminal text Not with hotkeys ! Something like terminal_text >…
user78927
107
votes
9 answers

How to find the installation path for a software under linux?

Under linux, I launch a software by typing, e.g., fluidplot. How can I find the installation path for this software?
user5997
  • 1,331
  • 3
  • 11
  • 6
107
votes
7 answers

How to strip multiple spaces to one using sed?

sed on AIX is not doing what I think it should. I'm trying to replace multiple spaces with a single space in the output of IOSTAT: # iostat System configuration: lcpu=4 drives=8 paths=2 vdisks=0 tty: tin tout avg-cpu: % user % sys %…
WernerCD
  • 1,314
  • 3
  • 10
  • 11
107
votes
22 answers

Detect init system using the shell

This may have more to do with detecting operating systems, but I specifically need the init system currently in use on the system. Fedora 15 and Ubuntu now use systemd, Ubuntu used to use Upstart (long time default until 15.04), while others use…
beatgammit
  • 7,453
  • 10
  • 31
  • 32