Adds linux basic command notes on permissions
This commit is contained in:
parent
43ec9604c6
commit
a07c95882b
|
@ -1,4 +1,4 @@
|
||||||
# Theory
|
# Linux
|
||||||
|
|
||||||
## Absolute Path vs Relative Path in Linux/Unix
|
## Absolute Path vs Relative Path in Linux/Unix
|
||||||
One of this blog follower asked us that whatâs the difference between absolute and relative path?
|
One of this blog follower asked us that whatâs the difference between absolute and relative path?
|
||||||
|
@ -41,15 +41,19 @@ Examples of relative path and absolute path for the same operation.
|
||||||
- Man: an interface to the on-line reference manuals
|
- Man: an interface to the on-line reference manuals
|
||||||
> $ man ls
|
> $ man ls
|
||||||
|
|
||||||
# Wildcard
|
## Wildcard
|
||||||
* Show all picture (multiple char)
|
* Show all picture (multiple char)
|
||||||
> $ ls pic*
|
> $ ls pic*
|
||||||
|
|
||||||
? show only picture between 50 and 59 (only one char)
|
? show only picture between 50 and 59 (only one char)
|
||||||
|
|
||||||
> $ ls pic5?.jpg
|
> $ ls pic5?.jpg
|
||||||
|
|
||||||
[] show only if char in [p-P]
|
[] show only if char in [p-P]
|
||||||
|
|
||||||
> $ ls [pP]ic*
|
> $ ls [pP]ic*
|
||||||
|
|
||||||
# Files and directory
|
## Files and directory
|
||||||
|
|
||||||
- ls: list directory contents
|
- ls: list directory contents
|
||||||
> $ ls
|
> $ ls
|
||||||
|
@ -60,31 +64,35 @@ Examples of relative path and absolute path for the same operation.
|
||||||
- Pwd: output the current working directory
|
- Pwd: output the current working directory
|
||||||
> $ pwd
|
> $ pwd
|
||||||
|
|
||||||
- Change directory
|
- Cd: Change directory
|
||||||
> $ cd
|
> $ cd
|
||||||
|
|
||||||
back to previous folder
|
back to previous folder
|
||||||
> $ cd -
|
> $ cd -
|
||||||
|
|
||||||
- Make directory
|
|
||||||
|
- Mkdir: Make directory
|
||||||
> $ mkdir test1 test2 test3
|
> $ mkdir test1 test2 test3
|
||||||
|
|
||||||
> $ mkdir -p lol/lol/lol
|
> $ mkdir -p lol/lol/lol
|
||||||
|
|
||||||
-p to create parent directory if needed
|
-p to create parent directory if needed
|
||||||
|
|
||||||
- Remove directory
|
- Rmdir: Remove directory
|
||||||
|
|
||||||
> rmdir filename
|
> rmdir filename
|
||||||
|
|
||||||
> rm -rf file name
|
> rm -rf filename
|
||||||
|
|
||||||
- Move directory (can be used to rename a file)
|
- Mv: Move directory (can be used to rename a file)
|
||||||
> mv file /opt/movedfile
|
> mv file /opt/movedfile
|
||||||
|
|
||||||
- Copy file or directory
|
- Cp: Copy file or directory
|
||||||
> $ cp file /opt/newcopiedfile
|
> $ cp file /opt/newcopiedfile
|
||||||
|
|
||||||
- Touch - change file timestamps but it can also create files
|
- Touch: change file timestamps but it can also create files
|
||||||
> $ touch nomdefichier.md
|
> $ touch nomdefichier.md
|
||||||
|
|
||||||
> $ touch pic{00..99}.jpeg # does not work
|
> $ touch pic{00..99}.jpeg # does not work
|
||||||
|
|
||||||
- Which: Searching the PATH for executable files matching the names of the arguments
|
- Which: Searching the PATH for executable files matching the names of the arguments
|
||||||
|
@ -105,7 +113,8 @@ back to previous folder
|
||||||
- Cat: concatenate files and print on the standard output
|
- Cat: concatenate files and print on the standard output
|
||||||
|
|
||||||
> $ cat filename
|
> $ cat filename
|
||||||
## Users and privileges
|
|
||||||
|
## Users
|
||||||
|
|
||||||
adduser, addgroup - add a user or group to the system
|
adduser, addgroup - add a user or group to the system
|
||||||
> sudo adduser steve
|
> sudo adduser steve
|
||||||
|
@ -132,7 +141,7 @@ Enter the new value, or press ENTER for the default
|
||||||
Other []:
|
Other []:
|
||||||
Is the information correct? [Y/n] y
|
Is the information correct? [Y/n] y
|
||||||
|
|
||||||
````
|
```
|
||||||
|
|
||||||
user skeleton: skeleton files used for new user configuration
|
user skeleton: skeleton files used for new user configuration
|
||||||
> $ ls /etc/skel/
|
> $ ls /etc/skel/
|
||||||
|
@ -147,7 +156,7 @@ user skeleton: skeleton files used for new user configuration
|
||||||
- Change user
|
- Change user
|
||||||
> $ su - marie
|
> $ su - marie
|
||||||
|
|
||||||
### Permissions
|
## Permissions
|
||||||
|
|
||||||
- Chmod: change file mode bits
|
- Chmod: change file mode bits
|
||||||
|
|
||||||
|
@ -159,6 +168,8 @@ A combination of the letters **ugoa** controls which users' access to the file
|
||||||
|
|
||||||
If none of these are given, the effect is as if (a) were given, but bits that are set in the umask are not affected.
|
If none of these are given, the effect is as if (a) were given, but bits that are set in the umask are not affected.
|
||||||
|
|
||||||
|
![file permissions](./img/file_permission.png)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
marie@d3bi4n:~$ ls -l
|
marie@d3bi4n:~$ ls -l
|
||||||
total 4
|
total 4
|
||||||
|
@ -173,7 +184,9 @@ total 4
|
||||||
|
|
||||||
> -rw-r--**rw**- 1 marie marie 12 Apr 7 05:44 test
|
> -rw-r--**rw**- 1 marie marie 12 Apr 7 05:44 test
|
||||||
|
|
||||||
###groups
|
|
||||||
|
Number alternatives:
|
||||||
|
### Groups
|
||||||
|
|
||||||
Groups: print the groups a user is in
|
Groups: print the groups a user is in
|
||||||
> $ groups
|
> $ groups
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
Loading…
Reference in New Issue