Wednesday, May 5, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


Use For loop to extract certain columns from a series of files to write new tab-delimited files

Posted: 05 May 2021 09:57 AM PDT

I have a series of files located in a series of folder, for example:

~/BR2_1-3/bin.1.permissive.tsv    ~/BR2_1-3/bin.2.permissive.tsv    ~/BR2_1-3/bin.3.orig.tsv    ~/BR2_2-4/bin.1.strict.tsv    ~/BR2_2-4/bin.2.orig.tsv    ~/BR2_2-4/bin.3.permissive.tsv    ~/BR2_2-4/bin.4.permissive.tsv    ~/BR2_3-5/bin.1.permissive.tsv    ~/BR2_3-5/bin.2.permissive.tsv      ~/BR2_3-5/bin.3.orig.tsv            ~/BR2_3-5/bin.4.orig.tsv    ~/BR2_3-5/bin.5.permissive.tsv  ...  

What I want to do is to extract the 1st and 5th column from each of the *.tsv file and create a new tab delimited file in the corresponding folder. That I can do separately for each file under its corresponding folder by using the commands below:

$ awk -F '\t' 'OFS="\t" {if ($5 != "") print($1,$5)}' bin.1.permissive.tsv > test  $ sed -i '1d' test  $ mv test BR2_1-bin.1.permissive.ec  

My question is, because I have over a hundred of this kind of file, is there a way to write a FOR loop to do this step at the terminal automatically? The naming convention for the folder and files are as follows:

"BR(2~5)_(1~6)-(n, as the number of files contained in the folder)" for the folders; "bin.n.(strict/permissive/orig).tsv" for the files.

Thank you in advance and all suggestions are welcomed!

Resource for Linux Graphics

Posted: 05 May 2021 09:56 AM PDT

Most distros include a 'usable' graphics stack out of the box. But graphics on linux is wildly inferior to Windows.

Setting up hardware acceleration for a browser can take an entire week.

I still don't have hardware acceleration on Pop_Os! Even though it's by far the best out of the box hybrid graphics experience I've used.

Is there a collective resource for Linux graphics issues?

Can we develop a site dedicated to troubleshooting and helping with easy fixes to common graphics problems?

Can we develop a tool to reliably detect (and in OEM's cases, fix) graphics issues during the boot process?

Can we develop a universal config file somewhere (/etc/graphics-stack.cfg) to let us decide what we want and let a tool make sure it's available?

I'm using Pop_Os! As a daily driver. I'd recommend it to my team to use for development work if I didn't spend the last 2 weeks debugging obscure hardware acceleration bugs(yes. It is a bug. Windows can do it first try and we can't) not to mention driver and xorg->wayland issues on Ubuntu and Arch too.

Update delimiter of specific columns

Posted: 05 May 2021 10:00 AM PDT

I have a comma-separated file with 7 fields. One of these fields, however, contains , in the value. I want to change the delimiter of the file to | without changing the data of the field with the ,.

File I have:

Name,Age,Country,ID,Address,Category,DOB  John Doe,19,England,3653,Manchester, England,Main Worker,20-05-1995  

Required Output:

Name,Age,Country,ID,Address,Category,DOB  John Doe|19|England|3653|Manchester, England|Part Time Worker|20-05-1995  

I have tried multiple solutions but have not been able to achieve what I am looking for. I tried the following command which only updates the delimiter of the first 4 columns:

sed 's/,/|/;s/,/|/;s/,/|/;s/,/|/' file  

The approach I'm looking for is to update the delimiter of the first 4 columns and last 2 columns. In this way I can have the file with updated delimiter without changing the Address column.

I have come up with the following piece of code but this removes the , between Manchester and England.

awk '{ORS="";N=split($0,a,",");\              print a[1]"|"a[2]"|"a[3]"|"a[4]"|"; \              for(i=5;i<N-1;i++) print a[i];               print "|"a[N-1]"|"a[N] }'  

Network bandwidth aggregation

Posted: 05 May 2021 09:24 AM PDT

Lets say I have access to two different networks: A and B. My device has two different network interfaces N1 and N2.

A has a bandwidth of 5 mbps B has a bandwidth of 3 mbps

I want to combine these two Networks to get a total bandwidth of: 8 Mbps. The way I was thinking of doing it as follows:

