Show Menu
Cheatography

Git & co Cheat Sheet (DRAFT) by

my first cheat sheet

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Virtual Enviro­nment (virtu­alenv & venv)

Install virtualenv
pip install virtualenv
Create virtualenv
virtualenv -p python3 my-env
 
python3 -m venv $my-env
Activate virtualenv
source my-env­­/b­i­n­/a­­ctivate
Deactivate
deactivate
Delete virtualenv
rm -rf my-env

pip

Instal­lation
Install pip python 3
sudo apt-get install python­­3-pip
Install defined library
pip install lib
 
pip install lib==1.4.0
Uninstall defined library
pip uninstall lib
Update library version
pip install lib --upgrade
 
pip install lib=1.3.0 --upgrade
Display
Display installed libraries
pip list
 
pip freeze
Create requir­ement file
pip freeze > requir­eme­nts.txt
Install from requir­ement file
pip install -r requir­eme­nts.text
Display outdated libraries
pip list --outdated
 

Linux - Directory operations

Show current directory
pwd
Make directory
dir my-dir
Change directory
cd my-dir
Go up a directory
cd ..
List files
ls

Linux - ls options

Show all (including hidden)
-a
Recursive list
-R
Reverse order
-r
Sort by last modified
-t
Sort by file size
-S
Long listing format
-l
One file per line
-1

Linus - File operations

Create file
touch my-file
Concat­enate files and ouput
cat my-file1 my-file2
Get type of file
file my-file
Copy
cp my-file copied­_file
Move
mv my_file moved_file
Delete
rm my-file
Show first 10 lines
head my-file
Show last 10 lines
tail my-file
 

Linus - Search files

Search for pattern in files
grep pattern files
Case insens­itive search
grep -i
Recursive search
grep -r
Inverted search
grep -v
Show matched part of file only
grep -o
Find files starting with name in dir
find /dir/ -name name

Linux - Nano shortcuts

Files
Read file
Ctrl-R
Save file
Ctrl-O
Close file
Ctrl-X
Cut and Paste
Start marking text
Alt-A
Cut marked text of line
Ctrl-K
Paste text
Ctrl-U
Navigate file
End of file
Alt-/
Beginning of line
Ctrl-A
End of line
Ctrl-E
Show line number
Ctrl-C
Got to line number
Ctrl-_
Search file
Find
Ctrl-W
Find next
Alt-W
Search and replace
Ctrl-\