The following basic SSH commands will be helpful to you in linux administration.
List of Common Secure SHell Commands
passwd : Changes your SSH account’s password, follow the options after typing to change account password.
nano [option] [file]: File editor, easy-to-use and very friendly.
nano –w /home/aquhome/public_html/index.php : your current editing index.php with –w being non wrapping of long lines
mkdir [directory_name] : Create a directory with specific default permissions .
mkdir aquhome : Creates a directory aquhome in the current directory you are.
df : [attribute]
[b]df -h[b] : It is to show you the disk space available in human readable format (Mbit and Gbit)
cd : change directory
cd ~ : takes to your home directory
cd – : takes to the last directory you viewed
cd ../ : takes you one level up a directory
cd [directory path]
ls: this command lists files and directories in a directory
ls –l : it will show all the files with detailed attributes
vi : it will show an advanced editor, having tons of features, but harder to use then nano
vi /home/aquhome/public_html/index.php : Editing that index.php file again
ln : Makes sys links between the files and directories
ln –s /usr/local/apache/conf/httpd.conf /etc/httpd.conf : it will allow you to edit the /etc/httpd.conf instead of the original, changes will apply to the original immediately. You can delete the link without deleting the original.
wall : broadcast message
wall so whens the server being restarted?
top : shows endlessly updating system processes in a table.
w : shows ip address of the person and who has logged in currently.
ps : displays the processes that are running.
touch : creates an empty file.
touch index.html : creates an empty index.html
kill : terminates a particular 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/ : it copies all files in public_html to /public_ftp
du : displays disk usage
du –sh : displays a summary of total disk space in the current directory along with the subdirectories in human readable form
netstat : displays all current network connections
netstat -rn : displays routing tables for IP’s.
netstat -an : displays all connections to the server.
chown : command to change the owner of a file
chown [attribute] newowner.newowner filenames
chown -R aquhome.aquhome /home/aquhome/public_html/index.php
chmod : [-r] permissions filenames
u – A User who owns the file.
g – A Group that owns the file.
o – Other.
a – All.
r – Reads the file.
w – Writes or edit the file.
x – Executes or run the particular file as a program.
CHMOD can also be 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 : shows last logins to the system
rm : deletes a file
rm filename.txt : deletes filename.txt, will more than likely ask, if you really wish to delete it
rm -f filename.txt : deletes filename.txt, won’t ask for confirmation before deleting.
rm -rf tmp/ : recursively deletes the directory tmp, and all files in it. You need to be very carefull with this command.
grep : Search for patterns in files
grep root /etc/passwd : displays all matches of root in /etc/passwd
grep -v root /etc/passwd : displays all lines that don’t match root
wc : word count
wc -l filename.txt : shows how many lines are in filename.txt
mv : Moves a specific file.
mv -f /home/pen/ram.php /root/ moves ram.php to the directory root
Basic Extracting Commands:
tar xvfz imagick-0.9.11.tgz : will 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
Essential Service Commands:
service httpd restart : Restarts Apache
service mysql restart : Restarts MySQL
service exim restart : Restarts exim
service cpanel restart : Restarts Cpanel
Note: In order to quit a service, replace “restart” with “stop” and “start” to start a service that is stopped.
Like this post ?
Share on your Social Networking Profile ( Facebook, Twitter & Google+ ) and get a flat 10% Recurring discount on our VPS Hosting and Dedicated Servers.
Email us the shared link at : firstname.lastname@example.org or speak to our live chat operator now, by clicking on the “Live Chat” Scroller on the left-hand side of this page and we will provide you with the discount Coupon right away!