Moving around with Bash short-cut
Answer:
Bash has some shortcuts that allow you to move around the command prompt
1. Ctrl + a
Just to the start of the current line.
2. Ctrl + e
Just to the endof the current line.
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
Moving around with Bash short-cut
Answer:
Bash has some shortcuts that allow you to move around the command prompt
1. Ctrl + a
Just to the start of the current line.
2. Ctrl + e
Just to the endof the current line.
Kill all processes listening on a particular port
Answer:
To kill all processes listening on a particular port, e.g. port 80
# kill -9 $( lsof -i:80 -t )
Replace 80 by the port you want.
How to check the startup time of a particular program
Answer:
E.g. To check the startup time of MySQL server:
# ps -eo pid,user,cmd,lstart | grep /sbin/mysqld
3546 mysql /usr/sbin/mysqld --basedir= Tue Mar 30 21:29:12 2010
9195 root grep /sbin/mysqld Tue Mar 30 22:43:33 2010
Adding SSL suport in Nginx
Answer:
Assume you have got your certificate file (server.crt) from a CA, and you also have a private key (server.key).
1. Compile Nginx to support SSL
# ./configure --with-http_ssl_module
2. Add the following line in nginx.conf
server {
server_name YOUR_DOMAINNAME_HERE;
listen 443;
ssl on;
ssl_certificate /usr/local/nginx/conf/server.crt;
ssl_certificate_key /usr/local/nginx/conf/server.key;
}
3. Restart Nginx
Reference: http://wiki.nginx.org/NginxHttpSslModule
Repeat previous command in Bash
Answer:
It is easy to type !! when you want to repeat the previous executed command in Bash
# ls -l /var/log/messages
-rw-r----- 1 syslog adm 330 Mar 29 17:17 /var/log/messages
# !!
ls -l /var/log/messages
-rw-r----- 1 syslog adm 330 Mar 29 17:17 /var/log/messages