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
|
||||
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 ls
|
||||
|
||||
# Wildcard
|
||||
## Wildcard
|
||||
* Show all picture (multiple char)
|
||||
> $ ls pic*
|
||||
> $ ls pic*
|
||||
|
||||
? show only picture between 50 and 59 (only one char)
|
||||
> $ ls pic5?.jpg
|
||||
|
||||
> $ ls pic5?.jpg
|
||||
|
||||
[] show only if char in [p-P]
|
||||
|
||||
> $ ls [pP]ic*
|
||||
|
||||
# Files and directory
|
||||
## Files and directory
|
||||
|
||||
- ls: list directory contents
|
||||
> $ ls
|
||||
|
@ -60,33 +64,37 @@ Examples of relative path and absolute path for the same operation.
|
|||
- Pwd: output the current working directory
|
||||
> $ pwd
|
||||
|
||||
- Change directory
|
||||
> $ cd
|
||||
back to previous folder
|
||||
> $ cd -
|
||||
- Cd: Change directory
|
||||
> $ cd
|
||||
|
||||
- Make directory
|
||||
back to previous folder
|
||||
> $ cd -
|
||||
|
||||
|
||||
- Mkdir: Make directory
|
||||
> $ mkdir test1 test2 test3
|
||||
|
||||
> $ mkdir -p lol/lol/lol
|
||||
> $ mkdir -p lol/lol/lol
|
||||
|
||||
-p to create parent directory if needed
|
||||
|
||||
- Remove directory
|
||||
- Rmdir: Remove directory
|
||||
|
||||
> 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
|
||||
|
||||
- Copy file or directory
|
||||
- Cp: Copy file or directory
|
||||
> $ cp file /opt/newcopiedfile
|
||||
|
||||
- Touch - change file timestamps but it can also create files
|
||||
> $ touch nomdefichier.md
|
||||
> $ touch pic{00..99}.jpeg # does not work
|
||||
- Touch: change file timestamps but it can also create files
|
||||
> $ touch nomdefichier.md
|
||||
|
||||
> $ touch pic{00..99}.jpeg # does not work
|
||||
|
||||
- Which: Searching the PATH for executable files matching the names of the arguments
|
||||
> $ which ls
|
||||
|
||||
|
@ -105,7 +113,8 @@ back to previous folder
|
|||
- Cat: concatenate files and print on the standard output
|
||||
|
||||
> $ cat filename
|
||||
## Users and privileges
|
||||
|
||||
## Users
|
||||
|
||||
adduser, addgroup - add a user or group to the system
|
||||
> sudo adduser steve
|
||||
|
@ -132,7 +141,7 @@ Enter the new value, or press ENTER for the default
|
|||
Other []:
|
||||
Is the information correct? [Y/n] y
|
||||
|
||||
````
|
||||
```
|
||||
|
||||
user skeleton: skeleton files used for new user configuration
|
||||
> $ ls /etc/skel/
|
||||
|
@ -147,7 +156,7 @@ user skeleton: skeleton files used for new user configuration
|
|||
- Change user
|
||||
> $ su - marie
|
||||
|
||||
### Permissions
|
||||
## Permissions
|
||||
|
||||
- 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.
|
||||
|
||||
![file permissions](./img/file_permission.png)
|
||||
|
||||
```bash
|
||||
marie@d3bi4n:~$ ls -l
|
||||
total 4
|
||||
|
@ -173,7 +184,9 @@ total 4
|
|||
|
||||
> -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
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
Loading…
Reference in New Issue