Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update multiple PR from previous status #238

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cheatsheets
===========
This repository contains community-sourced cheatsheets to be used with
This repository is fork of [cheatsheets][] cause the old repo has no update for long time. It contains community-sourced cheatsheets to be used with
[cheat][] and similar applications.

### Format ###
Expand All @@ -27,6 +27,9 @@ parameter placeholders. In edge-cases where that syntax may cause confusion, it
is permissible to use placeholder values (`foo.txt`, `example.com`, etc.) as
necessary.

### TODO ###
See [here](../TODO.md)

### License ###
Cheatsheets are licensed under [Creative Commons CC0 1.0][cc0]. See
[LICENSE.txt][] for the full license text.
Expand All @@ -36,3 +39,4 @@ Cheatsheets are licensed under [Creative Commons CC0 1.0][cc0]. See
[cc0]: https://creativecommons.org/publicdomain/zero/1.0/legalcode
[cheat]: https://github.com/cheat/cheat
[docopt]: http://docopt.org
[cheatsheets]: https://github.com/cheat/cheatsheets
7 changes: 7 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# TODO:

- fallocate
- ftp, lftp
- hostname
- htop
- locate
5 changes: 5 additions & 0 deletions alias
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ alias ll='ls -l'

# To remove alias:
unalias ll

# Add permanent aliasses
# bash: ~/.bashrc
# fish: ~/.config/fish/config.fish
# zsh: ~/.zshrc
42 changes: 42 additions & 0 deletions aptss
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
tags: [ packaging ]
---
# To find packages matching <phrase>:
aptss search <phrase>

# To show information on a package:
aptss show <package>

# To fetch package list:
aptss update

# To download and install the updates and (UNLIKE aptss-get) install new necessary packages:
aptss upgrade

# To download and install the updates AND install new necessary packages
# AND remove packages that stand in the way of the upgrade - use with caution:
aptss dist-upgrade

# To perform a full system upgrade:
aptss update && aptss upgrade

# To install package(s):
aptss install <package>...

# To uninstall package(s):
aptss remove <package>...

# To remove automatically all unused packages:
aptss autoremove

# To list dependencies of a package:
aptss depends <package>...

# To remove packages and delete their config files:
aptss purge <package>...

# To list all packages installed:
aptss list --installed

---
aptss is a wrapper of apt-fast and apt in order to accelerate package installation and download for spark app store and linuxdeepin
2 changes: 1 addition & 1 deletion bash
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# To implement a for loop:
for file in *;
do
do
echo $file found;
done

Expand Down
2 changes: 1 addition & 1 deletion chmod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
chmod a+x myscript.sh

# Set user to read/write/execute, group/global to read only (myscript.sh), symbolic mode
chmod u=rwx, go=r myscript.sh
chmod u=rwx, go=r myscript.sh

# Remove write from user/group/global (myscript.sh), symbolic mode
chmod a-w myscript.sh
Expand Down
2 changes: 1 addition & 1 deletion conda
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ conda env list
# To initialise an environment
conda create --name <environment_name>

# To initialise an environment with python3.10
# To initialise an environment with python3.10
conda create --name <environment_name> python=3.10

# To install from a file
Expand Down
2 changes: 1 addition & 1 deletion curl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ curl http://ifconfig.me/all.json
curl --limit-rate 1000B -O <outfile>

# To get your global IP:
curl httpbin.org/ip
curl httpbin.org/ip

# To get only the HTTP status code:
curl -o /dev/null -w '%{http_code}\n' -s -I URL
26 changes: 19 additions & 7 deletions docker
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ docker -d
# To build a docker image:
docker build -t <image-tag-name> <path-of-Dockerfile>

# To build a docker image with specific dockerfile name:
docker build -t <image-tag-name> -f <path-and-name-of-dockerfile> <path-of-Dockerfile>

# To start a container with an interactive shell:
docker run -ti <image-name> /bin/bash

