TitBits
Unix utility commands
# tar and compress to stdout and then ssh and untar it to the new machine
$ tar czf - <files> | ssh user@host "cd /wherever && tar xvzf -"
Alternatively, use -C option with ssh and drop 'z' option with tar
can use rsync or sshfs as well
More info:
https://unix.stackexchange.com/questions/10026/how-can-i-best-copy-large-numbers-of-small-files-over-scp
# To find the UUID of the embedded device like UDOO x86
sudo dmidecode | grep UUID
# Regular expressions
https://www.gnu.org/software/sed/manual/html_node/Regular-Expressions.html
To substitute numbers followed by 1 or more spaces with comma and a space
a = [[2 345 657]
[34 567 7890]]
%s/[0-9] \+/&,/g
then
%s/, \+/, /g
# to find the IP address in ubuntu
hostname -I
# to find the IP address in MAC
ifconfig | grep -w inet | grep -v "127.0.0.1" | awk '{print $2}'System Admin commands
To give a particular user sudo privilege to run a particular command
Ref: https://www.liquidweb.com/kb/how-to-give-a-linux-user-root-level-access-using-sudo/
Common apt-get commands
To fix broken apt-get
To find the hard drives in udoo x86, creating filesystem and mounting
To activate /etc/rc.local in ubuntu 18.04
To check if an image is JPEG
Ref: https://stackoverflow.com/questions/266648/python-check-if-uploaded-file-is-jpg
Bytes to string:
https://github.com/tensorflow/tensorflow/issues/5552
CRON
If cron is not installed in docker do this:
apt-get install -y cron
Cron running here:
Ref: https://www.digitalocean.com/community/tutorials/how-to-use-cron-to-automate-tasks-on-a-vps
Python - glob files from dir and extract file_prefix
Python - utility commands
Python - multiprocessing
Ref: https://pymotw.com/2/multiprocessing/basics.html
Git utilities
How to block comment in bash script
BASH SCRIPTING
AWS CLI
AWS Check the 'pending validation' state in Certificate Manager
AWS MOUNT S3 to EC2
https://cloudkul.com/blog/mounting-s3-bucket-linux-ec2-instance/
AWS mount a volume to a running instance
Ref: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html
BOTO
Uploading to GDrive
GDrive commands
nvidia-smi commands:
CURL COMMANDS:
MongoDB commands:
S3
Upload Images to S3 from client - secure way without exposing credentials
Ref: https://github.com/aws/aws-sdk-js/issues/1515
Ref: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#getSignedUrl-property
Ref: https://stackoverflow.com/questions/46368513/aws-s3-credentials-exposed-in-code
GCloud Commands
Jenkins on kubernetes
TLS 1.2 (same as SSL v4.0)
Ref: https://devanswers.co/test-server-tls-1-2-ubuntu/
Ref: http://nginx.org/en/docs/http/configuring_https_servers.html
To learn about using Let's Encrypt to setup TLS1.2
SSL/TLS - create own certificate - letsencrypt
SSE4_2
Ref: https://stackoverflow.com/questions/4203235/how-to-test-if-your-linux-support-sse2
Remote Desktop Solutions - Ubuntu
Ref: https://www.ubuntupit.com/10-fast-and-secure-remote-desktop-client-software-for-linux/
Install Fonts in ubuntu machine
Ref: https://askubuntu.com/questions/55643/install-ms-truetype-fonts-system-wide-for-all-users
SSH TUNNELING
Ref:[GOOD] https://www.everythingcli.org/ssh-tunnelling-for-fun-and-profit-local-vs-remote/
Ref: https://blog.philippklaus.de/2012/03/keeping-ssh-tunnels-open-reliably
Ref: https://jerrygamblin.com/2016/04/23/persistent-reverse-ssh-tunnels-on-a-raspberrypi/
Ref: https://helpful.knobs-dials.com/index.php/SSH_-_tunnels,_X_forwarding
Ref: http://manpages.ubuntu.com/manpages/trusty/man1/autossh.1.html
Ref: (Good): https://serverfault.com/questions/595323/ssh-remote-port-forwarding-failed/595335#595335
Screen
Ref: https://www.gnu.org/software/screen/manual/screen.html
Setting up Uwsgi, Flask and Nginx
Ref: https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/
Ref: https://www.keycdn.com/support/nginx-commands
Then follow UWSGI/AgShift_README to set it up
Sendmail/mail/mailx/ssmtp
How to bind v4l2 cameras to USB ports
BEST Ref: https://bugs.launchpad.net/mythbuntu/+bug/310820/comments/5
How to start VNC on GCP machine
XML in Python
Ref: https://micropyramid.com/blog/building-and-parsing-xml-document-using-python/
To extend disk space on GCP/AWS drive
Ref: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recognize-expanded-volume-linux.html
Ref: https://cloud.google.com/compute/docs/disks/add-persistent-disk
When ubuntu GUI hangs
OpenVPN
Setting up FTP server
# Ref: https://medium.com/tensult/configure-ftp-on-aws-ec2-85b5b56b9c94
# FTP example (from your own MAC/laptop)
Command to find Internet-facing IP address:
Last updated
Was this helpful?