sed (stream editor)
Sed is a non-interactive editor. Instead of altering a file by moving the cursor on the screen, you use a script of editing instructions to sed, plus the name of the file to edit. You can also describe sed as a filter.
Let’s have a look at some examples:
[...]
To Delete All Comments Awaiting Moderation in WordPress:
(Make sure that you have tacken a db backup)
From phpmyadmin select your WordPress database, click the sql tab, and enter the following query:
SELECT *FROM wp_comments WHERE comment_approved =”0″
That will select all the un-moderated comments. Then enter this query:
delete from wp_comments WHERE comment_approved =”0″
Run a check and repair on [...]
Jboss
JBoss Application Server (or JBoss AS) is a free software/open-source Java EE-based application server. Because it is Java-based, the JBoss application server operates cross-platform: usable on any operating system that Java supports. JBoss AS was developed by JBoss, now a division of Red Hat.
Versions
JBoss AS 4.0, a Java EE 1.4 application server, features an embedded [...]
1.) stdout to a file
The output of a command will redirect to another file.
Eg: ls -l > list.txt
2.) stderr to a file
The following command will redirect the stderr ouput of a program to a new file.
Eg: grep sibu * 2> grep-errors.txt
Here, a file called ‘grep-errors.txt’ will be created and it will contain what you [...]
Using this Options directive controls we can set server features for a particular directory.
Options can be set to None, in which case none of the extra features are enabled.
All :
All options except for MultiViews. (Default Settings).
ExecCGI :
Execution of CGI scripts using mod_cgi is permitted.
FollowSymLinks :
The server will follow symbolic links in this directory.
Includes :
Server-side includes [...]
SSI (Server Side Includes) are directives that are placed in HTML pages, and evaluated on the server while the pages are being served. Its use to add dynamically generated content to an existing HTML page.
SSI configurations
We must have mod_include module installed and enabled on apache. Also need to have the following directive either in [...]
While executing the mysqldump command you may have experienced following errors.
mysqldump: Got error: 1044: Access denied for user ‘root’@’localhost’ to database ‘information_schema’ when using LOCK TABLES
To quickly fix this problem use the following switch when running mysqldump for MySQL database backups.
mysqldump -u root -p -all-databases -single-transaction > all.sql
VPS Creation
# vzctl create VEID –ostemplate osname
# vzctl set VEID –ipadd a.b.c.d –save
# vzctl start VEID
Here VEID is the numeric ID for the VPS;
osname is the name of the OS template for the VE,
and a.b.c.d is the IP address to be assigned to the VE.
Example:
# vzctl create 101 –ostemplate fedora-core-5-minimal
# vzctl set 101 –ipadd 10.1.2.5 [...]
Find Out The Top 10 Memory Consuming Process
# ps -auxf | sort -nr -k 4 | head -10
Find Out top 10 CPU Consuming Process
# ps -auxf | sort -nr -k 3 | head -10
Max cpu resource usage
# ps -eo pcpu,pid,user,args | sort -r -k1 | more
To get the long list of a process, if [...]
If the linux box protected with root password only.
Do a hard reboot on the machine and click on ‘e’ button to edit the boot like when you get the grub menu. Scrol down to the line which starts with kernel and hit ‘e’ again to edit and add ‘single’ (with out quotes) at the [...]