Expand All @@ -13,6 +16,9 @@ docker run -d <image-name>
# To "shell" into a running container (docker-1.3+):
docker exec -ti <container-name> bash

# To exec some command inside container:
docker exec <container-name> ping 8.8.8.8

# To inspect a running container:
docker inspect <container-name> (or <container-id>)

Expand All @@ -22,15 +28,21 @@ docker inspect --format {{.State.Pid}} <container-name-or-id>
# To list (and pretty-print) the current mounted volumes for a container:
docker inspect --format='{{json .Volumes}}' <container-id> | python -mjson.tool

# To copy files/folders between a container and your host:
docker cp foo.txt mycontainer:/foo.txt
# To copy a file from the running container to host mechine:
docker cp <container-id>:<path/to/file> <host/copy/path>

# To copy a file from host mechine to the running container:
docker cp <host/copy/path> <container-id>:<path/to/file>

# To list currently running containers:
docker ps

# To list all containers:
docker ps -a

# To list all container in format: Name, Image, Status, Port
docker container ls -a --format "table {{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}"

# To remove all stopped containers:
docker container prune

Expand All @@ -46,6 +58,9 @@ docker image ls -q
# To remove all untagged images:
docker rmi $(docker images | grep "^<none>" | awk '{print $3}')

# To remove all images:
for image in $(docker image ls --format "table {{.Repository}}:{{.Tag}}"); do docker image rm -f $image ; done

# To remove all volumes not used by at least one container:
docker volume prune

Expand Down Expand Up @@ -97,8 +112,5 @@ docker run -v <volume-name>:<folder-path-in-container> <image>
# To link current folder between host and container for development:
docker run <image-name> -v $(pwd):<folder-path-in-container> <image>

# To copy a file from the running container to host mechine:
docker cp <container-id>:<path/to/file> <host/copy/path>

# To copy a file from host mechine to the running container:
docker cp <host/copy/path> <container-id>:<path/to/file>
# To clean-up docker environment (remove all images, unused containers, volumes, networks)
docker system prune -af
2 changes: 1 addition & 1 deletion du
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ du -shL
du -h --apparent-size

# To sort directories/files by size (human-readable):
du -sh * | sort -rh
du -sh * | sort -rh

# To list the 20 largest files and folders under the current working directory:
du -ma | sort -nr | head -n 20
46 changes: 23 additions & 23 deletions dwm
Original file line number Diff line number Diff line change
Expand Up @@ -2,78 +2,78 @@ Basic
=====
# launch terminal.
[Shift]+[Mod]+[Enter]

# show/hide bar.
[Mod]+[b]
[Mod]+[b]

# dmenu for running programs like the x#www#browser.
[Mod]+[p]
[Mod]+[p]

# push acive window from stack to master, or pulls last used window from stack onto master.
[Mod]+[Enter]
[Mod]+[Enter]

# focus on next/previous window in current tag.
[Mod] + [j / k]
[Mod] + [j / k]

# increases / decreases master size.
[Mod] + [h / l]
[Mod] + [h / l]


Navigation
==========
# moves your focus to tag 2.
[Mod]+[2]
[Mod]+[2]

# move active window to the 2 tag.
[Shift]+[Mod]+[2]
[Shift]+[Mod]+[2]

# increases / decreases number of windows on master
[Mod] + [i / d]
[Mod] + [i / d]

# move focus between screens (multi monitor setup)
[Mod] + [, / .]
[Mod] + [, / .]

# move active window to different screen.
[Shift]+[Mod]+[, / .]
[Shift]+[Mod]+[, / .]

# view all windows on screen.
[Mod]+[0]
[Mod]+[0]

# make focused window appear on all tags.
[Shift]+[Mod]+[0]
[Shift]+[Mod]+[0]

# kill active window.
[Shift]+[Mod]+[c]
[Shift]+[Mod]+[c]

# quit dwm cleanly.
[Shift]+[Mod]+[q]
[Shift]+[Mod]+[q]


