March 9
Rsync (Remote Sync)
Basic syntax of rsync command
# rsync options source destination
Some common options used with rsync commands
-v : verbose
-r : copies data recursively (but don’t preserve timestamps and permission while transferring data
-a : archive mode, archive mode allows copying files recursively and it also preserves symbolic links, file permissions, user & group ownerships and timestamps
-z : compress file data
-h : human-readable, output...
February 9
MySQL - Merge two user groups users into one current group, and delete the second group.
Merge two user groups users into one current group, and delete the second group.
Note: some users might be in both groups already.
# Show users in groupID 111 are also in groupID 222
SELECT user_id FROM user_group
WHERE user_group_id={111} AND user_id IN (SELECT user_id FROM user_group WHERE user_group_id={222} )
# Change user_group_id 222 to 111. Use 'UPDATE IGNORE' assume user_id & user_group_id are unique index
UPDATE IGNORE user_group SET user_group_id={111}
WHERE...
December 27
Website loading speed tester
Test your website loading speed world wide:
https://www.dotcom-tools.com/website-speed-test.aspx
...
December 6
Git tagging
To create a tag on your current branch (or with message), run this:
$ git tag {tag-name}
or,
$ git tag -a {tag_name} -m "message" #If you want to include a description with your tag, add -a to create an annotated tag:
This will create a local tag with the current state of the branch you are on. When pushing to your...
December 6
Git branch
You’ve decided that you’re going to work on feature_12 as an example. To create a new branch and switch to it at the same time, you can run the git checkout command with the -b switch:
$ git checkout -b feature_12
Switched to a new branch "feature_12"
This is shorthand for:
$ git branch feature_12
$ git checkout feature_12
After you are done with your branch...
October 24
How to Manage File and Folder Permissions in Linux
Command line: File permissions
The commands for modifying file permissions and ownership are:
chmod – change permissions
chown – change ownership.
chmod – the command to modify permissions
R – this modifies the permission of the parent folder and the child objects within
ugo+rw – this gives User, Group, and Other read and write access.
The breakdown of permissions looks like this:
u – user
g – group
o –...
October 24
Linux user and group management commands
How to See Which Groups Your Linux User Account Belongs To?
groups
How to add a new group?
sudo groupadd
How to add user to a group?
usermod -a -G
Change a User’s Primary Group
While a user account can be part of multiple groups, one of the groups is always the “primary group” and the others are “secondary groups”. The user’s login...
October 23
SCP command to transfer files/folders in Linux
Basic syntax of SCP
scp source_file_name username@destination_host:destination_folder
Example:
user@localhost ~/Documents $ scp -v user.name@212.x.x.x:.
Copy a Directory Recursively using SCP
I often need to quickly copy a directory from one Linux machine to another. An easy command to accomplish the task is the SCP (Secure Copy) command. Here's the general format of a recursive copy.
scp -r [/local/path/] [user@host]:[/remote/path]
The -r switch causes scp to copy recursively....