Friday, October 22, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


How do I install softwares in openbsd?

Posted: 22 Oct 2021 10:50 AM PDT

I want to install Firefox but been having issues. So how do I install softwares and games in OpenBsd?

Thanks Jonathan Steadman.

Install default Ubuntu 20.04 repositories and files on Kali

Posted: 22 Oct 2021 10:48 AM PDT

I can't seem to get my Desktop Environment for my (Windows 11 Beta) WSL-2 Ubuntu 20.04 to work, so I think it would be easier to just set up win-kex gnome on kali, then just install the default Ubuntu 20.04 files. Is this doable? If so, how do I do it?

tee in for loop not working as expected

Posted: 22 Oct 2021 11:29 AM PDT

I'm trying to use tee in a for loop as such:

for ea in $(ls *bam)    do samtools mpileup -f $ref $ea | \    tee \    >(java -jar $varscan2 mpileup2indel --output-vcf 1 > vcf/"$(echo $ea | sed s/.bam//)"_mpileup2indel.vcf) \    >(java -jar $varscan2 mpileup2snp --output-vcf 1 > vcf/"$(echo $ea | sed s/.bam//)"_mpileup2snp.vcf) | \    tail -n 5  done;  

I.e. using the output of samtools mpileup, and piping that into two separate commands. I added the tail -n 5 to prevent the output of samtools mpileup from being printed in its entirety to stdout (I want full output to be used as input to java -jar varscan, however).

This seems to work initially, but the command doesn't seem to complete (file size for each output is smaller than if command was done without tee).

Eventually I get an error that the two java -jar $varscan commands are waiting for an input that never arrives (prior to getting a chance to start the second iteration of the loop).

Is this the best way to accomplish what I'm after, i.e. using the output of the first command in two separate commands (ideally, not recording/printing the output of the first command at all)? Is tee incompatible with for loops?

Thanks in advance.

How to calculate disk usage filtering by pattern (e.g., *.JPG)?

Posted: 22 Oct 2021 10:27 AM PDT

How can I calculate disk space consumed only by some files of a directory recursively?

Extract unique subdomains from a list

Posted: 22 Oct 2021 10:40 AM PDT

I have a .txt file with 2 million lines containing URLs of the same domain, I need to extract only unique subdomains of this list... The problem is when I use the command below, the output return the entire unique URLs, I only need to extract unique subdomain names not the entire URL, without repeat. Any tips? Thanks<3

cat all-urls.txt | grep domain.com.br | uniq -u  

External monitor stuck on "Unknown display" 1024x768 - Fedora 34

Posted: 22 Oct 2021 10:10 AM PDT

Using a fresh install of Fedora 34 Workstation edition(GNOME) on a dell latitude 7400 laptop, I'm struggling to make my external display to work, an Asus ROG PG278Q 27". Connecting through the USB-C port, the display shows up in the system settings as an "unknown display" and the resolution is capped at 1024x768.

Things I already did:

  • updated all packages with dnf update
  • tried setting the resolution with xrandr, following this resolution
    • xrandr --newmode "2560x1440-144ghz" 808.75 2560 2792 3072 3584 1440 1443 1448 1568 -hsync +vsync
    • xrandr --addmode XWAYLAND1 "2560x1440-144ghz"
    • xrandr --output XWAYLAND1 --mode "2560x1440-144ghz" - gives me "X Error of failed request: BadValue (integer parameter out of range for operation) "

system info:

  • Graphics: Mesa Intel® UHD Graphics 620 (WHL GT2)

  • Windowing system: Wayland

  • GNOME Version: 40.4

  • lspci | grep VGA output: 00:02.0 VGA compatible controller: Intel Corporation WhiskeyLake-U GT2 [UHD Graphics 620] (rev 02)

This is my first time in many years switching to a linux desktop, this display used to work on my previous windows 10 instalation and it also worked in my (brief) rocky linux 8 installation.

How to create a file with a name that starts with the symbol '-'

Posted: 22 Oct 2021 10:26 AM PDT