Layout
======
# tiled mode. []=
[Mod]+[t]
[Mod]+[t]

# floating mode. ><>
[Mod]+[f]
[Mod]+[f]

# monocle mode. [M] (single window fullscreen)
[Mod]+[m]
[Mod]+[m]


Floating
========
# to resize the floating window.
[Mod]+[R M B]
[Mod]+[R M B]

# to move the floating window around.
[Mod]+[L M B]
[Mod]+[L M B]

# toggles to the previous layout mode.
[Mod]+[Space]
[Mod]+[Space]

# to make an individual window float.
[Mod]+[Shift]+[Space]
[Mod]+[Shift]+[Space]

# to make an individual window un#float.
[Mod]+[M M B]
[Mod]+[M M B]
10 changes: 5 additions & 5 deletions ed
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ tags: [ ed ]
:q quit
:Q quit without saving changes
:f {name} change buffer name
:w write to file using current buffer name
:w write to file using current buffer name
:w {file} write buffer to new file
:wq write buffer to existing file and exit

# Line-oriented addressing and movement
# Line-oriented addressing and movement
# `ed' uses line addresses to move around and operate within a buffer
# Move to or operate on single lines by entering the line number
# Move to or operate on ranges of lines using comma-separated values
Expand Down Expand Up @@ -53,12 +53,12 @@ r !{command} read output of {command} into buffer after current line
e test.txt edit file "test.txt"
45 `ed' returns character count as confirmation
1,3n display lines 1 through 3 with line numbers
1 This is line 1
1 This is line 1
2 This is line 2
3 This is line 3
2c change line 2
I am typing a new line 2
. end active edit
. end active edit
1,3n display lines 1 thorugh 3 with line numbers
1 This is line 1
2 I am typing a new line 2
Expand All @@ -71,7 +71,7 @@ wq write file "test.txt" and exit
g/foo/ search all lines for `foo' and display matching lines
g/foo/n search all lines for `foo'; display with line numbers

4,9/foo/ search lines 1 through 5 for `foo' and display matches
4,9/foo/ search lines 1 through 5 for `foo' and display matches
4,9/foo/n search lines 1 through 5 for `foo'; display with line numbers

# Replace
Expand Down
2 changes: 1 addition & 1 deletion emacs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
Run command in the scratch buffer C-x C-e

# Navigation ( backward / forward )

Character-wise C-b , C-f
Word-wise M-b , M-f
Line-wise C-p , C-n
Expand Down
2 changes: 1 addition & 1 deletion ethtool
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
syntax: bash
tags: [networking]
tags: [networking]
---
# To show statistics for the selected interface:
ethtool -S <interface>
Expand Down
5 changes: 4 additions & 1 deletion ffmpeg
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,8 @@ cat mylist.txt
file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'

ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4

# To change INPUT's FPS to 30 and save as OUTPUT (https://trac.ffmpeg.org/wiki/ChangingFrameRate)
ffmpeg -i <in-video.ext> -filter:v fps=fps=30 <out-video.ext>
4 changes: 1 addition & 3 deletions find
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ find ./path/ -name '*.txt' -exec cat '{}' \;

# To find files with extension '.txt' and look for a string into them:
find ./path/ -name '*.txt' | xargs grep 'string'
find ./path/ -name '*.txt' -exec grep -nrH 'string' {} \;

# To find files with size bigger than 5 Mebibyte and sort them by size:
find . -size +5M -type f -print0 | xargs -0 ls -Ssh | sort -z
Expand Down Expand Up @@ -61,10 +62,7 @@ find . -type f -samefile MY_FILE_HERE 2>/dev/null
find . -type f -exec chmod 644 {} \;

# To find all files changed in last 2 days:
find . -type f -ctime -48h
find . -type f -ctime -2
# Or created in last 2 days:
find . -type f -Btime -2
# Or accessed in last 2 days:
find . -type f -atime -2

Expand Down