Print sequences of numbers in Linux
Answer:
To generate a sequences of numbers from 1 to 99, you can try the `seq` command, e.g.
# seq 1 99
To reverse from 99 to 1, simply
# seq 99 1
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
Print sequences of numbers in Linux
Answer:
To generate a sequences of numbers from 1 to 99, you can try the `seq` command, e.g.
# seq 1 99
To reverse from 99 to 1, simply
# seq 99 1
How to curl two urls at the same time
Answer:
You can curl multiple urls with the "curl" command already, e.g.
# curl -v http://www.google.com http://www.google.com
How to only show respond header with curl command
Answer:
Sometimes the respond body is huge and you maybe only interested in knowing the headers only, then you can try:
# curl -v http://www.google.com -o /dev/null
..
> GET / HTTP/1.1
> User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5
> Host: www.google.com
> Accept: */*
>
< HTTP/1.1 302 Found
< Location: http://www.google.com.hk/
< Cache-Control: private
< Content-Type: text/html; charset=UTF-8
< P3P: CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info."
< Date: Sun, 09 Dec 2012 13:57:43 GMT
< Server: gws
< Content-Length: 222
< X-XSS-Protection: 1; mode=block
< X-Frame-Options: SAMEORIGIN
..
What is the meaning of kill -0?
Answer:
They are usually used to check if a given PID really exist or not (no side effect on Linux).
E.g.
# kill -0 3182
-bash: kill: (3182) - No such process
# kill -0 3184
# nothing will be returned if process really exists.
Fix git's fatal: index file corrupt
Answer:
When you experienced when your git repository might return the following error when you perform the status command, e.g.
# git status
error: bad index file sha1 signature
fatal: index file corrupt
To fix it, simply type
# rm -f .git/index
Then
# git reset
That's it.