0
   

Helpful linux commands for server management

 
 
Reply Wed 10 Sep, 2008 10:12 am
As a web developer I often am pushed into managing servers. This is not a task that I enjoy, but is often times a necessary evil when working with small companies.

I am starting this thread to put in one easy to find place a list of useful commands, and what they do.

To start things off, when troubleshooting email it can help to view exims logfile. This is located in /var/logs/exim_mainlog. If you are troubleshooting email for a specific user, you may need to look for their email address. The easiest way to do this is the following command:
Code:more /var/logs/exim_mainlog | grep [email protected]

The pipe passes information from the first command into the second. In this case, more outputs the file, and passes the information to grep, which looks through it for all instances of '[email protected]'.
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Discussion • Score: 0 • Views: 1,512 • Replies: 3
No top replies

 
Robert Gentel
 
  1  
Reply Wed 10 Sep, 2008 11:03 am
@Nick Ashley,
As you know, I'm often in the same boat. Here is one I have consistently found useful to find large files.

Code:find /var -size +100000


I learned this one years ago when solving a mail problem. The mail server had crashed and a df (disk free) command showed the problem was that the /var partition was full. That find command looks in /var (you can change this to whatever partition you want) for files above that size (you can also change the size parameter).
0 Replies
 
Nick Ashley
 
  1  
Reply Sat 13 Sep, 2008 03:12 pm
Another interesting command:
Code:netstat -an |grep :80 |wc -l

netstat will show active network connections. -a flag displays all connections, and -n displays ip addresses numerically.

This is passed to grep, which then looks for all lines with a ':80'. This effectively finds all connections to apache, as apache runs on port 80.

Finally, this is passed to wc, which is a word counter. The -l flag tells it to count newlines, so it returns the number of lines. This correlates to the number of active connections to apache.
0 Replies
 
Nick Ashley
 
  1  
Reply Tue 30 Sep, 2008 07:21 pm
ps will show a list of running processes.
-u: will filter by a user, for example 'root' or 'nobody'
-o: lets you define what columns are output. I use pid, command which gives me the process id, and the name of the command running.

I recently needed to use this because I wanted to stop a memcached daemon from running. I ran this command:
Code:ps -u nobody -o pid,command | grep memcached

to see what the process id of the daemon was. Once I had this, i could do
Code:kill [pid]
to kill the process
0 Replies
 
 

Related Topics

Can I install Linux? - Question by Wilso
linux on desktop - Question by lilsweetangel
Adding DNS IP's to /etc/ips.remotedns - Discussion by st34hird
Ubuntu, Java and Aptana Studio 3 - Question by Ken Dawson
linux - Question by stephen silver
SQUID CONF - Question by achix
Rest in peace, Dennis Richie! - Discussion by Thomas
 
  1. Forums
  2. » Helpful linux commands for server management
Copyright © 2019 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 05/25/2019 at 07:46:50