New answers tagged

0

Check scripts if any executed for housekeeping. If few files are gone, do check if any log rotation script is running.


0

buff/cache is normal memory that the system is currently using as buffers and caches (for example input/output). Please check man free. There is usually a manual page for each executable in the system.


0

The precise answer to this question is: "No, it is not possible to (logically) move a Logical Volume (LV) from one Volume Group (VG1) to another (VG2). The data must be physically copied." Reason: Logical Volume data is physically stored on block devices (disks, partitions) assigned to a specific Volume Group. Moving Logical Volume from VG1 consisting of /...


0

The init system and how to configure your program to be run by it is just one part of the problem. You will have to write the program itself to become a daemon when run. This involves forking into the background, creating a new session and disassociating from the controlling terminal, among other things. These steps are not necessary with systemd, because ...


0

Based on suggestions from @Kusalananda, the answers (by @guest and @Jetchisel), and this detailed answer by Kevin, I came up with this: #! /bin/bash # # Search for 'Name' field match in torrent metadata for all .torrent files in # current directory and directories 1-level below. # # USAGE e.g.: # cd ~/torrent-files # location of .torrent files # Run `~/...


0

Changes in fdisk remain in the memory of fdisk itself until you tell the tool to write them to the device. You do this with w. If you quit with q, the changes will be lost. After writing the changes fdisk notifies the OS. In modern "big" distros this should be enough. From now on lsblk should show the new state of partitions. I guess some old or limited ...


10

This is a really simply one liner: find Parent -empty -delete It's fairly self explanatory. Although when I checked I was surprised that it successfully deletes Parent/Child1. Usually you would expect it to process the parent before the child unless you specify -depth. This works because -delete implies -depth. See the GNU find manual: -delete ...


4

Here's a two command solution Delete empty files find Parent/ -type f -size 0 -delete Try to remove all directories find Parent/ -type d -depth -print0 | xargs -0 rmdir 2>/dev/null NB rmdir can't remove non-empty directories, thus it's safe to run but will produce errors, which we are hiding As above, but being a little more specific about the error ...


0

FILE_NAME is being passed directly to bash -c in the -exec option of your find command. This causes problems if FILE_NAME contains quotes/shell code. In fact, arbitrary code could be executed. Example: in this particular case, the input file could contain a line '; echo "run commands";' Instead, pass the loop var to bash -c as a positional parameter. e.g.: ...


2

If you are trying to run a command as another user, sudo will ask for your password, su will ask for the other user's password. Sudo is designed to let unprivileged users run specific commands as a different user, and so has a configuration file /etc/sudoers which lets system administrators decide which users can run which commands as which other users. IE ...


0

I would write it like this. #!/usr/bin/env bash pattern_file="$1" while IFS= read -r -d '' file; do transmission-show "$file" | awk .... "$pattern_file" ##: Figure out how to do the awk with a file rather than looping through an array. done < <(find . -maxdepth 2 -name '*.torrent' -type f -print0) That should avoid the quoting hell :-) Ok ...


0

I hear ya having a little trouble. I have a dell with a NVME and can dual boot. What I had to do (which might work). I did a Linux live boot with Mint 19.x and opened up a terminal. Then did a zero wipe using shred like so, sudo shred -n 1 -v -z /dev/sdx . The sdx could be sda, sdb or sdc etc.. You can make sure it at least do %50 of the NVME (the speed ...


1

xdg-open is designed to run a viewer program and wait for it to complete. It's not designed to be run in the background, and as you've found out, it's not likely to work very well. You would have the same problem with the older mailcap system, which also runs programs in the foreground. It's possible to change your shell function to always open in a new ...


0

I'm going to attempt an answer: find /usr/share/figlet/ -type f -name "*.flf" | xargs -n 1 figlet -f This will run one figlet command with one file name, and another figlet command with another file name, and so on. See for example the difference between find /usr/share/figlet/ -type f -name "*.flf" | xargs -t ls -l and find /usr/share/figlet/ -type f -...


0

When connecting to throwaway virtual machines or such, you should better not store the keys in the first place. Create a ssh0 alias or function with the following content: alias ssh0='ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=ERROR' In this way, you won't pollute your ~/.known_hosts file with garbage, and since you're ...


1

You only seem to have SSH (port 22) listening. No other server daemons appear to be running. Specifically, you have nothing on port 3000, so connecting to that correctly returns "connection refused" (if you had it firewalled it would have said, "connection timed out" -- connection refused means you got to receive an answer packet, which tells that the port ...


0

postrotate python3 /opt/myapp/test.py $1-`date '+%Y%m%d'` > /dev/null endscript This will work as long as it's run the same day.


0

Check the packages included with the distro in question at installation time at the distro's website. Those are pre-installed; everything else was added post-insta;;/


0

Slax is a distro debian based that can be easily installed. The step for install this distro is: Download the ISO file in https://www.slax.org/ (Download < 300 MB) Choose into 32 or 64 bits version Extract the .iso file into root of your partition [Windows users] the root folder must be X:\ (where X is your partition letter) [Linux users], extract ...


0

This will work no matter which characters are in your input (except newlines within quoted fields but that's a whole other problem). With GNU awk for FPAT: $ awk -v FPAT='("[^"]*")+' -v OFS='","' '{ for ( i=1; i<=NF; i++ ) { gsub(/"/,"",$i) } print "\"" $0 "\"" }' file "record 1","name 1","text 1, text 2" "record 2","name 2","text 2" ...


