$ cp -a source/. /dest/
The -a option is an improved recursive option, that preserve all file attributes, and also preserve symlinks. The . at end of the source path is a specific cp syntax that allow to copy all files and folders, included hidden ones.
$ sudo chmod -R ugo+rw /DATA/SHARE
The breakdown of the above command looks like:
- sudo – this is used to gain admin rights for the command on any system that makes use of sudo (otherwise you'd have to 'su' to root and run the above command without 'sudo')
- 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. As you can probably surmise, this command opens wide the SHARE folder such that anyone on the system can have access to that folder. As I mentioned earlier, a more secure method would be to use groups. But we're just using this for the purpose of demonstration.
The breakdown of permissions looks like this:
- u – user
- g – group
* o – other The 'other' entry is the dangerous one, as it effectively gives everyone permission for the folder/file. The permissions you can give to a file or folder are:
- r – read
- w – write
* x – execute Using the -R switch is important. If you have a number of sub-folders and files within the SHARE directory, and you want the permissions to apply from the parent object (the containing folder) to the child objects (the sub-folders and files), you must use the -R (recursive) switch so the same permissions are applied all the way to the deepest folder, contained within the parent.
$ rm -r mydir
$ >.tar.gz or tgz
$ tar xvzf ***.tar.gz
# v is for verbose
$ > .gz (.gzip)
$ gunzip ***.gz
$ >.tar.bz2 or .tbz
$ tar xvjf ***.tar.tbz
$ dtrx ***.tar.gz
$ dtrx ***.tar.bz2
$ dpkg --list # add > **.txt to dump list to file
$ df -h
$ sudo du -hs /*
$ sudo du -hs /etc/* # to restrict to specified directory