SOFTWARE APPLICATION

List of commands for some popular applications.

GIT

Init local new repository

git clone https://gitlab.com/user/my_project.git

cd my_project
touch README.md
git add README.md
git commit -m "add README"

git push -u origin master

Init repository with existing folder

cd existing_project
git init
git remote add origin https://gitlab.com/user/my_project.git
git add .
git commit -m "Initial commit"
git push -u origin master

Init repository with existing repository

cd existing_project
git remote rename origin old-origin
git remote add origin https://gitlab.com/user/my_project.git
git push -u origin --all
git push -u origin --tags

Publish

git add -A 		# add all files
git commit --quiet -m "publish"	#Commit all changes
git push origin master #move to branch master

Pupular commands

https://services.github.com/on-demand/downloads/github-git-cheat-sheet.pdf

Command Description
CONFIGURATION
git config --global user.name "[name]" Sets the name you want atached to your commit transactions
git config --global user.email "[email address]" Sets the email you want atached to your commit transactions
REPOSITORY
git init [project-name] Creates a new local repository with the specified name
git clone [url] Downloads a project and its entire version history
MAKE LOCAL CHANGES
git status Lists all new or modified files to be commited
git diff Shows file differences not yet staged
git add [file] Snapshots the file in preparation for versioning
git rm [file] Deletes the file from the working directory and stages the deletion
git add -A Snapshots all files in preparation for versioning
git commit -m "message" Records file snapshots permanently in version history
git reset HEAD~ Remove last commit
git add --all && git commit --quiet -m "message" One line to add and commit, silent output
MAKE LOCAL GROUP CHANGES
git branch Lists all local branches in the current repository
git branch [branch-name] Creates a new branch
git checkout [branch-name] Switches to the specified branch and updates the working directory
git merge [branch-name] Combines the specified branch’s history into the current branch
git branch -d [branch-name] Deletes the specified branch
MAKE SERVER CHANGES
git pull Downloads bookmark history and incorporates changes
git reset --hard Remove local changes
git push [alias] [branch] Uploads all local branch commits to GitHub or other git server
git push origin master Upload to branch master
Log Commands
git log --name-only For full path names of changed files
git log --name-status For full path names and status of changed files:
git log --stat For abbreviated pathnames and a diffstat of changed files:
git log -n 4 Last 4 commits

VIM

Basic Navigation

Source: https://vim.rtorr.com/

  • Mode: n - normal, i - insert, v - visual

Normal Mode / Navigation Current Line

Command Info Description
h,j,k,l # 1533643071685 move left,down,right,up
w # 1533203475971 jump to the start of a word (exclude punctation)
W # 1533203640443 jump to the start of a word (include punctation)
e # 1533203791549 jump to the end of a word (exclude punctation)
E # 1533203858681 jump to the end of a word (include punctation)
b # 1533548430193 jump backwards to the start of a word
B # 1533548516603 jump backwards to the start of a word (words can contain punctuation)
% # 1533549039124 jump to the matching characters (),[],<>,
0 # 1533549106217 Start of the line
^ # 1533549400426 Start of the line without: whitespace
$ # 1533549617329 End of the line
g_ # 1533549682561 End of the line without wihtespace
fu, fp # 1533643829309 Next character ‘u’,‘p’, etc… (only current line)
fu ->; # 1533644200134 repeat search for ‘u’forward
fu -> , # 1533644298725 repeat search for ‘u’backward
ty # 1533643981421 Before next character ‘y’

Normal Mode/ Navigation Document

