EMC VPS Homepage
VPS Hosting and Web Hosting Services by EMC VPS
  Support Center  |  Web Mail  
 
  Dedicated Servers
 
Quick Links
  Sep 10, 2010
Is there a cheatsheet for these shell commands?

Yes, there are countless linux-newbie tutorials out there.

The following is a breakdown of the most commonly used commands and the most commonly used arguments for them.

ls : list files/directories in a directory, comparable to dir in windows/dos.
ls -al : shows all files (including ones that start with a period), directories, and details attributes for each file.
cd : change directory
cd /usr/local/apache : go to /usr/local/apache/ directory
cd ~ : go to your home directory
cd - : go to the last directory you were in
cd .. : go up a directory
cat : print file contents to the screen
cat filename.txt : cat the contents of filename.txt to your screen
tail : like cat, but only reads the end of the file
tail /var/log/messages : see the last 20 (by default) lines of /var/log/messages
tail -f /var/log/messages : watch the file continuously, while it's being updated
tail -200 /var/log/messages : print the last 200 lines of the file to the screen
more : like cat, but opens the file one screen at a time rather than all at once
more /etc/userdomains : browse through the userdomains file. hit to go to the next page, to quit
pico : friendly, easy to use editor. A clone of it is "nano"
pico /home/burst/public_html/index.html : edit the index page for the user's website.
vi : another editor, tons of features, harder to use at first than pico
vi /home/burst/public_html/index.html : edit the index page for the user's website.
grep : looks for patterns in files
grep root /etc/passwd : shows all matches of root in /etc/passwd
grep -v root /etc/passwd : shows all lines that do not match root
touch : create an empty file
touch /home/burst/public_html/404.html : create an empty file called 404.html in the directory /home/burst/public_html/
ln : create's "links" between files and directories
ln -s /usr/local/apache/conf/httpd.conf /etc/httpd.conf : Now you can edit /etc/httpd.conf rather than the original. changes will affect the orginal, however you can delete the link and it will not delete the original.
rm : delete a file
rm filename.txt : deletes filename.txt, will more than likely ask if you really want to delete it.
rm -f filename.txt : deletes filename.txt, will not ask for confirmation before deleting.
rm -rf tmp/ : recursively deletes the directory tmp, and all files in it, including subdirectories. BE VERY CAREFULL WITH THIS COMMAND!!!
last : shows who logged in and when
last -20 : shows only the last 20 logins
last -20 -a : shows last 20 logins, with the hostname in the last field
w : shows who is currently logged in and where they are logged in from.
netstat : shows all current network connections.
netstat -an : shows all connections to the server, the source and destination ips and ports.
netstat -rn : shows routing table for all ips bound to the server.
file : attempts to guess what type of file a file is by looking at it's content.
file * : prints out a list of all files/directories in a directory
du : shows disk usage.
du -sh : shows a summary, in human-readble form, of total disk space used in the current directory, including subdirectories.
du -sh * : same thing, but for each file and directory. helpful when finding large files taking up space.
wc : word count
wc -l filename.txt : tells how many lines are in filename.txt
cp : copy a file
cp filename filename.backup : copies filename to filename.backup
cp -a /home/burst/new_design/* /home/burst/public_html/ : copies all files, retaining permissions form one directory to another.

Putting commands together.

Often you will find you need to use different commands on the same line. Here are some examples.

Note that the | character is called a pipe, it takes date from one program and pipes it to another.

> means create a new file, overwriting any content already there.
>> means tp append data to a file, creating a newone if it doesn not already exist.
< send input from a file back into a command.

grep User /usr/local/apache/conf/httpd.conf |more
-- this will dump all lines that match User from the httpd.conf, then print the results to your screen one page at a time.

last -a > /root/lastlogins.tmp
-- this will print all the current login history to a file called lastlogins.tmp in /root/

tail -10000 /var/log/exim_mainlog |grep domain\.com |more
-- this will grab the last 10,000 lines from /var/log/exim_mainlog, find all occurances of domain.com (the period represents 'anything',
-- comment it out with a \ so it will be interpretted literally), then send it to your screen page by page.

netstat -an |grep :80 |wc –l
-- show how many active connections there are to apache (httpd runs on port 80)

mysqladmin processlist |wc –l
-- show how many current open connections there are to mysql

My hard drive is slow and backups take a long time.

You should make sure that DMA is enabled on your drives.
Not that some older drives/motherboards have a problem with this,
so you should ask your datacenter to be sure it's ok before enabling DMA on your drives.

To enable DMA for a hard drive: hdparm -d1 /dev/hda
To disable DMA for a hard drive: hdparm -d0 /dev/hda
To measure transfer rate of a hard drive: hdparm -Tt /dev/hda
To see what options are enabled for a hard drive: hdparm /dev/hda
To see more info on your drive than you wanted to know: (this will show which UDMA modes are supported/enabled) hdparm -i /dev/had

Apache is restarting every 10 minutes ? What's wrong ?

Nothing is wrong, this is normal.

Cpanellogd sends a SIGUSR1 (graceful restart) every ten minutes to apache for log rotation and stats processing.

How can I add PHP support to my apache webserver ?

As root on the shell, via SSH, you should type

`/scripts/easyapache` and press return.

Select an option with PHP support from the easy to use menu and let it build the new apache with the php module.

How can I setup default page which is generated when any new domain is created on server?

You can set up a default site in the directory
/root/cpanel3-skel/public_html/
an it will be the default website for all accounts added afterwards.

write failed: disk quota exceeded What does this mean?

This means that you have used up the amount of disk space alloted for your account. You will be unable to save anything as you have no space left. You will need to contact EMC if you need more disk space.

How can I forward my old web site to my new site?

You can do this with a redirect. You will need to go to the old site's cPanel interface and then go to 'Redirects'. Set the old site's index page to redirect to the new site's index page.

Alternatively, if you wish for the old site and the new site to go to the same place but have not set up the new site yet, you can use a Parked Domain. A Parked Domain allows you to add a second domain name to your account that goes to the same website.

Why are none of my pictures working?

This could be for many reasons.

First, you'll need to make sure the links in your tags go to pictures that exist within your account.

Next, make sure that if you have Hotlink Protection enabled, your domain name is allowed to view the protected extensions.

Next, make sure the permissions on your pictures allow them to be read by web users. i.e. 644 or something similar. You may want to search for unix file permissions or image file permissions on the search engine of your choice.

How can I see my site as soon as it is created?

This may not be possible. Because the information necessary to view your site (DNS information) needs to spread across the internet before visitors can view your site, you may not be able to view your site for 24-48 hours after it is created, or if your DNS information is changed. There is no way to speed up this process.

How do I upload an existing subscriber list to the mailing list?

You can use the Mass Subscribe function to upload a current subscriber list or paste in a lot of email addresses to subscribe to a mailing list.

1) Go to your cPanel interface and go to Mail -> Mailing Lists.

2) Then choose Edit and login to the mailing list administration interface.

3) Go to Membership Management -> Mass Subscription.

Here you can paste a list of email addresses (one per line) or upload a file containing the email addresses (one per line).

After I upload a file, it still shows an older version. What's wrong?

Most likely, your browser has stored the older copy in it's cache for fast loading of your site. You'll need to clear your browser's cache and navigate to the page again to see the new version. Instructions on clearing your cache in a few major browsers are listed below:

Firefox
---------

Click on Tools -> Clear Private Data

Make sure the check box next to 'Cache' is checked and click on Clear Private Data Now

Internet Explorer
------------------

Click on Tools -> Internet Options

On the General tab, click on the Delete Files button.

Click OK, and then click OK again.

Safari
--------

Click on Safari -> Empty Cache

Click on Empty

How can I restore a full backup file to my server ?

If you need to restore a full backup file on a server, copy the file to your daily backups directory and it should be available for restoring.
Be sure to configure the backups correctly first.

I lost my password to cPanel, how can i get it reset or retrieved ?

If you have forgotten or lost your password to cPanel, you can click on the link shown on the login failure page, entitled:

"If you have lost your password, you can reset it by Clicking Here."

If you can't log into FTP, log into cPanel first and try changing your ftp password.

How do I change my Password in cPanel?

You can use the 'Change Password' area to change your password. In the X theme, it is on the main screen. In the X3 theme, it is under Preferences on the main screen.

How do I change name servers in cpanel?

You can change nameservers in WHM under 'Basic cPanel/WHM Setup'

If you need to change the nameservers associated with your domain, you may need to contact EMC and your domain registrar to update the information with them.

How can I backup my complete website to a drive on my computer?

You can use the Generate/Download a Full Backup function in the Backups section of your interface.

How can I uninstall cPanel?

The best way to uninstall cPanel is to reformat your server. It is recommended to reinstall your operating system to return your server to a default setting if you are not going to continue to use cPanel.

What is the address that I go to log onto my cpanel?

These examples assume your domain name is mydomain.com:

http://mydomain.com/cpanel
http://mydomain.com:2082

or for SSL (more security):

https://mydomain.com:2083

If your site does not yet resolve, you can use it's IP address instead. This example assumes your IP address is 255.225.255.255:

http://255.255.255.255:2082

Why does the content of cPanel overflow the page?

If you have set your local fonts to override any web site fonts, you may experience issues with text overflow in the cPanel interface. You will need to allow the cPanel site you login to to define and use its own fonts to correct this issue.

Why won't the homepage of a folder automatically default to index.php?

There can be a few lines in /usr/local/apache/conf/httpd.conf that allow for a index.php file to be displayed automatically. They look like:

# DirectoryIndex: Name of the file or files to use as a pre-written HTML # directory index. Separate multiple entries with spaces.


DirectoryIndex index.ppl index.pl index.plx index.perl index.html index.wml index.cgi index.shtml index.jsp index.js index.jp index.php4 index.php3 index.php index.phtml index.htm default.htm default.html home.htm

If those lines are not present, you'll need to add the following into a .htaccess file:
DirectoryIndex index.php

Manage your VPS or Web Hosting Account
  Email:
 
  Password:
 
  Sign up for an account

Register Domains | Web Hosting | Virtual Dedicated Hosting | Servers | Hsphere User Help | Plesk User Help | HSPC User Help
Terms of Service | Support Center | Web Mail Login | Submit a Trouble Ticket | Contact Us

Copyright © 1995 - 2010 Earth Media Coporation All rights reserved.

Earth Media Corporation and its affiliated websites offer Web Hosting, Design and Development Services and are not related to or affiliated in any way to
EMC Corporation ® the Information Management and Storage Company. If you need to contact the EMC Corporation, please visit their website at www.emc.com