Shell Code Samples


Shell Script to Generate the SSH key and display it on output screen also create virtualenv
sandeep | 2 years, 8 months
export PATH=$WORKSPACE/resources/chromedriver/mac:$WORKSPACE/venv/bin:/usr/local/bin:$PATH
export P
shell auto ssh key
To delete all the none docker images in single shot.
ashokrebel007 | 2 years
docker rmi $(docker images | grep "^<none>" | awk "{print $3}") --force
shell docker
Shell Script to Monitor Site with Json content
sandeep | 2 years, 8 months
a=`curl --insecure -I SITE-NAME | awk 'NR==1 {print $2}'`
b=`wget -qO- --no-check-certificate SITEN
shell Site-Monitor
How to untrack/ unstage a file i.e already trackable by git
harika | 1 year, 9 months
git reset HEAD fileName.txt
git shell
copy a file and replace with another or original file
kishore_kumar | 2 years, 3 months
# way1

cp -f /path/to/file1.txt /another/path/to/file1.txt
Run shell files in javascript
harika | 2 years, 8 months
//JS Code
function runShellScript(){
    const process = require('child_process'); 
keep the function code inside the js file wherever you want to use. and keep the shell file provided
javascript shell node js
How to check the logs around or at particular time in git
harika | 1 year, 9 months
#If you want to check the logs since 1 hour
git log --since="1 hour ago"

git shell
Remote copying (One centos machine to another centos machine)
ashokrebel007 | 2 years
scp filename username@ipaddress:destinationpath

For example :
shell centos
How to execute a curl command with bash script
Reshma | 1 year, 2 months
result=$(curl -n \
-X POST -H 'Content-Type: application/json' \
"give_url" \
shell curl with shell
How to find the port which is running and stop the process
Reshma | 1 year, 5 months
sudo lsof -i tcp:port //To find the port which is running

kill pid //kills the process which is r
shell kill port