Skip to content

Home

yum-provide-which-package-contains-the-command

See how to find the package you will need to install for the command you are looking for. Example, I was looking for the tshark command, but a simple yum search tshark was not returning any results. See how I found the linux command.

I ran this on a EC2 instances Amazon Linux v2, I wanted to run the command tshark but this was not available.

So, I searched for it with yum search tshark and package was not found.

A did quick research online and found in here a command that almost got forgotten!

yum whatprovides {COMMAND}

I decided to write this article to remind me of this command and it might be useful for you too.

yum whatprovides tshark

Try with other commands. Was this useful to you?


Happy learning

Antonio Feijao UK

docker-images-and-containers-start-with-basic-and-bonus-advanced-security

Docker images and containers start with basic and bonus advanced security Docker logo

Sample basic command for Docker containers and images

docker --help - list the help options for docker command

docker run --help - list the help option for docker run command

docker images - list your local docker images

docker ps - list local running docker containers

docker ps -a - list local running OR stopped docker containers

docker rm f66ae9b25d96 - remove docker container with ID f66ae9b25d96

docker run --rm centos:7 tail -f /dev/null - runs a docker container from image centos:7, keeps container running with tail -f /dev/null command

docker exec -it 513ee56fde09 /bin/sh - interactive shell on the container that is running

docker exec -it -u root 8891619cbcf0 /bin/sh - interactive shell with sudo privileges (NOT RECOMMENDED, security risk)

docker kill 513ee56fde09 - kill (stops) the docker container that was running

docker run ubuntu - runs a docker container with version ubuntu. It will download the docker image ubuntu:latest from docker-hub if it does not find it locally in the machine.

docker pull amazonlinux - updates the local docker images named `

docker commit 3808b8454239 centos-suresh:v01 - save current container with a image, which you can run more containers after

(...)


Bonus advanced security with Docker containers and images

chroot

unshared

....


Happy learning

Antonio Feijao UK

python3-merry-christmas

Python 3 prints Merry Christmas Everyone!

Merry Christmas with Python3 script

var="Merry Christmas Everyone!"

print (var)

pip3-list-installed-upgrade-all

So, I want to list the packages installed with pip3 and now that I can see them, I want to update them all.

List pip3 installed packages

pip3 list

Update all my pip3 packages

with a for loop you can loop through all your packages, exclude what is not a package and run the command pip3 {package} --upgrade on the installed packages.

for n in $(pip3 list | awk '{print $1}' | egrep -v 'Package|^-'); do
    pip3 install --upgrade ${n} ;
done

pip update outdates packages

Just another way of doing it.

for package in $(pip list -o | cut -f 1 -d ' ' | tail -n +3); do pip install --upgrade ${package}; done

If you know a better way, do let me know! :)

Beware of dependencies packages or minimum and max versions.

Use at your own responsibility.

Happy learning,

Antonio Feijao

github-basics-command

Github git basic commands

Some basic git command and working with ssh keys to update the repository

https://help.github.com/en/enterprise/2.17/user/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account

git clone


ssh-keygen -t rsa -b 4096 -C "my comment "

vim ~/.ssh/config

eval "$(ssh-agent -s)"

ssh-add "my-private-key..."


git remote set-url origin [email protected]:"USERNAME"/"REPOSITORI.git"


git status

git add .

git commit -am "message/comment about changes"

git push

git pull

git with ssh key

  1. first create your ssh key ssh-keygen -b 4096
  2. add the .pub key into your repository
  3. check this setup - https://medium.com/@czarpino/how-to-tell-git-which-ssh-key-to-use-c8574fb243fd

Good documentation about git commands

raspberry-pi-as-a-router-nat

Transform to run as a router and NAT device

Finally! This project is now documented here - https://antonio.cloud/projects/linux/raspberry-pi/raspberry-pi-router-access-point-dns-block-ads-vpn/

Important

Below are notes from my old post

## the command below required sudo

echo "-----------------------"
echo "Shows the configs before changes..."

sysctl net.ipv4.ip_forward net.ipv4.conf.eth0.send_redirects

iptables -n -t nat -L POSTROUTING 


echo "-----------------------"
echo "Enabling IPv4 routing packets forward..."

sysctl -q -w net.ipv4.ip_forward=1 net.ipv4.conf.eth0.send_redirects=0


echo "-----------------------"
echo "Enabling routing/PAT with ip tables..."

iptables -t nat -C POSTROUTING -o eth0 -j MASQUERADE 2> /dev/null || iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE


echo "-----------------------" 
echo "Show configs after changes..."
sysctl net.ipv4.ip_forward net.ipv4.conf.eth0.send_redirects
iptables -n -t nat -L POSTROUTING 


echo "-----------------------"
echo "Routing/NAT configuration completed "

python-3-http-server

A quick and simple way to start a webserver on the current directory with Python 3 using module http.server


{% highlight bash linenos %}

python3 -m http.server 8000 --directory .`

{% endhighlight %}


Happy learning and keep practicing!

Antonio.Cloud

linux-find-command

Linux find command

Warning

Use the flag -exec with care. Try the command find without the -exec rm {} \; to see which files are found,

find . -type f -name 'desktop.ini' -exec rm {} \;

find . -type f -name '.DS_Store' -exec rm {} \;

clamav-linux-free-antivuris-scan

Linux Clam AntiVirus ClamAV

ClamAV

  • clamav's logo

  • Runs on AmazonLinux, Linux RedHat, Ubuntu, MacOS, Raspberry Pi, ...

ClamAV is an open source antivirus engine for detecting trojans, viruses, malware & other malicious threats.


Basic installation ClamAV Linux open source antivirus

MacOS - brew install clamav

RaspberryPi Ubuntu - apt-get install clamav

AmazonLinux, RedHat, CentOS, Fedora - yum install clamav


Using ClamAV freshclam and clamscn

## updates anti-virus database engine

freshclam -v


## executes the scan-antivirus, -->> ATTENTION to the `--remove` flag, this deletes files!
##
# consider running the command first without the `--remove` flag.

sudo clamscan --infected --remove --recursive=yes .

brief explanation

  • sudo - run the command as superuser or root
  • clamscan - runs the ClamAV scanner
  • -v - run in verbose mode
  • --infected - only output infected files (unless you also specified the verbose)
  • --remove - removes (deletes) infected detected files

offical manual command man freshclam man clamscan

use man freshclam or man clamscan for the official command line manual.