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 (abc.py)
ps -aux | grep python | grep abc
## Run Python Program
nohup python abc.py > temp_nohup.log 2>&1 &
## Run and print in .log file using -u
nohup python -u main.py > model.log &
## Run Shell File
nohup sh abc.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

Java Conditions and Java Loops, Break Statement, Continue Statement, Java Arrays

Keyboards.

GSoC 2020: Making regex in Python “just” work

Cross-industry Supply Chain Track and Trace

Automate your Python Scripts with Task Scheduler

Journey of DLithe Bootcamp Java Full Stack Developer | Week 5(Apr18-Apr 15)

Engineering & Design: Primitive Problems

Executing Functions using the Apps Script API

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

A simple guide to install Linux on a Windows OS

SIEM TOOLS & CONFUSION MATRIX

Getting Started with Linux Command Line Basics

How to join Array/List of Chars/String Elements in Bash Shell Scripting and Python Scripting ?