I want to use the touch command in linux terminal in order to create a file with a name that begins with the symbol -, say -attempt.

How can I overcome the the fact that - is a special character?

For example, if I wanted to create a file with the name #attempt, I couldnt just write touch #attempt

Instead I would have to write touch \#attempt, but in the - case even if I use \ it still does not work well).

How to install .deb package without breaking debian?

Posted: 22 Oct 2021 09:54 AM PDT

I've a self build "emacs-ng.deb" package, i now want to install in my machine. But i heard horrible stories of installing third party softwares. But i really want to install emacs-ng, i see it is available in .deb package , made in docker.

I found because of lower version, i cant install from source.

Would you guys, please provide me a debian way of installing .deb packages in debian, so that in next uprade or upgrade, i wont be breaking my system

How it comes that ldapsearch output can't be piped

Posted: 22 Oct 2021 10:23 AM PDT

ldapsearch always outputs an authentication message with every query at the beginning:

SASL/GSS-SPNEGO authentication started  SASL username: user.principal@DOMAIN.NAME  SASL SSF: 56  SASL data security layer installed.  ...  <regular output>  

if I do ldapsearch -o ldif-wrap=no -b cn=<omitted>,cn=groups,dc=lan,dc=<ommited>,dc=de "(cn=<omitted>.nextcloud.users)"|grep -v SASL it doesn't disappear.

If append 2> /dev/null it doesn't help either.

This is annoying I am looking for some way to not show this SASL output when I do ldapsearch queries. The ldapsearch command ist executed against a samba4-LDAP

Return status code and body in curl

Posted: 22 Oct 2021 10:54 AM PDT

Is it possible to use curl to call a REST service (POST method) and get:

  • The HTTP status code.
  • The response body.

Other information like headers, methods, etc. are not relevant for my use case and actually add to the confusion when testing.

For example, I'm doing:

$ curl -i -H 'Content-Type: application/json' -d @payload.json localhost:8080/apply  HTTP/1.1 100     HTTP/1.1 400   Content-Type: text/plain;charset=UTF-8  Content-Length: 42  Date: Fri, 22 Oct 2021 16:29:18 GMT  Connection: close    Invalid product: product does not exist  

I know the service is returning 400 that I can see, and also the response error Invalid product: product does not exist that I can also see, so that's good.

However, is it possible to get rid of the rest of the display?

Preventing terminal output race of a Bash' sub process by `>( )` and its following command

Posted: 22 Oct 2021 09:55 AM PDT

How do we prevent terminal output race between a Bash' sub process by >( ) and command following it when this sub processing a large number of lines so most of its output lag behind the output of the following Bash command ?

How can I switch (local) virtual desktops from a VNC fullscreen session?

Posted: 22 Oct 2021 08:53 AM PDT

My goal is to have my local PC apps on desktop 1 and a full-screen VNC remote session on desktop 2. I'm using KDE5 on both, with Ctrl-F1/F2 mapped to the desktops. OS is Tumbleweed if that matters.

I would like the benefits of full-screen, namely Alt-Tab handling, but I would like to keep Ctrl-F1 local. In searching, I'm finding a lot of discussion related to sending keystrokes to the remote server but nothing about keeping keystrokes local to the client.

The documentation mentions the −FullscreenSystemKeys flag, but this seems to be the default. Oddly, I tried running vncviewer with -FullscreenSystemKeys, -FullscreenSystemKeys=0, and even -FullscreenSystemKeys=1. Oddly, they all have the same behavior, which is that Alt-Tab and Ctrl-Fx both get ignored by the local machine and sent through to the remote server.

How can I keep Ctrl-F1/F2 local?

Howto hook a Guest to a `tun` Interface

Posted: 22 Oct 2021 08:30 AM PDT

I'm trying to force all traffic from a guest (Windows or Linux) to go through the VPN of the host (Linux). To make sure that a guest has no access to the internet outside the VPN, I establish the connection on the host system, which creates a new interface tun0. The VPN tunnel works fine on the host.

Setting up br0, without VPN