I use the two network Interfaces(N1, N2) to connect to the networks A, B. Lets say I have hundred packets to send. I send 50 packets using network A and 50 using network B. I send these packets to a personal server where packets coming from network A and B are combined and are sent to the intended location.

In order to do all this I think I will have to get all traffic from the network layer and send it to different interfaces.

Assuming everything I just mentioned is doable, I want to know how can I intercept the packets coming from the internet layer so that I can implement the above logic and channel the traffic to different interfaces.

How does the this wildcard work "* .*"

Posted: 05 May 2021 09:34 AM PDT

Here are the outputs.

echo  *.*  file1.txt file2.txt file3.txt    echo * .*  file1.txt file2.txt file3.txt . ..  

Why does the second command include the files if they have no space character before the period? Thank you for the help much love!

Why Linux has "bridge" link type, and not a "switch"

Posted: 05 May 2021 09:22 AM PDT

In Linux, we can have a virtual bridge device. It is used i.e. by Docker, which creates a default "docker0" bridge. Since in networking bridge is a similar device to a switch (and switch is actually superior and used nowadays instead of bridges), I wonder, why is the link type called "bridge", and not "switch"?

I want to join two files and KEEP all the white space

Posted: 05 May 2021 08:54 AM PDT

I am trying to join two data files. The first one has 100.000 records where each line represents one person. The second file has 400.000 records where a person in the first file can appear multiple times. The first column in both files has a unique ID of each person

I want to join the files by the first column and add information from file 1 to file 2... so the new file will have 400.000 lines with added information about each person from datafile1.

I tried using a very simple:

join data2 data1 > data3  

But because column 3 in data2 is either 1, 2 or 3 letters and because there is not information in all all columns the output file does not look like I want it to look like.

I want to KEEP the white spaces between all the columns and I want the columns to line up!

Data 1:

200616550010284  1655001  10072006  20012015  07102008  29012010  09012011  28122011    200616550010285  1655001  16082006  10052010  29092008  04092009                        200616550010289  1655001  07092006  28052013  20072009  12072010  14072011  11102012    200616550010291  1655001  31102006  28032011  14012009  12012010                        200616550010292  1655001  09112006  09092013  05012009  17012010  02022011  01032012    200616550010293  1655001  13122006  03092009  19022009                                

Data 2:

200616550010284 22032010  32    200616550010284 10032011 162    200616550010285 04122008  32    200616550010285 18112009  32    200616550010289 02032008  32  

The data I want :

200616550010284 22032010  32  1655001  10072006  20012015  07102008  29012010  09012011  28122011    200616550010284 10032011 162  1655001  10072006  20012015  07102008  29012010  09012011  28122011    200616550010285 04122008  32  1655001  16082006  10052010  29092008  04092009     200616550010285 18112009  32  1655001  16082006  10052010  29092008  04092009     200616550010289 02032008  32  1655001  07092006  28052013  20072009  12072010  14072011  11102012  

The Data I get:

200116380810352 06042008 60 1638081 30082001 29082014 19112005 22112006 08122007 21012009    200116380810599 09052008 31 1638081 30102001 24032013 30112004 04082006 25012008 19022009    200116380810599 27102008 76 1638081 30102001 24032013 30112004 04082006 25012008 19022009    200116386910204 02072008 162 1638691 05062001 15122009 12122005 11012007 18122007 10042009    200116386910204 20052008 60 1638691 05062001 15122009 12122005 11012007 18122007 10042009    200116386910204 26042008 60 1638691 05062001 15122009 12122005 11012007 18122007 10042009  

sudo: sorry, you are not allowed to set the following environment variables: PATH

Posted: 05 May 2021 08:44 AM PDT

I set an alias for sudo as:

alias sudo='sudo PATH=$MY_PATH'  

I checked that this works well by running sudo printenv PATH.

However, I encounter an error when running sudo su - USER2.

sudo: sorry, you are not allowed to set the following environment variables: PATH

I could find a workaround by running sudo -i su - USER2, but I want to know why this error occurs.

I referred to https://www.sudo.ws/man/1.8.28/sudoers.man.html#Denied_command_log_entries but couldn't get the reason.

sorry, you are not allowed to set the following environment variables

The user specified environment variables on the command line that were not allowed by sudoers.

Why is PATH denied by sudoers?

