8

Linux -- Examples of Everyday Linux Commands

 3 years ago
source link: https://fuzzyblog.io/blog/story.radio.weblogs.com/2002/05/28/linux-examples-of-everyday-linux-commands.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Linux -- Examples of Everyday Linux Commands

May 28, 2002

Linux :: Examples of Everyday Linux Commands Last updated: 6/16/2002; 10:20:39 AM   The FuzzyBlog!

Marketing 101. Consulting 101. PHP Consulting. Random geeky stuff. I Blog Therefore I Am.

Linux :: Examples of Everyday Linux Commands

or "Scott's Ongoing Linux Struggle"

Co Author: Kjartan Mannes

I have been using Unix (SunOS) since 1986 on Sun 2s.  Despite this I find myself constantly asking stupid Linux questions whenever I encounter a more knowledgable Unix admin.  For me the problem isn't lack of understanding – it's poor memory.  This document gives examples for common Linux commands like "how do I shut down Apache", "how do I view the last 100 entries in an error log" and so on.  It's arranged topically by section.  And, where I felt appropriate, I added general Linux advice like the section on GUI Admin Tools.

My heartfelt thanks go out to Kjartan who suffered through my silly questions with not a single trace of the all too common Unix Sys Admin arrogance or "Stupid user, how dare you ask me that.  Off with your head!".

GUI Admin Tools

If you need a GUI admin tool for remote Linux administration then run, do not want, to Webmin.  www.webmin.com.  Highly recommended. 

Editors

There are a plethora of Linux editors.  Tons.  Even more than tons.  There are three editors that are almost always present on a given Linux box:

  • Emacs

Editors are like religion and I don't go near religious debate.

Chown and Chmod

chown and chmod are the two Linux commands that you use most frequently for web development, particularly if you are a Perl programmer.  chown changes the ownership of a file while chmod changes it's "mode" i.e. read, write, execute, etc.

User Management

MySQL

Question: How do I restart MySQL?

It's either of these two commands (determine which by looking at the ps example below):

  • mysqld
  • safe-mysqld

Question: How do I shutdown MySQL?

Use: mysqladmin shutdown

Question: How do I check if MySQL is still running?

Use: ps aux grep sql

You'll get back something like this:

mysql 5381 0.0 0.5 108260 6100 ? S May21 0:00 /usr/sbin/mysqldmysql 5382 0.0 0.5 108260 6100 ? S May21 0:05 /usr/sbin/mysqldmysql 5383 0.0 0.5 108260 6100 ? S May21 0:00 /usr/sbin/mysqldmysql 25949 0.0 0.5 108260 6100 ? S May24 0:58 /usr/sbin/mysqldmysql 27913 0.0 0.5 108260 6100 ? S May26 0:11 /usr/sbin/mysqld

Or you can use just mysql and check from the user interface.  I prefer ps myself.

Client Side Errors that Make you Think it's Server Side

Two things:

Just as a general comment

es (05:41:25 AM): MSIE in its infinate wisdom repots dns errors when servers have in fact crashed

kjartanmannes (05:57:38 AM): try a cvs up
kjartanmannes (05:57:44 AM): maybe something is confliting
fuzzygroup (05:57:54 AM): ok.
fuzzygroup (05:58:11 AM): can I get the exact syntax so I don't muck it up (I'll learn over time, I promise)
fuzzygroup (05:59:41 AM): mvr mind
fuzzygroup (05:59:42 AM): found it
kjartanmannes (05:59:44 AM): cvs update
kjartanmannes (05:59:45 AM):

Apache

fuzzygroup (05:42:07 AM): Apache logs are most recent last, so is there a simple command line to get the last 100 lines?
kjartanmannes (05:42:30 AM): tail -100 logfile

kjartanmannes (06:11:57 AM): its almost as if your PHP process crashes while parsing the page
fuzzygroup (06:12:26 AM): how do I check for a php crash?
kjartanmannes (06:12:46 AM): you have the command line interface running?
kjartanmannes (06:12:53 AM): IE: can you access php from the shell
fuzzygroup (06:13:03 AM): Not sure. will phpinfo tell me?
fuzzygroup (06:13:33 AM): if so http://www.inboxbuddy.com/version.php has it.
kjartanmannes (06:13:51 AM): just try typing php
kjartanmannes (06:14:03 AM): if it gives you command not found you are outta luck

  Copyright 2002 © The FuzzyStuff  


Posted In: #linux


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK