compare files with comm

Here’s a command that will compare two files and display the only entries in the first file that are missing in the second file. To do this, there’s a compare command in Linux Bash called comm that comes with several options. The option we are interested in is the comm -23 which exactly does that. Let me demonstrate. Let’s say file a.txt contains: one two three four five six seven eight nine ten And file b.txt contains: ...

September 6, 2020 · 1 min · ulysses

gcp set scopes

Here’s how to set the instance scope in GCP. Stop the server. gcloud compute instances stop server-name Default scopes. gcloud beta compute instances set-scopes server-name \ --service-account=your-service-account@gserviceaccount.com \ --scopes=default \ --project your-project-id \ --zone=us-central1-a Change scopes by adding storage-rw to default. gcloud alpha compute instances set-scopes servername \ --service-account=your-service-account@gserviceaccount.com \ --scopes=default,storage-rw \ --project your-project-id \ --zone=us-central1-c Start the server. gcloud compute instances start server-name Possible scope values. default cloud-platform storage-rw and more

September 4, 2020 · 1 min · ulysses

increase ssh timeout

Here’s how to keep your SSH timeout alive for a longer period. Edit /etc/ssh/sshd_config. Adjust interval and count max. ClientAliveInterval 1200 ClientAliveCountMax 3 ClientAliveInterval is set to 1200 and ClientAliveCountMax is set to the default which is 3. This means unresponsive SSH clients will be disconnected after approximately 3600 seconds or 1 hour.

August 25, 2020 · 1 min · ulysses

git bash path

Here’s how to add or edit the PATH in Git Bash. Edit your bash_profile. vi ~/.bash_profile Set your path by adding the new path at the end. PATH="/c/WINDOWS/system32:/c/Users/firstname.lastname/google-cloud-sdk/bin" The example path listed above is truncated for brevity.

August 19, 2020 · 1 min · ulysses

aws list of application lb

Here’s how to display a list of application load balancers. aws elbv2 describe-load-balancers --profile --region us-east-1 Here’s how to display classic load balancers. aws elb describe-load-balancers --profile --region us-east-1

August 17, 2020 · 1 min · ulysses

audacity copy

I was getting an error when launching Audacity. The error was: “The system has detected that another copy of Audacity is running.” However, Audacity wasn’t running at all. Not one process. It turned out to be just a locked file located in /var/tmp/audacity-[your-username]. All you have to do is delete the entire directory and rerun Audacity. rm -rf /var/tmp/audacity=[your-username]/ Once deleted, Audacity starts right up with no issues.

August 8, 2020 · 1 min · ulysses

linux fuser

Who is accessing a particular directory? There’s a Linux command called fuser which will tell you who’s running processes in that directory. fuser /etc/apache/ fuser /home/john/ Verbose. fuser /data/exports/ -v Check out the fuser man page.

August 6, 2020 · 1 min · ulysses

ansible run commands

Typically you will run Ansible using playbooks, just like the playbook that I ran from the previous post to patch a bunch of servers all at once. In addition to running playbooks, you can also run single ad hoc commands to a server or to a group of servers. Below are a few examples of that. First, here’s my /etc/ansible/hosts file. [servers] server1 server2 [webservers] server3 server4 [appservers] server5 server6 [dbservers] server7 server8 Here are the commands. ...

August 2, 2020 · 1 min · ulysses

ansible update playbook

I have an Ansible playbook that will patch all Ansible clients defined in the Ansible hosts file. The following are contents of my hosts file, and the update playbook. File: /etc/ansible/hosts [all:vars] ansible_user='ubuntu' ansible_become=yes ansible_become_method=sudo ansible_python_interpreter='/usr/bin/env python3' [servers] server1 server2 server3 [servers:vars] ansible_python_interpreter=/usr/bin/python3 File: /etc/ansible/update.yml --- - hosts: servers become: true become_user: root tasks: - name: Update apt repo and cache on all Debian/Ubuntu boxes apt: update_cache=yes force_apt_get=yes cache_valid_time=3600 - name: Upgrade all packages on servers apt: upgrade=dist force_apt_get=yes - name: Check if a reboot is needed on all servers register: reboot_required_file stat: path=/var/run/reboot-required get_md5=no - name: Reboot the box if kernel updated reboot: msg: "Reboot initiated by Ansible for kernel updates" connect_timeout: 5 reboot_timeout: 300 pre_reboot_delay: 0 post_reboot_delay: 30 test_command: uptime when: reboot_required_file.stat.exist Here’s how I run my Ansible update playbook. ...

August 1, 2020 · 1 min · ulysses

center search widget

Here’s how to center the Search widget in a WordPress Page or a post. This applies only if you’re using the default Search Widget. Div classes may vary based on theme being used. The CSS example below may not work for your theme. Check your theme’s source code to be sure. .entry-content .wp-block-search { display:block; margin-left:auto; margin-right:auto; text-align: center; } .entry-content .wp-block-search label { display:none; } .entry-content .wp-block-search input { width:250px; } The CSS above centers the search block. It suppresses the search label, and finally sets the form’s input to a fixed width of 250px.

August 1, 2020 · 1 min · ulysses