To get internet without VPN in the guest, I create a bridge device br0 and attach enp7s0 to it. This way, internet works in the guest.

ip link add name br0 type bridge  ip link set br0 up  ip link set enp7s0 master br0  

On the host, a vnet5 device has been added and bridged to br0. But at the same time, pinging from the host to a remote does not work anymore.

## On the Host  sudo ip a  # ...  # 14: vnet5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br0 state UNKNOWN group default qlen 1000  # link/ether ab:ab:ab:ab:ab:ab brd ff:ff:ff:ff:ff:ff  # inet6 fe80::fc54:ff:fe92:5aa9/64 scope link  # valid_lft forever preferred_lft forever  ping www.google.com  # ping: www.google.com: Temporary failure in name resolution  ping 8.8.8.8  # From 192.168.1.100 icmp_seq=1 Destination Host Unreachable  

Then I start the VM with virt-manager and check the connection. The guest has internet:

## On the Guest  ip a  # 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000  # ...  # 2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000  #     link/ether 52:54:00:92:5a:a9 brd ff:ff:ff:ff:ff:ff  #     inet 192.168.1.221/24 brd 192.168.1.255 scope global dynamic noprefixroute enp1s0  #        valid_lft 67432sec preferred_lft 67432sec  ping www.google.ch  # PING www.google.ch (172.217.168.35) 56(84) bytes of data.  # 64 bytes from zrh04s14-in-f3.1e100.net (172.217.168.35): icmp_seq=1 ttl=117 time=2.47 ms  

I guess instead of setting ip link set enp7s0 master br0 I could also create routing rules between br0 and enp7s0.

With VPN and the tun0 Interface

When I establish a VPN connection, a tun0 interface is created that can not be assigned to a bridge. Hence, I would need to create routing rules anyway. So I guess the situation is similar to the above case. First, I remove enp7s0 again from br0.

ip link set enp7s0 nomaster  sudo openvpn my_vpn_tcp.ovpn  # ...  # Initialization Sequence Completed  sudo ip a  # ...  # 3: enp7s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000  # link/ether ab:ab:ab:ab:ab:ab brd ff:ff:ff:ff:ff:ff permaddr ab:ab:ab:ab:ab:ab  # inet 192.168.1.100/24 brd 192.168.1.255 scope global dynamic noprefixroute enp7s0  # valid_lft 82702sec preferred_lft 82702sec  # ...  # 10: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 500  # link/none  # inet 10.7.7.5/24 scope global tun0  # valid_lft forever preferred_lft forever  # ...  # 12: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000  # link/ether 72:eb:06:e5:1e:5a brd ff:ff:ff:ff:ff:ff  # inet6 fe80::70eb:6ff:fee5:1e5a/64 scope link  # valid_lft forever preferred_lft forever  

Without further do, the VPN connection is used on the host, which is OK.

ping www.google.com  # PING www.google.com (172.217.168.3) 56(84) bytes of data.  # 64 bytes from lala.net (172.217.168.3): icmp_seq=1 ttl=117 time=9.64 ms  # ...  ping www.google.com -I tun0  # PING www.google.com (172.217.168.3) from 10.7.7.5 tun0: 56(84) bytes of data.  # 64 bytes from lala.net (172.217.168.3): icmp_seq=2 ttl=117 time=10.0 ms  # ...  ping www.google.com -I enp7s0  # PING www.google.com (172.217.168.3) from 192.168.1.100 enp7s0: 56(84) bytes of data.  # 64 bytes from lala.net (172.217.168.3): icmp_seq=1 ttl=115 time=4.59 ms  # ...  

But as already said, I can't add tun0 to br0. And because of that, also the guest has no internet.

sudo ip link set tun0 master br0  # RTNETLINK answers: Invalid argument  

I searched for solutions but could not found something that works out or my case is slightly different, that would require more insight into networking that I don't have. E.g. this (which did not do the job) or this (that does not exactly fit my case).

Awk command to replace a substring with a specific value

Posted: 22 Oct 2021 09:22 AM PDT

