Find the process ID of a running program
Answer:
The easiest way to get all the process IDs of a running program in Linux, see the following example:
# pidof apache2
29747 29745 29700 29698 29696 29695 29687 29678 29677 29664 23931
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
Find the process ID of a running program
Answer:
The easiest way to get all the process IDs of a running program in Linux, see the following example:
# pidof apache2
29747 29745 29700 29698 29696 29695 29687 29678 29677 29664 23931
How to ignore blank lines when creating the diff of two files
Answer:
By default, the diff command will also compare the blank line of two files.
To ignore them, use:
# diff -B a.txt b.txt
Create a short URL from command
Answer:
TinyUrl has a simple api for creating short URL for any web site.
E.g. Assume http://example.com
# curl 'http://tinyurl.com/api-create.php?url=http://example.com/'
http://tinyurl.com/kotu
Use insecure SSL connections and transfers with curl
Answer:
If you have a self-signed SSL certificate with your server, and you want to connect to it using the curl command, you need to use the " -k/--insecure" option since curl only use the CA certificate bundle installed by default.
Example:
# curl -k https://localhost
Show HTTP response using curl command
Answer:
curl is a very powerful tool for transferring data from or to a server, which support many protocols such as HTTP, HTTPS, FTP etc.
Example: Issue a HTTP request to a remote server.
# curl -v http://www.example.com
* About to connect() to www.example.com port 80 (#0)
* Trying 192.0.32.10... connected
* Connected to www.example.com (192.0.32.10) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.19.5 (x86_64-pc-linux-gnu) libcurl/7.19.5 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.15
> Host: www.example.com
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: Apache
< Last-Modified: Fri, 30 Jul 2010 15:30:18 GMT
< ETag: "573c1-254-48c9c87349680"
< Accept-Ranges: bytes
< Content-Type: text/html; charset=UTF-8
< Connection: Keep-Alive
< Date: Wed, 22 Dec 2010 16:19:06 GMT
< Age: 817
< Content-Length: 596
...