Command Info Description
gg # 1533642748042 First line of the document
G # 1533643636934 Last line of the document
16G # 1533643695709 Go to line 16
} # 1533644417156 Next paragraph
{ # 1533644475892 Previous paragraph

Normal Mode / Navigation Screen

Command Info Description
H,M,L # 1533642874888 Move top screen (H)
middle screen (M)
bottom screen (L)
zz Center line in the screen
ctrl+e Move one line down
ctrl+y Move one line up
ctrl+b Page Up
ctrl+f Page Down
ctrl+u half page up
ctrl+d half page down

Normal Mode / Insert Mode

Command Info Description
i # 1533203983042 Insert mode
I # 1534080755386 Insert mode at the begining of the line
A # 1534080850306 Insert mode at the end of the line
o # 1534080907705 Add new line below, move and go to the insert mode
O # 1534080974737 Add new line below, move and go to the insert mode
ea # 1534081035763 Insert mode in after the current word

Normal Mode/ Editing

Command Info Description
r (e.g. ra) # 1534081179826 Replace single character
R # 1534082404712 Replace mode
J # 1534081323737 Join line below to the current one with one space in between
gj # 1534081414043 Join line below to the current one
cc, S # 1534081543624 Change entire line (move to the insert mode)
cw # 1534081712090 Change word from cursor (move to the insert mode)
ciw # 1534081764988 Change entire word (move to the insert mode)
s # 1534081881969 delete character and substitue text (move to the insert mode)
xp # 1534081995872 Transpose two letters. (replace them in order)
> # 1534082254892 shift text right
< # 1534082295665 shift text left

Normal Mode/ Undo-Redo

Command Info Description
u Undo
Ctrl+r Redo
. # 1534082473392 repeat last command

Normal Mode / Copy

Command Info Description
yy Copy a line
3yy Copy 3 lines
yw # 1534082661891 Copy from the cursor to the end of the word

Normal Mode / Paste

Command Info Description
p # 1534082790209 Put from clipboard after the cursor
P # 1534082848018 Put clipboard before the cursor

Normal Mode / Cut

Command Info Description
dd # 1534083311410 Cut the line (to the clipboard)
2dd # 1534083351145 Cut 2 lines
dw # 1534083415529 Cut word from the cursor to the end
diw # 1534083505770 Cut entire word
diW # 1534083545177 Cut entire word include special characters
D # 1534083637369 Cut to the end of the line
x # 1534083688160 Cut single character
2x # 1534083731888 Cut two characters

Insert Mode

Command Info Description
Esc

left_alt+command
# 1533644594829 Exit insert mode, e.g. alt+o - exit and add new line, alt+j - exit and move down

Instructions

Instruction Description
:q Quit (error when not saved)
:q! Quit without save
:w Save changes
:wq Quit and save
:wqa Write (save) and quit on all tabs
:set nu
:set nonu
Display lines / Hide lines

TMUX

tmux is a terminal multiplexer. It lets you switch easily between several programs in one terminal, detach them (they keep running in the background) and reattach them to a different terminal.

https://github.com/tmux/tmux

sudo apt-get install tmux

1543592760201

Start new no named session:

tmux

Commands/sessions

Shortcut/Command Info Description
tmux ls # 1543595030671 session list
tmux new -s name # 1543595237119
1543595086388
Create new session
ctrl+b s # 1543595351573 List of sessiion and switch to selected session
tmux kill-session -t name # 1543595398789 Kill session with the name name

Panes shortcuts

Shortcut Info Description
ctrl+b d # 1543594809200 Deattached
ctrl+b % # 1543593929554 Vertical split
ctrl+b “ # 1543592797560 Horizontal Split
ctrl+b o # 1543592815599 Swap panels
ctrl+b ↑ # 15435928834641543592913808 Move Up
ctrl+b ↓ # 1543594103040 Move Down
ctrl+b ← # 1543594136937 Move left
ctrl+b q # 1543594195440 Show numbers
ctrl+b x # 15435942404881543594265055 Kill current pane (also command exit)
ctrl+b z # 1543594677657 Zoom ON/OFF
ctrl+b t # 1543594720451 show clock (anykey close clock)

Tmux commands

Shortcut/command Info Description
ctrl+b : # 1543595713973 Go to command
:resize-pane -L 10 # 15435958288061543595840922 Resize pane to left by 10 cells
:resize-pane -R 10 # 15435959072841543595922870 Resize pane to right by 10 cells
:resize-pane -D 10 # 1543595967276 Resize pane to down by 10 cells
:resize-pane -U 10 # 15435960104561543596018826 Resize pane to up by 10 cells
swap-pane -s 0 -t 1 # 1543596140373
1543596176708.1543596189309
swap panes

Windows shortcuts

Shortcut Info Description
ctrl+b c # 1543595518453 Create new window
ctrl+b w # 1543596383861 list windows
ctrl+b , # 1543596427030 name window
ctrl+b & # 1543596454148.1543596477437 kill window
ctrl+b n # 1543596544146 next window
ctrl+b p # 1543596570484 previous window