I have a flat file which has a phone number in field starting at position 314 till 323. Now I wanted to dummy out that field with 1234567890.

For this I tried using the below commands and both are throwing error:

awk '{var=substr($0,314,10);gsub("[0-9]","1234567890",$var); print}' final_phone.txt >final_phone.txt1  

fatal: grow_fields_arr: fields_arr: can't allocate 9849885432 bytes of memory (Cannot allocate memory)

In second case

awk 'var=substr($0,314,10) { var = "1234567890" }1' final_phone.txt >final_phone.txt1  

This worked but the values didn't change. The output remained the same.

Can someone help me with the syntax here?

In the first case I tried to assign the substring to a variable and in gsub() I wanted to check for numbers pattern and substitute with 1234567890.

can someone help me with this

Kernel panic while install OpenBSD

Posted: 22 Oct 2021 10:25 AM PDT

Kernel panic while install OpenBSD.


I tried installing the system but this is the error message that I have got:

Kernel panic.

Steps I tried:

  1. Reinstalling on the same ISO file.
  2. I have tried by reinstalling the ISO file and see if that fix the issue.

Thanks Jonathan Steadman.

The helpful guide I followed: https://www.openbsdhandbook.com/installation/

Why a Bash script still outputs to stdout even I redirect it to stderr?

Posted: 22 Oct 2021 08:39 AM PDT

I have a Bash script:

#!/bin/bash  echo this should be visible only in the stderr output but it is not 1>&2  exit 0  

Also, I have a custom app that starts this script. The app captures both - stdout and stderr. The stdout is empty and the stderr contains the text provided. So far, so good. But when I start the script from the console (physical terminal):

./my_script.sh  

I expect it to not print anything on the display, but it prints. I tried various combinations of redirecting, e.g., >&2, >/dev/stderr, etc. but results are the same. I also tried to redirect stdout to null 1>&2 >/dev/null, but obviously it also sends my text to the null.

Where is this configured? How can I make my terminal to not display stderr?

Diff between command > and command 1> ,>> [duplicate]

Posted: 22 Oct 2021 10:01 AM PDT

