How to use Kaggle API and download a dataset by a single command
First steps
Kaggle is a platform for data science and machine learning competitions, as well as a collaborative community for data scientists and machine learning enthusiasts. Kaggle allows users to find, share, and analyze datasets, as well as to participate in machine learning competitions and learn from other professionals in the field.
Prerequisites: installed Python and pip
1. Install kaggle on your comuputer
pip install kaggle
2. Register and create api key
Click on Right top corner profile icon > “Account” > Create New API Token
This will download a file kaggle.json with a content like this:
{"username":"pavoltravnik","key":"4947145f624f168fd0db5847dce59aa8"}
3. Save API token
You have to save token first you have two options.
Copy the file to your .kaggle folder
cp ~/Downloads/kaggle.json ~/.kaggle/kaggle.json
Or paste the content it directly there.
echo '{"username":"pavoltravnik","key":"4947145f624f168fd0db5847dce59aa8"}' > ~/.kaggle/kaggle.json
4. Find a competion and join
Just search for any competition on this site https://www.kaggle.com/competitions
5. Download and unzip latest downloaded zip file
You can find a command to download any dataset on the bottom of the page for each competition in the Data page.

Then just add the script to unzip the latest zip file.
kaggle competitions download -c house-prices-advanced-regression-techniques && \
LATEST_ZIP=$(ls -t *.zip | head -n 1) && unzip "$LATEST_ZIP" -d "$(basename "$LATEST_ZIP" .zip)"