Get Paid to Participate     Twitter     Facebook     Google+
Hosting Discussion
 

forgot password?


Reply


Old
  Post #1 (permalink)   04-27-2006, 07:35 PM
HD Newbie
 
Join Date: Apr 2006
Posts: 24

Status: AquariusADMIN is offline
SSH Command Guide

We’ll I’ve been doing some internet surfing and I’ve been putting together a list of common SSH commands. These SSH commands will help you with the basic linux administration. This guide pays a nice quick reminder as I some times find my self referring back to it as I sometimes forget a command. If you see some commands that you think should be added, please be sure to voice them!

Common SSH Commands

passwd : Change your SSH account's password, options follow after typing to change account password.

nano [option] [file]: friendly, easy to use file editor
nano –w /home/aquhome/public_html/index.php : your now editing index.php with –w being non wrapping of long lines

mkdir [directory_name] : Make a directory with proper default permissions
mkdir aquhome : Makes the directory aquhome in what ever directory your currently in

df : [attribute]
[b]df -h[b] : will show how much disk space is available in human readable format (Megabytes and Gigabytes!)


cd : change directory
cd ~ : go to your home directory
cd – : go to the last directory you was viewing
cd ../ : go up a directory
cd [directory path]
cd /home/aqhome/public_html

ls: lists files & directories in a directory
ls –l : shows all files with detailed attributes

vi : an advanced editor, tons of features, but much harder to use then nano
vi /home/aquhome/public_html/index.php : now we’re editing that index.php file again!

ln : creates sys links between files and directories
ln –s /usr/local/apache/conf/httpd.conf /etc/httpd.conf : Now you can edit the /etc/httpd.conf rather than the original, changes will effect the original instantly, however you can delete the link without deleting the original.

wall : broadcast message
wall [message]
wall so whens the server being restarted?

top : shows continuously updating system processes in a table.

w : shows who is currently logged in and there ip address.

ps : displays processes running. It’s similar to the top command, and it’s used to show currently running processes and their PID.

touch : creates a empty file.
touch [file]
touch index.html : creates a empty index.html

kill : terminate a system process
kill -9 [PID] : You can get a PID by using Top.
kill -9 100545