I am little bit confused about redirections in linux.

  1. command > file

  2. command 1> file

  3. command >> file.out 2>> file.err (this is working as expected)

  4. commmand 1>>file.out 2>>file.err (if command is successful , we get output log of command in file.err instead of in file.out

some guys said > and 1> are same but when used with commands not getting proper output.

for example ,

pg_dump -d postgres -t schemaname.table -v -f table.sql >>table.out 2>>table.err

if I execute above command , if command is successful , it should log the logs to table.log and not in table.err . table.err we get logs only in case pg_dump status exit 1.

My expectation is we get log in table.out when pg_dump executed without any error while dumping tables. and we should get logs in table.err when pg_dump status is exit 1 or it's failed to dump tables.

Thanks!

Are there Linux distributions designed for the 'mobile computing' use case in 2021?

Posted: 22 Oct 2021 09:21 AM PDT

In 2021 are there any linux distributions that succeed at delivering the basics of a 'mobile computing' use case for aftermarket installation on a laptop.

I consider a minimum 'mobile computing' baseline for reference is...

  • a laptop linux build with battery life equivalent to its preinstalled Windows build,
  • working wifi and bluetooth
  • closing the lid goes into hybrid sleep

There seem to be plenty of distros which will get laptops to boot and run off mains power, but every distro+hardware combination I have ever encountered has problems such as...

  • the device dies after 25% of its manufacturer stated battery life because some hardware is misconfigured by default, and it's not a focus of the distro to address this
  • closing the lid suspends but doesn't go into low power or hibernate leading to the loss of data within hours, and the distro doesn't support hibernation without extensive work
  • no power management is installed by default, and the distro doesn't have a 'canonical' way of configuring this
  • some component is actually impossible to configure for low power because of proprietary driver issues, and the distro doesn't have up to date information of devices or components which it CAN properly manage for mobile usage to guide installers

These are indications that those distros do not target 'mobile computing'. This makes a typical linux laptop radically worse than an equivalent MacBook in my experience.

I want to identify a distro which targets the 'mobile computing' case, and which is therefore likely to work out of the box without months of effort and likely failure.

I have no experience of the preinstalled Linux market, I don't know what level of mobile-computing support is reliable by default in any of those vendors' distro builds, and I can't realistically afford the 'Developer edition' price tags for preinstalled linux models, so I am looking for an distro that can be installed aftermarket.

Are there any examples of distro builds which fulfil the listed requirements?

BACKGROUND

In recent years I have relied on Chromebooks which have a linux kernel pre-configured correctly for their target hardware, and which will normally run for 10 hours straight. These fulfil the criteria on paper. They can run XWindows and linux apps via containerised crostini.

Unfortunately crostini is not really maintained and is currently unstable on my personal development machine, meaning it routinely experiences hard shutdowns when running or during sleep/hibernation, losing state.

Because of the composition of the closed ChromeOS ecosystem, there's no chance of uncovering or fixing those issues. I would like to find a FOSS alternative that meets the criteria of 'mobile computing'.

Delete sub-directories based on matching information from column

Posted: 22 Oct 2021 08:56 AM PDT

I want to keep only those sub-directories that are present in the corresponding directory from CSV file. The file structure looks something like this:

100_folder/  ├── folder_11  ├── folder_25  ├── folder_31  └── folder_41  210_folder/  ├── folder_13  ├── folder_23  ├── folder_31  └── folder_42  

Information in CSV:

Col6,Col26  100,folder_11  100,folder_13  100,folder_41  210,folder_31  210,folder_42  

Based on the information from the columns, I want to remove the sub-directories that are not present in CSV file.

Here is how I read the file:

eCollection=( $(cut -d ',' -f6,26 file.csv ) )  echo "${eCollection[@]}"  

X11 connection rejected because of wrong authentication

Posted: 22 Oct 2021 11:27 AM PDT

First of all what I want to do:

I want to login to a server via ssh. Then change change the user via sudo su user and start some application on my screen.

Some collegues do it by

su user  export DISPLAY=<IP>:0    

an it works.


I connect to a server via ssh -X user@server. Then I start a X11 application. This works fine (although there are warnings).

Warnings:

libEGL warning: DRI3: failed to query the version  libEGL warning: DRI2: failed to authenticate  qt.qpa.xcb: QXcbConnection: XCB error: 1 (BadRequest), sequence: 414, resource id: 1897, major code: 155 (Unknown), minor code: 1  

If I run sudo su (or sudo su user) and start the program or run it via sudo myprogram there is an error.

Error:

X11 connection rejected because of wrong authentication.  qt.qpa.xcb: could not connect to display localhost:11.0  qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.      This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.    Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.    Aborted  

I found some articles about this problem.

X11 forwarding fails when switching users

ssh connection. X11 connection rejected because of wrong authentication


So extend the /etc/pam.d/su file and the /etc/pam/sudo file by

session  optional  pam_xauth.so   

And later I changed /etc/ssh/sshd_config by adding:

X11Forwarding yes  

and restarting the sshd by systemctl restart ssh.service. ssh -T says x11forwarding yes

But nothing changed.

Does anybody know what to do? Its important to check some changes on the users program configurations after making changes.

Installing zsh from source file without root user access

Posted: 22 Oct 2021 11:38 AM PDT

I clone the source of zsh source file from github, after that I ran the command

bash install-sh  

and

./install  

It prompt to me that

No input file specified .

Then follow the instructions I tried

make install  

No luck I got

*** No rule to make target 'install'. Stop.

Can anyone give me some Hints or Instructions?

How to configure the path to my Linux installation in GRUB (currently doing it manually at each boot)?

Posted: 22 Oct 2021 08:44 AM PDT

So I have a laptop and I'm trying to get rid of my windows os and install kali linux.

Now I have done that but the problem is every time I turn on the computer it doesn't automatically go into the desktop environment it goes to the grub menu. Now I figured out the problem. The Problem is that it doesn't understand where to boot the instance from and I can go into the desktop by typing thisenter image description here

Now the problem I'm having is this doesn't fix the whole problem every time I reboot my computer to get to the desktop I have to type all this again. I reinstalled grub but did not help.I also noticed that when I do sudo efibootmg there is a windows boot manager an Ubuntu one too but no kali. What can I do so it automatically sends me to the desktop when I turn on the computer?

Why is the Wi-Fi in Ubuntu 21.04 so painfully slow?

Posted: 22 Oct 2021 09:51 AM PDT

I had been using Ubuntu 21.04 for a while, and all of a sudden the wifi is slow (download rate is not more than ~7000 B/s). My internet is pretty fast and gives around 50Mbps.

A few days back, I got myself with ransomware on Windows. I had to reset Windows. After resetting Windows, Ubuntu started to behave sluggishly. I reinstalled Ubuntu 21.04 twice using a bootable stick. The safe boot in Windows seems to block my wifi adapter, so I disabled it. Then I had the issue rising again yesterday and today. I disabled the power management, but the issue is still there.. I can't even do an update!

My laptop runs Ubuntu on Dual boot alongside Windows 10.

Laptop Details

output of iplink

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000      link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00  2: wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DORMANT group default qlen 1000      link/ether 5c:3a:45:12:ad:7f brd ff:ff:ff:ff:ff:ff      $ lshw -c network    *-network                          description: Wireless interface         product: QCA6174 802.11ac Wireless Network Adapter         vendor: Qualcomm Atheros         physical id: 0         bus info: pci@0000:02:00.0         logical name: wlp2s0         version: 32         serial: 5c:3a:45:12:ad:7f         width: 64 bits         clock: 33MHz         capabilities: bus_master cap_list ethernet physical wireless         configuration: broadcast=yes driver=ath10k_pci driverversion=5.11.0-16-generic firmware=WLAN.RM.4.4.1-00157-QCARMSWPZ-1 ip=192.168.1.9 latency=0 link=yes multicast=yes wireless=IEEE 802.11         resources: irq:139 memory:93000000-931fffff    $ iwconfig  lo        no wireless extensions.    wlp2s0    IEEE 802.11  ESSID:"Home (2)"              Mode:Managed  Frequency:2.462 GHz  Access Point: 14:A7:2B:62:3B:DE               Bit Rate=144.4 Mb/s   Tx-Power=20 dBm               Retry short limit:7   RTS thr:off   Fragment thr:off            Power Management:off            Link Quality=70/70  Signal level=-37 dBm              Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0            Tx excessive retries:0  Invalid misc:5   Missed beacon:0    $ speedtest-cli    Testing download speed................................................................................  Download: 0.42 Mbit/s  Testing upload speed......................................................................................................  Upload: 5.75 Mbit/s  

Does anyone have any suggestions on how I can make Wi-Fi in Ubuntu 21.04 faster?

How to add Pycharm Community Edition to path

Posted: 22 Oct 2021 09:04 AM PDT

I want to add Pycharm to my path so that I may launch it from the command line from any directory in the same way that atom can launch from terminal if I type atom.

I have already tried charm, pycharm-community, and believe instead I need to add this to my path?

Also, how would I do this for other programs in general as well.

Thanks for any help!

Centos 7 and Windows 10 Dual Boot Grub Not Saving Last Choice

Posted: 22 Oct 2021 10:03 AM PDT

I have a dual boot system with CentOS 7 and Win10. My install was totally vanilla (CentOS then Win10) and went fine. Everything is great except that grub does not appear to save my "last" choice from the boot load menu.

I dug through all the grub configuration files (e.g. /boot/efi/EFI/centos/grub.cfg) and all the code seems there for recording the last choice.

My /etc/default/grub shows:

GRUB_TIMEOUT=5  ...  GRUB_DEFAULT=saved  ...  GRUB_SAVEDEFAULT=true  

Is there anything obvious I am missing or need to do to enable this?

My /etc/efi/EFI/centos/grubenv never apperas to record the latest selection. It always has:

saved_entry=CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)  ##########[...snip...padding to 1k]  

