SSH Usage and Helpful Commands

passwd : Change the password you use to login to SSH. You can amend this command with a username, ex. 'passwd root'
vi : A basic text editor included with all Linux distributions. To edit a file, use 'vi /path/to/file' NOTE: to begin editing after entering vi, enter 'a'. To save and quit, enter ':', then 'wq' for write+quit, or just q for quit.
mkdir : Creates a new directory with the name you specify, ex. 'mkdir downloads'
df -h : Displays a summary of how much disk space is available.
cd : Change directory, ex. to move to your /home folder, use 'cd /home'
ls –l : List all files in the current directory. You can simply use 'ls' to list the files without details, or 'ls /path/to/directory' to list the contents of a remote directory.
top : Displays a summary of all running processes, with CPU and memory usage for each.
w : Shows users currently logged in, along with their IP addresses.
touch : Generates an empty file, ex. 'touch index.php' will create a blank index.php (which you can then edit with vi).
kill -9 PID : Kills a process. Use 'top' to find the PID of a running process.
cp : Copy file, ex. 'cp /file1 /home/file1' will move file1 to /home.
netstat -an
: Shows all open connections to the server.
chown : Change ownership permissions on a file, ex. 'chown user:group file.ext'
rm filename.txt : Deletes filename.txt, the prompt will ask if you are sure.
rm -f filename.txt : Deletes filename.txt, bypassing confirmation.
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.
mv : Moves a file, and can also change filename, ex. 'mv /home/file.xz /file.gz' will move the file and change its name.
tar xvfz file.tar.gz : Extracts a .tar.gz file.
bzip2 filename.txt : Zips filename.txt to filename.txt.bz2.
bunzip2 filename.txt.bz2 : Unzips filename.txt.bz2 to filename.txt

Restart Apache:
service httpd restart

Restart SSH:
service sshd restart

Restart MySQL:
service mysql restart

Restart Exim:
service exim restart

Restart cPanel:
service cpanel restart

Was this answer helpful?

 Print this Article

Also Read

How to Install & Enable tomcat for an account using WHM?

Step to Install Tomcat and enable tomcat service . 1. Login to WHM as root user. 2. Go to Whm...

Where can I check how much RAM my VPS is using?

You can check the RAM usage of your VPS easily by logging into SolusVM, but if you would like a...

Powered by WHMCompleteSolution