Most Popular

1500 questions
111
votes
3 answers

How do I time a specific command?

(The linux equivalent of TimeThis.exe) Something like: timethis wget foo.com Receiving foo.com ... wget foo.com took 3 seconds.
ripper234
  • 31,063
  • 43
  • 82
  • 90
110
votes
25 answers

How to get my own IP address and save it to a variable in a shell script?

How can I get my own IP address and save it to a variable in a shell script?
The Student
  • 3,439
  • 9
  • 30
  • 34
110
votes
10 answers

convert webp to jpg error: "no decode delegate for this image format" and "missing an image filename"

I'm using ubuntu 12.04. I've installed libwebp2 & libwebp-dev So far, no example found on the net of converting webp to jpg. Some webp files can easily converted by using imagemagick with command convert file.webp file.jpg but lots of webp files…
apasajja
  • 1,917
  • 5
  • 17
  • 19
110
votes
11 answers

Block network access of a process?

Is it possible to block the (outgoing) network access of a single process?
larkee
  • 1,203
  • 2
  • 9
  • 5
110
votes
3 answers

Why does /etc/resolv.conf point at 127.0.0.53?

I tried to check what my DNS resolver is and I noticed this: user@ubuntu:~$ cat /etc/resolv.conf nameserver 127.0.0.53 options edns0 I was expecting 192.168.1.1, which is my default gateway, my router. I don't understand why it points at…
HelloWorld
  • 1,355
  • 2
  • 6
  • 11
110
votes
2 answers

Pacman option to assume "yes" to every question?

When installing software in debian systems we can put something like this: sudo apt-get install -y chromium-browser that way the installation occurs automatically, whitout asking to confirm installation [Y/n]. Can i do the same with pacman?
JohannRamos
  • 1,241
  • 2
  • 9
  • 5
110
votes
12 answers

Kill many instances of a running process with one command

Suppose I have a thousand or more instances of any process (for example, vi) running. How do I kill them all in one single shot/one line command/one command?
The Dark Knight
  • 2,124
  • 4
  • 19
  • 20
110
votes
4 answers

How can I test for POSIX compliance of shell scripts?

Considering that POSIX is the closest thing to a common standard among all unices, I'm interested in knowing if there's a shell that supports it exclusively. While most modern shells provide support for POSIX (and will run POSIX compliant scripts…
rahmu
  • 19,673
  • 28
  • 87
  • 128
110
votes
4 answers

What is the difference between "cat file | ./binary" and "./binary < file"?

I have a binary (that I can't modify) and I can do: ./binary < file I also can do: ./binary << EOF > "line 1 of file" > "line 2 of file" ... > "last line of file" > EOF But cat file | ./binary gives me an error. I don't know why it doesn't work…
Boris
  • 1,073
  • 2
  • 8
  • 7
110
votes
14 answers

tar --exclude doesn't exclude. Why?

I have this very simple line in a bash script which executes successfully (i.e. producing the _data.tar file), except that it doesn't exclude the sub-directories it is told exclude via the --exclude option: /bin/tar -cf /home/_data.tar …
ateiob
  • 1,627
  • 4
  • 14
  • 12
110
votes
3 answers

How to copy files from the folder without the folder itself

I'm trying to copy files and subfolders from A folder without the A itself. For instance, A folder contains next: | file1.txt | file2.txt | subfolder1 Executing next command gives me wrong result: sudo cp -r /home/username/A/…
pushandpop
  • 1,336
  • 2
  • 10
  • 11
110
votes
6 answers

Can't Install build-essential on CentOS

When I run the command: sudo apt-get install build-essential I get the following error message: Reading Package Lists... Done Building Dependency Tree... Done E: Couldn't find package build-essential
Waley Chen
  • 1,253
  • 2
  • 9
  • 6
110
votes
2 answers

Understanding %CPU while running top command

I am trying to understand what %CPU means when I run top. I am seeing %CPU for my application at "400" or "500" most of the time. Does anyone know what this means? 19080 david 20 0 27.9g 24g 12m S 400 19.7 382:31.81 paper_client lscpu gives…
david
  • 2,147
  • 7
  • 25
  • 31
110
votes
2 answers

Why does Ctrl-D (EOF) exit the shell?

Are you literally "ending a file" by inputting this escape sequence, i.e. is the interactive shell session is seen as a real file stream by the shell, like any other file stream? If so, which file? Or, is the Ctrl+D signal just a placeholder which…
Geeb
  • 2,061
  • 2
  • 16
  • 17
109
votes
1 answer

How to change cron shell (sh to bash)?

Is it possible to make commands in crontab run with bash instead of sh? I know you can pass commands to bash with -c, but that's annoying and I never use sh anyway.
Fluffy
  • 2,047
  • 3
  • 15
  • 18