Linux command on Dedicated Server


Please, can I have common Linux command, which can help me in managing my un-managed dedicated server.

Hi Raj,

There are lot lot of commands availalbe, for you sake, I am providing you a very short tutorial of this, I hope, this may help you, if you do have any problem, you can also contact us at anytime.

To list your files and directories — ls
With the listing you also want to see the attribute details of each file — ls – al

To switch over to another directory, you can use cd command
e.g

cd /usr/local/apache
for going to the apache directory under usr local

cd ~ for going to the your home directory
cd – for going to the last directory you were in
cd .. for going to the parent directory
for printing the contents of the file on the screen you can use cat
e.g cat abc.txt which will dispaly the contents of the abc.txt on your screen
There are few very big log files, if you want to read only the end of the file, you can use the tail command
e.g
tail /var/log/messages
If you want to watch the file continously while it is being updated you can use the -f option with the tail command
e.g
tail -f /var/log/messages

If you want to just display 20 lines of the file on the screen then you can use the command
tail -20 /var/log/messages

You can also use the more command to open the file one screen at a time
e.g.
more /etc/userdomains
In this you can press the spacebar to go to the next screen and q for quit

Editors
I uses two of the editors pico and vi

pico /home/domain/public_html/index.html You can use this to edit the index page for the user’s website.

vi /home/burst/public_html/index.html

Please, you need to go for their specified tutorials, before using them.

To look for the pattern in the files, you need to use the grep command
grep root /etc/passwd It will display all matches of root in /etc/passwd
If you want the revers, I mean you does not want display the lines, which does not contain particular pattern, for that you can use the -v option with the grep command
grep -v root /etc/passwd

To create an empty file, you can use the touch command
touch /home/domain/public_html/404.html This will create an empty file called 404.html in the directory /home/domain/public_html/

Sometimes, you need to access the fiile, which have got very long paths, for them for them you can use the ln command to create the links between the files and the 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.

To delete a file you can use the rm command
rm abc.txt
it will be asking for the confirmation before actually deleting the abc.txt and
if you want that it does not ask you for the confirmation then you can use the -f option with the rm command
rm -f abc.txt

There is one option, -r, for deleting the subdirectories and directories, but, I will never suggest you to use this option.

If you want to see the last login’s information, you can use the last command
last -20 This will show only the last 20 logins
If you want to see the hostname in the last filed, you can use -a option with this
last -20 -a

If you want to see, who is currently logged in and from where, then just type w on the command line.

netstat will show all current network connections.
netstat -an will show all connections to the server, the source and destination ips and ports.
netstat -rn It will show routing table for all ips bound to the server.

To display live system processes in a nice table, memory information, uptime and other useful info you can use the top command. This is excellent for managing your system processes, resources and ensure everything is working fine and your server isn’t bogged down.
To sort by memory
top + m
To sort by CPU usage
top + p

If you wanted to just display currently running processes and their PID you can use the ps command (ps for process status)
A process ID is a unique number that identifies a process, with that you can use to kill or terminate a running program on your server (see kill command).
ps U username To show processes for a certain user
ps aux It will show all system processes
ps aux –forest : shows all system processes like the above but organizes in a hierarchy that’s very useful!

file * This will 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/domain/new_design/* /home/domain/public_html/ : copies all files, retaining permissions form one directory to another.

kill: terminate a system process
kill -9 PID wsshe: kill -9 431
kill PID EG: kill 10550
Use top or ps ux to get system PIDs (Process IDs)

e.g.

PID TTY TIME COMMAND
10550 pts/3 0:01 /bin/csh
10574 pts/4 0:02 /bin/csh
10590 pts/4 0:09 APP

Each line represents one process, with a process being loosely defined as a running instance of a program. The column headed PID (process ID) shows the assigned process numbers of the processes. The heading COMMAND shows the location of the executed process.

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

mysqldump -u username -ppassword dbname > file.sql
MySQL Dump

tar -zxvf file.tar.gz
UnTAR file

mysql -uusername -ppassword database_name <file.sql
Importing MySQL database

public FTP need


Hey,

I have a client needing to send large files. I need to create an FTP account for her to upload to a directory on site. I cannot find out how in the cpanel. On my old hosting cpanel. I sould just click add user and fill in the forms and it was done. how do I do it in H-Sphere? I only have ONE ftp account and that is mine. there is no options to add accounts.

u have a windows account? Multi FTP users is only supported under Linux. You can email support and they might make you a extra FTP username Also the only time dedicated IP is needed is for anonymous FTP…

Add domain in existing accounts


Hey All,

I have an account set up to give 3 domains and every additional domain is $1.00, but I want to give this particular user an additional 3 domain names for free. Is there a way I can add things to a user without having credit them? I just want to add to their account.

The only way with out giving them a credit is to create a special plan just for them.

account Crediting issue


If a user signs up for a hosting account and uses the paypal option, will every monthly payment he/she makes get automaticaly updated or do i have to give a credit each month?

You need to credit his/her account.

Dedicated IP Addresses help need


Hi!

i m in the process of moving my site to cpwebhosting.net Reseller web hosting account. i have a subweb that we use or SSL certificate to access. Do i need a dedicated IP address for the main web and the subweb or just the subweb or just the web?

If publishing via FP 2003 don’t you use the same login and password that you use to access your client’s control panel?

Is there a way to set this somewhere?

Thank you in advance.
Reply With Quote

Just the subdomain where you need SSL

For FP, use your ftp username and password

You can change the default page by:
1) Clicking on Web Settings
2) Clicking on the desired domain
3) Turning on directory indexes
4) Adding the desired home page (eg: index.asp)

reseller DNS IP problem


When clicking on the submit button in the server aliases section in the e-manager, we are receiving an error that says “no reseller DNS IP is available for host xx”. Is there something we did wrong, or is this a problem with the server?

Third level hosting


hello,
i m a Reseller hosting provider, how can i do third level hosting

Delegated Shared SSL, An SSL certificate type that allows your resellers to offer their customers your service domain for third level hosting and wildcard certificate installed on it.

restrict access of plans


hi,
i want some of my plans only accessed by administrators.no another user can access these plans, can i do it

yes, for set up plan access:

  1. Select Plans in the INFO menu.
  2. Click Access for the plan to restrict access to.
  3. Check authorized plans

Third Level Hosting


hi,
i have a Reseller web hosting website. some of my clients wants to use my service domain to create third level domains of their own. how can i do it?

u can create third level domain based on second level domains and this have same features as second level domains. Customers can use your service domain to create third level domains of their own. For instance, if your second level domain is xyz.com, your customers can create domains like illustrative.xyz.com.

Third level domains are registered on your DNS server and need no domain registration company to be registered.

To add a domain for third level hosting, you need to create a DNS zone and allow third level hosting in the zone settings.

how can we set up our corporate site?

for set up your corporate site:

1. Make sure you have a service DNS zone
2. Create a service plan
3. Disallow signups from outside your admin account.
4. Create a service account

Reseller web hosting info.


hi,
By purchasing a Reseller web hosting plan from cpwebhosting.net, i want to start a web hosting company. can i advertises my own web hosting company as the actual service provider?

yes, u can do it.

when the hosting reseller advertises his company as the actual service provider, and does not use the name of the actual underlying web-host provider it is called Private Labeling. This way the customers do not know who the actual provider is, and do not try to go around the reseller for a better price. In most cases, the customer does not even know that he is using a reseller.