Saturday, June 25, 2022

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


Korn shell (ksh) omits closing quote when displaying aliases

Posted: 25 Jun 2022 01:21 PM PDT

When displaying aliases in Korn shell (ksh) the closing quote is omitted. This happens with both predefined and user-defined aliases:

>> alias type r l ltr  type='whence -v  r='hist -s  l='pwd; ls  ltr='ls -ltrT  

Bourne shell (sh) and Bash do show the expected closing quote:

>> alias l ltr  l='pwd; ls'  ltr='ls -ltrT'  

Here's what the alias definitions in my ~/.kshrc look like. It doesn't seem to matter whether single quotes or double quotes are used:

alias l='pwd; ls'  alias ll="ls -l"  alias ltr="ls -ltrT"  

I am running /bin/ksh in MacOS Monterey, Version 12.4 (The same problem appears in earlier versions of MacOS such as Catalina.)

Why does this happen? Is this a known bug? Is there away to correct it?

Thanks!

Why to use udev rule to insure persistent naming/permission instead of mknod?

Posted: 25 Jun 2022 02:00 PM PDT

I have seen some configurations using udev rule to insure the disk name and permissions in the disk. But recently I've find out a command called mknod, where it works like an alias to the block device, by specify the major:minor of the disk, we can "create an alias", something like it:

[root@dbnode1 disks]# lsblk  NAME                MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT  sdd                   8:48   0  160M  0 disk    mknod /disks/QUORUML b 8 48  

Now I'd like to know why to use udev rules instead of mknod, since mknod is very simple to use. My main point is insure persistent naming and permission.

Start docker when log into account and not on boot

Posted: 25 Jun 2022 12:53 PM PDT

I am using systemd-homed with LUKS for managing my home directory (/home/myuser. I also have some docker containers which try to start on boot. The issue is that they have a volume which points to a directory on my home directory, and since the home directory is not mounted at that point, it creates those directories with root permissions.

When I try to log into my user, it can't mount the user directory because there are already some files there.

I would like to know how to make docker start the containers when I log into the user, and not when I boot the PC.

Stuck during login on server - conda related?

Posted: 25 Jun 2022 12:47 PM PDT

When I am login to my server, the terminal halts and I have to hit CTRL+C to continue and entering the server. After hitting CTRL+C I get a lot of warnings (?) related to condo I believe. Any idea why it is stuck during login, and what the errors mean?

username@server.no's password:   Welcome to Ubuntu 18.04.6 LTS (GNU/Linux 5.4.0-120-generic x86_64)  Last login: Sat Jun 25 21:37:39 2022 from xxxxxxxxxx  

Then these lines appear after hitting CTRL+C:

^CTraceback (most recent call last):    File "/home/local/username/anaconda3/bin/conda", line 13, in <module>      sys.exit(main())    File "/home/local/username/anaconda3/lib/python3.8/site-packages/conda/cli/main.py", line 142, in main      from ..activate import main as activator_main    File "/home/local/username/anaconda3/lib/python3.8/site-packages/conda/activate.py", line 19, in <module>      from ._vendor.toolz import concatv, drop    File "/home/local/username/anaconda3/lib/python3.8/site-packages/conda/_vendor/toolz/__init__.py", line 28, in <module>      from cytoolz import __version__ as cytoolz_version    File "/home/local/username/anaconda3/lib/python3.8/site-packages/cytoolz/__init__.py", line 1, in <module>      from .itertoolz import *    File "cytoolz/itertoolz.pyx", line 19, in init cytoolz.itertoolz    File "cytoolz/utils.pyx", line 10, in init cytoolz.utils    File "/home/local/username/anaconda3/lib/python3.8/site-packages/toolz/__init__.py", line 18, in <module>      from . import curried, sandbox    File "/home/local/username/anaconda3/lib/python3.8/site-packages/toolz/curried/__init__.py", line 27, in <module>      from . import operator    File "/home/local/username/anaconda3/lib/python3.8/site-packages/toolz/curried/operator.py", line 14, in <module>      {name: curry(f) if should_curry(f) else f    File "/home/local/username/anaconda3/lib/python3.8/site-packages/toolz/curried/operator.py", line 14, in <dictcomp>      {name: curry(f) if should_curry(f) else f    File "/home/local/username/anaconda3/lib/python3.8/site-packages/toolz/curried/operator.py", line 10, in should_curry      return num is None or num > 1 or num == 1 and has_keywords(f) is not False    File "/home/local/username/anaconda3/lib/python3.8/site-packages/toolz/functoolz.py", line 899, in has_keywords      sigspec, rv = _check_sigspec(sigspec, func, _sigs._has_keywords, func)    File "/home/local/username/anaconda3/lib/python3.8/site-packages/toolz/functoolz.py", line 832, in _check_sigspec      sigspec = inspect.signature(func)    File "/home/local/username/anaconda3/lib/python3.8/inspect.py", line 3093, in signature      return Signature.from_callable(obj, follow_wrapped=follow_wrapped)    File "/home/local/username/anaconda3/lib/python3.8/inspect.py", line 2842, in from_callable      return _signature_from_callable(obj, sigcls=cls,    File "/home/local/username/anaconda3/lib/python3.8/inspect.py", line 2296, in _signature_from_callable      return _signature_from_builtin(sigcls, obj,    File "/home/local/username/anaconda3/lib/python3.8/inspect.py", line 2109, in _signature_from_builtin  mh-ikom01:~$     return _signature_fromstr(cls, func, s, skip_bound_arg)    File "/home/local/username/anaconda3/lib/python3.8/inspect.py", line 1969, in _signature_fromstr      _signature_strip_non_python_syntax(s)    File "/home/local/username/anaconda3/lib/python3.8/inspect.py", line 1922, in _signature_strip_non_python_syntax      for t in token_stream:    File "/home/local/username/anaconda3/lib/python3.8/tokenize.py", line 525, in _tokenize      pseudomatch = _compile(PseudoToken).match(line, pos)  KeyboardInterrupt  ^C  

bash looping over files while tailing logs

Posted: 25 Jun 2022 02:17 PM PDT

I'm running a daemon that process files in a specific dir. I want to process those one by one. so idea is I will copy files 1 by 1 in daemon dir, and tail its log, 2nd file should be copied to daemon dir when log file finishes processing first, i.e, log file stops updating.

how can I achieve that? say

daemon_dir=/var/daemon_dir/  daemon_log_file=/var/daemon/daemon_log  

and I have 5 files to process i.e, file{1..5}

# ls -1  file1  file2  file3  file4  file5  

so my loop should go as is.

for file in file{1..5}  do    cp ${file} ${daemon_dir}    # daemon sees new file arriving in its dir, & starts processing    # log is tailed    tail -f ${daemon_log_file}    # when log file stops updating say for 1minute or specified time, tail quits  done  

and loop starts with next file.

Centos 7 to Automatically connect to a Bluetooth device when it's available

Posted: 25 Jun 2022 12:07 PM PDT

I need to connect Zebra ring scanners to Cent OS boxes. With Bluetoothctl I am able to connect to one with a specific BT address, however our users in the workhouse are using an application which launches right after the system boots up and have no access to any shell whatsoever. My question would be is there a way to make Bluetoothctl scan for specific Bluetooth devices and automatically connect to them when it finds one it trusts. Example scenario would be 2 scanners/pc, if ones battery dies it connects to the other one or if the system reboots it would start to scan for the dedicated devices in the backround and connect to them right away as one is available. Thanks for any reply in advance!

cant install a leafpad and gedit in kalilinux using sudo apt get install.......can you please guide me?

Posted: 25 Jun 2022 11:17 AM PDT

run apt-get update  Command 'run' not found, did you mean:    command 'runc' from deb runc    command 'srun' from deb slurm-client    command 'zrun' from deb moreutils    command 'zun' from deb python3-zunclient    command 'runq' from deb exim4-daemon-heavy    command 'runq' from deb exim4-daemon-light    command 'rup' from deb rstat-client    command 'crun' from deb crun    command 'grun' from deb grun  Try: sudo apt install <deb name>                                                                                 ┌──(kali㉿kali)-[~]  └─$ sudo apt install <gedit>    zsh: parse error near `\n'  

Reset system loop after installing any debian based distro

Posted: 25 Jun 2022 10:30 AM PDT

I am trying to install Linux (Ubuntu).

The installation process is fine.

At the very end when it asks to restart computer, I restart my laptop and the message Please remove installation medium, then press ENTER shows up, so I remove my USB and press enter.

The computer restarts then a message saying Reset System shows up and the computer restarts again and the message shows up again, and so on for ever.

Does anyone know how to fix this?

I have now tried with many Debian based distros and always get the same issue.

Get tty device paths for zte MF710M modem

Posted: 25 Jun 2022 10:46 AM PDT

i am trying to get the device paths for my modem zte MF710M using this script

#get all connected devices  usb-devices  T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 21 Spd=480 MxCh= 0  D:  Ver= 2.00 Cls=02(commc) Sub=00 Prot=00 MxPS=64 #Cfgs=  1  P:  Vendor=19d2 ProdID=1405 Rev=f0.09  S:  Manufacturer=ZTE,Incorporated  S:  Product=ZTE Mobile Broadband Station  S:  SerialNumber=1234567890ABCDEF  C:  #Ifs= 3 Cfg#= 1 Atr=c0 MxPwr=500mA  I:  If#=0x0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=06 Prot=00 Driver=cdc_ether  I:  If#=0x1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether  I:  If#=0x2 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage      #function to get the dev path using the product id and the version id  vidpid_to_devs(){          find $(grep -l "PRODUCT=$(printf "%x/%x" "0x${1%:*}" "0x${1#*:}")" \                    /sys/bus/usb/devices/[0-9]*:*/uevent | sed 's,uevent$,,') \             /dev/null -name dev -o -name dev_id |          sed 's,[^/]*$,uevent,' |          xargs sed -n -e s,DEVNAME=,/dev/,p -e s,INTERFACE=,,p  }    #this should return all the tty paths for the modem  vidpid_to_devs 19d2:1405    #the output i got  usb0  /dev/sg1  /dev/sr0  /dev/bsg/2:0:0:0  /dev/sg2  /dev/sdb  /dev/bsg/2:0:0:1  

i tried using usb0 but i got this error [Error: Error: No such file or directory, cannot open usb0]

also, locate usb0 returns nothing

i also realized it's a "usb to ethernet stack". is there any way configure a serial port for that?

Permanently remap caps lock to escape

Posted: 25 Jun 2022 02:00 PM PDT

I am trying to remap caps lock to escape on the keyboard. I tried the following solution found on AskUbuntu without success:

$ xmodmap -e "keycode 9 = Caps_Lock NoSymbol Caps_Lock"  $ xmodmap -e "keycode 66 = Escape NoSymbol Escape"  $ setxkbmap -option caps:swapescape  

what shall I do?

Arch, Gnome - how to change the default terminal?

Posted: 25 Jun 2022 02:04 PM PDT

I want to change my default terminal emulator, that is, the terminal that opens when I Right Click -> Open in terminal

So far, I've tried:

  • sudo update-alternatives --config x-terminal-emulator
  • sudo update-alternatives --config $TERM ($TERM is equal to xterm-256color)
  • changing the TERM variable in ~/.bashrc
  • chaning the default terminal in GNOME settings - however, there was no option to choose a default terminal emulator, only for the default browser, media player, etc

How to make grep for a regex that appear multiple times in a line

Posted: 25 Jun 2022 10:37 AM PDT

I want to grep a regex. The pattern I am searching for may appear multiple times in a line. If the pattern appeared many times, I want to separate each occurrence by a comma and print the match only not the full line in a new file. If it did not appear in a line I want to print n.a.

Example. I want to use this regex to find numbers in the pattern: [12.123.1.3].

grep -oh "\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]" 'filename'  

input file (input.txt)

blabla [11.335.2.33] xyuoeretrete [43.22.11.88] jfdfjkfbs [55.66.77.88]  blabla [66.223.44.33]  foo bar  blabla [1.2.33.3] xyuoeretrete [42] bla[1.32.2.4]  

intended result in a new file (output.csv):

11.335.2.33,43.22.11.88,55.66.77.88  66.223.44.33  n.a.  1.2.33.3,1.32.2.4  

Note: I use Ubuntu

awk/sed find indexes of the first and the last capital letter in a string

Posted: 25 Jun 2022 11:24 AM PDT

I have several kinds of strings like this:

the example string1

--AbbbAnde---  

the example string2

abksjiRNNBBKUGFLYFYLF  

the example string3

-ankNUGUYUBUIGCafrg--  

the example string4

BNKJUGFVULNK-Kew---  

PS: there are no strings having only one capital letter.

I want to find indexes of the first and the last capital letter from the string which looks like the above examples by awk, sed, or other bash programs, because I have thousands of files, and Python would be time-consuming. the index of the first capital letter should be the count from the start to the end (left to the right). while the index of the last capital letter should be the count for the end to the start (right to the left).

for example,

for the example string1, the first capital letter is A, and the index is 3 from the left to the right (start to end). the last capital letter is A, and the index is 7 from the end to the beginning.

for the example string2, the first capital letter is R, and the index is 7 from the left to the right (start to end). the last capital letter is F, and the index is 1 from the end to the beginning.

for the example string3, the first capital letter is N, and the index is 5 from the left to the right (start to end). the last capital letter is C, and the index is 7 from the end to the beginning.

for the example string4, the first capital letter is B, and the index is 1 from the left to the right (start to end). the last capital letter is K, and the index is 6 from the end to the beginning.

Thanks for your help.

Print occurence count of "keys" and sum of the associated "values" in 3-column data file

Posted: 25 Jun 2022 10:30 AM PDT

I'm reading a Redis dump file using shell.

There are 3 main columns in the dump file as below.

Text:tags:name    682651    520  Text:tags:age     78262     450  Value:cache       77272     672  Value:cache:name  76258     872  New:specific      77628     762  New:test          76628     8622  

Expected output:

Key     Count     Sum  Text:*  2         970  Value:* 2         1544  New:*   2         9384  

Looking to get the expected above as columns can be checked based on substrings may be staring/middle/ending with strings (keys).

Add Archlinux Mirrorlist in Manjaro

Posted: 25 Jun 2022 12:55 PM PDT

Manjaro does not install the latest packages from aur or arch repos. But i want to install the latest available packages in arch repos and aur in manjaro.

I then looked into the file \etc\pacman.d\mirrorlist the mirrorlist is not same. How can i add the archlinux mirrorlist to manjaro

Enable Mod Expires on Apache

Posted: 25 Jun 2022 11:07 AM PDT

I'd like to enable mod_expires on my server.

I'm using Ubuntu and Apache.

When I try to check if the module is enabled :

********:/etc/apache2$ sudo a2enmod expires  Module expires already enabled  

My apache2.conf :

<IfModule mod_expires.c>    ExpiresActive on    ExpiresByType application/javascript "access plus 2 days"    ExpiresByType image/jpg "access plus 1 month"    ExpiresByType image/jpeg "access plus 1 month"    ExpiresByType image/gif "access plus 1 month"    ExpiresByType image/png "access plus 1 month"    ExpiresByType text/css "access plus 2 days"  </IfModule>  

I have restarted apache with the command systemctl restart apache2 but when I try to check if my website have the caching it seem's that I don't have something...

The website that I'm using to ckeck is : https://www.giftofspeed.com/cache-checker/

Do you have any idea of the issue ?

Stuck trying to upgrade from Ubuntu 18.04 to 20.04 'multiverse' (component misspelt in sources.list?)

Posted: 25 Jun 2022 01:04 PM PDT

When I tried to upgrade from Ubuntu 18.04 to Ubuntu 20.04 I I got stuck. While upgrading, it shows: 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

W: Skipping acquire of configured file 'multiverse/binary-amd64/Packages' as repository 'http://archive.canonical.com/ubuntu bionic InRelease' doesn't have the component 'multiverse' (component misspelt in sources.list?)  W: Skipping acquire of configured file 'multiverse/i18n/Translation-en_IN' as repository 'http://archive.canonical.com/ubuntu bionic InRelease' doesn't have the component 'multiverse' (component misspelt in sources.list?)  W: Skipping acquire of configured file 'multiverse/i18n/Translation-en_GB' as repository 'http://archive.canonical.com/ubuntu bionic InRelease' doesn't have the component 'multiverse' (component misspelt in sources.list?)  W: Skipping acquire of configured file 'multiverse/i18n/Translation-en' as repository 'http://archive.canonical.com/ubuntu bionic InRelease' doesn't have the component 'multiverse' (component misspelt in sources.list?)  W: Skipping acquire of configured file 'multiverse/dep11/Components-amd64.yml' as repository 'http://archive.canonical.com/ubuntu bionic InRelease' doesn't have the component 'multiverse' (component misspelt in sources.list?)  W: Skipping acquire of configured file 'multiverse/dep11/icons-48x48.tar' as repository 'http://archive.canonical.com/ubuntu bionic InRelease' doesn't have the component 'multiverse' (component misspelt in sources.list?)  W: Skipping acquire of configured file 'multiverse/dep11/icons-64x64.tar' as repository 'http://archive.canonical.com/ubuntu bionic InRelease' doesn't have the component 'multiverse' (component misspelt in sources.list?)  W: Skipping acquire of configured file 'multiverse/cnf/Commands-amd64' as repository 'http://archive.canonical.com/ubuntu bionic InRelease' doesn't have the component 'multiverse' (component misspelt in sources.list?)  

I tried sudo nano /etc/apt/sources.list, and it says the same line already exists in sources.list.

deb http://archive.canonical.com/ubuntu bionic partner  

I found a solution on the internet. Replace this line: deb http://archive.canonical.com/ubuntu bionic multiverse partner with this line: deb http://archive.canonical.com/ubuntu bionic partner. But the same line was already present in my sources.list.

Now I'm unable to upgrade from Ubuntu 18.04 to Ubuntu 20.04.

FreeBSD 11.2 - Default resolution on console window

Posted: 25 Jun 2022 01:36 PM PDT

I installed FreeBSD 11.2 on my DELL Latitude E7470 with UEFI (might be important). By default it does not install a GUI and that is fine by me (for now). Using the <Alt>+<Fn> keys I can switch between different virtual terminals.

I'm stuck with a 1920x1080 screen resolution

This results in way too small characters for me to read comfortably.

  • I tried enterind mode 0 in /boot/loader.conf to switch to 800x600 mode but that does not work. It does work however when I press the <Esc> key during boot and enter it at the boot prompt.
  • Using gop set <n> crashes the laptop, i.e. the screen goes black and the laptop does not respond to any keys anymore.

Anyone has any ideas on how to fix this?

Move folder to BTRFS sub-volume

Posted: 25 Jun 2022 10:59 AM PDT

I recently formatted my /home partition using BTRFS, but since it was my first touch with this FS, I didn't know about sub-volumes.

Yesterday I reinstalled my Linux Mint and selected to mount my existing home partition as /home. Now I was surprised, that my files first seemed to be lost, but then I noticed that Linux Mint created a sub-volume called @home next to my existing user home folder.

Current situation is the following disk layout: 250 GiB SSD -- 64 GiB / (BTRFS) -- 8 GiB swap -- ~170 GiB /home (BTRFS)

When I try to move my home folder into the @home sub-volume, I get the error that there isn't enough space left (?!) although there's ~50 GiB left on this partition and I want to move, and not to copy the files. I haven't any other disk right now that I could reformat to any non-NTFS format, which would be required to keep any symlinks..

Now I got the question: How to move the files from the folder into the sub-volume correctly? And why doesn't moving the files work?

Unable to SSH but able to ping it

Posted: 25 Jun 2022 11:04 AM PDT

I am using Ubuntu 16.04. The problem is I am able to SSH other machines from my system but I am unable to SSH my system from another machine. However, I am able to ping my system from other machines.

For example, my system's IP address is 192.168.103.32 and another machine which runs CentOS has IP address 192.168.170.52. So I am able to SSH on 192.168.170.52 from 192.168.103.32 but vice-versa fails. Also, I am able to ping 192.168.103.32 from 192.168.170.52.

Output of ssh from 192.168.170.52:

ssh -v bhavya@192.168.103.32  OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013  debug1: Reading configuration data /etc/ssh/ssh_config  debug1: Applying options for *  debug1: Connecting to 192.168.103.32 [192.168.103.32] port 22.  

Output for:

sudo service ssh status  

is:

ssh.service - OpenBSD Secure Shell server     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: ena     Active: active (running) since Thu 2017-06-29 11:39:00 IST; 39min ago    Process: 3064 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCE   Main PID: 1142 (sshd)     CGroup: /system.slice/ssh.service             └─1142 /usr/sbin/sshd -D    Jun 29 11:39:37 bhavya systemd[1]: Reloading OpenBSD Secure Shell server.  Jun 29 11:39:37 bhavya sshd[1142]: Received SIGHUP; restarting.  Jun 29 11:39:37 bhavya systemd[1]: Reloaded OpenBSD Secure Shell server.  Jun 29 11:39:37 bhavya sshd[1142]: Server listening on 0.0.0.0 port 22.  Jun 29 11:39:37 bhavya sshd[1142]: Server listening on :: port 22.  Jun 29 11:39:37 bhavya systemd[1]: Reloading OpenBSD Secure Shell server.  Jun 29 11:39:37 bhavya sshd[1142]: Received SIGHUP; restarting.  Jun 29 11:39:37 bhavya sshd[1142]: Server listening on 0.0.0.0 port 22.  Jun 29 11:39:37 bhavya sshd[1142]: Server listening on :: port 22.  Jun 29 11:39:37 bhavya systemd[1]: Reloaded OpenBSD Secure Shell server.  

Rotate every other page with pdfjam

Posted: 25 Jun 2022 01:36 PM PDT

I want to rotate 180 degrees every odd page using pdfjam. I do not want to use pdftk, as in this question. The command seems to be pdf180 (for pdfjam before version 3.02), but the selection does not seem to take rules like odd/even pages. Also, if I skip pages, the new document does not include them. Thus, the command

pdf180 file.pdf 1,3,5,7,9                # for pdfjam < 3.02  pdfjam --angle 180 file.pdf 1,3,5,7,9    # for pdfjam >= 3.02  

produces a file without pages 2, 4, 6, and 8.

Also, I have a large document, so would like to save space when writing this. I cannot see anything useful in pdfjam --help.

How can I achieve this goal?

If a one-line command cannot produce this, I guess I could have a script, which produces $N$ number of rotated files, and then merge them?

How to run start up scripts on Amazon linux?

Posted: 25 Jun 2022 02:01 PM PDT

I'm trying to create some script that should run on start.

Now I've created some myScript file under the /etc/init.d/ and then run sudo chkconfig --add myScript;

chkconfig --list myScript output is:
myScript 0:off 1:off 2:on 3:on 4:on 5:on 6:off

myScript:

#!/bin/sh  # chkconfig: 2345 98 02  # description:  # processname:    # Source function library.  if [ -f /etc/init.d/functions ] ; then    . /etc/init.d/functions  elif [ -f /etc/rc.d/init.d/functions ] ; then    . /etc/rc.d/init.d/functions  else    exit 0  fi  KIND="_"    start() {     echo starting `date` >> ~/myScript.log  }    stop() {     echo stopping myScript  }    restart() {     echo restarting  }    case "$1" in    start)            start          ;;    stop)            stop          ;;    restart)            restart          ;;    *)          echo $"Usage: $0 {start|stop|restart}"          exit 1  esac  exit $?  

Now I can successfully run service myScript start and log record will be appended. But if I run sudo reboot or restart the instance with AWS UI console it doesn't work as was expected.

Although runlevel output is:
N 3

Need some help.

How to change pager key bindings

Posted: 25 Jun 2022 11:08 AM PDT

I'd like to swap RETURN (scroll forward N lines, default one window) and SPACE (scroll forward N lines, default 1) in less to get a for me more natural way to page through man pages.

I saw years ago a colleague having this setup during a telnet session to a router while he was skimming through a config file, so I don't actually know if this setting was on his SSH client, on the node or wherever.

Anyway, I'd like to achieve this to the most extent possible, be it locally or remotely.

I checked less man page's key bindings section and found a reference to lesskey.

Unfortunately, Darwin doesn't have this program.

What are the alternatives to the FHS?

Posted: 25 Jun 2022 10:45 AM PDT

I'm a long time Linux user for over 15 years but one thing I hate with a passion is the mandated directory structure. I don't like that /usr/bin is the dumping ground for binaries or libs in /usr/lib, /usr/lib32, /usr/libx32, /lib, /lib32 etc... Random stuff in /usr/share etc. It's dumb and confusing. But some like it and tastes differ.

I want a directory structure where each package is isolated. Imagine instead if the media player dragon had it's own structure:

/software/dragon  /software/dragon/bin/x86/dragon  /software/dragon/doc/README  /software/dragon/doc/copyright  /software/dragon/lib/x86/libdragon.so  

Or:

/software/zlib/include/zlib.h  /software/zlib/lib/1.2.8/x86/libz.so  /software/zlib/lib/1.2.8/x64/libz.so  /software/zlib/doc/examples/...  /software/zlib/man/...  

You get the point. What are my options? Is there any Linux distro that uses something like my scheme? Can some distro be modified to work like I want it (Gentoo??) or do I need LFS? Is there any prior art in this area? Like publications on if the scheme is feasible or unfeasible?

Not looking for OS X. :) But OS X-inspired is totally ok.

Edit: I have no idea how PATH, LD_LIBRARY_PATH and other environment variables that depend on a small set of paths should work out. I'm thinking that if I have the KDE editor Kate installed in /software/kate/bin/x86/bin/kate then I'm ok with having to type the full path to the binary to start it. How it should work for dynamic libraries and dlopen calls, I don't know but it can't be an unsolvable engineering problem.

check md5sum from pipe

Posted: 25 Jun 2022 11:55 AM PDT

I am confused how md5sum --check is supposed to work:

$ man md5sum  -c, --check      read MD5 sums from the FILEs and check them  

I have a file, I can pipe it to md5sum:

$ cat file | md5sum  44693b9ef883e231cd9f90f737acd58f  -  

When I want to check the integrity of the file tomorrow, how can I check if the md5sum is still 44693b9ef883e231cd9f90f737acd58f?

Note

cat file might be a stream. So I want to use the pipe as in my example, not md5sum file.

Is there a way to add a directory to my PATH in zsh only if it's not already present?

Posted: 25 Jun 2022 11:32 AM PDT

Is there an easy way in zsh to add a directory to my PATH only if it's not already present? (or, more generally, any environment variable). I've tried:

PATH+=/my/directory  

... but if that's executed twice, it gets added twice.

Rotate pdf pages: 90 degree for even pages and -90 degree for odd pages

Posted: 25 Jun 2022 01:42 PM PDT

I was wondering in a pdf file, how to rotate pdf pages: 90 degree for even pages and -90 degree for odd pages?

By pdftk, all I know is to rotate a page by pdftk in.pdf cat 1W output out.pdf, and rotate all pages by pdftk in.pdf cat 1-endW output out.pdf.

Thanks!

No comments:

Post a Comment