Skip to content

Commit

Permalink
Updated tldr pages
Browse files Browse the repository at this point in the history
  • Loading branch information
mkcn committed Jan 4, 2022
1 parent 76fabde commit 80cfcf5
Show file tree
Hide file tree
Showing 68 changed files with 761 additions and 56 deletions.
2 changes: 1 addition & 1 deletion fastHistory/tldr/tldr/last_tldr_commit.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6a48a5a31a32d549b221242fe25ad58d8413c400
b8eb880db6835040a6c10edfc78c711a53067b33
2 changes: 1 addition & 1 deletion fastHistory/tldr/tldr/last_update_date.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2021-12-07
2022-01-04
28 changes: 17 additions & 11 deletions fastHistory/tldr/tldr/pages/common/[.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
# [
> Check file types and compare values.
> Returns 0 if the condition evaluates to true, 1 if it evaluates to false.
> More information: <https://www.gnu.org/software/coreutils/test>.
> More information: <https://www.gnu.org/software/bash/manual/bash.html#index-test>.
- Test if a given variable is equal to a given string
`[ "{{$VARIABLE}}" == "{{/bin/zsh}}" ]`
- Test if a given variable is equal/not equal to the specified string
`[ "${{variable}}" {{==|!=}} "{{string}}" ]`

- Test if a given variable is empty
`[ -z "{{$GIT_BRANCH}}" ]`
- Test if a given variable is [eq]ual/[n]ot [e]qual/[g]reater [t]han/[l]ess [t]han/[g]reater than or [e]qual/[l]ess than or [e]qual to the specified number
`[ "${{variable}}" -{{eq|ne|gt|lt|ge|le}} {{integer}} ]`

- Test if a file exists
`[ -f "{{path/to/file}}" ]`
- Test if the specified variable has a non-empty value
`[ -n "${{variable}}" ]`

- Test if a directory does not exist
`[ ! -d "{{path/to/directory}}" ]`
- Test if the specified variable has an empty value
`[ -z "${{variable}}" ]`

- If-else statement
`[ {{condition}} ] && {{echo "true"}} || {{echo "false"}}`
- Test if the specified file exists
`[ -f {{path/to/file}} ]`

- Test if the specified directory exists
`[ -d {{path/to/directory}} ]`

- Test if the specified file or directory exists
`[ -e {{path/to/file_or_directory}} ]`
28 changes: 28 additions & 0 deletions fastHistory/tldr/tldr/pages/common/[[.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# [[
> Check file types and compare values.
> Returns 0 if the condition evaluates to true, 1 if it evaluates to false.
> More information: <https://www.gnu.org/software/bash/manual/bash.html#index-_005b_005b>.
- Test if a given variable is equal/not equal to the specified string
`[[ ${{variable}} {{==|!=}} "{{string}}" ]]`

- Test if a given string conforms the specified glob/regex
`[[ ${{variable}} {{==|=~}} {{pattern}} ]]`

- Test if a given variable is [eq]ual/[n]ot [e]qual/[g]reater [t]han/[l]ess [t]han/[g]reater than or [e]qual/[l]ess than or [e]qual to the specified number
`[[ ${{variable}} -{{eq|ne|gt|lt|ge|le}} {{integer}} ]]`

- Test if the specified variable has a non-empty value
`[[ -n ${{variable}} ]]`

- Test if the specified variable has an empty value
`[[ -z ${{variable}} ]]`

- Test if the specified file exists
`[[ -f {{path/to/file}} ]]`

- Test if the specified directory exists
`[[ -d {{path/to/directory}} ]]`

- Test if the specified file or directory exists
`[[ -e {{path/to/file_or_directory}} ]]`
4 changes: 2 additions & 2 deletions fastHistory/tldr/tldr/pages/common/awk.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
- Print different values based on conditions
`awk '{if ($1 == "foo") print "Exact match foo"; else if ($1 ~ "bar") print "Partial match bar"; else print "Baz"}' {{filename}}`

- Print all lines where the 10th column value equals the specified value
- Print all lines where the 10th column value equals the specified value
`awk '($10 == value)'`

- Print all the lines which the 10th column value is between a min and a max
- Print all the lines which the 10th column value is between a min and a max
`awk '($10 >= min_value && $10 <= max_value)'`
15 changes: 15 additions & 0 deletions fastHistory/tldr/tldr/pages/common/colorls.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# colorls
> A Ruby gem that beautifies the terminal's ls command, with color and font-awesome icons.
> More information: <https://github.com/athityakumar/colorls>.
- List files one per line
`colorls -1`

- List all files, including hidden files
`colorls --all`

- Long format list (permissions, ownership, size, and modification date) of all files
`colorls --long --all`

- Only list directories
`colorls --dirs`
18 changes: 18 additions & 0 deletions fastHistory/tldr/tldr/pages/common/daps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# daps
> DAPS is an open source program for transforming DocBook XML into output formats such as HTML or PDF.
> More information: <https://opensuse.github.io/daps/doc/index.html>.
- Check if a DocBook XML file is valid
`daps -d {{path/to/file.xml}} validate`

- Convert a DocBook XML file into PDF
`daps -d {{path/to/file.xml}} pdf`

- Convert a DocBook XML file into a single HTML file
`daps -d {{path/to/file.xml}} html --single`

- Display help
`daps --help`

- Display version
`daps --version`
21 changes: 21 additions & 0 deletions fastHistory/tldr/tldr/pages/common/declare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# declare
> Declare variables and give them attributes.
> More information: <https://www.gnu.org/software/bash/manual/bash.html#Bash-Builtins>.
- Declare a string variable with the specified value
`declare {{variable}}="{{value}}"`

- Declare an integer variable with the specified value
`declare -i {{variable}}="{{value}}"`

- Declare an array variable with the specified value
`declare {{variable}}=({{item_a item_b item_c}})`

- Declare an associative array variable with the specified value
`declare -A {{variable}}=({{[key_a]=item_a [key_b]=item_b [key_c]=item_c}})`

- Declare a readonly string variable with the specified value
`declare -r {{variable}}="{{value}}"`

- Declare a global variable within a function with the specified value
`declare -g {{variable}}="{{value}}"`
8 changes: 4 additions & 4 deletions fastHistory/tldr/tldr/pages/common/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
> Some subcommands such as `docker run` have their own usage documentation.
> More information: <https://docs.docker.com/engine/reference/commandline/cli/>.
- List currently running docker containers
`docker ps`

- List all docker containers (running and stopped)
`docker ps -a`
`docker ps --all`

- Start a container from an image, with a custom name
`docker run --name {{container_name}} {{image}}`
Expand All @@ -18,6 +15,9 @@
- Pull an image from a docker registry
`docker pull {{image}}`

- Display the list of already downloaded images
`docker images`

- Open a shell inside a running container
`docker exec -it {{container_name}} {{sh}}`

Expand Down
27 changes: 27 additions & 0 deletions fastHistory/tldr/tldr/pages/common/doctl-apps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# doctl apps
> Used to manage digitalocean apps.
> More information: <https://docs.digitalocean.com/reference/doctl/reference/apps>.
- Create an app
`doctl apps create`

- Create a deployment for a specific app
`doctl apps create-deployment {{app_id}}`

- Delete an app interactively
`doctl apps delete {{app_id}}`

- Get an app
`doctl apps get`

- List all apps
`doctl apps list`

- List all deployments from a specific app
`doctl apps list-deployments {{app_id}}`

- Get logs from a specific app
`doctl apps logs {{app_id}}`

- Update a specific app with a given app spec
`doctl apps update {{app_id}} --spec {{path/to/spec.yml}}`
12 changes: 12 additions & 0 deletions fastHistory/tldr/tldr/pages/common/doctl-balance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# doctl balance
> Show the balance of a Digital Ocean account.
> More information: <https://docs.digitalocean.com/reference/doctl/reference/balance/>.
- Get balance of the account associated with the current context
`doctl balance get`

- Get the balance of an account associated with an access token
`doctl balance get --access-token {{access_token}}`

- Get the balance of an account associated with a specified context
`doctl balance get --context`
12 changes: 12 additions & 0 deletions fastHistory/tldr/tldr/pages/common/doctl-compute-droplet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# doctl compute droplet
> List, create, and delete virtual machines which are called droplets.
> More information: <https://docs.digitalocean.com/reference/doctl/reference/compute/droplet/>.
- Create a droplet
`doctl compute droplet create --region {{region}} --image {{os_image}} --size {{vps_type}} {{droplet_name}}`

- Delete a droplet
`doctl compute droplet delete {{droplet_id|droplet_name}}`

- List droplets
`doctl compute droplet list`
15 changes: 15 additions & 0 deletions fastHistory/tldr/tldr/pages/common/exercism.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# exercism
> Download and solve problems from the command-line.
> More information: <https://exercism.org/docs/using/solving-exercises/working-locally>.
- Configure the application token and the preferred workspace for Exercism
`exercism configure --token={{your-application-token}} --workspace={{/path/to/preferred/workspace}}`

- Download a specific exercise
`exercism download --exercise={{exercise_slug}} --track={{track_slug}}`

- Submit an exercise
`exercism submit {{path/to/file}}`

- Print the path to the solution workspace
`exercism workspace`
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# git delete-merged-branches
> Delete branches that are listed in `git branch --merged` excluding master.
> Part of `git-extras`.
> More information: <https://github.com/tj/git-extras/blob/master/Commands.md#git-delete-merged-branches>.
- Delete merged branches
`git delete-merged-branches`
2 changes: 1 addition & 1 deletion fastHistory/tldr/tldr/pages/common/git-delete-tag.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# git delete-tag
> Delete existing local and remote tags.
> Part of git-extras.
> Part of `git-extras`.
> More information: <https://github.com/tj/git-extras/blob/master/Commands.md#git-delete-tag>.
- Delete a tag
Expand Down
16 changes: 16 additions & 0 deletions fastHistory/tldr/tldr/pages/common/git-filter-repo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# git filter-repo
> A versatile tool for rewriting Git history.
> See also: `bfg`.
> More information: <https://github.com/newren/git-filter-repo>.
- Replace a sensitive string in all files
`git filter-repo --replace-text <(echo '{{find}}==>{{replacement}}')`

- Extract a single folder, keeping history
`git-filter-repo --path {{path/to/folder}}`

- Remove a single folder, keeping history
`git-filter-repo --path {{path/to/folder}} --invert-paths`

- Move everything from sub-folder one level up
`git-filter-repo --path-rename {{path/to/folder/:}}`
16 changes: 16 additions & 0 deletions fastHistory/tldr/tldr/pages/common/git-mr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# git mr
> Check out GitLab merge requests locally.
> Part of `git-extras`.
> More information: <https://github.com/tj/git-extras/blob/master/Commands.md#git-mr>.
- Check out a specific merge request
`git mr {{mr_number}}`

- Check out a merge request from a specific remote
`git mr {{mr_number}} {{remote}}`

- Checkout a merge request from its URL
`git mr {{url}}`

- Clean up old merge request branches
`git mr clean`
3 changes: 2 additions & 1 deletion fastHistory/tldr/tldr/pages/common/git-pr.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# git pr
> Check out GitHub pull requests locally.
> Part of `git-extras`.
> More information: <https://github.com/tj/git-extras/blob/master/Commands.md#git-pr>.
- Check out a specific pull request
`git pr {{pr_number}}`

- Check out a pull request for a specific remote
- Check out a pull request from a specific remote
`git pr {{pr_number}} {{remote}}`

- Check out a pull request from its URL
Expand Down
2 changes: 1 addition & 1 deletion fastHistory/tldr/tldr/pages/common/github-label-sync.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# github-label-sync
> A command-line interface for synchronising GitHub labels.
> More information: <https://npmjs.com/package/github-label-sync>.
> More information: <https://github.com/Financial-Times/github-label-sync>.
- Synchronise labels using a local `labels.json` file
`github-label-sync --access-token {{token}} {{repository_name}}`
Expand Down
18 changes: 18 additions & 0 deletions fastHistory/tldr/tldr/pages/common/glab-repo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# glab repo
> Work with GitLab repositories on the command-line.
> More information: <https://glab.readthedocs.io/en/latest/repo/index.html#synopsis>.
- Create a new repository (if the repository name is not set, the default name will be the name of the current directory)
`glab repo create {{name}}`

- Clone a repository
`glab repo clone {{owner}}/{{repository}}`

- Fork and clone a repository
`glab repo fork {{owner}}/{{repository}} --clone`

- View a repository in the web browser
`glab repo view {{owner}}/{{repository}} --web`

- Search some repositories in the GitLab instance
`glab repo search -s {{search_string}}`
4 changes: 2 additions & 2 deletions fastHistory/tldr/tldr/pages/common/go-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
> Compile Go sources.
> More information: <https://golang.org/cmd/go/#hdr-Compile_packages_and_dependencies>.
- Compile a file
- Compile a 'package main' file (output will be the filename without extension)
`go build {{path/to/main.go}}`

- Compile, specifying the output filename
Expand All @@ -11,5 +11,5 @@
- Compile a package
`go build -o {{path/to/binary}} {{path/to/package}}`

- Compile a main package into an executable, with data race detection
- Compile a main package into an executable, enabling data race detection
`go build -race -o {{path/to/executable}} {{path/to/main/package}}`
2 changes: 1 addition & 1 deletion fastHistory/tldr/tldr/pages/common/groff.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
`groff {{path/to/input.roff}} > {{path/to/output.ps}}`

- Render a man page using the ASCII output device, and display it using a pager
`groff -man -T ascii {{path/to/manpage.1}} | less`
`groff -man -T ascii {{path/to/manpage.1}} | less --RAW-CONTROL-CHARS`

- Render a man page into an HTML file
`groff -man -T html {{path/to/manpage.1}} > {{path/to/manpage.html}}`
Expand Down
30 changes: 18 additions & 12 deletions fastHistory/tldr/tldr/pages/common/if.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
# if
> Simple shell conditional.
> Performs conditional processing in shell scripts.
> See also: `test`, `[`.
> More information: <https://www.tcl.tk/man/tcl8.6.11/TclCmd/if.html>.
> More information: <https://www.gnu.org/software/bash/manual/bash.html#Conditional-Constructs>.
- Execute two different commands based on a condition
`if {{command}}; then {{echo "true"}}; else {{echo "false"}}; fi`
- Execute the specified commands if the condition command's exit status is zero
`if {{condition_command}}; then {{echo "Condition is true"}}; fi`

- Check if a variable is defined
`if [[ -n "{{$VARIABLE}}" ]]; then {{echo "defined"}}; else {{echo "not defined"}}; fi`
- Execute the specified commands if the condition command's exit status is not zero
`if ! {{condition_command}}; then {{echo "Condition is true"}}; fi`

- Check if a file exists
`if [[ -f "{{path/to/file}}" ]]; then {{echo "true"}}; else {{echo "false"}}; fi`
- Execute the first specified commands if the condition command's exit status is zero otherwise execute the second specified commands
`if {{condition_command}}; then {{echo "Condition is true"}}; else {{echo "Condition is false"}}; fi`

- Check if a directory exists
`if [[ -d "{{path/to/directory}}" ]]; then {{echo "true"}}; else {{echo "false"}}; fi`
- Check whether a file exists
`if [[ -f {{path/to/file}} ]]; then {{echo "Condition is true"}}; fi`

- Check if a file or directory exists
`if [[ -e "{{path/to/file_or_directory}}" ]]; then {{echo "true"}}; else {{echo "false"}}; fi`
- Check whether a directory exists
`if [[ -d {{path/to/directory}} ]]; then {{echo "Condition is true"}}; fi`

- Check whether a file or directory exists
`if [[ -e {{path/to/file_or_directory}} ]]; then {{echo "Condition is true"}}; fi`

- Check whether a variable is defined
`if [[ -n "${{variable}}" ]]; then {{echo "Condition is true"}}; fi`

- List all possible conditions (`test` is an alias to `[`; both are commonly used with `if`)
`man [`
Loading

0 comments on commit 80cfcf5

Please sign in to comment.