*) How to extract tr.gz. file
To extract one or more members from an archive :
tar -zxvf {file.tar.gz}
For example, If your tar name is backup.tar.gz, enter the following at a shell prompt:
tar -zxvf backup.tar.gz
*) How to run .bin file
Change the permission of the file you downloaded to be executable. Type the following command:
$ chmod +x file.bin
Start the installation process or run .bin file.Type the following command:
./file.bin
For example if .bin file name is application.bin. Type:
$ chmod +x application.bin
$ ./application.bin
*) How to set a BASH variable equal to the output from a command?
Use $(), which I find easier to read, and allows for nesting.
OUTPUT=$(ls -1) echo $OUTPUT
*) How to read IP Address In a Shell Script
Type the following command:
ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'
*) How to find out particular ProcessId
ps -ef | grep processname
eg: ps -ef | grep mysql
*) How to display Line number from a file
sed -n "linenumber p" file.txt
sed -n "3 p" file1.txt
*) How to check Hidden file
ls -a
sed -n "linenumber p" file.txt
sed -n "3 p" file1.txt
*) How to check Hidden file
ls -a
*) How to check port
netstat -tulpn
netstat -tulpn
*) How to find directory on linux?
find / -name 'httpdocs' -type d
the first parameter "/" is where to look, in this case "/" it's the entire system.
-name could be -iname to ignore case also -type is not mandatory
use : man find for more option
find / -name 'httpdocs' -type d
the first parameter "/" is where to look, in this case "/" it's the entire system.
-name could be -iname to ignore case also -type is not mandatory
use : man find for more option
*) How to check free RAM size ?
free -m
*) How to clear cache memory ?
free -m
*) How to clear cache memory ?
echo 1 > /proc/sys/vm/drop_caches
*) How to check linux version
cat /proc/version
*) How to check which all service is running ?
intictl list
For a particular service
intictl list | grep nova