Snippets Collections
# By default, each destination (name of new link) should not already exist

ln -s /home/user/project /var/www/html

# The link will be created inside /var/www/html having the name of the target i.e. project.
# If you want to have a symlink /var/www/html pointing to /home/user/project then you should not have the directory html present beforehand. So, you should only have /var/www and then running the following will create the desired symlink (don't do this unless you are sure)
command -v STM32_Programmer_CLI >/dev/null 2>&1 || { echo >&2 "Need to add STM32_Programmer_CLI to the enviorenment path. Aborting..."; exit 1; }

if [[ $file =~ \.bin$ ]] || [[ $file =~ \.hex$ ]]; then
    echo "OK" >&2
    echo "NOT OK" >&2
    exit 2
if [ "$#" -ne 1 ]; then
  echo "Usage: $0 Path to binary file" >&2
  exit 1
sudo apt install stress
stress --cpu 8
curl -fsSL | sudo -E bash -
sudo apt-get install -y nodejs
# check the status of the web server i.e apache2
sudo systemctl status apache2

# restart the service
sudo systemctl restart apache2

# return network-related information using a combination of flags along with the netstat command to check which process is using a particular port
sudo netstat -nlp

# find python3 programs running
ps -ax | grep python3

# kill a process by its process ID (PID)
sudo kill [process-id]

# let's check for the availability of any service with the keywords "python" or "jimmy"
sudo systemctl --type=service | grep jimmy

# stop and disable a service using
sudo systemctl stop _servicename_ && sudo systemctl disable _servicename_

# start a web service using nginx
service nginx start

# check nginx landing page using curl
curl http://localhost:80
# install docker
sudo apt-get install

# create and run a container from an image from the Docker Hub
sudo docker run --name firstContainer ubuntu:latest # where firstContainer is the name of the container

# list locally available docker containers
sudo docker ps -a

# open a docker container in interactive mode in the terminal
sudo docker run -it --name myContainer ubuntu:latest # where myContainer is the container name
# you can exit the container by pressing CTRL+P and CTRL+Q

# attach container to terminal
sudo docker attach myContainer # the container will now stay open in the background even after exiting via CTRL+P and CTRL+Q

# execute commands in the container running in the background
sudo docker exec myContainer echo $PATH

# delete containers
sudo docker rm -f firstContainer myContainer

# create new docker image based on your local environment/container
sudo docker commit myNginx docker_id/image_name # where myNginx is the name of your currently running container

# create new docker container from an image from a previously committed image
sudo docker run -it --name nginxNew docker_id/image_name

# list images on your machine
sudo docker image ls

# login to your docker hub account from the terminal
sudo docker login # you will be prompted to enter your id and password

# push an image to docker hub when logged into your docker account
sudo docker push docker_id/image_name

# run a docker container in the background
sudo docker run -d --name myApp nginx

# start an interactive bash terminal for the container running in the background
sudo docker exec -it myApp bashapt-get

# stop a running container
sudo docker stop myApp

# start a stopped container again
sudo docker start myApp
# replace _file_name_ with the name of the file that is to be made executable including its filetype suffix, e.g. ".py"
chmod +x _file_name_
sudo forever start --sourceDir /opt/bitnami/projects/nesk_back -c "npm run prod" /
ip addr | grep eth0 | grep inet | awk '{print $2}' | awk -F '/' '{print $1}' | awk '{printf "%s:3000", $0}' | clip.exe

Fri Jun 18 2021 08:58:12 GMT+0000 (UTC)

#symlink #linux #filesystem

Wed Jun 09 2021 10:26:20 GMT+0000 (UTC)

#linux #shell-script

Wed Jun 09 2021 10:16:48 GMT+0000 (UTC)

#linux #shell-script

Wed Jun 09 2021 08:41:11 GMT+0000 (UTC)

#linux #shell-script

Thu May 06 2021 10:24:14 GMT+0000 (UTC)


Thu May 06 2021 10:20:29 GMT+0000 (UTC)

#linux #cpu

Thu May 06 2021 10:18:48 GMT+0000 (UTC)

#linux #cron

Sun Apr 18 2021 16:35:19 GMT+0000 (UTC)

#ubuntu #bash #linux

Sat Apr 10 2021 05:57:14 GMT+0000 (UTC)

#linux #nginx

Sat Apr 10 2021 05:55:14 GMT+0000 (UTC)

#linux #docker

Thu Mar 25 2021 09:14:28 GMT+0000 (UTC)


Sat Jun 13 2020 08:20:55 GMT+0000 (UTC)

#bash #linux

Fri Dec 27 2019 13:19:35 GMT+0000 (UTC)

#commandline #interesting #windows #ubuntu #linux

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension