Saturday, March 29, 2014

sysctl command


sysctl helps to configure the linux kernel parameters during runtime.

#cat /etc/sysctl.conf is the sysctl configuration file.

#sysctl -a  , this will list all the currently available string or integer values.This is the default value, if no parameters are given to sysctl.


To modify the kernel parameter permanently on run-time.

# vi /etc/sysctl.conf -> add the necessary changes and save it

then

#sysctl -p -> it will commit the changes .It will be still there after the reboot.


To modify the kernel parameter temporary

#sysctl -w <kernel parameter details>

Note:The changes will lost after reboot.




Friday, March 28, 2014

How to troubleshoot with dmesg ?


This is really very helpful command when you start troubleshooting your linux issues.Try the below steps to explore more into that .

1. dmesg |more

2. dmesg|grep memory -- > it will give you the memory details
3. dmesg |grep eth       - - >it will give you the interface details.
4. dmesg -c                 --> to clear the dmesg entry from it before reboot {only if required}





Very Helpful Linux Command Tips


1. How to automatically correct mistypes directory names.?
 
You have typed mall instead of mail
 
#cd /etc/mall

do the below command

#shopt -s cdspell

If you type  again cd /etc/mall  , it will direct you in the correct directory..


Try it and enjoy.

2. How to convert lower case to upper case in a file ?

if you want to convert from lower to upper

tr a-z A-Z < filename

do vice verca for upper to lower

tr A-Z a-z < filename

3. How to add time stamp in history output ?

This is really very helpful command .

# export HISTTIMEFORMAT=’%F %T ‘

then do history |more

If you don't want to use it , rever it back to original.

# export HISTTIMEFORMAT=’ '

4. How to run a command from history?
If you want to run a particular command {nth command} from history, just try with '!'

Ex:If you want to run 100th command in history, just type # !100  - it will run 100th command in history

5. ac command

ac -d  -  display connect time for the current logged in user
ac -p  - connect time for all users

ac -d utech - connect time for a specific user


6. How to execute commands in background  even after you logged out from the putty session ?

use '&' at the end of command line to run any command in background. If you use 'nohup' option at the beggining of a command line, it will run in background even after you logged out from the session.

For Ex:
#nohup ./yourscript.sh &

7. How can we see multiple log files in one terminal ?

Just type tail -f logfile1 -f logfile2

Please try it and make use of it.