default prefix : Ctrl B
| operation | keyboard shortcut |
|---|---|
| create a window | prefix c |
| delete a window | prefix & |
| delete a pane | Ctrl d |
| rename a window | prefix , |
| create a horizontal pane | prefix % |
| create a vertical pane | prefix " |
| attach to a session | tmux attach -t <session-id> |
| move pane to a new window | prefix ! |
| kill current session | prefix xkbmap us: kill-session |
| detach from currently attached session | prefix d |
- search: https://superuser.com/questions/231002/how-can-i-search-within-the-output-buffer-of-a-tmux-shell
-
export the packages to a .yml file
conda env export > environment.yml -
install the package from the .yml file
conda env create -f environment.yml- the firt line in .yml file sets the new environment's name
-
deactivate auto-loading of base environment since it is best-practice to not accidently install packages inside the base environment:
conda config --set auto_activate_base false
| operation | keyboard shortcut |
|---|---|
| undo cell deletion | Z |
| delete cell | D D |
| markdown cell to code cell | Y |
| code cell to markdown cell | M |
| select multiple cell | Shift Up/Down |
| merge selected cell | Shift M |
| copy current cell | C |
| cut currect cell | X |
| paste cells below | V |
| paste cells above | Shift V |
| show all shortcuts | H |
| enter edit mode | Enter |
| scroll the notebook down | Space |
| scroll the notebook up | Shift Space |
| operation | keyboard shortcut |
|---|---|
| split cell at cursor | Ctrl Shift -/+ |
| exti edit mode | Esc |
| show function arguments/documentation | Shift-Tab |
- helper function: add a
?after the function and then run Ctrl Shift C: show command pallette%matplotlib qt: interactive plot mode%matplotlib inline: normal charts inside notebook
-
push local branch to a remote branch:
git push <remote> <local_branch>:<remote_branch> -
pull a remote branch to a local branch
git pull <remote> <remote_branch>:<local_branch>Note: git pull will only work at fast-forward merge. For non-fast-forward merge:
$ git fetch <remote> <remote_branch> $ git merge <remote>/<remote_branch> -
show the difference of a file between current commit and one commit back:
git diff HEAD^ HEAD main.c, between current commit and two commits backgit diff HEAD^^ HEAD main.c -
git branch description:
Edit branch description:
git branch --edit-descriptionView branch description:
git config branch.BRANCHNAME.description -
git tags:
Add tags with message:
git tag -a TAGNAME -m COMMENTSList tags:
git tag -n99, notegit tagwill list tags without messages.Push all tags:
git push --tags
Shift-Shift: open search bar
Alt-Enter: open pycharm suggestions
Ctrl-W: select the current word, press twice W select the current string, press more Ws futher to select wider scope; Ctrl-Shift-W to shrink selection.
Ctrl-Y: delete current line
Ctrl-D: duplicate selected line/ shortcut for copy-paste combined
Shift-UpperArrow: select from the current caret postion to one line above; press UpperArrow twince to select one more line
Shift-DownArrow: select from the current caret postion to one line below
Shift-LeftArrow or Shift-RightArrow: move the caret to left/right and select the text
Ctrl-Shift-UpperArrow: move current line up; if at the beginning of a block, the entire block wil be moved up.
Ctrl-Minus: collapse a code fragment
Ctrl-Equal: expand a code region
Ctrl-Shift-Minus: collapse all code regions
Ctrl-Shift-Equal: expand all code regions
Alt-J: select the symbol at the caret, press J agin to select the next occurence of this symbol.
Ctrl-Alt-Shift-J: select all occurences in the file (this is quite useful if you want to rename a variable and change its name in all occurences.
-
print the owner of a pid:
ps -o user= -p PIDHERE -
zip a folder and exclude certain folders
zip -r myarchive.zip dir1 -x dir1/ignoreDir1/\* dir1/ignoreDir2/\* -
bash short cuts:
Ctrl-U: to clear line before the cursor. The deleted command will be stored into a buffer.Ctrl-Kto clear line after the cursor.Ctrl-Yto paste the deleted command.Ctrl-Eto jump to the end of the input line.Ctrl-Ato jump to the start of the input line.Ctrl-Cto abort what you're typing.Ctrl-Wto delete word on the left.Alt-Dto delete word on the right.Alt-Fto move one word forward.Alt-Bto move one word back.
-
Search and run previous command:
Ctrl-rsearch for command!{history-number}history number can be found athistrorycommand output
-
grep search + next/previous lines:
grep -A1 "PATTERN" example.txt OPTIONS -A NUM, --after-context=NUM -B NUM, --before-context=NUM -C NUM, --context=NUM -
show juyter notebook on server from local computer
ssh -N -f -L localhost:$1:localhost:$2 user@server_ip -
open a file or URL in default pplication
xdg-open {file URL} -
switch keyboard layout
setxkbmap deswitch to german keyboardsetxkbmap usswitch to us keyboard -
print directory size
du -h -d 1: -h stands for human-readable, -d 1 prints only 1 level below the current directorydu -hs: -s stands for summarize the total size -
report file system disk space usage:
df -h -
remove all files exclude certrain files:
rm -rf !(*.py): remove all files except for .py filesrm -rf !(index*).html: remove all .html files except for those named index*.html(* is a wildcard here) -
pavucontrol: change volume above 100% -
set brightness of a display:
xrandr --output $Monitor --brightness 1.0Note:
$Monitoris in the list ofxrandr --listmonitors, set brightness to a float number will dim the selected display, e.g 0.5 is half the current brightness -
change system font size
gsettings set org.gnome.desktop.interface text-scaling-factor [scaling-factor-value] -
print Linux version
lsb_release -a -
find my IP address:
curl ifconfig.me
Run and profile the .py script:
kernprof -l script_to_profile.py
View the profiler results stored in .lprof
python -m line_profiler script_to_profiler.py.lprof