I can't see this file from a Windows boot, but I did test via the "rescue Centos entry".

I manually set the value in grubenv to Windows Boot Manager (on /dev/sda2) (the Windows entry) and this works out okay. However, booting back into CentOS fails to change it.

It just seems I am missing something to enable this "save the last choice" behavior. Any ideas?

Can Symbolic Links span different file systems in Unix or Linux

Posted: 22 Oct 2021 11:02 AM PDT

Can Symbolic Links span different file systems in Unix or Linux ??? I.e consider different file systems like ext2 and ext3 can symbolic link span them?

Apache not reading changes to PHP files

Posted: 22 Oct 2021 10:10 AM PDT

I'm developing on a CentOS6 server with Apache and PHP. When I make a change to a PHP file (and save) it appears that apache is not reading the changed file - it's still processing my old .php file. After 5-10 minutes it will start to use the new file.

Can someone tell me how to force Apache to immediately pickup the changed .php files?


UPDATE: I moved the files onto the apache server and the problem remains (this is not an NFS issue). So it seems that Apache is just not reading in the changed files for several minutes Confused...

Cannot prompt user using rm bultin prompt option -i with xargs and find

Posted: 22 Oct 2021 11:26 AM PDT

I am using xargs and rm with find in order to remove files that follow a specific pattern defined by find as follows.

