Tips & Tricks with Linux

I'll be updating this post with new tips and tricks about Linux as my personal list of useful commands and configurations.


Wheel group on Linux

When you need to give an user access special system privileges you use the wheel group, like:

# useradd -m -g wheel postgres

source


Get SHA1 value from a file

openssl sha1 [FILE]  

Better output when running scripts

set -ex  

In my case I'm setting this params to have a better output when running my Dockerfiles, so -e will exit immediately if a command exits with an error and -x will print commands and their arguments as they are executed.


Download a file with several options

curl -fsSL ${FILEBEAT_SRC_URL} -o filebeat.tar.gz | tar -xz  

This will download a file dealing with failed attempts -f in silent -s unless an error happen S and if the file have been moved to another address will use the redirect header to try the new address L outputing the downloaded file with the specified name -o and pipe all that to tar to extract -x the compresed file using gzip z


Tail all our logs files

tail -f ./*  

Send UPD request

echo -n "test" > /dev/udp/172.20.0.2/5044  

 Resources