|
SSH Commands: Current Count 48
Please reply with your most often used commands. Please number them if you can so we can keep track with how many we have here.
Here are some to start:
1. How to block an IP an via SSH?
/sbin/iptables -I INPUT -s 222.222.222.2 -j DROP
2. How to stop apache via SSH (if a website has high traffic and causing server load to rise)?
service httpd stop
3. How to start apache via SSH?
service httpd restart
4. How to start the POP mailserver?
/usr/local/cpanel/bin/cppop
5. How to restart Named (DNS server)
service named restart
6. w
Show who is currently connected to your server via SSH and what they are currently doing.
7. top
Show the top processes in terms of how much processor time/memory, etc. they are using in real time. Don't run this for a long time, because it can put a strain on an already overworked server.
8. How do I see all the files in a directory?
ls
List directory. ls -a to view a list of files including the "hidden" files that start with a "." ls -l list files with more information like owner, group and permissions info. You can combine both like this ls -la or ls -al
9. less <filename>
To view a file a page at a time.
10. pico -w <filename>
to edit a file
11. rm -r <directory name>
to recursively remove a directory (use with caution
12. ps -ewf | grep <search string>
to find a running process matching <search string>
13. tail <filename>
to view the end of a file - useful for example if you want to monitor a log file. As the file is updates, the new contect will be displayed on screen.
Probably not a good idea to run for too long.....
14. How do I change directories?
Type: cd <directory name> (Move to another directory)
Type: cd .. (Move back a directory)
15. How do I check permissions on a file?
Type: ls -l (Will show permissions for all files in directory)
16. How do I check disk space?
Type: df -m (Will show all free space info for all drives)
17. How do I check all running services?
Type: ps -xa
18. How do I view the contents of a text file?
Type: cat <filename>
19. How do I debug a cgi script?
Goto the directory the file is in.
Type: ./filename.cgi
Read outputs, and fix errors based on output read.
20. How do I execute a program, but send it to the background?
Execute the command normally but add an & at the end of it.
21. How do I bring a program back from the background?
Type: fg
22. How do I know what my CPU Information is?
Type: cat /proc/cpuinfo
23. How do I know what my memory information is? RAM
Type: cat /proc/meminfo
24. How do I find out information about my hard drives?
Type: fdisk -l
25. I just uploaded/moved some files to a customers/user of mine and now they can't modify/rename/delete this file?
This is because you uploaded the file as a different user/root.
Login to your server via SSH & Type: /scripts/chownpublichtmls
26. Sometimes when moving an account to your WHM Account from another
WHM Account/server you will get an error where the domain is forbidden.
Login to your server via SSH & Type: /scripts/enablefileprotect
27. How can I view the status of my Advanced Policy Firewall ? (APF)
Login to your server via SSH & Type: /etc/apf/apf -st
28. How can I stop my Advanced Policy Firewall ? (APF)
Login to your server via SSH & Type: service apf stop
29. How can I start my Advanced Policy Firewall ? (APF)
Login to your server via SSH & Type: service apf start
30. How can I restart CPanel via SSH?
Login to your server via SSH & Type: /etc/rc.d/init.d/cpanel restart
31. How can I stop BIND / NAMED from SSH?
Login to your server via SSH & Type: /etc/init.d/named stop
32. How can I start BIND / NAMED from SSH?
Login to your server via SSH & Type: /etc/init.d/named start
33. How can I force AWSTATS to update?
Login to your server via SSH & Type: /scripts/runlogsnow
34. How can I find files owned by a customer/user?
Login to your server via SSH & Type: find -user username *Replace username*
|