Any link or comment appreciated.

Pass the variable value to curl JSON

Posted: 05 May 2021 08:29 AM PDT

I am trying to create a JIRA ticket using curl POST method, but the variable substitution is not happening properly in TODAY_DATE variable. If i remove that it is working fine. ANy hint on how this can be solved?

Below is my code where only TODAY_DATE substition isnt working and failing with below error

#!/bin/bash  JIRA_CREDS="XXX:YYY"  JIRA_PROJECT="OPS"  JIRA_URL="http://jira/jira/rest/api/2/issue/"  JIRA_CONTENT_TYPE="Content-Type: application/json"  DATE_1=`date +"%d/%b/%y %r" | cut -d":" -f1`  DATE_2=`date +"%d/%b/%y %r" | cut -d":" -f2`  DATE_3=`date +"%d/%b/%y %r" | cut -d":" -f3 | cut -d" " -f2`  TODAY_DATE=`echo "${DATE_1}:${DATE_2} ${DATE_3}"`   curl -D- -u "$JIRA_CREDS" -X POST --data '{   "fields": {   "project":   {   "key": "'$JIRA_PROJECT'"   },   "summary": "Security patch update",   "description": "The instances need to be updated via yum.",   "customfield_13339": { "value": "Bamboo" },   "customfield_13338": { "value": "Approved" } ,   "customfield_13337": [{ "value": "Team" }],   "customfield_13331": [{ "value": "SITTR" }],   "customfield_13334": { "value": "'$TODAY_DATE'" },   "issuetype": {   "name": "Tech Task"   }   }   }' -H "$JIRA_CONTENT_TYPE" "$JIRA_URL"    curl: (7) Failed to connect to 0.0.0.11: Invalid argument  curl: (23) Failed writing header  

Best way to create splash screen from kernel boot to Xorg JavaFX app?

Posted: 05 May 2021 08:11 AM PDT

Context

I work on Raspberry pi 4 with Yocto OS.

I try to create a splash screen who appears after kernel boot and disappears when my JavaFx app is ready on Xfce4.

I found several "solutions" but they do not suit me.

My bad solution

My actual solution is that I run a script at the boot (after kernel) who write directly on framebuffer my splash screen image.

When Xorg start, I use xsetroot -bitmap to display the same splash image on the screen.

When Xfce4 start, I set the Xfce4 desktop background with the same image and I wait that my JavaFx app start.

My problem

This solution has a main problem, between each transition (boot-->xorg-->xfce4), I have a black screen. It's not a fluid boot.

My dream

I thought that, it will be perfect to prepare Xorg + xfce4 + JavaFx boot in fake screen and display the splash screen on the real screen.

When my Javafx app is fully started, I display my fake screen on the real.

I don't found how to realize this solution, and maybe it's the worth solution.

Can you help me please ?

Thank you in advance.

Is there any better tool than nft to print ordered rules?

Posted: 05 May 2021 08:04 AM PDT

I hate the way nft prints tables, rules and so on. Using the print with iptables -L shows directly all the rules in chains in order of priority. It's very easy to see all the rules in a unique chain at the first glance.

  • Why isn't nft capable of that? Is there any other alternative? Just to look at what is processed in which order for a single hook such as nat for example. So that the debugging is much easier.

Unable to install Manjaro

Posted: 05 May 2021 09:26 AM PDT

I had installed Manjaro gnome and xfce. At first, I tried with gnome version of Manjaro. I made my USB bootable. Then, I reboot my PC. Tried to install in boot. When I entered Pendrive disk. I got following message. enter image description here

After pressing any key I got following message.

enter image description here

