Linux
Find or calculate response time of web site
How to calculate or find the response time of web site or web page
curl -s -w "\nResponse time:\t%{time_total}s\n" -o /dev/null http://w3calculator.com
The above curl is used to print the time it takes in seconds to return a web page.
Sometimes it might be necessary for web developer or the web site owner ..
Copy file content to mouse clip board
How to copy file content to X clipboard
!xclip -i %
Allows to copy the file contents to X clipboard, and then be pasted in any application with the middle mouse button.
..
Ffmpeg command to capture video
The below ffmpeg command is used to capture video in linux machine.
ffmpeg -f x11grab -s `xdpyinfo | grep 'dimensions:'|awk '{print $2}'` -r 25 -i :0.0 -sameq /tmp/out.mpg > /root/howto/capture_screen_video_ffmpeg
..
Remap a keyboard key in linux
How can I disable one or several keys of my laptop keyboard in Linux?
When I press DELETE key it gets stuck and deletes everything
No problem! You can use the following command to remap or disable any key of your keyboard:
xmodmap -e 'keycode <value>=<action>'
For example, run the following to ..
Find network activity of a process
View network activity of any application or user in realtime
lsof -r 2 -p PID -i -a
The above command will help to find network activity of a process or a user in real time.
The "-r 2" option puts lsof in repeat mode, with updates every 2 seconds. (Ctrl ..
Copy mysql databases to a remote server
Shell script to Backup all mysql databases to individual files on a remote server
for I in $(mysql -e 'show databases' -u root --password=root -s --skip-column-names); do mysqldump -u root --password=root $I | gzip -c | ssh user@server.com "cat > /remote/$I.sql.gz"; done
It grabs all the database names granted for the ..
Script to translate a paragraph
translate() { curl -s "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=$1&langpair=$2%7C$3" | sed 's/.*"translatedText":"\([^"]*\)".*}/\1\n/'; }
Usage:
translate <phrase> <source-language> <output-language>
Example:
translate hello en es
This script is very much helpful when you are about to translate a para or phrase.
..
Detect language of a string from google
detectlanguage() { curl -s "http://ajax.googleapis.com/ajax/services/language/detect?v=1.0&q=$@" | sed 's/{"responseData": {"language":"\([^"]*\)".*/\1\n/'; }
Usage:
detectlanguage <phrase>
Example:
detectlanguage bola
..
Small Script to make you look busy
This command will make you to look busy in your system.
alias busy='my_file=$(find /usr/include -type f | sort -R | head -n 1);
my_len=$(wc -l $my_file | awk "{print $1}");
let "r = $RANDOM % $my_len" 2>/dev/null;
vim +$r $my_file'
This makes an alias for a command named 'busy'. The 'busy' ..
Change vtiger admin password
Here is a simply sql query to change vtiger admin password:
Login in to mysql client:
mysql -u root -p
(you need to know your mysql root password...)
then issue this command:
mysql> update vtiger_users set user_hash='21232f297a57a5a743894a0e4a801fc3', user_password='adpexzg3FUZAk',confirm_password='adoY/6Mlw8kqg',crypt_type='' where user_name='admin';
and you can login with:
username: admin
password: admin
..
Find gateway ip address
The below command will fetch the gateway ipaddress of your system.
/sbin/route -n | grep "^0\.0\.0\.0" | awk '{ print $2 }'
ip route list match 0.0.0.0/0 | cut -d \" \" -f 3
OUTPUT:
192.168.0.1
The above command will just fetch the gateway IP Address and will print it. Both ..
Use iproute2
The below command will fetch the gateway ipaddress of your system.
ip route list match 0.0.0.0/0 | cut -d " " -f 3
OUTPUT:
192.168.0.1
The above command will just fetch the gateway IP Address and will print it. You can also use iproute2 command to fetch the gateway IP address.
..
Config your browser to access other ports
Browse websites on non-standard ports like 79 with Firefox
If you try to browse http://www.yourhomepage.com:79 Firefox will cancel this request for your protection.
It does that by default whenever you use a port other than port 80 - the default website port.
Solution:
1. Open Firefox
2. Type about:config in the browser address field ..
List .log files open by a pid
List .log files open by a pid or by a particular process
lsof -p 1234 | grep -E "\.log$" | awk '{print $NF}'
Uses lsof to display the full path of ".log" files opened by a specified PID.
You can find what a process have done. By using the process id you ..
List all the installed kernals
The below command will print the list of installed kernel by searching the rpm.
rpm -qf /lib/modules/*
The below command will list the kernel module using ls command
ls -1 /lib/modules
..