amuck-landowner

Linux VPS cheat sheet. Linux commands for CentOS/RHEL and Ubuntu/Debian

zim

The Invader
Verified Provider
lsmod - List loaded kernal module

modprob modname - Load kernal module

I saw mention of dd tests in this thread and i would like to add some stuff to make your disk test more complete. If you run the below, simultainusly with dd you will get a per second BW and IOPS read

yum install sysstat - Installs sysstat

iostat 1 - Runs iostat a sysstat package and updates every second (tps(transactions per second) output is IOPS)
 

IntegralHost

New Member
Verified Provider
Find number of incoming connections to your server (It will help to find the source of DOS attack)

netstat -nut | awk '{print $5}' | cut -d : -f1| sort | uniq -c | sort -n

Find the count of every user process (Better to find cpu abusers) 

ps aux | awk '{print $1}' | sort | uniq -c | sort -n | tail -5
 

ModyDev

New Member
 iftop  - Bandwidth usage

chown - change owner of a file

Code:
chown apache:apache /var/external/www
 
Last edited by a moderator:

souen

Active Member
For systems using systemd (CentOS, etc.)


systemctl [stop/start/restart/enable/disable] service
nano is cool, though vi is more likely available if you're stuck without connectivity:


vi [filename]
(i to insert/edit, Esc to exit insert mode, :wq to save file and exit)
Create or extract tarballs:


tar -cvf [filename.tgz] [directory]
tar -xvf [filename.tgz]
Handy commands for testing Internet connectivity

Test outbound connection and path:


ping -c [number of packets to send] [host]
ping6 -c [number of packets to send] [host]
traceroute -m [max hops] [host]
(use -4 or -6 to specify test on ipv4 or ipv6)
Get external IP (using curl or wget):


curl http://wgetip.com/
wget -q -O - http://wgetip.com/
(ipv4/ipv6)
curl http://whatsmyipv6.org/backend.php
See network devices


ifconfig
ip a
Show local network routes:


ip r s
(to show only routes a given device: ip r s dev [device])
Check host record (useful for rDNS, mail PTR, etc.)


dig [host]
Show processes listening on local ports:

Code:
netstat -lnpt
 

VENETX

New Member
This a great thread, but wouldnt it be better to take everyone's idea and put it on the main thread so its easier to find rather than go to page 2 or 3?
 

Chatahooch

New Member
Good thread thanks I'll post my cheat sheet as well pretty quick though much of it has already been covered ^^
 

CenTex Hosting

Member
Verified Provider
Great starter Guide. I am going to take this and put it into our new hire training.


Thanks for the great share and putting a ton of info in one place
 

ModyDev

New Member
crontab for those who want to schedule linux commands and here is a short description of the usage.


 to open and edit crontabs

Code:
crontab -e

crontab format


MIN HOUR DOM MON DOW CMD


MIN  - Minute Field


HOUR - Hour Field


DOM - Day Of Month


MON - Month Field


DOW - Day Of Week


CMD - Command


So for example if i want to schedule a backup on 1st June  09:10 AM

Code:
10 09 01 01 * /path/to/backup/script

There is some fancy keywords too

Code:
@yearly cmd

Code:
@monthly cmd

Code:
@weekly cmd

Code:
@daily cmd

Code:
@hourly cmd

Code:
@reboot cmd
 
Top
amuck-landowner