Some Useful Commands — Linux, Python, Pip

Search specific text in current : <grep -RilE “text1|text2”>

Name of Operating System: <uname -a> and <hostnamectl>

Output of “uname -a”
Output of “hostnamectl”

Basic ls command

* ls -ltr - reverse output order, which is particularly useful when sorting by date

Check difference in two directory: <diff -q dir1/ dir2/>

Command to copy directory structure without content:

source=/home/folder1/

Host Jupyter Notebook on Server (to make it accessible by other team members):

nohup jupyter notebook --ip=a.b.c.d --port=8089 --Notebook.token=password > /home/temp/jupyter_nb.log &

Replace Value in multiple file

## Replace "aakash" with "aakash_goel"
sed -i "s/aakash/aakash_goel/g" *.txt

Top Command

* Use Top command and Press 1 to see CPU Usage

PS Command

## 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

Nohup Command

## Run Python Program
nohup python abc.py > temp_nohup.log 2>&1 &

Pip Command

pip install --upgrade pip

--

--

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