0

I found the solution; I modified the file /usr/bin/startlxqt: export QT_QPA_PLATFORMTHEME=lxqt with export QT_QPA_PLATFORMTHEME=qt5ct reboot


1

You should use binfmt_misc for that [1]. First, define a magic that handles files which start with #! /bin/bash<CR><LF>, then create an executable interpreter for it. The interpreter can be another script: INTERP=/path/to/bash-crlf echo ",bash-crlf,M,,#! /bin/bash\x0d\x0a,,$INTERP," > /proc/sys/fs/binfmt_misc/register cat > "$INTERP" <...


1

You're missing $ in front of var when you call it, like you wrote it, it will be literally var. Consider possible vulnerabilities of your script when using [[ ... ]] or (( ... )) together with variables you cannot control. In your case, it might be better to use [ "$var" -ne 0 ]. You're missing a space between != and 0 (this is the source of the error!) != ...


0

Ok, I found somewhat of a workaround, via: "Junctioned" symbolic links Modern unix systems have a way to make arbitrary data appear as a file, independently of how it's stored: FUSE. With FUSE, every operation on a file (create, open, read, write, list directory, etc.) invokes some code in a program, and that code can do whatever you want. See ...


1

As far as I’m aware, there’s no way to tell Bash to accept Windows-style line endings. In situations involving Windows, common practice is to rely on Git’s ability to automatically convert line-endings when committing, using the autocrlf configuration flag. See for example GitHub’s documentation on line endings, which isn’t specific to GitHub. That way ...


0

Emulating how tools such as comm or join would compare two sets of sorted input, using bash: # Get lists of (base-)names from both directories. files1=( dir1/* ); files1=( "${files1[@]##*/}" ) files2=( dir2/* ); files2=( "${files2[@]##*/}" ) # Loop over these sorted lists until one of them is empty. while [[ ${#files1[@]} -gt 0 ]] && [[ ${#files2[@]...


2

usr does not stand for user. The folder is actually located at /usr/local/ you can try cd /usr/local/ to change your directory to it.


0

With java installed, go into the tomcat/bin directory and run this command: ./version.sh The output will be in this format: Using CATALINA_BASE: /opt/tomcat/apache-tomcat-9.0.33 Using CATALINA_HOME: /opt/tomcat/apache-tomcat-9.0.33 Using CATALINA_TMPDIR: /opt/tomcat/apache-tomcat-9.0.33/temp Using JRE_HOME: /usr Using CLASSPATH: /opt/...


1

Compilation is actually rather read/write intensive than just consuming large amounts of memory so it is a good measurement for IO-speeds of your memory. But the bottleneck is probably either your disk or your CPU so there is better RAM benchmarks


2

Say you need libevent version 42.1. If your package manager has libevent version 42.5, go ahead and install it. No need to build it from source. To build software using libevent, you'll need to install the corresponding development packages; libevent-dev on .deb-based distributions, libevent-devel on RPM-based distributions. If you package manager only has ...


1

That's a simple one, check out the popular tool diff: diff -r dir1 dir2 Edit: I got OP's question wrong, to get only the information that the files differ, not how they differ, you need to use the -q option: diff -r -q dir1 dir2


1

on the rpm level you cannot really know. Depending on the package manager you use there might be some information stored there. Note that this only works if the user ran the installation commands with sudo. If he became root, you'll never know who did it. Yum yum history gives you a list of transactions and which user launched the command. Dnf dnf ...


1

Your tags are unclear, we don't know which package manager you use. But since you used the tag arch-linux I am going to answer for pacman. Well the first question is a hard one, it is not really possible to my knowledge and heavily depends on your installation. There isn't one standard Linux installation since there are many different distributions, desktop ...


