Linux Cheatsheet

This is just a collection of Linux commands that I compiled in one spot so I wouldn't keep having to go hunting for them. There are lots of different installs out there, so some of this might not work on your server, but hopefully it does and saves you some time.

How to Create a Symbolic Link

ln -s target linkname

How to Allow a Group (examplegroup) Access to a Folder

chown -R apache.examplegroup folder
chmod -R 775 folder

How to Block a Group (examplegroup) From a Folder

chown -R apache.examplegroup folder
chmod -R 705 folder

How to Restart Email Systems

sudo service dovecot restart
sudo service sendmail restart

How To Restart Apache

sudo /etc/rc.d/init.d/httpd restart

How to Empty Your Mailbox

cd /var/spool/mail/
tail username > username

How to Add a User

/usr/sbin/useradd newusername
passwd newusername

How to Delete a User

/usr/sbin/userdel -r user

How to See All Users

vi /etc/passwd

How to Add a Domain

cd /etc/httpd/conf/virtuals
/etc/rc.d/init.d/httpd restart



This post was first published on October 3rd, 2011 and last updated on June 24th, 2016 by Robert James Reese in the following categories: Apache and Linux Before using any of the code or other content in this post, you must read and agree to our terms of use.