From LedHed's Wiki
Jump to: navigation, search
Line 1: Line 1:
== Tips -N- Tricks ==
+
'''Tips -N- Tricks'''
  
'''Search command history'''<br>
+
== Search command history ==
 
  grep -i 'SearchStringHere' ~/.bash_history<br>
 
  grep -i 'SearchStringHere' ~/.bash_history<br>
<br>
+
 
'''View Log Continuously'''
+
== View Log Continuously ==
 
  tail -f /path/to/log/filename<br>
 
  tail -f /path/to/log/filename<br>
 
or<br>
 
or<br>
Line 11: Line 11:
 
  tail -f /path/to/log/filename | grep -i 'FilterStringHere'<br>
 
  tail -f /path/to/log/filename | grep -i 'FilterStringHere'<br>
 
<br>
 
<br>
'''Dump a .conf file to a new file without the comments (#)'''<br>
+
== Dump a .conf file to a new file without the comments (#) ==
 
  grep -v '#' file.conf > newfile.conf<br>
 
  grep -v '#' file.conf > newfile.conf<br>
  
 +
== Disable/Enable Swap ==
 +
To disable all swap space in Linux use this command:
 +
swapoff -a
 +
 +
To re-enable it use this command:
 +
swapon -a
  
 
[[Category:Linux]]
 
[[Category:Linux]]

Revision as of 21:48, 19 May 2008

Tips -N- Tricks

Search command history

grep -i 'SearchStringHere' ~/.bash_history

View Log Continuously

tail -f /path/to/log/filename

or

Filter a continuous log for a specific entry

tail -f /path/to/log/filename | grep -i 'FilterStringHere'


Dump a .conf file to a new file without the comments (#)

grep -v '#' file.conf > newfile.conf

Disable/Enable Swap

To disable all swap space in Linux use this command:

swapoff -a

To re-enable it use this command:

swapon -a