mv -i oldname newname
Copying a directory (and it’s contents) recursively:
cp -r /etc/ /var/tmp/backup/
Create folder
mkdir foldername
Why host images on a separate subdomain?
- A separate domain prevents your domain’s cookies from being sent for every image request, where they’re not needed. Reduces the bandwidth overhead for each request.
- Most browsers will only make a certain number of HTTP requests at one time to a particular domain, so serving images and other static content off a second domain potentially doubles the number of HTTP requests at one time.
- You can conceivably use a different, lighter weight webserver like nginx/lighttpd to serve the static content.
Add a User to a Group
Add an Existing User Account to a Group
usermod -a -G examplegroup exampleusername
Change a User’s Primary Group
usermod -g groupname username
View current user’s groups
groups
To view the numerical IDs associated with each group, run the id
command instead:
id
View groups of another user:
View groups of another user:
groups exampleusername
id exampleusername
View all groups of the system:
getent group
Show All Members of a Group
Use the grep command as follows:
grep 'www-data' /etc/group
Deploy a website to a remote server with Git push
Install DOS to Unix converter
apt-get install dos2unix
Then use it like so:
dos2unix /var/www/project-create.sh
Will recursively find all files inside current directory and call for these files dos2unix command
find . -type f -print0 | xargs -0 dos2unix
Install WordPress for new project
On Server
Download WordPress to site
wget -c http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
sudo rsync -av wordpress/* /var/www/sarah/public_html
OLD WAY Upload WordPress zip to directory
unzip wordpress.zip
Make whole site writable for WordPress (wp-content needed for plugins, wp-admin needed for wordpress update)
I think you need to set like this instead (if you have trouble installing plugins after this then I was wrong)
find /var/www/sarah/public_html -type d -exec chmod 775 {} \;
find /var/www/sarah/public_html -type f -exec chmod 664 {} \;
Then update to belong to user:
sudo chown -R sarah:www-data /var/www/sarah/public_html
Go to IP alias or domain and follow wizard
After wizard complete, download wp-config.php and add this line to bottom so users can upload plugins using admin
if(is_admin()) {
add_filter('filesystem_method', create_function('$a', 'return "direct";' ));
define( 'FS_CHMOD_DIR', 0751 );
}
On Local
Create new site folder under D:\sites\{site-name}
Unzip in folder
Open project in localhost:
Follow WordPress steps to hook up to WordPress database you created
Remove all files and subfolders in directory
rm -r /path/to/directory/*