cp : copy a file
cp yourfile yourfile.copy : copies yourfile to yourfile.copy
cp –a /home/aquhome/public_html/* /home/aquhome/public_ftp/ : copies all of the files in public_html to /public_ftp

du : shows disk usage
du –sh : shows a summary, in human-readable form, of total disk space used in the currently directory, including subdirectories

netstat : shows all current network connections
netstat -rn : shows routing tables for ip’s.
netstat -an : shows all connections to the server.

chown : commands for system that changes the owner of a file
chown [attribute] newowner.newowner filenames
chown -R aquhome.aquhome /home/aquhome/public_html/index.php

chmod : [-r] permissions filenames
Permissions
u - User who owns the file.
g - Group that owns the file.
o - Other.
a - All.
r - Read the file.
w - Write or edit the file.
x - Execute or run the file as a program.
Numeric Permissions:
CHMOD can also to attributed by using Numeric Permissions:
400 read by owner
040 read by group
004 read by anybody (other)
200 write by owner
020 write by group
002 write by anybody
100 execute by owner
010 execute by group
001 execute by anybody
CHMOD 755 /home/aquhome/public_html/index.php

last : displays last logins to the system
last

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!!

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


wc : word count
wc -l filename.txt : tells how many lines are in filename.txt

mv : Moves a file.
mv -f /home/pen/ram.php /root/ Moves ram.php to the directory root

Basic Extracting

tar xvfz imagick-0.9.11.tgz (extracts the .tgz file)

bzip2 and bunzip: Files With .bz2 Extensions

bzip2 filename.txt : zips filename.txt to filename.txt.bz2

bunzip2 filename.txt.bz2 : unzips filename.txt.bz2 to filename.txt

Important Service Commands

Restart apache:
-
service httpd restart

Restart MySQL:
-
service mysql restart

Restart exim:
-
service exim restart

Restart Cpanel:
-
service cpanel restart

Note: "restart" can be replaced with "stop" to quit the service and "start" to start a stopped service.
 
 
 


Old
  Post #2 (permalink)   09-08-2006, 04:09 PM
HD Amateur
 
Join Date: Sep 2006
Posts: 63
Send a message via ICQ to watchdoghosting Send a message via AIM to watchdoghosting Send a message via MSN to watchdoghosting Send a message via Yahoo to watchdoghosting

Status: watchdoghosting is offline
Very good HOWTO. Kudos mate!
 
 
 


Old
  Post #3 (permalink)   11-03-2006, 08:12 PM
HD Newbie
 
Join Date: Nov 2006
Location: www.pwrhost.com
Posts: 46
Send a message via AIM to PWRseth Send a message via MSN to PWRseth

Status: PWRseth is offline
Yes good job, thanks

also check out http://www.ss64.com/bash/
__________________
PWRHost - Power Internet Services
http://www.pwrhost.com
Web Hosting | VPS | Dedicated Servers
 
 
 


Old
  Post #4 (permalink)   11-11-2006, 01:28 AM
HD Newbie
 
Join Date: Aug 2006
Posts: 42

Status: ACENET-Jason is offline
I personally like using 'top -ic' . Allows for some quick troubleshooting.

Very useful post for anyone just learning about ssh btw.
 
 
 


Old
  Post #5 (permalink)   04-13-2007, 04:46 PM
HD Addict
 
Join Date: Apr 2007
Posts: 137

Status: Dougy is offline
Hey, thanks.

I've learned something new now. That's awesome. I love learning new things.
 
 
 


Old
  Post #6 (permalink)   04-13-2007, 04:48 PM
HD Management Staff
 
Artashes's Avatar
 
Join Date: Apr 2003
Posts: 8,524

Status: Artashes is offline
Even though its a year-old thread, I have never seen it before. Ah well, where are those glasses...
__________________
HostingDiscussion.com - web hosting community for grown-ups.

FORUM RULES | NEWS BLOG | HOSTING SHOWCASE | Follow us on Twitter
 
 
 


Old
  Post #7 (permalink)   04-13-2007, 05:17 PM
HD Wizard
 
Join Date: Sep 2004
Location: Pennsylvania
Posts: 1,621

Status: ANMMark is offline
lol I have not seen this one either....odd for me. Very good, and I actually believe that SHE will love this to be prominant when SHE strolls in.
__________________
Mark
avidInteractive Design | BlackAsylum™ Records
Lead singer of Circle7 - Check out Circle7 on MTV
 
 
 


Old
  Post #8 (permalink)   04-13-2007, 05:20 PM
HD Management Staff
 
Artashes's Avatar
 
Join Date: Apr 2003
Posts: 8,524

Status: Artashes is offline
Quote:
Originally Posted by ANMMark
lol I have not seen this one either....odd for me. Very good, and I actually believe that SHE will love this to be prominant when SHE strolls in.
Stop being silly, Mark. You know SHE doesn't like manly stuff. Well, predominantly manly.
__________________
HostingDiscussion.com - web hosting community for grown-ups.

FORUM RULES | NEWS BLOG | HOSTING SHOWCASE | Follow us on Twitter
 
 
 


Old
  Post #9 (permalink)   05-27-2007, 03:07 AM
HD Amateur
 
Join Date: Dec 2006
Location: Ohio
Posts: 66
Send a message via Yahoo to proweb2006

Status: proweb2006 is offline
The newbie will definitely benefit from this how to, good job
__________________
Check out Specialty Consultants for All of Your Hosting and Web development Needs
 
 
 


Old
  Post #10 (permalink)   05-27-2007, 11:27 AM
HD Wizard
 
Join Date: Sep 2004
Location: Pennsylvania
Posts: 1,621

Status: ANMMark is offline
I think that more than newbies can benefit from this. This is a good reference for those that just need a reminder as well.

There are many times when people just need a syntax reminder, and this can provide that.
__________________
Mark
avidInteractive Design | BlackAsylum™ Records
Lead singer of Circle7 - Check out Circle7 on MTV
 
 
 


Old
  Post #11 (permalink)   05-27-2007, 12:46 PM
HD Newbie
 
Join Date: Nov 2006
Location: www.pwrhost.com
Posts: 46
Send a message via AIM to PWRseth Send a message via MSN to PWRseth

Status: PWRseth is offline
More helpful info for cpanel admins.

Summary:
This article lists all the well known, and registered ports that are being used by cPanel. You should consider this ports list if you’re installing 3rd party firewall software.

More information:
The list is divided into two categories: Inbound tcp/udp and Outbound tcp/udp.

Quote:
Inbound ports

TCP
20 – FTP
21 – FTP
22 – SSH
25 – SMTP
26 – SMTP
53 – DNS
80 – HTTP
110 – POP3
143 – IMAP4
443 – HTTPS
465 – SMTP (TLS/SSL)
993 – IMAP4 (SSL)
995 – POP3 (SSL)
2082 – CPANEL
2083 – CPANEL (SSL)
2086 – WHM (Web Host Manager)
2087 – WHM (SSL)
2095 – WEBMAIL
2096 – WEBMAIL (SSL)
3306 – MYSQL (ONLY IF YOU WANT TO ALLOW INCOMING MYSQL CONNECTIONS)
6666 - CHAT

UDP
21 – FTP
53 – DNS
465 – SMTP (TLS/SSL)

Quote:
Outbound ports

TCP
20 – FTP
21 – FTP
25 – SMTP
26 – SMTP
37 – RDATE
43 – WHOIS
53 – DNS
80 – HTTP
113 – IDNET
465 – SMTP (TLS/SSL)
873 – RSYNC
2089 – CPANEL LICENSE
3306 – MYSQL (ONLY IF YOU NEED TO CONNECT TO REMOTE MYSQL SERVER)

UDP
21 – FTP
53 – DNS
465 – SMTP (TLS/SSL)
873 – RSYNC
Note: For more information on standard port assignment, visit the following URL: http://www.iana.org/assignments/port-numbers.
__________________
PWRHost - Power Internet Services
http://www.pwrhost.com
Web Hosting | VPS | Dedicated Servers
 
 
 


Old
  Post #12 (permalink)   07-01-2007, 10:24 AM
HD Addict
 
Join Date: May 2006
Posts: 129

Status: alemcherry is offline
I would call it basic Linux commands
 
 
 


Old
  Post #13 (permalink)   10-31-2007, 07:41 AM
HD Amateur
 
Join Date: Sep 2007
Posts: 53

Status: indyamail is offline
Adding to the above list:

wget - to get files from another location (server)
example : wget http://www.abcd.com/filename.tar

updatedb - Update the Search System and File System so you can use the "locate" command to find files on your server.

example : updatedb

locate - To search for location of a file or folder on your server

example: locate filename or locate file.tar (or whatever extension)
__________________
IndyaMail.Com - Proud to Be Indian, Proud to Be Worldwide.
IndyaMail VPS, Resellers and Shared Hosting
IndyaMail Email Service
 
 
 


Old
  Post #14 (permalink)   02-28-2008, 06:21 PM
HD Newbie
 
Join Date: Jul 2007
Posts: 42

Status: appage is offline
Thanks, a good cheat sheet incase i forget something =)
__________________
Erupt.com - Shared and Reseller Hosting
We Care About Your Website
 
 
 


Old
  Post #15 (permalink)   02-28-2008, 08:44 PM
HD Newbie
 
Join Date: Feb 2008
Posts: 5
Send a message via MSN to hsphereclub

Status: hsphereclub is offline
Great tutorial
 
 
 
Reply
Previous Thread Next Thread


Thread Tools

New Post New Post   Old Post Old Post
Posting Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Sponsored By: