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

1.   ln -s target linkname

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

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

How to Block a Group (examplegroup) From a Folder

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

How to Restart Email Systems

1.   sudo service dovecot restart
2.   sudo service sendmail restart

How To Restart Apache

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

How to Empty Your Mailbox

1.   cd /var/spool/mail/
2.   tail username > username

How to Add a User

1.   /usr/sbin/useradd newusername
2.   passwd newusername

How to Delete a User

1.   /usr/sbin/userdel -r user

How to See All Users

1.   vi /etc/passwd

How to Add a Domain

1.   cd /etc/httpd/conf/virtuals
2.   vi
3.   /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.