1

I'm not a big fan of nohup (I use disown instead), but if you put ‘nohup’ in front of each command in a shell script it will accomplish the nohup part of your question. However, I think your files are SAS programs? If you want SAS run in parallel on each SAS program: nohup sas test1_2.sas & nohup sas test3_4.sas & etc. That will run independent ...


1

Following Emmanuel's two instructions, my gist is updated. In your configuration.nix, try services.udev.packages = [ px4_drv ] You may also need to change the udev path in the installPhase to $out/lib/udev/rules.d, not $out/etc/udev/rules.d.


0

Another option is the fd tool: fd csv -x ./extractdata https://github.com/sharkdp/fd


1

The reason it did not work is that xargs will cram as many files in a command line as it can. So your "extractdata" script will receive all the files at once, and probably process only the first argument. I.e. you have N files, you execute one script with all the files as argument. You need to use the -n argument: ... | xargs -n 1 ./extractdata This way ...


1

There are many ways to solve that, for example, you could ask find to call the script, like this: $ find . -type f -name "*.csv" -exec your_script {} ; {} is the file name that was found each time. You might need to escape those chars: $ find . -type f -name "*.csv" -exec your_script \{\} \;


2

Using csvformat to turn the delimiters to tabs (csvformat -T), removing any double quotes (tr -d '"'), and then returning the delimiters to commas while quoting every field (that last bit of the pipeline): $ csvformat -T file.csv | tr -d '"' | csvformat -t -U1 "record 1","name 1","text 1, text 2" "record 2","name 2","text 2" "record 3","name 3","" ...


0

You can try with this: sed 's/""\(.*\)""/\1/g' file


0

I know it's an old post, but I was struggling with this issue and this is my result: My disks were "frozen" - Seagate disks. You can check, if you have same issue by entering command: hdparm -I /dev/sdb Which showed: Security: Master password revision code = 65534 supported not enabled not locked frozen not expired: security count supported: ...


0

i would have just used parted to resize the partition, but you already did that. The next step is to boot kali in regular mode [not persistence] in a terminal do this... umount /dev/sdb3 Actually run fdisk -l first and make sure sdb is the drive you want to change e2fsck /dev/sdb3 If there are any errors just type Y to fix 'em and finally resize2fs ...


1

I had the same issue and forgot about processing order. You need to name your file something like /etc/rsyslog.d/00_tcpconnections.conf so it is processed before other rules in /etc/rsyslog.d/. This is an example for my ocragent script. # copy to /etc/rsyslog.d/00_ocragent.conf if ( $programname == "ocragent" ) then { action(type="omfile" file="/var/log/...


2

On some systems (e.g. MS-Dos) the pipe is implemented by copying the output of the first command to a file, then running the 2nd command to read from this file. Unix does not do it that way. On Unixes it is like a production line. Each stage works simultaneously, reading input and producing output. If process A produces faster than process B consumes, then ...


2

Both cat and strings, and most similar utilities¹, read a little bit of input at a time, process it, then read more input, and so on. So in your case, cat only reads what less displays, plus a little more that's in transit. In more detail, the basic operation of cat is: Reserve a few kilobytes of memory for use as a buffer. While there's more input ...


5

This has more to do with how less works than with how cat or strings work. The cat command will only push data to its standard output, and it will block whenever the pipe buffer between it and strings is full and nobody is reading. cat does minimal buffering by itself, and the pipe buffer is typically small. This is also true for strings. It will ...


3

Pipes have limited buffer space, and if a pipe reader (such as less in your example) does not read more data from the pipe, the writer will be blocked after filling the buffer. This will affect the strings command, which in turn will block the cat command after its pipe is full. Naturally, the cat command cannot read the whole sda device contents into main ...


0

Well it seems I've solved it! No answers have been put here, and I can't blame you all for it: The more I've looked at it, the more evident it's become that this is a tricky problem: PrimeOS is relatively niche, and its GRUB loader settings only more so. Anyway, to anyone interested, I took the plunge. I reformatted the partition it was installed on (wiping ...


0

A basic DNS resolver (like the one in the Windows client) assumes that each DNS server configured for it knows or can find out everything there is to know, and if one server says something does not exist, there will be no point in asking another server for a second opinion. A DNS server can have more flexibility in where it gets its information from. Many ...


0

Try also - given your shell provides "process substitution" - tac file2 | sed 1r<(tac file1) | tac


Top 50 recent answers are included