Skip to content

scottsuk0306/cheatsheet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 

Repository files navigation

cheatsheet

Collection of commands that I use often

Managing files

1. See how large a file is.

ls -lh example.txt

2. Sort files accroding to the file size

  • In the current directory
du -sh .[^.]* * | sort -h
  • Recursively search in the current directory, for files larger than 100MB
find . -type f -size +100M -exec du -h {} + | sort -h

3. Sort Users according the the used up space

sudo du -sh /home/* | sort -h

4. See usage of a whole file system

df -h

5. Determine the device of the directory

df -h directory_name

6. Check how much space the current directory takes up

du -sh .

Docker

1. Run docker container with mounted directory and gpus attached, in detach mode

docker run --gpus all -v /mnt/sda/{your_directory}:/home/{your_username} -d --name {container_name} {image_name}

2. Run docker container with gpus attached, in detach mode

docker run --gpus all -d --name {container_name} {image_name}

3. Interact with a running container

docker exec -it {container_name} /bin/bash

Git

1. Reapply .gitignore

git rm -r --cached .
git add .
git commit -m "Reapply .gitignore"

2. git clone but with a different directory name

git clone https://github.com/username/myproject.git myproject-clone

Conda

1. Install conda

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod +x Miniconda3-latest-Linux-x86_64.sh
# install without interaction
./Miniconda3-latest-Linux-x86_64.sh -b -u

# conda bash init
~/miniconda3/bin/conda init

2. Create a new environment

conda create -n env_name python=3.9

3. Install python using conda

conda install python=3.X

4. Manually configure the installation path for conda environments and packages

conda config --prepend pkgs_dirs [PATH]
conda config --prepend envs_dirs [PATH]

Huggingface

Tmux

1. Install tmux

sudo apt-get install tmux

Poetry

1. Remove poetry env

poetry env remove $(which python)

2. Install poetry

curl -sSL https://install.python-poetry.org | python3 -

About

Collection of commands that I use often

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages