=!hostname
hn0] hn[
'Jupiter-2.local'
There are many shells one can use, Mac default is zsh
(located at /bin/zsh
). I set up PyCharm to use it as well in the Preferences\Tools\Terminal\Shell Path
Bash/zsh comment is the same as python: #
# To open Pycharm/VSCode from terminal:
open -na "PyCharm.app" .
open -na "Visual Studio Code.app" .
# To open a finder from terminal:
open .
To open terminal from folder I added a shortcut: Control + Alt + Shift + T
To see hidden files on Mac in finder: Command + Shift + .
To replace chars inside a string:
ls
commandTo count files in a folder from terminal:
recursively:
find <directory> -type f | wc -l
for example:
ls '/Users/nenad.bozinovic/work/Frame/elasticity_logs' | head -4
to see file sizes:
to see hiden files:
To create/delete directory:
tree
commandTo see tree of directories use tree
command:
To install on Linux:
to install on Mac:
To zip/unzip gz:
Install gnu-tar if seeing warning with the tar
, then use gtar
:
To zip:
gtar -zcvf myfolder.tar.gz myfolder
gzip filename # zip it back
gzip -k filename # to zip it and keep original
to see the content of a zipped file:
to unzip:
To download a file from URL:
Print path:
Homebrew is a package manager for macOS, it might have some unique packages that pip doesn’t have, to install wget
for example:
To install package:
When using []
with pip
it is important to use ""
to avoid shell parsing for example:
To see version of the package installed:
To see all packages installed:
Command | Explanation |
---|---|
i |
insert mode |
Esc | exit insert mode |
:w |
Saves the file you are working on |
:w [filename] |
Allows you to save your file with the name you’ve defined |
:wq |
Save your file and close Vim |
:q! |
Quit without first saving the file you were working on |
yes | conda create -n $repo_name python=$python_ver # notice there is no keyword env
conda env list
conda env remove -n ENV_NAME
conda env export > env.yml
conda env create -n ENVNAME --file ENV.yml
To be able to use ip
:
Before you generate ssh key pair check if you have one:
To generate ssh key pair:
this will ask you to generate a new key in a specified file. Yuo should see id_rsa
and id_rsa.pub
files that relate to private and public keys.
To copy the key, replace the user and server with your username and the server address you wish to use the key authentication on (use commands hostname
and whoami
for hostname and username):
Gives for example: /opt/conda/bin/python
Use scp. For example:
For folders add -r
:
To get IP address on Linux, use curl this:
To get a hostname in Jupyter:
To search for a specific file:
where . is current directory.
Check if there is x
in front of the name with: