This is a draft cheat sheet. It is a work in progress and is not finished yet.
Virtual Environment (virtualenv & venv)
Install virtualenv |
|
Create virtualenv |
virtualenv -p python3 my-env
|
|
|
Activate virtualenv |
source my-env/bin/activate
|
Deactivate |
|
Delete virtualenv |
|
pip
Installation |
Install pip python 3 |
sudo apt-get install python3-pip
|
Install defined library |
|
|
|
Uninstall defined library |
|
Update library version |
pip install lib --upgrade
|
|
pip install lib=1.3.0 --upgrade
|
Display |
Display installed libraries |
|
|
|
Create requirement file |
pip freeze > requirements.txt
|
Install from requirement file |
pip install -r requirements.text
|
Display outdated libraries |
|
|
|
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 |
Concatenate 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 insensitive 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-\ |
|