Logo
Logo
  • Home
  • About
  • Services
    • Fractional CTO
    • Application Architecture
    • Platform Audits
    • Platform Rebuilds
  • Projects
  • Writing
  • Work
  • Request Quote
Logo

Backed by 20+ years of hands-on software development expertise, mithra62 transforms ideas into powerful, reliable solutions—designed to work exactly how you want, every time.

  • Address

    Tucson, AZ 85712
  • Email

    eric@mithra62.com
  • Contact

    +1-310-739-3322

Linux Cheat Sheet

  • Home
  • Writing
Linux Cheat Sheet
26 Jan 09
  • Servers

Like most web developers, I use Linux on a daily basis. Because I always have to revisit how to do some of the basics from time to time I thought I'd put together a list of some of the commands I use the most along with some of their examples. NOTE: the paths are all from RHEL 4 and CENTOS 4 & 5.

Linux

Enjoy!

MySQL

Example of mysqldump::

mysqldump -u USER -pPASSWORD DATABASE > filename.sql

Example of restore DB::

mysql -u USER -p DBNAME < dump.sql

Start the MySQL service::

/etc/init.d/mysqld start

Stop MySQL service::

/etc/init.d/mysqld stop

Add User::

GRANT ALL PRIVILEGES ON *.* TO 'USER'@'localhost' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;

Export Single Table::

mysqldump --opt -u USER-pPASSWORD DataBaseName TableName > FileName

rsync

rsync is used primarily synchronize data between two directories or servers.

Sync 2 servers

rsync -p -r -a -z -v /path/to/dir 2.2.2.2:/path/to/dir

Sync 2 directories

rsync -p -r -a -z -v /path/to/dir /path/to/new/dir

Lighttpd

Start the lighttpd service::

/etc/init.d/lighttpd start

Stop the lighttpd service::

/etc/init.d/lighttpd stop

Path to conf::

/etc/lighttpd/lighttpd.conf

SSH

Restart SSH Server

/etc/rc.d/init.d/sshd restart

Start SSH Server

/etc/rc.d/init.d/sshd start

Stop SSH Server

/etc/rc.d/init.d/sshd stop

Tar/GZ

Create tarball

tar -cvf directory.tar directory/

Create gzipped tar file

tar -czvf directory.tgz directory/

Extracting tarball:

tar -xvf directory.tar

Extracing gzipped tar:

tar -xzvf directory.tgz

Misc.

Delete the mail queue

rm /var/spool/mqueue/*

Count files in directory recursively

ls -R -1 proc | wc -l

Want to get in touch and let me know how I can help you with your project?

Get Started

Recent Post

  • Your Platform Isn’t Broken. It’s Fighting You.
    Your Platform Isn’t Broken. It’s Fighting You.
    16 Mar, 2026
  • Stop Fighting the ExpressionEngine Control Panel
    Stop Fighting the ExpressionEngine Control Panel
    29 Jan, 2026
  • When You Don't Know What You Don't Know
    When You Don’t Know What You Don’t Know
    23 Dec, 2025

follow us

Logo

Backed by 20+ years of hands-on software development expertise, mithra62 (Eric Lamb) transforms ideas into powerful, reliable solutions designed to work exactly how you want, every time.

© Copyright 2026 | mithra62

Useful Links

  • About
  • Projects
  • Writing
  • Work
  • Request Quote

Services

  • Fractional CTO
  • Application Architecture
  • Platform Audits
  • Platform Rebuilds

Contact Info

Get in touch now to begin work immediately.

  • Email: eric@mithra62.com
  • Contact: 310.739.3322