Some Useful Commands — Linux, Python, Pip

Output of “uname -a”
Output of “hostnamectl”
* ls -ltr - reverse output order, which is particularly useful when sorting by date* ls -lS - sort by file size* ls -1 | wc -l - Return No of files
source=/home/folder1/target=/home/folder2/rsync -av -f"+ */" -f"- *" "$source" "$target"
nohup jupyter notebook --ip=a.b.c.d --port=8089 --Notebook.token=password > /home/temp/jupyter_nb.log &
## Replace "aakash" with "aakash_goel"
sed -i "s/aakash/aakash_goel/g" *.txt
* Use Top command and Press 1 to see CPU Usage
## Check Process Usage by CPU, Memory
ps -eo pcpu,pid,user,args | sort -k 1 -r | head -3
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head -3
## Get Process ID (
ps -aux | grep python | grep abc
## Run Python Program
nohup python > temp_nohup.log 2>&1 &
## Run and print in .log file using -u
nohup python -u > model.log &
## Run Shell File
nohup sh > temp_nohup.log 2>&1 &
pip install --upgrade pip# Upgrade to a specific version
python -m pip install pip==18.1
## Version of pip
pip --version
## get requirements.txt
/datascience/user/env/bin/pip freeze > requirements.txt
## Install all packages in req.txt
pip install -r requirements.txt




Senior Data Scientist @ Fractal Analytics

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

My Take Towards CKA & CKAD + September Curriculum Update Tips

Writing a simple e-comm REST API in Go programming language

Terraform: Creating A Custom Module For EC2

My Visual Studio Code Review

From quest to Cardboard

How to automate deployment in a React App to Github Pages using Github Actions

RSS Feeds of BBC News

Getting to the Bottom of Issues… Root Cause Analysis for Tech Consultants

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aakash Goel

Aakash Goel

Senior Data Scientist @ Fractal Analytics

More from Medium

Ubuntu Operating System

Beginner’s Guide to Linux Command Line

Environment Variables and Python command not found

Get Python Up and Running in No-Time