I had made my USB bootable using Power ISO and Rufus(At first I tried by Power ISO, I noticed I was getting above error using Power ISO that's why I tried Rufus. Although I am having same issue) in Windows. Here's my Manjaro bootable USB image.

enter image description here

Ansible - matching a string to an item in a list

Posted: 05 May 2021 09:38 AM PDT

I'm trying to iterate over a list in Ansible and search for a string in each item in it, and then assigning the matched item to a variable. To be more specific, I'm pulling all MAC addresses on each node into a list and looking for a specific manufacturer prefix in each interface.

The list is created from Ansible facts - I create it at the start of the play:

  vars:      mac_addresses: []  

And then add found facts into it:

- name: Find MAC addresses      shell: "echo {{ ansible_facts[item]['macaddress']|default(None) }}"      register: mac_addresses      with_items:      - "{{ ansible_interfaces }}"  

I then tried to iterate over that list - I tried using the match method:

  - name: Find correct MAC address      debug:        msg: "{{ item }} is the correct NIC"      when: "{{ item }}" is match("*[mac prefix]*")      with_items:      - "{{ mac_addresses }}"        

I've also tried registering the prefix to a variable and using a conditional by replacing the above's when line with:

when: correct_prefix in mac_addresses  

Both of which fail to run or produce unwanted results.

How would I go about finding a string in a list, and registering the result in a variable? I've looked around the internet and in documentation and could not figure it out - any help would be greatly appreciated.

Thanks!

How to check if command had any output (zsh)

Posted: 05 May 2021 08:13 AM PDT

I want to print a new line after a command if it had any output (I hope that this will make it more readable once my terminal starts scrolling).

I found this:

precmd() {      precmd() {          print ""      }  }  

Which works, but obviously prints line after every command.

And also this:

precmd () {                              exec 2>&- >&-      lastline=$(tail -1 ~/.command.out)      sleep 0.1      exec > /dev/tty 2>&1  }    preexec() {      exec > >(tee ~/.command.out&)  }  

And tried to modify it, but it "breaks" the output (and makes vim un-usable) even w/o my modificatons.

random output from input

Posted: 05 May 2021 08:44 AM PDT

Related question : how to create a random output from users input

I was thinking to take an input(only one argument) from user just like Hello. And, I want to give output like

olleho  llohe  he  llo  lo  

Just like above. And, I want to make millions of sample from that single input. I want to save those texts in a txt formatted file. How to do it?


Suppose, I am giving my email address as an argument `Istiakshovon0@gmail.com`. So, now I want to make possible related password with this account. Some sample output given below :
Istiakshovon0@gmail.com  Istiakshovon  Istiak  Ishovon  Ishovon0  Iksgc  gmail  moc  

I want to create sample password every possible way as possible.


I added tag cause, I noticed that lot of peoples were formatting texts using `awk`. I am not familiar with it(I am just a beginner Linux user). That's why I added it.

Install a second G++ on Debian using official packages only?

Posted: 05 May 2021 09:12 AM PDT

I need a newer G++ for a project, but all tutorials will tell you to download the sources, compile them and "simply" install them then use it. Which is something I don't want since it's not very reproducible.

However, Debian do have more recent packages in their repositories (bullseye, testing, unstable, etc) that I can keep and share. I know doing this will almost get me a FrankenDebian, but it's far better than going the sources way or any shady repository (some tutorials even suggest ppas for Debian...).

I also want to keep Debian buster's G++, since a lot of things will surely use it and that avoiding such errors:

/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.30' not found (required by /lib/x86_64-linux-gnu/libselinux.so.1)    error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory  

would certainly prevent some headaches here.

I also heard about setting alternatives and all, but I would need to install the right packages first.

So here's my question: How do I install another G++ on Debian buster, without going the sources' way ?

bash script pattern not found

Posted: 05 May 2021 08:46 AM PDT

I have the following script:

#!/bin/bash  result=$(grep "pattern 1\|pattern 2\|pattern 3\|pattern 4\|pattern 5\|pattern 6\|pattern 7\|pattern 8" file_data.dat)    if [ -n "$result" ]; then      printf '%s\n' "$result"  else      printf 'No match found for pattern "%s"\n' "$pattern"  fi  

It works but it has an issue, if there is no match for one of the patterns, I want to know which pattern did not match.

I also tried with:

#!/bin/bash    if          grep "pattern 1\|pattern 2\|pattern 3\|pattern 4\|pattern 5\|pattern 6\|pattern 7\|pattern 8" file_data.dat  then  echo "All patterns found"  else  echo "Missing pattern"  fi  

But it has same issue.

Extract only rows with duplicated strings in tab-delimited table

Posted: 05 May 2021 08:33 AM PDT

I have a long list of data with 10 tab delimited columns. First two columns are the IDs. I would like to retrieve rows of selected IDs.

I started with renaming the selected IDs, so that each of them prepended with comp-. Then I tried to extract the rows with selected IDs present in both column 1 and 2.

file:

comp-AA11232.1  GR55896.1  AB55887.1   comp-FR87559.1  comp-AC11232.1  comp-AE55888.1  comp-AC66742.1  comp-AD87559.1  

Desired output:

comp-AC11232.1    comp-AE55888.1  comp-AC66742.1    comp-AD87559.1  

I was using sed -n '/comp\-.*\tcomp\-.*/p' file. The output files were all those that met criteria, but unfortunately some of the rows with same criteria missed out in the output files.

Not sure what is happening here. Any idea? Or is there any better approach with grep/awk/sed in this case?

Sending HTML with Mutt mangles the reply history badly; How can I make replies survive a call to Pandoc?

Posted: 05 May 2021 08:38 AM PDT

In mutt, I'm trying to write formatted emails, but the pre-processing step that converts markdown to HTML is mangling the previous messages.

I'm using this answer to convert my messages to HTML.

In mutt, I can write a message literally like this:

Dear A    # Summary of changes    1. Item 1  2. Item 2    B  

and it ends up formatted as you'd expect. A sees B's well-formatted html.

Unfortunately, this mangles the reply thread, since markdown uses whitespace differently than the sender probably did. In addition the reply thread is rendered to white-space+text, rather than retaining markdown/html markup.

To see this, if B replies using the Mutt/HTML/Markdown tricks, pandoc will interpret the quoted text strangely, and mangle the reply text.

The result after B->A->B looks like (I had to edit a bit to remove emails and such, but the it's basically spot on)

A,  You mangled my reply, you twit, people do read the chain sometimes, you know    --B                                                                                                                                                                                                                                                                     On Tue, May 4, 2021, 3:49 PM A <a> wrote:                                                                                                                                                                                                    > B,  > I can do that too!                                                                                                                       > With formatting!                                                                                                                     >                                                                                                                                      >    1. One-again                                                                                                                      >    2. Two-again                                                                                                                      > --A                                                                                                                                     > On Tue, May 04, 2021 at 03:48:21PM -0700, B <b> wrote: >                                                               > > Summary of Changes > > > 1. Item 1 > > 2. Item 2 > > > >                                                                >                                                                                                                                                                          

Question

Is it possible (and how can I) edit in markdown, convert my message to HTML, and either attach prev replies unchanged, or (ideally) in-line previous replies unchanged.

Zoom - Problems with sound in Ubuntu

Posted: 05 May 2021 09:17 AM PDT

I have some weird issues with Zoom in Ubuntu 20.04. Every time I join a meeting and select "Join with my Computer Audio", Zoom volume starts at 10%:

enter image description here

The second problem is weirder. It happens when I am in a meeting created by a specific colleague of mine (and only him!): when someone enters or leaves the room, Zoom's volume falls to 0%. I must manually changing again. This doesn't happen with anyone else, nor does it happen to the other participants of the meeting. It's only me.

I have Zoom 5.5.4 for Linux. Any ideas what might be the problem? Feels like a local issue. Some odd configuration.

Asus PN50 mini-PC: There are no pwm-capable sensor modules installed

Posted: 05 May 2021 09:49 AM PDT

I am running Linux Mint on a PN50 Ryzen 5 4500U. Fan is very loud and I think it can make it quieter with a little bit of fan RPM control. However, I am not able to detect the fan speed:

$ sudo pwmconfig  # pwmconfig version 3.6.0  /usr/sbin/pwmconfig: There are no pwm-capable sensor modules installed  

My sensors output is

Adapter: Virtual device  temp1:        +46.0°C      k10temp-pci-00c3  Adapter: PCI adapter  Tdie:         +52.5°C  (high = +70.0°C)  Tctl:         +52.5°C  

The sensors-detect output is here https://pastebin.com/VsZuqiuL

Any ideas how to add the fan sensor to the list of sensors? and CPU core temperature?

How do I switch <Ctrl+C> from interrupt to copy, and <Ctrl+Shift+V> to <Ctrl+V>, in xfce4-terminal?

Posted: 05 May 2021 09:09 AM PDT

This is basically the same question as How to set ctrl+c to copy, ctrl+v to paste and ctrl+shift+c to kill process in xfce4-terminal?, but not a duplicate, because neither of the answers helped.  Alex Kaszynski's answer suggests modifying the ~/.config/xfce4/terminal/accels.scm file. 

I did that: I have changed two lines:

; (gtk_accel_path "<Actions>/terminal-window/paste" "<Primary><Shift>v")  -->  ; (gtk_accel_path "<Actions>/terminal-window/paste" "<Primary>v")  

and

; (gtk_accel_path "<Actions>/terminal-window/copy" "<Primary><Shift>c")  -->  ; (gtk_accel_path "<Actions>/terminal-window/copy" "<Primary>c")  

but neither of those helped; the interrupt is still assigned to Ctrl+C.  (I would probably need to make it unbind and rebind to Ctrl+Shift+C, but do not know how to do so.)

  1. How to map "copy" from Ctrl+Shift+C to Ctrl+C
  2. Remap interrupt from Ctrl+C to Ctrl+Shift+C
  3. Remap "paste" from Ctrl+Shift+V to Ctrl+V

Python open screen and execute inside screen

Posted: 05 May 2021 08:04 AM PDT

I have a py script S1 that I would need to execute inside a screen. On an end-user point of view, I would like them to just execute another python script S2, which will open a screen and execute the script S1 inside that screen.

My S2.py is like this :

import os   os.cmd('echo Outside main terminal')  os.cmd('screen -S sTest')  os.cmd('echo I would like to be inside screen here. Not successfully!. How to send command to screen instead of remaining at main Terminal')  os.cmd('spark-submit S1.py') #this should execute inside screen. currently main Terminal is the one that runs it  #Additional steps to check status, clean up, check if screen is active then spawn another sTest2 sTest3, otherwise close and/or reuse screen sTest, etc.  screen_list = os.cmd('screen -ls')  if 'sTest' in screen_list ...... #let python process  

What I want is that end-users can simply run python S2.py, the screen hassle is handled by me at the back. I will need to have extra mechanism to clean up screen, use existing screens etc. Giving users instruction to open screen themselves will litter every terminal with screens.

The reason S1.py needs to be inside screen is due to SSH connection stability if run on main Terminal.

Joe 4.6: How do I override color definitions?

Posted: 05 May 2021 09:34 AM PDT

After upgrading from Debian 9 (Joe 4.4) to Debian 10 (Joe 4.6), the following lines in my joerc started creating errors:

=Preproc    yellow  =Tag    cyan bold  

I used this to override the default colour scheme, which has C pre-processor lines in dark blue, which is very difficult to read when using a terminal with black background.

I am unable to find documentation on how to do this in 4.6, the entire section on colours has just disappeared from the default /etc/joerc.

Any help would be appreciated.

Create an image of the partition (only the used space)

Posted: 05 May 2021 08:24 AM PDT

I have a partition sdb1 of size 3.3 GB. From 3.3 GB only 1.9 GB is used and 1.2 GB is an empty space. I want to create an image of this partition. But I want the image to only have the used space i.e. 1.9 GB

Now when I run a command using dd:

dd if=/dev/sdb1 of=/home/data/Os.img bs=1M status=progress  

I saw behavior that dd is making the image of 3.3 GB While I don't want the unallocated space to be the part of the OS image.

So I tried different solutions. I found one solution:

dd if=/dev/sdb1 of=/home/data/OS.img bs=1M count=1946 status=progress  

This solution created an image of 1.9 GB as I have defined a block size of 1M and count is 1946 which will give 1.9 GB totally.

Question I am unable to determine if this dd command only made an image of the used space or it just created an image of size 1.9 GB in which there are both used and unused spaces?

And is there any other way in which the image can be created for the used space only?

Why is vim frozen?

Posted: 05 May 2021 09:32 AM PDT

I have two different machines (home and work) running Ubuntu 18.04. Last night vim froze at home. I was in insert mode and typing and went to save (esc :w) and nothing happened. The status bar still reads -- INSERT --, the cursor is still blinking where it was. I was stuck. I couldn't find a way out. I couldn't type (nothing happened when I type), I couldn't move around (the up and down arrows did nothing). It was stuck in insert mode with the cursor blinking where it was.

I was definitely multitasking and probably hit some other keys in there, but I don't know what keys. It was late, though, so I closed the terminal window and tried again (I was entering a git commit message). It happened again partway through my typing so I switched to git commit -m "don't need an editor for this" instead. And then I shut down my computer and stopped working.

I figured I was just tired, but then it happened to me today at work on a different laptop altogether. Again I was multitasking and can't swear I didn't type any bizarro key sequence but if I did it was accidental. And other tabs in the same terminal aren't frozen.

I'm used to getting trapped in visual mode in vim. That's a trick I've learned. But stuck in insert mode? Any ideas on what I might've done and how to get out of it?

Per a comment suggestion I tried looking at .viminfo but the only .viminfo I see is owned exclusively by root and only appears to show things I would have edited with sudo:

# Input Line History (newest to oldest):    # Debug Line History (newest to oldest):    # Registers:    # File marks:  '0  1  0  /etc/neomuttrc  |4,48,1,0,1531789956,"/etc/neomuttrc"  '1  1  66  /etc/apt/sources.list.d/signal-bionic.list  |4,49,1,66,1530816565,"/etc/apt/sources.list.d/signal-bionic.list"  '2  51  0  /etc/apt/sources.list  |4,50,51,0,1530816531,"/etc/apt/sources.list"    # Jumplist (newest first):  -'  1  0  /etc/neomuttrc  |4,39,1,0,1531789956,"/etc/neomuttrc"  -'  1  66  /etc/apt/sources.list.d/signal-bionic.list  |4,39,1,66,1530816565,"/etc/apt/sources.list.d/signal-bionic.list"  -'  1  66  /etc/apt/sources.list.d/signal-bionic.list  |4,39,1,66,1530816565,"/etc/apt/sources.list.d/signal-bionic.list"  -'  51  0  /etc/apt/sources.list  |4,39,51,0,1530816531,"/etc/apt/sources.list"  -'  51  0  /etc/apt/sources.list  |4,39,51,0,1530816531,"/etc/apt/sources.list"  -'  51  0  /etc/apt/sources.list  |4,39,51,0,1530816531,"/etc/apt/sources.list"  -'  51  0  /etc/apt/sources.list  |4,39,51,0,1530816531,"/etc/apt/sources.list"  -'  1  0  /etc/apt/sources.list  |4,39,1,0,1530816447,"/etc/apt/sources.list"  -'  1  0  /etc/apt/sources.list  |4,39,1,0,1530816447,"/etc/apt/sources.list"  -'  1  0  /etc/apt/sources.list  |4,39,1,0,1530816447,"/etc/apt/sources.list"  -'  1  0  /etc/apt/sources.list  |4,39,1,0,1530816447,"/etc/apt/sources.list"    # History of marks within files (newest to oldest):    > /etc/neomuttrc      *   1531789952  0      "   1   0    > /etc/apt/sources.list.d/signal-bionic.list      *   1530816564  0      "   1   66      ^   1   67      .   1   66      +   1   66    > /etc/apt/sources.list      *   1530816454  0      "   51  0  

It seems odd that I wouldn't have an unprivileged .viminfo but I did sudo udpatedb and locate .viminfo and still didn't surface more than the one root-owned file.

IBM V7000 scripts for monitoring

Posted: 05 May 2021 09:02 AM PDT

Hello (I'm no hard core coder:),

I try to develop a script to do some very basic monitoring on an IBM SVC.

My goal is to get some information about the nodes and my quroum status and then send this information by mail.

here's my code so far (I understood that grep command doesn't "work" on CLI for SVC).

#check nodes of the cluster with lsnodes and parse status  ssh admin@SVCName superuser>svcinfo lsnode | while read id name sn wwnn status temp;do echo $name" "$status;done    #check quorum status with lsquorum and parse status  ssh admin@SVCName superuser>svcinfo lsquorum | while read quorum_index status id name controller_id controller_name active temp; do echo $controller_name" "$active;done  

My problem is sending an email from the CLI to designed users. I don't find any valuable information anywhere on the internet.

HINT: this script will be deployed on a jumppoint server (probably a windows server) in production, I cannot allow the installation of any exectution environment such as cigwin or perl or anything).

Could you help me with that ?

Applying changes to xorg.conf without restarting

Posted: 05 May 2021 07:58 AM PDT

I'm using Ubuntu 12.04 and making some changes to /etc/X11/xorg.conf. I now need to restart X server to apply the changes, but I don't want to restart my machine.

I know restarting the display manager (eg. lightdm) will sometimes work, is this the best way to do it?

No comments:

Post a Comment