Pycharm installation Posted: 25 Sep 2021 10:02 AM PDT I have installed pycharm from source and used the shell script to install it. I have a problem with running it, how do i run it? how do I know if software should be run from a shell script or from executable etc ... |
how can I count and remove certain lines with condition in a csv file? Posted: 25 Sep 2021 08:29 AM PDT I have a csv file looks like this: id country 12343 China 23455 Japan 47 Singapore 374 Australia 6572e United Kingdom Firtly, I want to count the total number of lines that under column id, the length of value is larger than 3. And then I want to remove the lines that the length of value is not equal to 5 and containing character.Finally, I want to create a new file to store the result. I have tried awk method but it fails to give an answer. I am new to linux, so can you show the full commands for 3 questions? Thanks! |
macos-terminal-bash-python-packages Posted: 25 Sep 2021 08:18 AM PDT I am having hard time installing packages. Sometimes when i install a python package and enter to terminal "xx --version" there is no problem, but sometimes when i do the same thing it says -command not found. For example I first download yarn with "npm install --global yarn" then i entered yarn --version the i got the reply -command not found. Then I installed it with brew then entered yarn --version then i saw the version of yarn. After that i tried the command yarn global add ganache-cli and entered ganache-cli --version, then i got the reply -command not found. I need help. I need to know what i do not know :) Thanks in advance.. |
Mounting a MacOS partition labelled 'Apple Core Storage' fails Posted: 25 Sep 2021 09:51 AM PDT This process goes wrong for me right at the end: apfs-fuse /dev/$diskpart $mountpoint . sda2 is the Mac partition, MacOS exists in the media folder. I use sudo apfs-fuse /dev/sda2 /media/MacOS I just get the error: media/MacOS failed to set up loop device . My system appears to have /dev/loop0 to loop7. I followed thes How To's: The second because the partition is reported as "Apple Core Storage" by fdisk -l . The latter gave me command: mount /dev/sda2/ -t hfsplus -o ro,sizelimit=963784540160 /media/MacOS or mount /dev/sda2/ -t hfsplus -o ro,sizelimit=120473067520 /media/MacOS depending on how you interpret the instructions in the latter article. Any suggestions please? |
Glitches on every Linux distros i boot /: Posted: 25 Sep 2021 07:36 AM PDT I'm not much fan of writing a preface, so I cut to the chase. Here's the problem, I've been installing several Linux distros (e.g. Ubuntu, Elementary OS etc.) on my PC but as soon as it starts up and the desktop is shown, some graphical glitches happen on every single one of the distros. Dunno why. Though I think it might be due to the old hardware of mine. You see, dual core could and 4gb RAM. But if you have any on what's going on with the system or thought you could help, I'd be glad to hear from you. BTW, I try to add a photo of it. |
How can I list weak dependencies with dnf? Posted: 25 Sep 2021 07:52 AM PDT For example, if I initiate installation of the Greek language meta-package, I am prompted to install its dependencies and weak dependencies. $ LC_ALL=C sudo dnf install langpacks-el [sudo] password for roman: Last metadata expiration check: 4:03:14 ago on Sat Sep 25 13:17:49 2021. Dependencies resolved. =============================================================================== Package Arch Version Repository Size =============================================================================== Installing: langpacks-el noarch 3.0-14.fc34 fedora 10 k Installing dependencies: autocorr-el noarch 1:7.1.6.2-1.fc34 updates 81 k langpacks-core-el noarch 3.0-14.fc34 fedora 10 k langpacks-core-font-el noarch 3.0-14.fc34 fedora 10 k Installing weak dependencies: glibc-langpack-el x86_64 2.33-20.fc34 updates 512 k hunspell-el noarch 1:0.9-7.fc34 fedora 1.7 M hyphen-el noarch 0.20051018-23.fc34 fedora 9.3 k libreoffice-help-el x86_64 1:7.1.6.2-1.fc34 updates 3.6 M libreoffice-langpack-el x86_64 1:7.1.6.2-1.fc34 updates 854 k mythes-el noarch 0.20070412-25.fc34 fedora 161 k Transaction Summary =============================================================================== Install 10 Packages Total download size: 6.9 M Installed size: 56 M Is this ok [y/N]: However, if I try manually listing the dependencies, I don't see the weak dependencies. How can I look them up? Here is what I tried. $ LC_ALL=C dnf repoquery --depends langpacks-el Last metadata expiration check: 3:15:20 ago on Sat Sep 25 14:07:02 2021. langpacks-core-el $ LC_ALL=C dnf repoquery --depends langpacks-core-el Last metadata expiration check: 3:15:42 ago on Sat Sep 25 14:07:02 2021. langpacks-core-font-el $ LC_ALL=C dnf repoquery --depends langpacks-core-font-el Last metadata expiration check: 3:16:08 ago on Sat Sep 25 14:07:02 2021. dejavu-sans-fonts According to the manpage: dnf [options] repoquery [<select-options>] [<query-options>] [<package-file-spec>] Searches available DNF repositories for selected packages and displays the requested information about them. It is an equivalent of rpm -q for remote repositories. --depends Display capabilities that the package depends on, enhances, recommends, suggests or supplements. |
Linux software installation Posted: 25 Sep 2021 06:47 AM PDT so I am fairly new to linux and trying to figure out its ins and outs, I noticed that installed software behave differently, in such way that for example on my OpenSUSE I have both softwares OpenFOAM and MATLAB... In my .bashrc aliases, Openfoam has following alias alias OF='source /..../bashrc' but matlab alias os as follows alias matlab='/opt/..../matlab' which means matlab has an execuatable and openfoam just a bash script to run it... my question is, why is it two different ways of running the softwares? P.S: I havent installed the software myself, they were already there. Thanks! |
Bit confused about how to set up snapper BTRFS snapshots Posted: 25 Sep 2021 08:02 AM PDT I have installed void Linux created subvolumes redirected the root reinstalled grub and I am booting up fine. Here's my /etc/fstab : UUID=D7C4-586F /boot/efi vfat defaults 0 2 UUID=8b0e6c9e-3bcb-48b5-b014-94be842e8b53 / btrfs subvol=/@,defaults,noatime,space_cache,autodefrag,compress=zstd 0 0 UUID=8b0e6c9e-3bcb-48b5-b014-94be842e8b53 /root btrfs subvol=/@root,defaults,noatime,space_cache,autodefrag,compress=zstd 0 0 UUID=8b0e6c9e-3bcb-48b5-b014-94be842e8b53 /var/cache btrfs subvol=/@cache,defaults,noatime,space_cache,autodefrag,compress=zstd 0 0 UUID=8b0e6c9e-3bcb-48b5-b014-94be842e8b53 /var/log btrfs subvol=/@log,defaults,noatime,space_cache,autodefrag,compress=zstd 0 0 UUID=8b0e6c9e-3bcb-48b5-b014-94be842e8b53 /var/tmp btrfs subvol=/@tmp,defaults,noatime,space_cache,autodefrag,compress=zstd 0 0 UUID=8b0e6c9e-3bcb-48b5-b014-94be842e8b53 /home btrfs subvol=/@home,defaults,noatime,space_cache,autodefrag,compress=zstd 0 0 UUID=15097b82-144a-4534-b9c5-e12bc550478b none swap sw 0 0 tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0 I have installed Void into a single partition. Now I don't know how to create snapper configs for @ and @home subvolumes separately Before creating a snapper configuration for a Btrfs subvolume, the subvolume must already exist. If it does not, you should create it before generating a snapper configuration. To create a new snapper configuration named config for the Btrfs subvolume at /path/to/subvolume, run: snapper -c config create-config /path/to/subvolume But what would be the path to the subvolume '@' & ' @home ' in my case? How can I install snapper-GUI in Void Linux? |
Shared memory as reported by free not equal df reported one. Cache takes huge amount of memory despite recent drop_caches Posted: 25 Sep 2021 09:39 AM PDT I'm running Linux Mint 20. I often encounter low memory situations. Today I do not understand why available is so low. As per What is the meaning of `shared` memory in the `free` command? shared is sum of tmpfs systems, but my sum is times less. free -hw total used free shared buffers cache available Mem: 15Gi 6,2Gi 4,6Gi 3,9Gi 26Mi 4,5Gi 5,0Gi Swap: 0B 0B 0B free -h total used free shared buff/cache available Mem: 15Gi 5,9Gi 5,1Gi 3,7Gi 4,4Gi 5,4Gi Swap: 0B 0B 0B df -h Filesystem Size Used Avail Use% Mounted on udev 7,7G 0 7,7G 0% /dev tmpfs 1,6G 1,7M 1,6G 1% /run tmpfs 7,7G 254M 7,5G 4% /dev/shm tmpfs 5,0M 4,0K 5,0M 1% /run/lock tmpfs 7,7G 0 7,7G 0% /sys/fs/cgroup cache 786M 247M 540M 32% /home/alex/.cache cache 158M 0 158M 0% /home/root/.cache rd 16G 460M 15G 3% /media/ramdrive tmpfs 1,6G 176K 1,6G 1% /run/user/1000 rd is tpmfs and cache (s) are also tmpfs for performance/low disk wearout, still it is ~1Gb total in used , not 3.7. Also why cache per free can be so high? (I've just dropped caches). ADDED: right after I posted the question I decided to add free -hw and shared grew by 0.2Gb while df output stayed the same. ADDED 2: In https://linoxide.com/command-to-show-shared-memory-settings/ it is shown to use ipcs command to show shared memory. In my case the sum is ~880Mb. How does it correspond to /proc/meminfo Shmem (it is same as free outputs) and info on tmpfs systems? The sum from ipcs does not look like any number produced by those. I was not able to find answer by web search. |
Why does ".." in a symlinked directory in Linux reference the "incorrect" directory? Posted: 25 Sep 2021 08:35 AM PDT Please, try to run the following script: #!/bin/bash mkdir a mkdir a/asub mkdir b ln -sfr a/asub b/bsub touch a/this_file_is_in_a touch b/this_file_is_in_b cd b/bsub echo "I'm in directory: $(pwd)" echo This is the contents of the upper directory: ls .. What would you expect to get? Probably the contents of directory b . However, it does not work that way. I've run it in the directory /tmp/bb . Below is the result: wzab@WZabHP:/tmp/bb$ ./ls_tester.sh I'm in directory: /tmp/bb/b/bsub This is the contents of the upper directory: asub this_file_is_in_a So despite pwd returning the right path being b the sub-directory, the ".." refers to the a sub-directory. Is my understanding of symlinks incorrect, or is it a bug in Linux? |
Rsync specific files only from root and subdirectories Posted: 25 Sep 2021 10:02 AM PDT I have files in a directory structure like this: /books/a.epub /books/sub/b.epub /books/test/c.epub I would like to find all .epub files in root (/books/) and subdirectories (/books//) and use rsync to copy only *.epub files to a remote directory. So far I tried: rsync -av --include='*.epub' --include='*/' --exclude='*' /media/share/Books/ /home/user/docker/calibre/books/ But it is syncing directories as well. Output should be look like this: /a.epub /b.epub /c.epub |
what is the correct way to mount an .img in fstab? Posted: 25 Sep 2021 09:58 AM PDT I have done these procedures to mount my .img file in /etc/fstab (for ubuntu mate 20.04 x64) Create .img file: dd if=/dev/zero of=filename.img bs=1024 count=2M sudo mkfs.ext4 filename.img Mount /etc/fstab in /mount/point : /home/user/filename.img /home/user/vdisk ext4 defaults 0 0 # or /home/user/filename.img /home/user/vdisk ext4 loop 0 0 # or /home/user/filename.img /home/user/vdisk auto loop 0 0 But always show 2 units: vdisk (mount) and loop (not mount) (see image) if i try to click on this other drive showing unmounted i get the following message: Why doesn't it just show the fileimage.img image mounted in the vdisk folder? what am I doing wrong? Update: if I run any of the following commands: sudo mount -a # or sudo mount /home/user/vdisk The same thing that I describe in my post appears. My fstab (I have altered the UUID for security reasons): # / was on /dev/sda2 during installation UUID=9f92d1aa-458d-441a-b349-abcdefghijkl / ext4 errors=remount-ro 0 1 # /boot/efi was on /dev/sda1 during installation UUID=F798-ABCD /boot/efi vfat umask=0077 0 1 /swapfile none swap sw 0 0 /home/user/filename.img /home/user/vdisk ext4 defaults 0 0 List: sudo losetup --list | grep filename.img /dev/loop8 0 0 1 0 /home/user/filename.img 0 512 Important: But, if I remove the /etc/fstab line, delete /dev/loop8 and mount .img image manually (with the followings commands), the described error does not appear sudo mount -o loop /home/user/filename.img /home/user/disk # or sudo mount -t ext4 -o loop /home/user/filename.img /home/user/disk Workaround: mount .img manually to /dev/loopXX available: losetup -f /dev/loop8 sudo losetup -P /dev/loop8 filename.img sudo losetup -l /dev/loop8 0 0 0 0 /home/user/filename.img 0 512 edit /etc/fstab and put the line: # /path/to/loop/device /path/to/mount/point auto loop 0 0 # example: /dev/loop8 /home/user/disk ext4 defaults 0 0 and: sudo mount -a But it's not the same. And if it is the only way then it would be better not to use fstab and replace it with bash script that mount .img and schedule it in crontab. |
Fish shell vi-mode is missing "repeat" command (dot/period/. key in Zsh) Posted: 25 Sep 2021 08:44 AM PDT I recently moved from Zsh to Fish, and I'm having a problem with vi-mode in Fish. There doesn't seem to be a "repeat" keybinding, like in Zsh's vi-mode (bound to the "dot" . ). I think this is one of the most useful commands in vi-mode since it can prevent you from repeating commands. Is there a way to add this command to vi-mode in the Fish shell. Any idea how am I supposed to do this? Thanks. |
perf mem record <command> does not work as non root user Posted: 25 Sep 2021 09:51 AM PDT As a non root user, perf mem record does not work even though I have set /proc/sys/kernel/perf_event_paranoid to -1 and set CAP_SYS_ADMIN on /usr/bin/perf getcap /usr/bin/perf /usr/bin/perf = cap_sys_admin+ep cat /proc/sys/kernel/perf_event_paranoid -1 bash$ perf mem record id Error: You may not have permission to collect stats. Consider tweaking /proc/sys/kernel/perf_event_paranoid, which controls use of the performance events system by unprivileged users (without CAP_SYS_ADMIN). The current value is -1: -1: Allow use of (almost) all events by all users Ignore mlock limit after perf_event_mlock_kb without CAP_IPC_LOCK. >= 0: Disallow ftrace function tracepoint by users without CAP_SYS_ADMIN Disallow raw tracepoint acess by users without CAP_SYS_ADMIN >= 1: Disallow CPU event access by users without CAP_SYS_ADMIN >= 2: Disallow kernel profiling by users without CAP_SYS_ADMIN To make this setting permanent, edit /etc/sysctl.conf too, e.g.: kernel.perf_event_paranoid = -1 I can't figure out why this doesn't work. Oddly, I don't get the permission error if I run it with an strace. It seems to work in this case. (Again, this is as a non root user) strace -f -e perf_event_open perf mem record id Running perf --debug verbose=2 perf mem record id shows that the perf_event_open system call is returning errno 13 (EACCES) The perf_event_open man page says: EACCES Returned when the requested event requires CAP_SYS_ADMIN permission (or a more permissive perf_event_paranoid setting). Some common cases where an unpriviliged process may encounter this error: attaching to a process owned by a different user; monitoring all processes on a given CPU (i.e., specifying the pid argument as -1); and not setting exclude_kernel when the paranoid setting requires it. This is CentOS 7.6. |
Can I install spell-checking and other language support packages on Fedora without searching them? Posted: 25 Sep 2021 09:23 AM PDT I would like to learn the canonical way for adding system-wide language support on Fedora Workstation or confirm that there is none. I intend to preserve my interface language, but add all other associated language tools, such as spell-checking dictionaries, hyphenation assistance, etc. I know I can enable all of this by installing relevant individual packages manually, but I would like to rely on the distribution maintainers to decide what packages are necessary. Is such approach supported? The Fedora documentation seems to cover only the system locale and keyboard configuration, but not the spell-checking. During Fedora installation, I specified Ukrainian as my system language. However, only English spell-checking was installed by default. hunspell-uk wasn't installed. For instance, in the GNOME text editor (gedit ), there were only English spell-checking dictionaries. When I opened LibreOffice Writer for the first time, a system pop-up prompted for installation of additional packages, which completed automatically once confirmed. So, now, I have hunspell-uk and other packages for spell-checking and hyphenation in Ukrainian in LibreOffice, GNOME text editor, and in Firefox (after restart). $ LC_ALL=C dnf history info 21 Transaction ID : 21 Begin time : Sun Aug 29 19:17:00 2021 Begin rpmdb : 1760:50e6a4d235a9a38ca4c583e8a47bd6091ec988c0 End time : Sun Aug 29 19:17:01 2021 (1 seconds) End rpmdb : 1769:e7ecb46ec061ec5ad63f3c0b121ecb0e013a7ab3 User : Roman Riabenko <roman> Return-Code : Success Releasever : Command Line : Comment : Packages Altered: Install glibc-langpack-uk-2.33-20.fc34.x86_64 @updates Install libreoffice-help-uk-1:7.1.5.2-5.fc34.x86_64 @updates Install libreoffice-langpack-uk-1:7.1.5.2-5.fc34.x86_64 @updates Install hunspell-uk-1.8.0-7.fc34.noarch @fedora Install hyphen-uk-0.20030903-22.fc34.noarch @fedora Install langpacks-core-font-uk-3.0-14.fc34.noarch @fedora Install langpacks-core-uk-3.0-14.fc34.noarch @fedora Install langpacks-uk-3.0-14.fc34.noarch @fedora Install mythes-uk-1.6.5-20.fc34.noarch @fedora For context, I will explain how I was dealing with it under Debian. With Debian, assuming I chose Ukrainian as my system language during installation, I get both English and Ukrainian support installed automatically out-of-the-box. I know that, during installation, the configuration is handled by tasksel . So, after installation, I can run tasksel install russian russian-desktop . It effectively installs metapackages task-russian and task-russian-desktop that rely on the necessary packages without me needing to learn or remember what are those packages. It seems to introduce some packages that I don't really need, like some converters that I never use, but I consider it to be a trade-off of relying on someone else for making an educated decision to cover most use cases. Is there any similar global configuration for language support on Fedora? In GNOME settings, I added Russian as another input language, so that I could enter text from keyboard, but this did not bring spell-cheking. I could also change the language for the GUI, but I do not want to do that and it does not promise to provide spell-checking. I found that there are langpacks-* in Fedora repositories, but, in case of langpacks-uk and langpacks-ru , the package brings only font packages and not spell-checking packages like hunspell-ru , aspell-ru , hyphen-ru , etc. Is it a bug? $ LC_ALL=C dnf info langpacks-ru Last metadata expiration check: 3:25:16 ago on Sat Sep 25 14:07:02 2021. Installed Packages Name : langpacks-ru Version : 3.0 Release : 14.fc34 Architecture : noarch Size : 400 Source : langpacks-3.0-14.fc34.src.rpm Repository : @System From repo : fedora Summary : Russian langpacks meta-package License : GPLv2+ Description : This package provides Russian langpacks meta-package. $ LC_ALL=C dnf repoquery --depends langpacks-ru Last metadata expiration check: 2:36:48 ago on Sun Aug 29 19:05:55 2021. langpacks-core-ru pt-sans-fonts $ LC_ALL=C dnf repoquery --depends langpacks-core-ru Last metadata expiration check: 2:37:44 ago on Sun Aug 29 19:05:55 2021. langpacks-core-font-ru $ LC_ALL=C dnf repoquery --depends langpacks-core-font-ru Last metadata expiration check: 2:36:48 ago on Sun Aug 29 19:05:55 2021. dejavu-sans-fonts I learned that I can list package groups available for installation with dnf grouplist , but there appears to be no language-specific groups. |
Are there any method to forward a port from my physical machine to VPS? Posted: 25 Sep 2021 09:55 AM PDT VPS port fowarding via SSH Provides a method via SSH port forwarding, though, such method is quite unstable as when SSH connection disconnects, the forwarded port will be disconnected and reopened. Any alternatives? I am currently using Ubuntu 20.04 hosted on AWS Lightsail. |
Create OpenVPN certificate valid for more than a year Posted: 25 Sep 2021 08:44 AM PDT This command keeps generating the certificate valid only 365 days, no matter if I change the value to 100 or 3650 the result is same. 1 Year. How can I generate the certificate valid for 10 years? # openssl req -new -keyout newkey.pem -out newreq.pem -days 3650 Generating a 2048 bit RSA private key ...........................................................+++ .........................+++ writing new private key to 'newkey.pem' Enter PEM pass phrase: Verifying - Enter PEM pass phrase: ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [AU]:AU State or Province Name (full name) [Some-State]:State Locality Name (eg, city) []:City Organization Name (eg, company) [Internet Widgits PTY Ltd]:company Organizational Unit Name (eg, section) []:section Common Name (eg, server FQDN or YOUR name) []:server Email Address []:mail@example.com Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: An optional company name []: # ./CA.sh -sign Using configuration from /usr/lib/ssl/openssl.cnf Enter pass phrase for ./demoCA/private/cakey.pem: Check that the request matches the signature Signature ok Certificate Details: Serial Number: cb:32:13:1d:e2:40:2f:e4 Validity Not Before: May 11 17:58:32 2021 GMT Not After : May 11 17:58:32 2022 GMT Subject: countryName = AU stateOrProvinceName = State localityName = City organizationName = company organizationalUnitName = section commonName = server emailAddress = mail@example.com X509v3 extensions: X509v3 Basic Constraints: CA:FALSE Netscape Comment: OpenSSL Generated Certificate X509v3 Subject Key Identifier: E7:8A:D9:91:7C:81:BF:C0:CE:D9:43:D7:C8:D8:03:1C:60:85:D0:35 X509v3 Authority Key Identifier: keyid:CF:76:53:4A:FB:01:EC:DE:CE:40:C1:F2:F0:F6:6E:12:57:24:8F:45 Certificate is to be certified until May 11 17:58:32 2022 GMT (365 days) Sign the certificate? [y/n]: |
Perl having problem in programme execution [closed] Posted: 25 Sep 2021 08:43 AM PDT #!/usr/bin/perl #Script:name2.pl - Demonstrates use of chop # print("Enter your name:"); $name=<STDIN>; $lname = chop($name); #Removes newline character from $name if ($lname ne "") { print("$lname,have a nice day\n"); } else { print("You have not entered your name\n"); } $ ./name2.pl Enter your name:stallman ,have a nice day $ While executing a Perl program, it is not executing the "chop" function. Is there any error in the programming line? |
GTK3 programs not launching with correct theme or settings (even with config files) Posted: 25 Sep 2021 06:57 AM PDT Currently all my gtk3 apps launch in the standard Adwaita theme. I have been, so far unsuccessfully, trying to get them to launch in the dark variant. I know this should work beacue when I do GTK_THEME=Adwaita:dark program the program will launch using the correct theme. After some googling and checking the arch wiki I found I had to create the following config files, ~/.gtkrc-2.0 for gtk2 programs and ~/.config/gtk-3.0/settings.ini for gtk3 pograms. The ~/.gtkrc-2.0 file contains the following: gtk-theme-name = "Adwaita-dark" the ~/.config/gtk-3.0/settings.ini file conatins: [Settings] gtk-theme-name=Adwaita:dark gtk-application-prefer-dark-theme=1 I believe this worked because when I use neofetch it has a line stating Theme: Adwaita-dark [GTK2], Adwaita:dark [GTK3] yet still gtk3 applications launch in Adwaita and not Adwaita-dark/Adwaita:dark Additionally I have also tried using the gsettings command, instaling lxappearance, and by adding export GTK_THEME=Adwaita:dark to my ~/.xinitrc file. None of these things have worked either. I am using arch linux with xorg and i3 window manager. How do I get this to work? All I want is for gtk apps to launch in dark mode. Is there something I am missing? Something I did wrong? Maybe a work around? I honestly did not expect this to be so difficult. Any help whatsoever would be greatly appreciated! |
How do I remove the first 300 million lines from a 700 GB txt file on a system with 1 TB disk space? Posted: 25 Sep 2021 09:35 AM PDT How do I remove the first 300 million lines from a 700 GB text file on a system with 1 TB disk space total, with 300 GB available? (My system has 2 GB of memory.) The answers I found use sed, tail, head: But I think (please correct me) I cannot use them due to the disk space being limited to 1 TB and they produce a new file and/or have a tmp file during processing. The file contains database records in JSON format. |
Testing for presence of duplicate values in array Posted: 25 Sep 2021 07:13 AM PDT I'm trying to find a simple way to just test an array for duplicate values. It would be nice, but not completely necessary, to be able to identify the specific lines that have duplicates, but the important point is simply being able to see that there's a duplicate. I have an array, $key_array , which contains some numbers: # echo ${key_array[@]} 1 2 3 4 3 3 This array could have an arbitrary number of numbers, some of which could be duplicates of others. They will be integer numbers only. (Numbers beginning with a 0 , such as 03 , should not make into the array at all, but in the off-chance that it happens, catching 3 and 03 as a duplicate of each other would be better than treating them as different numbers.) I need to determine if any of these numbers are duplicates. I was thinking this could be done with an exit code if nothing else. What I was after was something like this: if $(some command); then echo "Array contains duplicates." exit 1 fi $(commands to run after duplicate check) The idea being in the end that the script informs the user and exits if there are duplicates (not super important to identify where the duplicates are, just telling the user to check for duplicates is enough), or if there aren't any duplicates, it proceeds and runs a bunch of other stuff. How would I best accomplish this? |
Primary vs secondary groups in Linux Posted: 25 Sep 2021 08:43 AM PDT What is the difference between the primary and secondary group? Why is there a need for a primary group? Are the user's permissions the same as the primary group permission? Assume there is a user A with primary group grp1 and user B with primary group grp2 and secondary group grp1 . Then can B have the same permission as A for the files created by A ? |
I created a new user but I can't perform any actions on new user Posted: 25 Sep 2021 09:06 AM PDT So I created a user named test and then I tried to make a directory in it but the permission was denied although the user test has all permissions. tambkto@X250:/home$ ls amna tambkto tambkto@X250:/home$ sudo useradd test -m tambkto@X250:/home$ ls amna tambkto test tambkto@X250:/home$ cd test/ tambkto@X250:/home/test$ ls examples.desktop tambkto@X250:/home/test$ mkdir app mkdir: cannot create directory 'app': Permission denied tambkto@X250:/home/test$ ls -l total 12 -rw-r--r-- 1 test test 8980 Apr 16 2018 examples.desktop tambkto@X250:/home/test$ cd .. tambkto@X250:/home$ ls -l total 12 drwxr-xr-x 2 test test 4096 Apr 23 05:41 amna drwxr-xr-x 23 tambkto tambkto 4096 Apr 24 00:09 tambkto drwxr-xr-x 2 test test 4096 Apr 24 00:12 test tambkto@X250:/home$ |
Can't create directory in directory owned by group Posted: 25 Sep 2021 06:48 AM PDT I have a group called homeperms on an Ubuntu system, with a few users: $ cat /etc/group | grep "homeperms" homeperms:x:1004:jorik,tim.wijma,vanveenjorik,jorik_c And I've done $ sudo chgrp -R homeperms /home . But when I try to md /home/flask. I get a permission denied error (Happens with any other folder name too). I don't want to 777 the folders since I'm going to be dealing with web server stuff. Permissions of home in / drwxr-xr-x 12 vanveenjorik homeperms 4096 Jul 6 09:06 home permissions inside /home : drwxr-xr-x 6 vanveenjorik homeperms 4096 Jul 3 20:08 19150 drwxr-xr-x 3 codeanywhere-ssh-key homeperms 4096 Jul 6 08:00 codeanywhere-ssh-key drwxr-xr-x 2 vanveenjorik homeperms 4096 Jul 6 09:13 downloads drwxr-xr-x 5 vanveenjorik homeperms 4096 Jul 4 08:43 jorik drwxr-xr-x 4 jorik_c homeperms 4096 Jul 6 08:09 jorik_c drwxrwxr-x 4 vanveenjorik homeperms 4096 Jul 3 20:15 mkdir_python drwxr-xr-x 5 vanveenjorik homeperms 4096 Jul 4 09:09 tim.wijma drwxr-xr-x 3 vanveenjorik homeperms 4096 Jul 3 18:20 ubuntu drwxr-xr-x 5 vanveenjorik homeperms 4096 Jul 4 09:27 vanveenjorik drwxrwxr-x 3 vanveenjorik homeperms 4096 Jul 3 22:28 venvs I am trying to do this on the user 'jorik_c' and with sudo this (of course) works flawlessly Before this gets marked as duplicate, the answer to this question, didn't help. |
How do I force x11vnc to stream lower quality? Posted: 25 Sep 2021 09:00 AM PDT I need to access a remote machine via a high latency, slow connection. It uses x11vnc and I want it to broadcast video in much lower quality than what's actually on the screen. First thing that comes to mind is to use less colours (e.g. 8 bit), but it can be anything, as long as the remote machine is responsive even though it may, for example, show a large rich-colour desktop image (which I don't need to see anyway). Something like this, except for x11vnc . I will, however, appreciate keeping all the text sharp because, I work with the terminal. Here's what I tried: I'm using the built-in Screen Sharing app, which seems to be almost the only option on Mac OS. I'm out of ideas. Please help. |
Is an Apple File System (APFS) driver for linux available or in progress? Posted: 25 Sep 2021 07:26 AM PDT I know the specs are available somewhere because Paragon Software already offers a very capable APFS driver for Windows at https://www.paragon-software.com/home/apfs-windows/ I'm looking for a driver like hpfsutils that would let my now multi boot system interoperate more fully. |
Can't connect to 5GHz network on Broadcom BCM43228 802.11a/b/g/n [14e4:4359] Posted: 25 Sep 2021 07:21 AM PDT Whenever I try to connect to my 5 GHz network, my KDE Network Manager takes a while on "configuring interface", where then I am prompted to enter a password. I enter the network password, but the whole process repeats. I am running Manjaro Linux, and additional information is below. $ sudo lspci -vvvnnk -d 14e4: 02:00.0 Network controller [0280]: Broadcom Limited BCM43228 802.11a/b/g/n [14e4:4359] DeviceName: Wireless LAN Subsystem: Broadcom Limited BCM43228 802.11a/b/g/n [14e4:05e2] Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Latency: 0, Cache Line Size: 64 bytes Interrupt: pin A routed to IRQ 17 Region 0: Memory at b2400000 (64-bit, non-prefetchable) [size=16K] Capabilities: [40] Power Management version 3 Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+) Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=2 PME- Capabilities: [58] Vendor Specific Information: Len=78 <?> Capabilities: [48] MSI: Enable- Count=1/1 Maskable- 64bit+ Address: 0000000000000000 Data: 0000 Capabilities: [d0] Express (v1) Endpoint, MSI 00 DevCap: MaxPayload 128 bytes, PhantFunc 0, Latency L0s <4us, L1 unlimited ExtTag+ AttnBtn- AttnInd- PwrInd- RBE+ FLReset- SlotPowerLimit 10.000W DevCtl: CorrErr- NonFatalErr- FatalErr- UnsupReq- RlxdOrd- ExtTag+ PhantFunc- AuxPwr- NoSnoop- MaxPayload 128 bytes, MaxReadReq 512 bytes DevSta: CorrErr- NonFatalErr- FatalErr- UnsupReq- AuxPwr+ TransPend- LnkCap: Port #0, Speed 2.5GT/s, Width x1, ASPM L1, Exit Latency L1 <64us ClockPM- Surprise- LLActRep+ BwNot- ASPMOptComp- LnkCtl: ASPM L1 Enabled; RCB 64 bytes Disabled- CommClk+ ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt- LnkSta: Speed 2.5GT/s (ok), Width x1 (ok) TrErr- Train- SlotClk+ DLActive+ BWMgmt- ABWMgmt- Capabilities: [100 v1] Advanced Error Reporting UESta: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol- UEMsk: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol- UESvrt: DLP+ SDES- TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol- CESta: RxErr- BadTLP- BadDLLP- Rollover- Timeout- AdvNonFatalErr- CEMsk: RxErr- BadTLP- BadDLLP- Rollover- Timeout- AdvNonFatalErr+ AERCap: First Error Pointer: 00, ECRCGenCap+ ECRCGenEn- ECRCChkCap+ ECRCChkEn- MultHdrRecCap- MultHdrRecEn- TLPPfxPres- HdrLogCap- HeaderLog: 00000000 00000000 00000000 00000000 Capabilities: [13c v1] Virtual Channel Caps: LPEVC=0 RefClk=100ns PATEntryBits=1 Arb: Fixed- WRR32- WRR64- WRR128- Ctrl: ArbSelect=Fixed Status: InProgress- VC0: Caps: PATOffset=00 MaxTimeSlots=1 RejSnoopTrans- Arb: Fixed- WRR32- WRR64- WRR128- TWRR128- WRR256- Ctrl: Enable+ ID=0 ArbSelect=Fixed TC/VC=ff Status: NegoPending- InProgress- Capabilities: [160 v1] Device Serial Number 00-00-b3-ff-ff-d7-30-10 Capabilities: [16c v1] Power Budgeting <?> Kernel driver in use: bcma-pci-bridge Kernel modules: bcma $ iwlist wlp2s0b1 freq wlp2s0b1 20 channels in total; available frequencies : Channel 01 : 2.412 GHz Channel 02 : 2.417 GHz Channel 03 : 2.422 GHz Channel 04 : 2.427 GHz Channel 05 : 2.432 GHz Channel 06 : 2.437 GHz Channel 07 : 2.442 GHz Channel 08 : 2.447 GHz Channel 09 : 2.452 GHz Channel 10 : 2.457 GHz Channel 11 : 2.462 GHz Channel 36 : 5.18 GHz Channel 40 : 5.2 GHz Channel 44 : 5.22 GHz Channel 48 : 5.24 GHz Channel 149 : 5.745 GHz Channel 153 : 5.765 GHz Channel 157 : 5.785 GHz Channel 161 : 5.805 GHz Channel 165 : 5.825 GHz Current Frequency:2.437 GHz (Channel 6) Driver I'm using the b43 module. |
Dual boot Windows 10-Ubuntu - Grub, os-prober not detecting Windows 10 partition Posted: 25 Sep 2021 07:19 AM PDT Got my Dell XPS 9560 replaced by warranty after motherboard on previous one went bad. Took out the HDD on the new unit and swapped it out with SSD in previous unit. In the past when swapping out hard drives, if the computer didn't boot to grub, I'd just boot to Ubuntu Live USB and run boot-repair. It would detect all OSes and repair grub, etc. This time however it only detected the Ubuntu partition on the SSD, not the Windows partition. os-prober returns nothing. I can mount and read and write to Windows partition just fine from Ubuntu. Since I've simply used boot-repair in the past I'm pretty unfamiliar with EFI, grub, boot flags/required partitions, etc. Here is output from fdisk -l: Device Start End Sectors Size Type /dev/sdb1 2048 34815 32768 16M Microsoft reserved /dev/sdb2 34816 748181142 748146327 356.8G Microsoft basic data /dev/sdb3 748181504 749150207 968704 473M Windows recovery environment /dev/sdb4 749152256 750200831 1048576 512M EFI System /dev/sdb5 750200832 1448673279 698472448 333.1G Linux filesystem /dev/sdb6 1448673280 1465147391 16474112 7.9G Linux swap /dev/sdb7 749150208 749152255 2048 1M BIOS boot Partition table entries are not in disk order. |
Where are the Shell Profile Settings Stored? Posted: 25 Sep 2021 09:13 AM PDT I just broke a machine running Linux Mint with KDE 4. Thankfully I managed to back up /home/ , so I have all my data. Now I've installed Kubuntu with KDE 5, and I'm trying to configure my Shell colorscheme to match my previous setup. I usually created a variant on "Linux Colors" in "Shell Profiles". Where can I find this data? |
Reading passwords without showing on screen in Bash Scripts Posted: 25 Sep 2021 09:51 AM PDT How can one read passwords in bash scripts in such a way that tools do not show it on a terminal? (Changing font to black-on-black is easily worked around by copy & paste, so it's not solution.) |
No comments:
Post a Comment