mirror of https://github.com/Idnan/bash-guide.git
chown added (#34)
* chown added * add chown command * add chown command
This commit is contained in:
parent
4329a7352f
commit
cae0769e3c
77
README.md
77
README.md
|
@ -80,25 +80,26 @@ Clears content on window.
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="#a-cat">cat</a></td>
|
<td><a href="#a-cat">cat</a></td>
|
||||||
<td><a href="#b-chmod">chmod</a></td>
|
<td><a href="#b-chmod">chmod</a></td>
|
||||||
<td><a href="#c-cp">cp</a></td>
|
<td><a href="#c-chown">chown</a></td>
|
||||||
<td><a href="#d-diff">diff</a></td>
|
<td><a href="#d-cp">cp</a></td>
|
||||||
<td><a href="#e-file">file</a></td>
|
<td><a href="#e-diff">diff</a></td>
|
||||||
<td><a href="#f-find">find</a></td>
|
<td><a href="#f-file">file</a></td>
|
||||||
<td><a href="#g-gunzip">gunzip</a></td>
|
<td><a href="#g-find">find</a></td>
|
||||||
<td><a href="#h-gzcat">gzcat</a></td>
|
<td><a href="#h-gunzip">gunzip</a></td>
|
||||||
<td><a href="#i-gzip">gzip</a></td>
|
<td><a href="#i-gzcat">gzcat</a></td>
|
||||||
<td><a href="#j-head">head</a></td>
|
<td><a href="#j-gzip">gzip</a></td>
|
||||||
|
<td><a href="#k-head">head</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="#k-lpq">lpq</a></td>
|
<td><a href="#l-lpq">lpq</a></td>
|
||||||
<td><a href="#l-lpr">lpr</a></td>
|
<td><a href="#m-lpr">lpr</a></td>
|
||||||
<td><a href="#m-lprm">lprm</a></td>
|
<td><a href="#n-lprm">lprm</a></td>
|
||||||
<td><a href="#n-ls">ls</a></td>
|
<td><a href="#o-ls">ls</a></td>
|
||||||
<td><a href="#o-more">more</a></td>
|
<td><a href="#p-more">more</a></td>
|
||||||
<td><a href="#p-mv">mv</a></td>
|
<td><a href="#q-mv">mv</a></td>
|
||||||
<td><a href="#q-rm">rm</a></td>
|
<td><a href="#r-rm">rm</a></td>
|
||||||
<td><a href="#r-tail">tail</a></td>
|
<td><a href="#s-tail">tail</a></td>
|
||||||
<td><a href="#s-touch">touch</a></td>
|
<td><a href="#t-touch">touch</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
@ -116,25 +117,31 @@ cat < file1 > file2 #copy file1 to file2
|
||||||
```
|
```
|
||||||
|
|
||||||
### b. `chmod`
|
### b. `chmod`
|
||||||
Lets you change the read, write, and execute permissions on your files. For more information on this command check this [link](https://ss64.com/bash/chmod.html).
|
The chmod command stands for "change mode" and allows you to change the read, write, and execute permissions on your files and folders. For more information on this command check this [link](https://ss64.com/bash/chmod.html).
|
||||||
```bash
|
```bash
|
||||||
chmod -options filename
|
chmod -options filename
|
||||||
```
|
```
|
||||||
|
|
||||||
### c. `cp`
|
### c. `chown`
|
||||||
|
The chown command stands for "change owner", and allows you to change the owner of a given file or folder, which can be a user and a group. Basic usage is simple forward first comes the user (owner), and then the group, delimited by a colon.
|
||||||
|
```bash
|
||||||
|
chown -options user:group filename
|
||||||
|
```
|
||||||
|
|
||||||
|
### d. `cp`
|
||||||
Copies a file from one location to other.
|
Copies a file from one location to other.
|
||||||
```bash
|
```bash
|
||||||
cp filename1 filename2
|
cp filename1 filename2
|
||||||
```
|
```
|
||||||
Where `filename1` is the source path to the file and `filename2` is the destination path to the file.
|
Where `filename1` is the source path to the file and `filename2` is the destination path to the file.
|
||||||
|
|
||||||
### d. `diff`
|
### e. `diff`
|
||||||
Compares files, and lists their differences.
|
Compares files, and lists their differences.
|
||||||
```bash
|
```bash
|
||||||
diff filename1 filename2
|
diff filename1 filename2
|
||||||
```
|
```
|
||||||
|
|
||||||
### e. `file`
|
### f. `file`
|
||||||
Determine file type.
|
Determine file type.
|
||||||
```bash
|
```bash
|
||||||
file filename
|
file filename
|
||||||
|
@ -144,7 +151,7 @@ Example:
|
||||||
$ file index.html
|
$ file index.html
|
||||||
index.html: HTML document, ASCII text
|
index.html: HTML document, ASCII text
|
||||||
```
|
```
|
||||||
### f. `find`
|
### g. `find`
|
||||||
Find files in directory
|
Find files in directory
|
||||||
```bash
|
```bash
|
||||||
find directory options pattern
|
find directory options pattern
|
||||||
|
@ -155,31 +162,31 @@ $ find . -name README.md
|
||||||
$ find /home/user1 -name '*.png'
|
$ find /home/user1 -name '*.png'
|
||||||
```
|
```
|
||||||
|
|
||||||
### g. `gunzip`
|
### h. `gunzip`
|
||||||
Un-compresses files compressed by gzip.
|
Un-compresses files compressed by gzip.
|
||||||
```bash
|
```bash
|
||||||
gunzip filename
|
gunzip filename
|
||||||
```
|
```
|
||||||
|
|
||||||
### h. `gzcat`
|
### i. `gzcat`
|
||||||
Lets you look at gzipped file without actually having to gunzip it.
|
Lets you look at gzipped file without actually having to gunzip it.
|
||||||
```bash
|
```bash
|
||||||
gzcat filename
|
gzcat filename
|
||||||
```
|
```
|
||||||
|
|
||||||
### i. `gzip`
|
### j. `gzip`
|
||||||
Compresses files.
|
Compresses files.
|
||||||
```bash
|
```bash
|
||||||
gzip filename
|
gzip filename
|
||||||
```
|
```
|
||||||
|
|
||||||
### j. `head`
|
### k. `head`
|
||||||
Outputs the first 10 lines of file
|
Outputs the first 10 lines of file
|
||||||
```bash
|
```bash
|
||||||
head filename
|
head filename
|
||||||
```
|
```
|
||||||
|
|
||||||
### k. `lpq`
|
### l. `lpq`
|
||||||
Check out the printer queue.
|
Check out the printer queue.
|
||||||
```bash
|
```bash
|
||||||
lpq
|
lpq
|
||||||
|
@ -192,19 +199,19 @@ active adnanad 59 demo 399360 bytes
|
||||||
1st adnanad 60 (stdin) 0 bytes
|
1st adnanad 60 (stdin) 0 bytes
|
||||||
```
|
```
|
||||||
|
|
||||||
### l. `lpr`
|
### m. `lpr`
|
||||||
Print the file.
|
Print the file.
|
||||||
```bash
|
```bash
|
||||||
lpr filename
|
lpr filename
|
||||||
```
|
```
|
||||||
|
|
||||||
### m. `lprm`
|
### n. `lprm`
|
||||||
Remove something from the printer queue.
|
Remove something from the printer queue.
|
||||||
```bash
|
```bash
|
||||||
lprm jobnumber
|
lprm jobnumber
|
||||||
```
|
```
|
||||||
|
|
||||||
### n. `ls`
|
### o. `ls`
|
||||||
Lists your files. `ls` has many options: `-l` lists files in 'long format', which contains the exact size of the file, who owns the file, who has the right to look at it, and when it was last modified. `-a` lists all files, including hidden files. For more information on this command check this [link](https://ss64.com/bash/ls.html).
|
Lists your files. `ls` has many options: `-l` lists files in 'long format', which contains the exact size of the file, who owns the file, who has the right to look at it, and when it was last modified. `-a` lists all files, including hidden files. For more information on this command check this [link](https://ss64.com/bash/ls.html).
|
||||||
```bash
|
```bash
|
||||||
ls option
|
ls option
|
||||||
|
@ -222,13 +229,13 @@ drwxr-xr-x 17 adnan staff 578 Mar 27 23:36 .git
|
||||||
-rwxr-xr-x 1 adnan staff 2702 Mar 25 18:08 .gitignore
|
-rwxr-xr-x 1 adnan staff 2702 Mar 25 18:08 .gitignore
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
### o. `more`
|
### p. `more`
|
||||||
Shows the first part of a file (move with space and type q to quit).
|
Shows the first part of a file (move with space and type q to quit).
|
||||||
```bash
|
```bash
|
||||||
more filename
|
more filename
|
||||||
```
|
```
|
||||||
|
|
||||||
### p. `mv`
|
### q. `mv`
|
||||||
Moves a file from one location to other.
|
Moves a file from one location to other.
|
||||||
```bash
|
```bash
|
||||||
mv filename1 filename2
|
mv filename1 filename2
|
||||||
|
@ -240,7 +247,7 @@ Also it can be used for rename a file.
|
||||||
mv old_name new_name
|
mv old_name new_name
|
||||||
```
|
```
|
||||||
|
|
||||||
### q. `rm`
|
### r. `rm`
|
||||||
Removes a file. Using this command on a directory gives you an error.
|
Removes a file. Using this command on a directory gives you an error.
|
||||||
`rm: directory: is a directory`
|
`rm: directory: is a directory`
|
||||||
To remove a directory you have to pass `-r` which will remove the content of the directory recursively. Optionally you can use `-f` flag to force the deletion i.e. without any confirmations etc.
|
To remove a directory you have to pass `-r` which will remove the content of the directory recursively. Optionally you can use `-f` flag to force the deletion i.e. without any confirmations etc.
|
||||||
|
@ -248,13 +255,13 @@ To remove a directory you have to pass `-r` which will remove the content of the
|
||||||
rm filename
|
rm filename
|
||||||
```
|
```
|
||||||
|
|
||||||
### r. `tail`
|
### s. `tail`
|
||||||
Outputs the last 10 lines of file. Use `-f` to output appended data as the file grows.
|
Outputs the last 10 lines of file. Use `-f` to output appended data as the file grows.
|
||||||
```bash
|
```bash
|
||||||
tail filename
|
tail filename
|
||||||
```
|
```
|
||||||
|
|
||||||
### s. `touch`
|
### t. `touch`
|
||||||
Updates access and modification time stamps of your file. If it doesn't exists, it'll be created.
|
Updates access and modification time stamps of your file. If it doesn't exists, it'll be created.
|
||||||
```bash
|
```bash
|
||||||
touch filename
|
touch filename
|
||||||
|
|
Loading…
Reference in New Issue