touch file  find . -name file | xargs rm  

Everything works fine with the above code, but if I enter the -i option to rm, then executing:

touch file  find . -name file | xargs rm -i  

prints:

rm: remove regular empty file './file7'? user@host:$

without letting me enter y or n ? Thus the file is not removed.

What's the problem in here ?

I also am aware of -p parameter of xargs which works but it is more general. That is, it prompts user to execute the specific command, which is not user-friendly.

EDIT: While using it in a shell script, I've found out that it executes the command I want but it also prints find's result. Something that it is not preferable.

Also when I pass the ls file2 command to cmd variable, it does not specifically print the file2's specs. Same thing happens when I type rm -i file2 . It prompts me to delete every single file in the directory.

This is my script:

#!/bin/bash  touch file{1..9}      # Create 9 files named file1,file2...file9  echo -n 'command: '  # Prompt user  read -e cmd             # read command  find . -exec ${cmd} '{}' +    

The only solution I can think of, is to prompt the user separately for his preferred pattern. Then store that pattern to a variable and pass it as an argument to find command's -name option.

Something like this:

#!/bin/bash  touch file{1..9}     # Create 9 files named file1,file2...file9  echo -n 'command: '  # Prompt user for command  read -e cmd          # read command  echo -n 'pattern: '  # Prompt user for pattern  read -e pattern  find . -name "$pattern" -exec ${cmd} '{}' +    

But even with this solution, find's output is still printed and if the pattern field is left empty (i.e the user just does not want to use a pattern) then problems occur.

Any Ideas ?

Why does Firefox refuse to die despite killing it with pkill -9?

Posted: 22 Oct 2021 10:23 AM PDT

I am issuing the following command to kill Firefox on my Red Hat Linux box:

[subhrcho@slc04lyo ~]$ pkill -9 -f firefox  [subhrcho@slc04lyo ~]$   

However, when I try to invoke Firefox through Applications -> Internet -> Firefox, it says:

Firefox is already running, but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system.

How do I delete a file whose name begins with "-" (hyphen a.k.a. dash or minus)?

Posted: 22 Oct 2021 10:16 AM PDT

How do you remove a file whose filename begins with a dash (hyphen or minus) -? I'm ssh'd into a remote OSX server and I have this file in my directory:

tohru:~ $ ls -l  total 8  -rw-r--r--    1 me  staff  1352 Aug 18 14:33 --help  ...  

How in the world can I delete --help from a CLI? This issue is something that I come across in different forms on occasion, these files are easy to create, but hard to get rid of.

I have tried using backslash

rm \-\-help  

I have tried quotes

rm "--help"  

How do I prevent the minus (dash or hyphen) character to be interpreted as an option?

No comments:

Post a Comment